A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
GDD 0.3 training centre: a centre that stops operating cancels its course at once (Refs #1697) (#2461)
Eyal Golan20883d1b92d3
diff --git a/changelog.d/1697-centre-loss.md b/changelog.d/1697-centre-loss.mdnew file mode 100644index 000000000..65e683d0b--- /dev/null+++ b/changelog.d/1697-centre-loss.md@@ -0,0 +1,5 @@+- GDD 0.3 training centre courses in the sim test fixture (Refs #1697): a farmer or pioneer course whose centre stops+ operating is now cancelled at once, like any cancel, instead of being refused as "Deferred": the pupil and the+ teacher are civilians without a job in their city, no Money is refunded, and nobody graduates, even on the turn the+ course would have finished. Nothing in the game calls this fixture yet, so nothing changes for players and saves are+ unaffected.diff --git a/docs/gdd/training.md b/docs/gdd/training.mdindex cff830e79..a9b2018db 100644--- a/docs/gdd/training.md+++ b/docs/gdd/training.md@@ -63,7 +63,7 @@ Retained training, teaching and active service are exclusive assignments. ActiveUnder retained `R-UNIT-005`, Send home is the only way home: no automatic demobilisation happens, and the order is unavailable until its armistice condition is met; when it runs, the unit leaves the map and its strength joins the nearest city as civilians without a job [S9]. **Amir's proposal [S6]:** demobilisation at an operating camp would be immediate/free, preserve the proposal's military state and route incomplete-reception units through the proposed queue. The owner's 30 October 2026 conflict review did not rule on this; on 1 November 2026 the owner kept `R-UNIT-005` (`docs/rules/mvp.md`) with "Keep R-UNIT-005 (Recommended)", so camp demobilisation is post-MVP [S11], and `content/gdd03-balance.yaml` lists `military.demobilise_money` / `military.demobilise_wait` (basis Agreed). Amir's return of issued Arms to a reusable pool agrees with main (`military.demobilise_return`; the review lists Arms as not a conflict).-Cancelled retained courses award no unfinished qualification. A course whose slot is lost, or whose people are reassigned, is cancelled like `CancelTraining`: people return at once as civilians without a job, Money and tools are not refunded, and Arms return to the pool; a novice may then take another profession, and graduates may re-enrol at any time (owner, 1 November 2026, Q44, Q52, 27M-3 to 27M-5) [S11]. The novice craftsman label starts with the craftsman course and ends on cancelling (#1698 follow-up) [S11]. Proposed reception credit and reusable-equipment cancellation rules are non-operative [S6]. [Resources](cutover-resource-layer.md) owns retained affordability rules. (unitless)+Cancelled retained courses award no unfinished qualification. A course whose slot is lost, or whose people are reassigned, is cancelled like `CancelTraining`: people return at once as civilians without a job, Money and tools are not refunded, and Arms return to the pool; a novice may then take another profession, and graduates may re-enrol at any time (owner, 1 November 2026, Q44, Q52, 27M-3 to 27M-5) [S11]. A training centre that stops operating cancels its course at once (owner, 4 November 2026, https://github.com/eyalgolan/statecraft-israel/issues/1697#issuecomment-6622207214, asked "When a training centre stops operating, what happens to the course running there?", answered "Cancel at once (Recommended)"; the chosen option read: "Losing the centre cancels the course immediately, exactly like CancelTraining: people go home as jobless civilians, no Money refund, issued Arms go back to the pool."); in `gdd-0.3` this is built in the synthetic training centre fixture only (`R-TRAIN-007`, `docs/rules/mvp.md`). The novice craftsman label starts with the craftsman course and ends on cancelling (#1698 follow-up) [S11]. Proposed reception credit and reusable-equipment cancellation rules are non-operative [S6]. [Resources](cutover-resource-layer.md) owns retained affordability rules. (unitless)On the `gdd-0.3` craftsman course (`R-CRAFT-003`), an apprentice or expert craftsman who takes it again keeps their level on the course and after it (owner, 4 November 2026: "Keep their level (Recommended)"), and a trained or veteran farmer or pioneer may start it and loses that level, as under `R-QUAL-006`; tools are kept, and cancelling leaves an ordinary civilian (owner, 4 November 2026: "Yes, lose old level (Recommended)") [S12].diff --git a/docs/rules/mvp.md b/docs/rules/mvp.mdindex f4813c5f8..92c8ec7bb 100644--- a/docs/rules/mvp.md+++ b/docs/rules/mvp.md@@ -174,13 +174,13 @@ R-TRAIN-003: Each turn, in ascending id, every cohort has one turn less to go. AR-TRAIN-004: `Reinforce(unit, city, n)` (#1510; owner, 23 October 2026: "Replacements cost Arms", https://github.com/eyalgolan/statecraft-israel/issues/1510#issuecomment-6372356139, and "Default (Recommended)") refills a damaged formation of the player's with trained replacements. The unit must be a military unit of the player's side standing on `city`'s settlement hex. Its course is the trained type of the unit's side and class (a type with a `facility`): the recruit's basic training for a recruit or a veteran soldier, the guns' and the armoured cars' own for artillery and armoured cars (R-UNIT-008); a type no course trains (any enemy type) takes none. The cohort then follows R-TRAIN-001: the city's facility, `n` of its civilians without a job, `n * training_cost` with borrowing (R-MONEY-003), and the Arms of R-ARMS-003 for that course; it carries the unit's id, written into the state hash (`|unit=<id>`) only when set. The cap is the strength the unit had before its first loss, `Unit.Full`: combat stores it on a player's unit at its first loss (R-COMBAT-003) and clears it when replacements bring the unit back to it, and it is written into the state hash (`|full=<n>`) only when set, so a unit that has lost nobody, and every enemy unit, hashes as before. The order is refused, the state and Attention unchanged, for an unknown unit ("There is no such unit"), a unit with no side or an enemy unit (R-ORDER-001's wording), an unknown city, a unit off the city's hex ("Unit N is not in <city>"), a type no course trains ("Unit N cannot take replacements"), a unit with nothing to refill ("Unit N has no losses to replace") and `n` past the cap less the unit's strength and the replacements already training for it ("Unit N can take K more groups"), then for R-TRAIN-001's and R-ARMS-003's reasons. A queued `Reinforce` takes its city's civilians as a queued `Train` does (R-CITY-001). In step 4, before a turn is counted, replacements whose unit has left the state (destroyed, captured, sent home) or stands off the city's hex are cancelled as R-TRAIN-002 cancels a cohort: people and Arms back, the Money spent, with a Why line. A cohort that finishes adds its count to the unit's strength and makes no unit and takes no id; the unit keeps its type, service, order and home (a veteran stays a veteran, R-UNIT-004). The people join the unit's home city's housing (R-HOUSE-003). `attention_cost.reinforce` is 1, Train's cost, a design value (owner, 24 October 2026: "1, like Train (Recommended)", https://github.com/eyalgolan/statecraft-israel/issues/1510#issuecomment-6375591436). The save line is `reinforce <unit> <city> <n>` and the scenario form `{ kind: reinforce, unit, city, count }`.-R-TRAIN-005: In gdd-0.3 synthetic fixtures only (#1697; nothing in the game calls it), a farmer or pioneer course starts at an operating training centre, a facility in its host city with no reception camp, centre upgrade or reception bed (owner, 1 November 2026, "No reception-bed layer (Recommended)"; `docs/gdd/training.md:38`, "The MVP has no reception-bed layer"). A centre has one veteran teacher and one pupil, the teacher housed in the centre's city (GDD, 1 November 2026 answers, `docs/GDD.md:372`: "One veteran teacher and one pupil per centre, the teacher housed in the centre's city (Q42)."). A population location has a region and an optional hex or facility but no city, so the centre's region stands in for its host city, an approximation until real places are bound (#1691). A teacher outside the centre's region is refused with a plain reason that cites Q42. Q42 rules only on the teacher; that the trainee is in the centre's city too is our reading, pending maintainer confirmation (#1697 body: "the teacher and the trainee are housed there as ordinary residents"; `docs/GDD.md:374`, "Training is ordered in the camp's city, with no travel (27M-7)."), and a trainee outside the region is refused with a plain reason that says so. A centre takes at most one teacher and one pupil, whatever `profession.trainees_per_teacher` says: a second teacher, or a second pupil while one is on a course there, is refused with a plain reason that cites Q42, not as Deferred, and an inventory with either is refused the same way. The teacher is a free civilian, a veteran of the matching profession; the trainee is a free civilian who is a novice of that profession. Either may hold a job, which is released in the same commit that starts the course (a reading of `docs/gdd/cities.md:42`, "Reassignment releases old capacity atomically.", with `docs/GDD.md:372`, Q43(b) and (c), "can be assigned from the next planning, or at once on cancellation", and `docs/gdd/training.md:66`, people "return at once"); a teacher teaching elsewhere, or a pupil on a course, is refused, since only a cancel or a graduation ends those here. No reception progress is read (`docs/GDD.md:374`, "Refugees cannot train until they become civilians"), and refugees in a reception camp take no course place. No tools are needed or charged: tools are post-MVP (#1693, owner answers of 3 November 2026, answer 1: "Tools in the MVP: no."), and the record's tools fields are kept unchanged. A teacher also takes at most Agreed `profession.trainees_per_teacher` pupils (currently 1; the approved Q42 answer names this value as its basis), so a busy teacher refuses another pupil; a synthetic value above 1 admits no second pupil, because the centre's own limit is one. No Money is charged. Teacher and trainee then hold exclusive Teaching and Course assignments, so other assignment paths refuse them (`docs/gdd/training.md:31` at `605277dfa511dc512562ececeb273b8393b21d35`, "The teacher is fully occupied and cannot work, fight, build, travel or teach another pupil simultaneously."). Every refusal leaves the state unchanged. Craftsmen, soldiers and refugees cannot enrol. Only exact gdd-0.3 states with an initialized population ledger are accepted; legacy and gdd-0.1 are refused unchanged.+R-TRAIN-005: In gdd-0.3 synthetic fixtures only (#1697; nothing in the game calls it), a farmer or pioneer course starts at an operating training centre, a facility in its host city with no reception camp, centre upgrade or reception bed (owner, 1 November 2026, "No reception-bed layer (Recommended)"; `docs/gdd/training.md:38`, "The MVP has no reception-bed layer"). A centre has one veteran teacher and one pupil, the teacher housed in the centre's city (GDD, 1 November 2026 answers, `docs/GDD.md:372`: "One veteran teacher and one pupil per centre, the teacher housed in the centre's city (Q42)."). A population location has a region and an optional hex or facility but no city, so the centre's region stands in for its host city, an approximation until real places are bound (#1691). A teacher outside the centre's region is refused with a plain reason that cites Q42. Q42 rules only on the teacher; that the trainee lives in the centre's host city too was our reading (#1697 body: "the teacher and the trainee are housed there as ordinary residents"; `docs/GDD.md:374`, "Training is ordered in the camp's city, with no travel (27M-7)."), and is now the owner's ruling (owner, 4 November 2026, Q23: asked "Must a farmer-course or pioneer-course pupil live in the training centre's host city?", the owner answered "yes", [recorded on #1697](https://github.com/eyalgolan/statecraft-israel/issues/1697#issuecomment-6623127820)). The fixture still uses the centre's region as the stand-in for its host city, so a trainee outside the region is refused with a plain reason that says so; the rule tightens to the host city once centres are bound to real cities (#1691). A centre takes at most one teacher and one pupil, whatever `profession.trainees_per_teacher` says: a second teacher, or a second pupil while one is on a course there, is refused with a plain reason that cites Q42, not as Deferred, and an inventory with either is refused the same way. The teacher is a free civilian, a veteran of the matching profession; the trainee is a free civilian who is a novice of that profession. Either may hold a job, which is released in the same commit that starts the course (a reading of `docs/gdd/cities.md:42`, "Reassignment releases old capacity atomically.", with `docs/GDD.md:372`, Q43(b) and (c), "can be assigned from the next planning, or at once on cancellation", and `docs/gdd/training.md:66`, people "return at once"); a teacher teaching elsewhere, or a pupil on a course, is refused, since only a cancel or a graduation ends those here. No reception progress is read (`docs/GDD.md:374`, "Refugees cannot train until they become civilians"), and refugees in a reception camp take no course place. No tools are needed or charged: tools are post-MVP (#1693, owner answers of 3 November 2026, answer 1: "Tools in the MVP: no."), and the record's tools fields are kept unchanged. A teacher also takes at most Agreed `profession.trainees_per_teacher` pupils (currently 1; the approved Q42 answer names this value as its basis), so a busy teacher refuses another pupil; a synthetic value above 1 admits no second pupil, because the centre's own limit is one. No Money is charged. Teacher and trainee then hold exclusive Teaching and Course assignments, so other assignment paths refuse them (`docs/gdd/training.md:31` at `605277dfa511dc512562ececeb273b8393b21d35`, "The teacher is fully occupied and cannot work, fight, build, travel or teach another pupil simultaneously."). Every refusal leaves the state unchanged. Craftsmen, soldiers and refugees cannot enrol. Only exact gdd-0.3 states with an initialized population ledger are accepted; legacy and gdd-0.1 are refused unchanged.R-TRAIN-006: In the same fixture, the enrolment month is course turn 1 (#1668 question 43(a); GDD, 1 November 2026 answers: "A course occupies its people from its first turn"), so a course turn is counted in the enrolment month, even with a snapshot taken before the course started, unless the centre was not available at that month's freeze, and in a later month only when its opening snapshot (the #1716 synthetic month context) already holds that course with the same teacher. It is counted at most once per month ordinal: an ordinal before the enrolment month, or not above the last one counted for that pupil, is refused. A counted turn keeps the same population id and every record field (work XP, reception progress, equipment, location, military history); no person is created, and teaching and the course earn no work XP (`docs/gdd/training.md:17` at `605277dfa511dc512562ececeb273b8393b21d35`, "Travel, idle time, teaching and courses do not count."). The turn that brings a course to Agreed `profession.course_turns` counted turns (currently 3) graduates it: the pupil takes the trained tier through R-QUAL-008's transform and keeps the same id, work XP, reception progress, equipment and the tools' payment fact, location and military history; the pupil and the teacher (a centre has one pupil, R-TRAIN-005) are released in that turn, in one change, as civilians without a job. Nothing is charged and no person is created. #1697: "A free civilian or a matching equipped novice may enrol; completion gives the trained tier." Release timing follows R-TRAIN-008. The fixture also refuses a unit already trained, because Amir's proposal made a trained profession permanent (`docs/gdd/training.md:13` at the same commit, "Once trained, a civilian profession cannot be replaced."). That lock is post-MVP: D3 keeps two-way professions (R-QUAL-006), and the GDD's 1 November 2026 answers say "Graduates join their city's civilians and may re-enrol at any time" (27M-5).-R-TRAIN-007: In the same fixture, cancelling a course at any turn before its graduation keeps the population id, profession, novice tier, the record's tools fields and reception progress. It grants no unfinished trained tier, clears the course progress and releases the teacher and the centre's place. Nothing is refunded and no one moves. The released teacher and pupil are civilians without a job at once, in that month's snapshot, and may take a job that month, or start another course that month, and the centre can take another teacher and pupil at once (#1716; #1668 question 43(b), owner-approved answer of 1 November 2026, [answers](https://github.com/eyalgolan/statecraft-israel/pull/1668#issuecomment-6553884547): "Cancellation: they are released at once, as civilians without a job."). A second cancel, a cancel of a unit not in a course, or a cancel or further course turn for a graduate, is refused unchanged, and a restart is a full new course with no 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-007: In the same fixture, cancelling a course at any turn before its graduation keeps the population id, profession, novice tier, the record's tools fields and reception progress. It grants no unfinished trained tier, clears the course progress and releases the teacher and the centre's place. Nothing is refunded and no one moves. The released teacher and pupil are civilians without a job at once, in that month's snapshot, and may take a job that month, or start another course that month, and the centre can take another teacher and pupil at once (#1716; #1668 question 43(b), owner-approved answer of 1 November 2026, [answers](https://github.com/eyalgolan/statecraft-israel/pull/1668#issuecomment-6553884547): "Cancellation: they are released at once, as civilians without a job."). A second cancel, a cancel of a unit not in a course, or a cancel or further course turn for a graduate, is refused unchanged, and a restart is a full new course with no 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."). A centre that stops operating cancels its course at once in the same way (owner, 4 November 2026, https://github.com/eyalgolan/statecraft-israel/issues/1697#issuecomment-6622207214, asked "When a training centre stops operating, what happens to the course running there?", answered "Cancel at once (Recommended)"; the chosen option read: "Losing the centre cancels the course immediately, exactly like CancelTraining: people go home as jobless civilians, no Money refund, issued Arms go back to the pool."; with 27M-4, "It is cancelled like CancelTraining, with no Money refund. Arms return to the pool.", and 27M-9, "To their city as a civilian without a job. Overflow rules apply, with no hard cap.", in the [answers](https://github.com/eyalgolan/statecraft-israel/pull/1668#issuecomment-6553884547)): its next course turn counts nothing and cancels the course, the turn that would have graduated it included, so no one graduates, and a cancel there is an ordinary cancel. Our readings, not owner rulings: the fixture's centres are fixed records, so a centre that stops operating is one given to the fixture as not operating; the pupil and teacher are already in the centre's city (R-TRAIN-005), so no one moves; the fixture charges no Money and issues no Arms, so there is nothing to refund or return; and the released pair may start a course that month at another operating centre, while the lost centre refuses a start.-R-TRAIN-008: The fixture refuses, with a "Deferred:" reason and the state unchanged, every case this slice has not built, and chooses no default. Question 44 and the novice lock-in below are decided (GDD, 1 November 2026 answers, and D3), so those refusals are implementation gaps, not open design answers. Question 42 is built and refuses with a plain reason that cites it, not as Deferred (R-TRAIN-005): a second teacher or a second pupil at one centre, a teacher outside the centre's region (the region standing in for the city), and a teaching teacher with no pupil (an invalid inventory); a pupil outside the region is refused with a plain reason that names our reading, as R-TRAIN-005 says. Question 43 is built in full: what either participant held at the month's opening (a job, or a course or teaching cancelled this turn) is no bar to starting a course that month (a reading of `docs/gdd/cities.md:42`, "Reassignment releases old capacity atomically."; `docs/GDD.md:372`, "they are released in the turn its last course turn counts and can be assigned from the next planning, or at once on cancellation"; `docs/gdd/training.md:66`, people "return at once"), except a graduation, below. The ruled question 43 limits are refused unchanged with a plain reason that cites the ruling, not as Deferred: counting a month after the enrolment month whose opening snapshot does not hold the course with the same teacher (43(a)). There are no reception beds, so a centre's place freed by a cancel or a graduation is free at once, also in the month a course started and was cancelled; #1668 question 41's bed reuse is post-MVP (`docs/GDD.md:377`). #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 centre stops operating. Graduation release under question 43(b) and (c) is built and is not Deferred (#1697 body, owner answers of 1 November 2026: "on graduation the people are released in the turn the last course turn counts and can be assigned from the next turn's planning" and "a person whose course ends this turn starts work the next turn"): a graduate and a teacher released by the graduation cannot start a course in the graduation month, even after taking a job that month (refused unchanged with a plain reason, not Deferred), and can from the next month; and work eligibility is read from the month's opening snapshot (#1716), where the graduate still holds the course, so a job given after graduation counts from the next month. Real centres, hosts, regions, map bindings, Money and Food settlement, saves and commands remain held with their owners (#1691, #1696, #1700, #1702, #1713, #1716; #1690 closed on 2 November 2026, its post-MVP regional pools moved to #2233).+R-TRAIN-008: The fixture refuses, with a "Deferred:" reason and the state unchanged, every case this slice has not built, and chooses no default. Question 44 and the novice lock-in below are decided (GDD, 1 November 2026 answers, and D3), so those refusals are implementation gaps, not open design answers. Question 42 is built and refuses with a plain reason that cites it, not as Deferred (R-TRAIN-005): a second teacher or a second pupil at one centre, a teacher outside the centre's region (the region standing in for the city), and a teaching teacher with no pupil (an invalid inventory); a pupil outside the region is refused with a plain reason that cites the owner's Q23 ruling (4 November 2026) on where the pupil lives, and our reading of 27M-7 for training there with no travel, as R-TRAIN-005 says. Question 43 is built in full: what either participant held at the month's opening (a job, or a course or teaching cancelled this turn) is no bar to starting a course that month (a reading of `docs/gdd/cities.md:42`, "Reassignment releases old capacity atomically."; `docs/GDD.md:372`, "they are released in the turn its last course turn counts and can be assigned from the next planning, or at once on cancellation"; `docs/gdd/training.md:66`, people "return at once"), except a graduation, below. The ruled question 43 limits are refused unchanged with a plain reason that cites the ruling, not as Deferred: counting a month after the enrolment month whose opening snapshot does not hold the course with the same teacher (43(a)). There are no reception beds, so a centre's place freed by a cancel or a graduation is free at once, also in the month a course started and was cancelled; #1668 question 41's bed reuse is post-MVP (`docs/GDD.md:377`). #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. A course turn in a month whose #1716 facility freeze lists the centre as unavailable or without a place: a centre that stops operating cancels its course (R-TRAIN-007), but when a loss inside a month takes effect against that freeze is unruled. Graduation release under question 43(b) and (c) is built and is not Deferred (#1697 body, owner answers of 1 November 2026: "on graduation the people are released in the turn the last course turn counts and can be assigned from the next turn's planning" and "a person whose course ends this turn starts work the next turn"): a graduate and a teacher released by the graduation cannot start a course in the graduation month, even after taking a job that month (refused unchanged with a plain reason, not Deferred), and can from the next month; and work eligibility is read from the month's opening snapshot (#1716), where the graduate still holds the course, so a job given after graduation counts from the next month. Real centres, hosts, regions, map bindings, Money and Food settlement, saves and commands remain held with their owners (#1691, #1696, #1700, #1702, #1713, #1716; #1690 closed on 2 November 2026, its post-MVP regional pools moved to #2233).## Craftsmendiff --git a/sim/Statecraft.Sim.Tests/Gdd03TrainingCentreFixtureTests.cs b/sim/Statecraft.Sim.Tests/Gdd03TrainingCentreFixtureTests.csindex 981462060..8fab3284c 100644--- a/sim/Statecraft.Sim.Tests/Gdd03TrainingCentreFixtureTests.cs+++ b/sim/Statecraft.Sim.Tests/Gdd03TrainingCentreFixtureTests.cs@@ -75,6 +75,8 @@ public class Gdd03TrainingCentreFixtureTestsconst string PupilCity = Gdd03TrainingCentreFixture.PupilCityReason;const string GraduationMonth = Gdd03TrainingCentreFixture.GraduationMonthReason;const string CourseAtOpening = Gdd03TrainingCentreFixture.CourseAtOpeningReason;+ // The one centre-loss case no ruling covers: a centre the month's #1716 facility freeze lists without a place.+ const string MonthFreezeDeferred = "Deferred: #1716 month freeze";static void Unchanged(GameState s, Action act, Type expected, string? messagePrefix = null){@@ -295,8 +297,8 @@ public class Gdd03TrainingCentreFixtureTestsnew object[] { "same person", 1, 1, CentreA, true },new object[] { "unknown centre", 0, 1, "fixture-unknown", true },new object[] { "centre not operating", 0, 1, CentreA, false },- // The teacher is housed in the centre's city (Q42) and, by our reading, the pupil trains there; the region stands- // in for the city.+ // The teacher is housed in the centre's city (Q42), the pupil lives there (the owner's Q23 ruling, 4 November 2026)+ // and, by our reading of 27M-7, trains there with no travel; the region stands in for the city.new object[] { "other region", 0, 1, CentreSouth, true },new object[] { "trainee in another region", 0, 14, CentreA, true },new object[] { "teacher in another region", 16, 1, CentreA, true },@@ -324,7 +326,7 @@ public class Gdd03TrainingCentreFixtureTests}// R-TRAIN-005, Q42 (docs/GDD.md:372: "the teacher housed in the centre's city"): a teacher outside the centre's region- // is refused with the Q42 reason; a pupil outside it with our reading's reason (Q42 rules only on the teacher). Both+ // is refused with the Q42 reason; a pupil outside it with the Q23 ruling's reason (Q42 rules only on the teacher). Both// are refused before the ledger is asked, the state unchanged. The region stands in for the city.[Fact] public void ATeacherOrPupilOutsideTheHostRegionIsRefused(){@@ -439,7 +441,9 @@ public class Gdd03TrainingCentreFixtureTests// R-TRAIN-006, R-TRAIN-008: #1668 Q43(a) (docs/GDD.md:372: "A course occupies its people from its first turn"). The// enrolment month counts once even though its opening snapshot predates the course, unless the centre was not- // available at that month's freeze (27 Oct list Q9 stays Deferred). Every later month still needs the course at its+ // available at that month's freeze. When a centre loss inside a month takes effect against the #1716 freeze is+ // unruled (the owner's 4 November 2026 ruling covers a centre that stops operating), so that case stays Deferred, as+ // does a later month whose freeze lists the centre unavailable. Every later month still needs the course at its// opening: a month-1 snapshot taken before the course started is refused with the Q43(a) reason (a ruled rule).[Fact] public void TheEnrolmentMonthCountsAndLaterMonthsNeedTheCourseAtTheirOpening(){@@ -447,17 +451,19 @@ public class Gdd03TrainingCentreFixtureTestsvar f = new Gdd03TrainingCentreFixture(c, s, Centres());var enrolment = Month(s, 0); var closedEnrolment = Month(s, 0, centresAvailable: false); var staleLater = Month(s, 1);f.Start(1, 0, CentreA, enrolment);- Unchanged(s, () => f.Advance(1, closedEnrolment), typeof(NotSupportedException), "Deferred: #1668 27 Oct list Q9");+ Unchanged(s, () => f.Advance(1, closedEnrolment), typeof(NotSupportedException), MonthFreezeDeferred);Unchanged(s, () => f.Advance(1, staleLater), typeof(ArgumentException), CourseAtOpening);f.Advance(1, enrolment);Assert.Equal(1, s.PopulationLedger.Get(1).Assignment.ProgressTicks);Unchanged(s, () => f.Advance(1, enrolment), typeof(ArgumentException));Unchanged(s, () => f.Advance(1, staleLater), typeof(ArgumentException), CourseAtOpening);+ Unchanged(s, () => f.Advance(1, Month(s, 1, centresAvailable: false)), typeof(NotSupportedException), MonthFreezeDeferred);}- // R-TRAIN-006, 27 Oct list Q9: in the enrolment month the centre's availability is read from the month's facility- // list (the opening may predate the course). A centre listed with no free place (opening capacity 0) at that month's- // freeze counts no course turn: refused Deferred, state unchanged; the next month with a place counts as before.+ // R-TRAIN-006, R-TRAIN-008: in the enrolment month the centre's availability is read from the month's facility list+ // (the opening may predate the course). A centre listed with no free place (opening capacity 0) at that month's+ // freeze counts no course turn: refused Deferred (the timing of a loss inside a month against the #1716 freeze is+ // unruled), state unchanged; the next month with a place counts as before.[Fact] public void TheEnrolmentMonthCountsNothingWhenTheCentreHasNoPlace(){var c = Catalogue(); var s = State(c); var f = new Gdd03TrainingCentreFixture(c, s, Centres());@@ -465,7 +471,7 @@ public class Gdd03TrainingCentreFixtureTestsFacilities.Select(id => new Gdd03SyntheticFacilitySnapshot(id, true, id == CentreA ? 0 : 1)),Array.Empty<int>(), Array.Empty<Gdd03SyntheticHousingSnapshot>(), Array.Empty<Gdd03SyntheticPendingEntry>());f.Start(1, 0, CentreA, Month(s, 0));- Unchanged(s, () => f.Advance(1, noPlace), typeof(NotSupportedException), "Deferred: #1668 27 Oct list Q9");+ Unchanged(s, () => f.Advance(1, noPlace), typeof(NotSupportedException), MonthFreezeDeferred);Assert.Equal(0, s.PopulationLedger.Get(1).Assignment.ProgressTicks);f.Advance(1, Month(s, 1));Assert.Equal(1, s.PopulationLedger.Get(1).Assignment.ProgressTicks);@@ -842,17 +848,151 @@ public class Gdd03TrainingCentreFixtureTestsUnchanged(s, () => f.Start(1, 2, CentreA, Month(s, 1)), typeof(NotSupportedException), "Deferred: #1668 Q44");}- // R-TRAIN-008: 27 Oct #1668 list question 9 stays open: no course turn or cancellation once the centre stops- // operating.- [Fact] public void CentreLossStaysDeferred()+ // R-TRAIN-007, R-TRAIN-008, the owner's ruling (owner, 4 November 2026; "When a training centre stops operating,+ // what happens to the course running there?" "Cancel at once (Recommended)"; the chosen option read: "Losing the centre cancels the course+ // immediately, exactly like CancelTraining: people go home as jobless civilians, no Money refund, issued Arms go back+ // to the pool."), with 27M-4 and 27M-9 ("To their city as a civilian without a job. Overflow rules apply, with no+ // hard cap."). The fixture's centres are fixed records, so a centre that stops operating is a fixture built over the+ // same ledger with `operating: false` (a maintainer reading). Its next course turn counts nothing and cancels the+ // course as R-TRAIN-007 does: ids, profession, novice tier, the tools fields and reception progress kept; pupil and+ // teacher civilians without a job where they are (already in the centre's city, so no one moves); no Money refunded+ // and no Arms change (this fixture charges no Money and issues no Arms); no qualification; progress cleared.+ [Theory]+ [InlineData(CivilianProfession.Farmer, 0)]+ [InlineData(CivilianProfession.Farmer, 1)]+ [InlineData(CivilianProfession.Pioneer, 0)]+ [InlineData(CivilianProfession.Pioneer, 1)]+ public void ALostCentreCancelsItsCourseAtOnce(CivilianProfession profession, int counted){- var c = Catalogue(); var s = State(c);+ var c = Catalogue(); var s = State(c); var l = s.PopulationLedger; s.Treasury = 100; s.Arms = 7;+ var f = new Gdd03TrainingCentreFixture(c, s, Centres());+ var (teacher, trainee) = Pair(profession); var before = l.Get(trainee); var teacherBefore = l.Get(teacher);+ int count = l.Units.Count, next = l.NextPopulationId;+ f.Start(trainee, teacher, CentreA, Month(s, 0));+ for (int m = 1; m <= counted; m++) f.Advance(trainee, Month(s, m));+ Assert.Equal(counted, l.Get(trainee).Assignment.ProgressTicks);++ new Gdd03TrainingCentreFixture(c, s, Centres(operating: false)).Advance(trainee, Month(s, counted + 1));+ CancelledByTheLoss(s, before, teacherBefore, 100, 7);+ Assert.Equal(count, l.Units.Count); Assert.Equal(next, l.NextPopulationId);+ }++ // R-TRAIN-008 (review SHOULD): the loss is checked before the month's opening snapshot is read, so a month context that+ // does not list the pupil (or their teacher) still cancels the course at a centre that stopped operating, instead of+ // refusing the turn.+ [Theory]+ [InlineData(CivilianProfession.Farmer)]+ [InlineData(CivilianProfession.Pioneer)]+ public void ALostCentreCancelsEvenWhenTheMonthDoesNotListThePupil(CivilianProfession profession)+ {+ var c = Catalogue(); var s = State(c); var l = s.PopulationLedger; s.Treasury = 100; s.Arms = 7;+ var f = new Gdd03TrainingCentreFixture(c, s, Centres());+ var (teacher, trainee) = Pair(profession); var before = l.Get(trainee); var teacherBefore = l.Get(teacher);+ f.Start(trainee, teacher, CentreA, Month(s, 0));+ var without = Gdd03SyntheticMonthContext.CreateSynthetic(SaveGame.Gdd03Ruleset, 1,+ l.Units.Where(p => p.Id != trainee && p.Id != teacher),+ Facilities.Select(x => new Gdd03SyntheticFacilitySnapshot(x, true, 1)),+ Array.Empty<int>(), Array.Empty<Gdd03SyntheticHousingSnapshot>(), Array.Empty<Gdd03SyntheticPendingEntry>());+ new Gdd03TrainingCentreFixture(c, s, Centres(operating: false)).Advance(trainee, without);+ CancelledByTheLoss(s, before, teacherBefore, 100, 7);+ }++ // R-TRAIN-007, R-TRAIN-008, the owner's answer "Cancel at once (Recommended)" (4 November 2026; the chosen option+ // read: "Losing the centre cancels the course immediately"): a loss seen+ // on the turn that would have graduated the course still cancels it. Our reading: the loss cancels the course before+ // that turn counts, so the pupil stays a novice and nobody graduates; graduation needs the last course turn to count.+ [Theory]+ [InlineData(CivilianProfession.Farmer)]+ [InlineData(CivilianProfession.Pioneer)]+ public void ALossOnTheGraduationTurnCancelsAndNobodyGraduates(CivilianProfession profession)+ {+ var c = Catalogue(); var s = State(c); var l = s.PopulationLedger; s.Treasury = 100; s.Arms = 7;+ var f = new Gdd03TrainingCentreFixture(c, s, Centres());+ var (teacher, trainee) = Pair(profession); var before = l.Get(trainee); var teacherBefore = l.Get(teacher);+ var enrolment = Month(s, 0);+ f.Start(trainee, teacher, CentreA, enrolment); f.Advance(trainee, enrolment); f.Advance(trainee, Month(s, 1));+ Assert.Equal(2, l.Get(trainee).Assignment.ProgressTicks); // the next counted turn is the third and would graduate++ var lost = new Gdd03TrainingCentreFixture(c, s, Centres(operating: false));+ lost.Advance(trainee, Month(s, 2));+ CancelledByTheLoss(s, before, teacherBefore, 100, 7);+ // Not a graduation: a cancel frees them at once (Q43(b)), so both may start a course in that same month.+ f.Start(trainee, teacher, CentreB, Month(s, 2));+ Assert.Equal(PopulationStatus.Trainee, l.Get(trainee).Status); Assert.Equal(CentreB, l.Get(trainee).Assignment.Target);+ }++ // R-TRAIN-007, R-TRAIN-008, the owner's answer "Cancel at once (Recommended)" (4 November 2026; the chosen option read: "exactly like CancelTraining"): an explicit cancel of a course+ // whose centre stopped operating is an ordinary R-TRAIN-007 cancel.+ [Fact] public void CancelAtALostCentreIsAnOrdinaryCancel()+ {+ var c = Catalogue(); var s = State(c); var l = s.PopulationLedger; s.Treasury = 100; s.Arms = 7;+ var before = l.Get(1); var teacherBefore = l.Get(0);+ var enrolment = Month(s, 0);+ var f = new Gdd03TrainingCentreFixture(c, s, Centres());+ f.Start(1, 0, CentreA, enrolment); f.Advance(1, enrolment);+ new Gdd03TrainingCentreFixture(c, s, Centres(operating: false)).Cancel(1);+ CancelledByTheLoss(s, before, teacherBefore, 100, 7);+ }++ // R-TRAIN-005, R-TRAIN-007, R-TRAIN-008, owner, 4 November 2026, with #1668 Q43(b) ("Cancellation: they are released+ // at once"): after the loss, a second course turn or cancel of the old course is refused with nothing changed, the+ // lost centre still refuses a start, and the released pair may start that month at another operating centre, whose+ // enrolment month counts once as its first course turn.+ [Fact] public void PeopleReleasedByALostCentreMayStartElsewhereThatMonth()+ {+ var c = Catalogue(); var s = State(c); var l = s.PopulationLedger;new Gdd03TrainingCentreFixture(c, s, Centres()).Start(1, 0, CentreA, Month(s, 0));- var closed = new Gdd03TrainingCentreFixture(c, s, Centres(operating: false));- Unchanged(s, () => closed.Advance(1, Month(s, 1)), typeof(NotSupportedException), "Deferred: #1668 27 Oct list Q9");- Unchanged(s, () => closed.Cancel(1), typeof(NotSupportedException), "Deferred: #1668 27 Oct list Q9");- var open = new Gdd03TrainingCentreFixture(c, s, Centres());- Unchanged(s, () => open.Advance(1, Month(s, 1, centresAvailable: false)), typeof(NotSupportedException), "Deferred: #1668 27 Oct list Q9");+ var opening = Month(s, 1);+ var lost = new Gdd03TrainingCentreFixture(c, s, Centres(operating: false));+ lost.Advance(1, opening);+ Assert.Equal(PopulationStatus.FreeCivilian, l.Get(1).Status); Assert.Same(PopulationAssignment.Unassigned, l.Get(0).Assignment);++ Unchanged(s, () => lost.Advance(1, opening), typeof(ArgumentException));+ Unchanged(s, () => lost.Cancel(1), typeof(ArgumentException));+ Unchanged(s, () => lost.Start(1, 0, CentreA, opening), typeof(ArgumentException));+ lost.Start(1, 0, CentreB, opening);+ Assert.Equal(CentreB, l.Get(1).Assignment.Target); Assert.Equal(0, l.Get(1).Assignment.TeacherId);+ lost.Advance(1, opening);+ Assert.Equal(1, l.Get(1).Assignment.ProgressTicks);+ }++ // R-TRAIN-006, R-TRAIN-008, owner, 4 November 2026: only the course at the centre that stopped operating is+ // cancelled. A course at another, operating centre keeps counting through the same fixture and graduates as before.+ [Fact] public void ACourseAtAnOperatingCentreIsUnaffectedByAnotherCentresLoss()+ {+ var c = Catalogue(); var s = State(c); var l = s.PopulationLedger;+ var f = new Gdd03TrainingCentreFixture(c, s, Centres()); var enrolment = Month(s, 0);+ f.Start(1, 0, CentreA, enrolment); f.Start(3, 2, CentreB, enrolment);+ f.Advance(1, enrolment); f.Advance(3, enrolment);++ var lost = new Gdd03TrainingCentreFixture(c, s, Centres(operating: false));+ var month1 = Month(s, 1);+ lost.Advance(3, month1);+ Assert.Equal(2, l.Get(3).Assignment.ProgressTicks); Assert.Equal(CentreB, l.Get(3).Assignment.Target);+ lost.Advance(1, month1);+ Assert.Same(PopulationAssignment.Unassigned, l.Get(1).Assignment); Assert.Equal(CivilianTier.Novice, l.Get(1).Tier);+ Assert.Equal(2, l.Get(3).Assignment.ProgressTicks); Assert.Equal(PopulationAssignmentKind.Teaching, l.Get(2).Assignment.Kind);++ lost.Advance(3, Month(s, 2));+ Assert.Equal(CivilianTier.Trained, l.Get(3).Tier); Assert.Same(PopulationAssignment.Unassigned, l.Get(3).Assignment);+ Assert.Same(PopulationAssignment.Unassigned, l.Get(2).Assignment);+ }++ // The R-TRAIN-007 cancel state after a centre loss: same ids and records, pupil and teacher civilians without a job+ // in place, no trained tier, no Money refund and no Arms change.+ static void CancelledByTheLoss(GameState s, PopulationUnit before, PopulationUnit teacherBefore, double treasury, int arms)+ {+ var l = s.PopulationLedger; var after = l.Get(before.Id); var teacher = l.Get(teacherBefore.Id);+ Assert.Equal(PopulationStatus.FreeCivilian, after.Status); Assert.Same(PopulationAssignment.Unassigned, after.Assignment);+ Assert.Equal(CivilianTier.Novice, after.Tier); Assert.Equal(before.Profession, after.Profession);+ Assert.Same(before.Equipment, after.Equipment); Assert.True(after.Equipment.ToolsPaid);+ Assert.Equal(before.ReceptionTicks, after.ReceptionTicks); Assert.Equal(before.WorkXp, after.WorkXp);+ Assert.Equal(before.Qualification, after.Qualification); Assert.Same(before.Location, after.Location);+ Assert.Equal(PopulationStatus.FreeCivilian, teacher.Status); Assert.Same(PopulationAssignment.Unassigned, teacher.Assignment);+ Assert.Equal(CivilianTier.Veteran, teacher.Tier); Assert.Equal(teacherBefore.Equipment, teacher.Equipment);+ Assert.Same(teacherBefore.Location, teacher.Location);+ Assert.Equal(treasury, s.Treasury); Assert.Equal(arms, s.Arms);+ l.Reconcile();}// R-TRAIN-005: exact gdd-0.3 only; legacy and gdd-0.1 states are refused and unchanged in the same run.diff --git a/sim/Statecraft.Sim/Gdd03TrainingCentreFixture.cs b/sim/Statecraft.Sim/Gdd03TrainingCentreFixture.csindex 62d2f0f0f..b787fe283 100644--- a/sim/Statecraft.Sim/Gdd03TrainingCentreFixture.cs+++ b/sim/Statecraft.Sim/Gdd03TrainingCentreFixture.cs@@ -28,9 +28,11 @@ namespace Statecraft.Sim/// synthetic fixtures only. No command, save, loader, resolver, Money, Food or UI caller. GDD 0.3 (docs/GDD.md, 1 November/// 2026 answers): "A course occupies its people from its first turn (Q43(a)); they are released in the turn its last/// course turn counts and can be assigned from the next planning, or at once on cancellation, and work starts the turn- /// after (Q43(b), Q43(c))." So the enrolment month is course turn 1 and the last counted turn graduates. Cases this- /// slice has not built (Q44, decided in the GDD's 1 November 2026 answers, so the refusal is an implementation gap, not- /// an open design answer; and the 27 Oct list Q9) are refused with a "Deferred:" NotSupportedException.</summary>+ /// after (Q43(b), Q43(c))." So the enrolment month is course turn 1 and the last counted turn graduates. A centre that+ /// stops operating cancels its course at once (the owner's answer "Cancel at once (Recommended)", 4 November 2026, #1697 comment+ /// 6622207214; the chosen option read: "Losing the centre cancels the course immediately, exactly like CancelTraining"). Cases this slice has not built (Q44, decided in the GDD's 1 November 2026+ /// answers, so the refusal is an implementation gap, not an open design answer; and a centre the month's #1716 facility+ /// freeze lists without a place, whose timing no ruling covers) are refused with a "Deferred:" NotSupportedException.</summary>internal sealed class Gdd03TrainingCentreFixture{readonly Content content;@@ -61,14 +63,18 @@ namespace Statecraft.Siminternal const string OneTeacherOnePupilReason = "A centre has one veteran teacher and one pupil (#1668 Q42, GDD 1 Nov 2026).";internal const string TeacherNeedsAPupilReason = "A centre's teacher teaches its pupil: a teaching record with no pupil is invalid (#1668 Q42, GDD 1 Nov 2026).";internal const string TeacherCityReason = "The teacher is housed in the centre's city (#1668 Q42, GDD 1 Nov 2026); this fixture checks the centre's region as an approximation of the city.";- // Q42 rules only on the teacher. That the pupil is in the centre's city too is our reading, pending maintainer- // confirmation: #1697's body says "the teacher and the trainee are housed there as ordinary residents", and- // docs/GDD.md:374 says "Training is ordered in the camp's city, with no travel (27M-7)."- internal const string PupilCityReason = "The pupil trains in the centre's city, with no travel (a reading of #1697 and 27M-7, pending maintainer confirmation); this fixture checks the centre's region as an approximation of the city.";+ // Q42 rules only on the teacher. The pupil lives in the centre's host city too: the owner's Q23 ruling of 4 November+ // 2026 (asked "Must a farmer-course or pioneer-course pupil live in the training centre's host city?", answered+ // "yes", https://github.com/eyalgolan/statecraft-israel/issues/1697#issuecomment-6623127820). That the pupil trains+ // there with no travel is our reading of docs/GDD.md:374, "Training is ordered in the camp's city, with no travel+ // (27M-7).", not part of the Q23 ruling.+ internal const string PupilCityReason = "The pupil lives in the centre's host city (owner ruling Q23, 4 November 2026, #1697) and trains there with no travel (a reading of 27M-7); this fixture checks the centre's region as an approximation of the city.";internal const string GraduationMonthReason = "A person released by a graduation can start a course from the next month (#1668 Q43(b), GDD 1 Nov 2026).";internal const string CourseAtOpeningReason = "After the enrolment month, a course turn counts only when the month's opening holds the course with the same teacher (#1668 Q43(a), GDD 1 Nov 2026).";const string Q44 = "#1668 Q44 and the GDD novice lock-in decision (when a free entrant becomes a novice; profession change after a cancelled course).";- const string Q9 = "#1668 27 Oct list Q9 (return after cancellation or camp loss).";+ // The owner's 4 November 2026 ruling covers a centre that stops operating (Operating false). When a loss inside a+ // month takes effect against the #1716 month freeze, which lists the centre unavailable or without a place, is unruled.+ const string MonthFreeze = "#1716 month freeze: when a centre loss inside a month takes effect is unruled (a centre that stops operating is cancelled, owner 4 Nov 2026).";// GDD 1 November 2026 answers (docs/GDD.md:374): "Refugees cannot train until they become civilians". In the MVP a// refugee becomes a civilian on the housing step (R-CITY-004), so no reception progress is read here.@@ -130,7 +136,7 @@ namespace Statecraft.Sim=> p.WithPlacement(PopulationStatus.FreeCivilian, p.Location, PopulationAssignment.Unassigned, p.Captor, p.Home);/// <summary>R-TRAIN-005: enrol a matching novice with a matching veteran teacher at an operating centre, both in the- /// centre's region (Q42 for the teacher, our reading for the pupil), and only into an empty+ /// centre's region (Q42 for the teacher, the owner's Q23 ruling for the pupil), and only into an empty/// centre: one teacher and one pupil (Q42). Either may leave a job to do so, released in the same commit. No payment, and no tools:/// tools are post-MVP (#1693, owner answers of 3 November 2026, answer 1).</summary>internal void Start(int traineeId, int teacherId, string centreId, Gdd03SyntheticMonthContext month)@@ -187,12 +193,18 @@ namespace Statecraft.Sim/// <summary>R-TRAIN-006: count one completed course turn, once per month ordinal: in the enrolment month (Q43(a), "A/// course occupies its people from its first turn"), or in a later month whose opening already holds the course with/// the same teacher. The turn that reaches Agreed `profession.course_turns` graduates: the pupil takes the trained- /// tier (R-QUAL-008), and pupil and teacher are released in that turn as civilians without a job (Q43(b)).</summary>+ /// tier (R-QUAL-008), and pupil and teacher are released in that turn as civilians without a job (Q43(b)). At a+ /// centre that stops operating, the turn counts nothing and cancels the course as `Cancel` does, the would-be+ /// graduation turn included (R-TRAIN-008; the owner's answer "Cancel at once (Recommended)", 4 November 2026, #1697 comment 6622207214; the chosen+ /// option read: "Losing the centre cancels the course immediately, exactly like CancelTraining").</summary>internal void Advance(int traineeId, Gdd03SyntheticMonthContext month){ValidateInventory();var ledger = state.PopulationLedger; var trainee = ledger.Get(traineeId); var centre = CentreOf(trainee);- if (!centre.Operating) throw Deferred(Q9);+ if (month == null) throw new ArgumentNullException(nameof(month));+ // The loss is checked before the month's snapshot is read: a lost centre cancels even when the month does not+ // list the pupil (R-TRAIN-008).+ if (!centre.Operating) { Cancel(traineeId); return; }var opening = Opening(month, trainee.Id);bool tracked = months.TryGetValue(trainee.Id, out var known);// Q43(a): the enrolment month counts, though its opening snapshot was taken before the course started.@@ -206,7 +218,7 @@ namespace Statecraft.Simif (enrolmentMonth? !month.Facilities.Any(f => string.Equals(f.Id, centre.Id, StringComparison.Ordinal) && f.AvailableAtMonthFreeze && f.OpeningCapacity > 0): !month.CourseEligibleIds.Contains(trainee.Id))- throw Deferred(Q9);+ throw Deferred(MonthFreeze);if (!enrolmentMonth && trainee.Assignment.ProgressTicks != opening.Assignment.ProgressTicks)throw new ArgumentException("This month's course turn was already counted.");@@ -231,12 +243,12 @@ namespace Statecraft.Sim/// <summary>R-TRAIN-007: cancel keeps the id, profession, tier, the record's tools fields and its reception progress;/// it clears the unfinished course and releases the teacher and the centre's place. Nothing is refunded or granted/// and no one moves. The released people, and the centre, can take another assignment at once, in this month's- /// snapshot (#1716, #1668 Q43(b), answered 1 Nov 2026).</summary>+ /// snapshot (#1716, #1668 Q43(b), answered 1 Nov 2026). A centre that stopped operating is no bar: this is the+ /// cancel its loss makes (the owner's answer "Cancel at once (Recommended)", 4 November 2026; the chosen option read: "exactly like CancelTraining").</summary>internal void Cancel(int traineeId){ValidateInventory();- var ledger = state.PopulationLedger; var trainee = ledger.Get(traineeId); var centre = CentreOf(trainee);- if (!centre.Operating) throw Deferred(Q9);+ var ledger = state.PopulationLedger; var trainee = ledger.Get(traineeId); _ = CentreOf(trainee); // refuses a record that is not a pupil herevar teacher = ledger.Get(trainee.Assignment.TeacherId!.Value);Commit(Released(trainee), Released(teacher)); // the centre's one pupil (Q42), so its teacher is released toomonths.Remove(trainee.Id);