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.

Month snapshot of work and course assignments (synthetic, Refs #1716) (#2125)

Beri61e4e4097aae
diff --git a/changelog.d/1716-month-snapshot.md b/changelog.d/1716-month-snapshot.md
new file mode 100644
index 000000000..29674637a
--- /dev/null
+++ b/changelog.d/1716-month-snapshot.md
@@ -0,0 +1,5 @@
+- Refs #1716: in the gdd-0.3 synthetic fixtures, the month's work and course snapshot reflects this turn's orders. A job
+ change made this turn is in it, the same job again changes nothing (state and hash), and a novice released from work
+ this turn can start a course and is on the course, off work, in the same snapshot. Q43(b)/(c) (when a course end or
+ a cancel releases people) were answered on 1 November 2026 (#1668 Q43(b)/(c), https://github.com/eyalgolan/statecraft-israel/pull/1668#issuecomment-6553884547);
+ building that release is #1716's follow-up, so the fixture still refuses those cases as Deferred. Nothing in the game calls this, and legacy/gdd-0.1 behaviour and content are unchanged.
diff --git a/docs/rules/mvp.md b/docs/rules/mvp.md
index abed9826a..829e9e8ef 100644
--- a/docs/rules/mvp.md
+++ b/docs/rules/mvp.md
@@ -30,7 +30,7 @@ R-LOOP-005: Every balance number of the GDD loop (all of `cities.yaml` and `unit
The ID R-LOOP-003 (the Phase 1 overlay, `MvpSlice.Overlay`) is retired with the overlay at the cutover and is not reused.
-Synthetic #1716 fixtures provide an internal immutable monthly snapshot for future gdd-0.3 work (R-LOOP-001/002; #1668, loop-switch.md:17-39 at 605277df). There is no shipping caller, resolver integration, persistence or activation. Consumers must revalidate eligibility; R-LOOP-004 is unchanged.
+Synthetic #1716 fixtures provide an internal immutable monthly snapshot for future gdd-0.3 work (R-LOOP-001/002; #1668, loop-switch.md:17-39 at 605277df). There is no shipping caller, resolver integration, persistence or activation. Consumers must revalidate eligibility; R-LOOP-004 is unchanged. The month's work and course snapshot is taken after that turn's orders (Amir's 28 October answers 4 and 5, [owner-relayed](https://github.com/eyalgolan/statecraft-israel/pull/1668#issuecomment-6465662174): "Training: occupies people from the turn training starts until it finishes"; "Job changes: take effect immediately. assigning the same job is a no op"). A job change made this turn is in this month's snapshot, a re-assignment to the same job leaves the state and its hash unchanged, and a course started this turn shows its pupil on the course and off work in the same snapshot (R-CITY-001/002, R-TRAIN-005, R-TRAIN-008). When a course end or a cancel releases people was answered on 1 November 2026 ([#1668 Q43(b)/(c)](https://github.com/eyalgolan/statecraft-israel/pull/1668#issuecomment-6553884547)); building that release is the follow-up on #1716, not this change, so the fixture still refuses those cases as Deferred.
## Settlement control
@@ -170,7 +170,7 @@ R-TRAIN-006: In the same fixture, a course turn is counted only for a month whos
R-TRAIN-007: In the same fixture, cancelling a course at any turn this slice can reach keeps the population id, profession, novice tier, tools and their payment fact and reception progress. It grants no unfinished trained tier, clears the course progress and releases the teacher and the bed. Nothing is refunded and no one moves. When the released people and bed can be used again is #1668 question 43(b) (R-TRAIN-008). A second cancel, or a cancel of a unit not in a course, is refused unchanged, and a restart is a full new course with no second tools charge (`docs/gdd/training.md:49`, "Cancelled courses retain paid entry costs and earned reception credit but award no unfinished qualification." and "Unfinished course progress clears, and restarting needs a fresh course.").
-R-TRAIN-008: The fixture refuses, with a "Deferred:" reason and the state unchanged, every case that needs an open design answer, and chooses no default. #1668 question 42 (teachers per centre and teacher housing): a second teacher at one centre, or a teaching teacher with no pupil. #1668 question 43 (course turn boundaries): counting the enrolment month, including a later snapshot with the enrolment month's ordinal; counting the turn that would bring a course to `profession.course_turns` minus 1 (graduation timing, 43(a)); starting in a month whose opening snapshot shows either participant on another assignment, including a teacher or pupil released by a cancel that month; and starting in a month whose opening snapshot shows the parent camp's beds full, so a bed freed after the opening is not reused that month (43(b), with #1668 question 41). #1668 question 44 and the GDD's novice lock-in decision: a free civilian without a profession, or a novice of another profession, entering a course. #1668, 27 October list, question 9: a course turn or cancellation after the parent camp or the centre stops operating. Same-month availability of a teacher or pupil after a cancel stays Deferred under question 43(b) and (c): the ledger release is not a ruling on it, and the work-assignment fixture (`Gdd03AssignmentFixture.Assign`) takes no month, so it does not enforce it. Real centres, hosts, regions, map bindings, Money and Food settlement, saves and commands remain held with their owners (#1690, #1691, #1696, #1700, #1702, #1713, #1716).
+R-TRAIN-008: The fixture refuses, with a "Deferred:" reason and the state unchanged, every case that needs an open design answer, and chooses no default. #1668 question 42 (teachers per centre and teacher housing): a second teacher at one centre, or a teaching teacher with no pupil. #1668 question 43 (course turn boundaries): counting the enrolment month, including a later snapshot with the enrolment month's ordinal; counting the turn that would bring a course to `profession.course_turns` minus 1 (graduation timing, 43(a)); starting in a month whose opening snapshot shows either participant on another assignment, including a teacher or pupil released by a cancel that month, except a pupil whose opening assignment was work and who was released from it this turn (an immediate job change; the course occupies them from its start turn, Q43(a), #1716; a teacher who worked at the opening and was released this turn stays Deferred); and starting in a month whose opening snapshot shows the parent camp's beds full, so a bed freed after the opening is not reused that month (43(b), with #1668 question 41). #1668 question 44 and the GDD's novice lock-in decision: a free civilian without a profession, or a novice of another profession, entering a course. #1668, 27 October list, question 9: a course turn or cancellation after the parent camp or the centre stops operating. Same-month availability of a teacher or pupil after a cancel stays Deferred under question 43(b) and (c) (answered 1 November 2026, build is #1716's follow-up): the ledger release is not a ruling on it, and the work-assignment fixture (`Gdd03AssignmentFixture.Assign`) takes no month, so it does not enforce it. The fixture also does not yet refuse a same-month restart after a cancel when the opening snapshot did not show the course (a gap that is also on main); that is a follow-up under the approved Q43(b). Real centres, hosts, regions, map bindings, Money and Food settlement, saves and commands remain held with their owners (#1690, #1691, #1696, #1700, #1702, #1713, #1716).
## Craftsmen
diff --git a/sim/Statecraft.Sim.Tests/Gdd03TrainingCentreFixtureTests.cs b/sim/Statecraft.Sim.Tests/Gdd03TrainingCentreFixtureTests.cs
index 71eaabcc3..aebea5639 100644
--- a/sim/Statecraft.Sim.Tests/Gdd03TrainingCentreFixtureTests.cs
+++ b/sim/Statecraft.Sim.Tests/Gdd03TrainingCentreFixtureTests.cs
@@ -6,8 +6,8 @@ public class Gdd03TrainingCentreFixtureTests
static readonly Lazy<Gdd03BalanceCatalogue> Real = new(() => ContentLoader.Load(RealContentTests.ContentRoot()).Gdd03Balance!);
const string CentreA = "fixture-centre-a", CampA = "fixture-camp-a", CentreB = "fixture-centre-b", CampB = "fixture-camp-b";
const string CentreSouth = "fixture-centre-south", CampSouth = "fixture-camp-south", Field = "fixture-field";
- const string Service = "fixture-service";
- static readonly string[] Facilities = { CampA, CampB, CampSouth, CentreA, CentreB, CentreSouth, Field };
+ const string Service = "fixture-service", Workshop = "fixture-workshop";
+ static readonly string[] Facilities = { CampA, CampB, CampSouth, CentreA, CentreB, CentreSouth, Field, Workshop };
static Content Catalogue(string? key = null, Gdd03DesignValue? replacement = null, string ruleset = SaveGame.Gdd03Ruleset)
{
@@ -29,6 +29,7 @@ public class Gdd03TrainingCentreFixtureTests
new PopulationTarget(CentreB, PopulationAssignmentKind.Course, "north", 3),
new PopulationTarget(CentreSouth, PopulationAssignmentKind.Course, "south", 3),
new PopulationTarget(Field, PopulationAssignmentKind.Work, "north"),
+ new PopulationTarget(Workshop, PopulationAssignmentKind.Work, "north"),
new PopulationTarget(Service, PopulationAssignmentKind.ActiveService, "north") },
Array.Empty<string>(), Array.Empty<string>());
@@ -294,27 +295,66 @@ public class Gdd03TrainingCentreFixtureTests
Unchanged(idle, () => new Gdd03TrainingCentreFixture(c, idle, Centres()), typeof(NotSupportedException), "Deferred: #1668 Q42");
}
- // R-TRAIN-008: #1668 Q43 stays open: the enrolment month is not counted, and a participant who held another
- // assignment at the month's opening cannot start that month.
+ // R-TRAIN-008: #1668 Q43 stays open: the enrolment month is not counted, and a participant released from a course
+ // by a cancel cannot start again that month.
[Fact] public void CourseTurnBoundariesStayDeferred()
{
- var c = Catalogue(); var s = State(c, Person(CivilianProfession.Farmer, CivilianTier.Novice, "tools-6",
- assignment: new PopulationAssignment(PopulationAssignmentKind.Work, Field)));
+ var c = Catalogue(); var s = State(c);
var f = new Gdd03TrainingCentreFixture(c, s, Centres());
var enrolment = Month(s, 0);
f.Start(1, 0, CentreA, enrolment);
Unchanged(s, () => f.Advance(1, enrolment), typeof(NotSupportedException), "Deferred: #1668 Q43");
var opening = Month(s, 1);
- s.PopulationLedger.ChangeAssignment(6, PopulationAssignment.Unassigned);
- Unchanged(s, () => f.Start(6, 4, CentreB, opening), typeof(NotSupportedException), "Deferred: #1668 Q43");
-
f.Cancel(1);
Unchanged(s, () => f.Start(1, 0, CentreA, opening), typeof(NotSupportedException), "Deferred: #1668 Q43");
// A teacher released by that cancel cannot teach at another centre in the same month.
Unchanged(s, () => f.Start(5, 0, CentreB, opening), typeof(NotSupportedException), "Deferred: #1668 Q43");
}
+ // #1716 month snapshot, R-CITY-001/002 (owner-relayed Q34, 28 Oct 2026: a job change takes effect at once and the
+ // same job again is a no-op). The month's work and course snapshot is taken after this turn's orders.
+ [Fact] public void AJobChangeThisTurnIsInThisMonthsSnapshotAndTheSameJobAgainChangesNothing()
+ {
+ var c = Catalogue(); var s = State(c, Person(CivilianProfession.None, CivilianTier.None, null,
+ assignment: new PopulationAssignment(PopulationAssignmentKind.Work, Field)));
+ var work = new Gdd03AssignmentFixture(c, s, new[] {
+ new Gdd03FixtureSlot(Field, Gdd03FixtureWork.Farm, 1, "fixture"),
+ new Gdd03FixtureSlot(Workshop, Gdd03FixtureWork.Workshop, 1, "fixture") });
+ Assert.Equal(Field, Month(s, 0).OpeningPeople.Single(p => p.Id == 6).Assignment.Target);
+
+ Assert.Equal(Gdd03FixtureAssignmentResult.Applied, work.Assign(6, Workshop));
+ var month = Month(s, 1);
+ Assert.Equal(Workshop, month.OpeningPeople.Single(p => p.Id == 6).Assignment.Target);
+ Assert.Contains(6, month.WorkEligibleIds);
+
+ var hash = s.Hash(); var described = s.Describe();
+ Assert.Equal(Gdd03FixtureAssignmentResult.NoOp, work.Assign(6, Workshop));
+ Assert.Equal(hash, s.Hash()); Assert.Equal(described, s.Describe());
+ var again = Month(s, 1);
+ Assert.Equal(month.OpeningPeople, again.OpeningPeople); Assert.Equal(month.WorkEligibleIds, again.WorkEligibleIds);
+ }
+
+ // #1716 month snapshot, R-TRAIN-005, R-TRAIN-008 (owner-relayed Q43(a), 28 Oct 2026: a course occupies people from
+ // the turn it starts). A novice who worked at the month's opening is released from work (an immediate job change) and
+ // starts a course this turn; this month's snapshot has them on the course and off work.
+ [Fact] public void ACourseStartedThisTurnTakesTheTraineeOffWorkInThisMonthsSnapshot()
+ {
+ var c = Catalogue(); var s = State(c, Person(CivilianProfession.Farmer, CivilianTier.Novice, "tools-6",
+ assignment: new PopulationAssignment(PopulationAssignmentKind.Work, Field)));
+ var f = new Gdd03TrainingCentreFixture(c, s, Centres());
+ var work = new Gdd03AssignmentFixture(c, s, new[] { new Gdd03FixtureSlot(Field, Gdd03FixtureWork.Farm, 1, "fixture") });
+ var opening = Month(s, 0);
+ Assert.Contains(6, opening.WorkEligibleIds);
+
+ Assert.Equal(Gdd03FixtureAssignmentResult.Applied, work.Assign(6, null));
+ f.Start(6, 4, CentreB, opening);
+ var month = Month(s, 0);
+ Assert.DoesNotContain(6, month.WorkEligibleIds);
+ Assert.Contains(6, month.CourseEligibleIds);
+ Assert.Equal(PopulationAssignmentKind.Course, month.OpeningPeople.Single(p => p.Id == 6).Assignment.Kind);
+ }
+
// R-TRAIN-008: #1668 Q43(b): a teacher who worked at the month's opening and was released afterwards cannot start
// teaching that month.
[Fact] public void TeacherWhoWorkedAtTheOpeningCannotStartThatMonth()
diff --git a/sim/Statecraft.Sim/Gdd03TrainingCentreFixture.cs b/sim/Statecraft.Sim/Gdd03TrainingCentreFixture.cs
index 8fe58653b..8f256cd3b 100644
--- a/sim/Statecraft.Sim/Gdd03TrainingCentreFixture.cs
+++ b/sim/Statecraft.Sim/Gdd03TrainingCentreFixture.cs
@@ -149,7 +149,12 @@ namespace Statecraft.Sim
var traineeOpening = Opening(month, trainee.Id); var teacherOpening = Opening(month, teacher.Id);
bool teacherOpenedHere = teacherOpening.Assignment.Kind == PopulationAssignmentKind.Teaching && teachingHere
&& string.Equals(teacherOpening.Assignment.Target, centre.Id, StringComparison.Ordinal);
- if (traineeOpening.Assignment.Kind != PopulationAssignmentKind.Unassigned
+ // #1716 month snapshot (owner-relayed Q43(a) and Q34, 28 Oct 2026): a course occupies the pupil from the turn it
+ // starts and a job change is immediate, so a pupil who worked at the opening and was released this turn may start,
+ // and this month's work/course snapshot shows the course. A pupil who held a course at the opening was released
+ // by a cancel: Q43(b)/(c) were answered on 1 Nov 2026 (#1668), but building the release is #1716's follow-up, so this still refuses as Deferred.
+ if ((traineeOpening.Assignment.Kind != PopulationAssignmentKind.Unassigned
+ && traineeOpening.Assignment.Kind != PopulationAssignmentKind.Work)
|| (teacherOpening.Assignment.Kind != PopulationAssignmentKind.Unassigned && !teacherOpenedHere))
throw Deferred(Q43);
// A bed freed after the month's opening (for example by a cancel) is not reused that month: Q43(b), Q41.