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): preserve workshop cycle identity and repair parent guard (#2000)

Eyal Golan8f2156af6fde
diff --git a/changelog.d/gdd-fixture-regression-contracts.md b/changelog.d/gdd-fixture-regression-contracts.md
new file mode 100644
index 000000000..8e68d3d0c
--- /dev/null
+++ b/changelog.d/gdd-fixture-regression-contracts.md
@@ -0,0 +1 @@
+- Add fixture regression coverage for workshop worker identity across paid cycles and the unresolved housing-repair parent gate; live rules stay unchanged.
diff --git a/sim/Statecraft.Sim.Tests/Gdd03HousingFormulaTests.cs b/sim/Statecraft.Sim.Tests/Gdd03HousingFormulaTests.cs
index 3f2f6daeb..1f10bd2a7 100644
--- a/sim/Statecraft.Sim.Tests/Gdd03HousingFormulaTests.cs
+++ b/sim/Statecraft.Sim.Tests/Gdd03HousingFormulaTests.cs
@@ -235,4 +235,15 @@ public class Gdd03HousingFormulaTests
Assert.Throws<ContentException>(() => Gdd03HousingFormula.FromCatalogue(c));
Assert.Throws<ArgumentNullException>(() => Gdd03HousingFormula.FromCatalogue(null!));
}
+
+ // R-HOUSE-001: a valid numeric child cannot authorize an unresolved parent repair row.
+ [Fact]
+ public void ReaderRejectsDeferredRepairParentWithAnIntactNumericPart()
+ {
+ var catalogue = ContentLoader.Load(RealContentTests.ContentRoot()).Gdd03Balance
+ ?? throw new InvalidOperationException("GDD 0.3 catalogue required");
+ Gdd03HousingFormula.FromCatalogue(catalogue);
+ catalogue.Values["housing_repair"].Basis = "Deferred"; // TEST-ONLY SYNTHETIC parent gate flip
+ Assert.Throws<ContentException>(() => Gdd03HousingFormula.FromCatalogue(catalogue));
+ }
}
diff --git a/sim/Statecraft.Sim.Tests/SyntheticWorkshopCycleTests.cs b/sim/Statecraft.Sim.Tests/SyntheticWorkshopCycleTests.cs
index 8075ca445..b64860699 100644
--- a/sim/Statecraft.Sim.Tests/SyntheticWorkshopCycleTests.cs
+++ b/sim/Statecraft.Sim.Tests/SyntheticWorkshopCycleTests.cs
@@ -142,4 +142,25 @@ public class SyntheticWorkshopCycleTests
c = Catalogue(); c.Ruleset = SaveGame.GddRuleset;
Assert.Throws<ArgumentException>(() => SyntheticWorkshopRules.FromCatalogue(c));
}
+
+ // R-LOOP-005: completing a fixture cycle keeps its staffed identity for the next explicit reservation.
+ [Fact]
+ public void CompletionKeepsTheWorkerForTheNextPaidCycle()
+ {
+ var cycle = Empty().WithWorker("fixture-a", SyntheticWorkshopTier.Apprentice).ReserveExplicitly(4m);
+ cycle = cycle.StaffedTurn().StaffedTurn().StaffedTurn();
+ Assert.Equal(1, cycle.CompletedArms);
+ Assert.Null(cycle.PaidCost);
+ Assert.Equal("fixture-workshop", cycle.FixtureFacilityId);
+ Assert.Equal("fixture-a", cycle.WorkerId);
+ Assert.Equal(SyntheticWorkshopTier.Apprentice, cycle.WorkerTier);
+ cycle = cycle.ReserveExplicitly(4m);
+ var next = cycle.StaffedTurn();
+ Assert.NotSame(cycle, next);
+ Assert.Equal(1, next.Progress);
+ Assert.Equal(4m, next.PaidCost);
+ Assert.Equal("fixture-workshop", next.FixtureFacilityId);
+ Assert.Equal("fixture-a", next.WorkerId);
+ Assert.Equal(2, next.StaffedTurn().StaffedTurn().CompletedArms);
+ }
}