Skip to content

A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.

test(gdd): isolate captive and transit resident guards (#2001)

Eyal Golan935edd9e4c4f
diff --git a/changelog.d/gdd-resident-status-contract.md b/changelog.d/gdd-resident-status-contract.md
new file mode 100644
index 000000000..2169f29a4
--- /dev/null
+++ b/changelog.d/gdd-resident-status-contract.md
@@ -0,0 +1 @@
+Added synthetic monthly-context regressions rejecting captured and transit pre-arrival residents while preserving constructible opening records.
diff --git a/sim/Statecraft.Sim.Tests/Gdd03SyntheticMonthContextTests.cs b/sim/Statecraft.Sim.Tests/Gdd03SyntheticMonthContextTests.cs
index 716231605..4f51fd291 100644
--- a/sim/Statecraft.Sim.Tests/Gdd03SyntheticMonthContextTests.cs
+++ b/sim/Statecraft.Sim.Tests/Gdd03SyntheticMonthContextTests.cs
@@ -56,6 +56,24 @@ public class Gdd03SyntheticMonthContextTests
new Gdd03SyntheticPendingEntry("synthetic-key", "synthetic-other-unit", -3m) }));
}
+ // Synthetic boundary only: these statuses may be opening records but cannot be pre-arrival residents.
+ [Theory]
+ [InlineData(PopulationStatus.Captured)]
+ [InlineData(PopulationStatus.CivilianInTransit)]
+ public void CaptiveOrTransitOpeningPeopleCannotBePreArrivalResidents(PopulationStatus status)
+ {
+ var assignment = status == PopulationStatus.CivilianInTransit
+ ? new PopulationAssignment(PopulationAssignmentKind.Travel, "synthetic-route")
+ : PopulationAssignment.Unassigned;
+ var person = new PopulationUnit(4, status, 0, null, assignment,
+ CivilianProfession.None, CivilianTier.None, 0, "", 0, PopulationEquipment.None);
+ var control = Context(new[] { person });
+ Assert.Equal(new[] { 4 }, control.OpeningPeople.Select(p => p.Id));
+ Assert.Empty(control.PreArrivalResidentIds);
+ Assert.Empty(control.WorkEligibleIds);
+ Assert.Throws<ArgumentException>(() => Context(new[] { person }, residents: new[] { 4 }));
+ }
+
// RED-FIRST: GDD loop-switch:17,24. Structural references do not replace owner validation.
[Fact] public void RejectsIncompatibleStatusAndUnresolvedTeacherAndDuplicateHousing()
{