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.

feat(sim): captured soldiers become ledger records on a Historical ledger game (#1710, #1725 PR 7) (#2971)

Eyal Golan1d01027e3f2c
diff --git a/changelog.d/1725-pr7-prisoners.md b/changelog.d/1725-pr7-prisoners.md
new file mode 100644
index 000000000..47712c509
--- /dev/null
+++ b/changelog.d/1725-pr7-prisoners.md
@@ -0,0 +1,5 @@
+- GDD 0.3 starting population (Refs #1725, Refs #1710): a surrender of one of the player's opening formations now works on
+ the inactive dark start's Historical ledger. Its soldier records become captives of the winning side, keep their id,
+ history and issued item, and the held-soldier count stays beside them with a check that the two agree. The prisoners
+ eat and the held soldiers cost Money as in the aggregate start. Every enemy side is bound as a captor when the
+ Historical ledger starts. No new-game wiring, so there is no change in the game.
diff --git a/docs/rules/mvp.md b/docs/rules/mvp.md
index 1d40709e7..226dbcc81 100644
--- a/docs/rules/mvp.md
+++ b/docs/rules/mvp.md
@@ -394,7 +394,7 @@ R-WAR-008: Under exact `gdd-0.3` (`gdd-0.1` in #752), each front's armistice car
Phase 5 PR 12 (#751). The impact plan's §4.3 as written (Q-POW-1), points per unit returned (Q-POW-2), a sourced event card per front (Q-POW-3), the player's soldiers counted with a cost (Q-POW-4) and a Food cost whose shortfall costs cohesion (Q-POW-5): the owner's picks of 15 October 2026 (#375). The four amounts (`rules.yaml` `mvp.food_per_prisoner_unit`, `mvp.prisoner_shortfall_cohesion`, `mvp.points_per_prisoner_unit_returned`, `mvp.held_soldier_cost_per_turn`) are agent defaults posted on #751 (https://github.com/eyalgolan/statecraft-israel/issues/751#issuecomment-6318787961), accepted by the owner as design values (owner, 21 October 2026, #751: https://github.com/eyalgolan/statecraft-israel/issues/751#issuecomment-6321366548). The same ruling says ALA and local-force prisoners belong to no front, so they stay held, and fed, to the game's end. It does not name the front of each side or the captor of the player's soldiers; those stay agent defaults. The four sourced exchange cards are not in `content/` yet: they wait for a person's source check (CONTENT_POLICY §2) and the owner's sensitivity review.
-R-POW-001: Prisoners come only from a surrender in combat (R-COMBAT-003). The surrendered enemy unit's strength, in population units, is added to `GameState.PrisonersHeld` under its side; residents never become prisoners (R-CTRL-003). No command and no event effect adds to or takes from the count: no effect target names it. The surrender's Why line ends "They are held as prisoners", and nothing on screen celebrates a capture (impact plan §4.3 item 4).
+R-POW-001: Prisoners come only from a surrender in combat (R-COMBAT-003). The surrendered enemy unit's strength, in population units, is added to `GameState.PrisonersHeld` under its side; residents never become prisoners (R-CTRL-003). No command and no event effect adds to or takes from the count: no effect target names it. The surrender's Why line ends "They are held as prisoners", and nothing on screen celebrates a capture (impact plan §4.3 item 4). On the dark start's Historical ledger (#1710, #1725 PR 7) enemy prisoners stay this count per side, with no ledger record (owner, 8 November 2026: "No, keep count (Recommended)").
R-POW-002: In step 7, after the nation eats and the import (R-FOOD-002), the prisoners eat `mvp.food_per_prisoner_unit` (real value 1, one unit's ration) for each population unit held, as far as the stock goes. Each unit of their Food the stock cannot give lowers Social cohesion by `mvp.prisoner_shortfall_cohesion` (real value 0.01), the one cohesion cost of a military matter in Phase 5 (Q-CIV-3); a shortfall never reduces the prisoners (Q-POW-5).
@@ -402,9 +402,9 @@ R-POW-003: Prisoners are never labour, Money, Arms, housing occupants, jobs or a
R-POW-004: An event with `prisoners: <front>` (egypt, jordan, lebanon or syria) is that front's exchange card. It fires only while the front holds prisoners either way, a stored 0 holding nobody (the Jordan card also returns the Iraqi prisoners: the Jordan agreement took over the Iraqi sector, Art. VI, Q-OBJ-1; the ALA and the local forces belong to no front, so no card returns theirs). It has exactly one option and resolves without an RNG draw, like an objective's card. Resolving it moves its sides' prisoners from `PrisonersHeld` to `PrisonersReturned` and adds `mvp.points_per_prisoner_unit_returned` (real value 10) to the score for each population unit returned (Q-POW-2). Nothing scores at the capture (impact plan §4.3 item 3). It holds unchanged under gdd-0.3, played with a synthetic exchange card: a returned unit scores 10 (owner, 1 November 2026, O7: "10 per unit, main (Recommended)"; `PrisonersGdd03Tests.AReturnedUnitScoresTenPoints`); the card fires once, so prisoners taken after it has resolved stay held to the end of the game with no points (27M-19; `PrisonersGdd03Tests.PrisonersTakenAfterTheCardStayHeldWithNoPoints`); and a loaded save pays no return twice (`PrisonersGdd03Tests.ASaveAndReloadCannotPayTwice`).
-R-POW-005: A surrendered unit of the player's is added to `GameState.SoldiersHeld` under the side of the engagement's lowest-id attacker. In step 7, after the prisoners eat, the Treasury pays `mvp.held_soldier_cost_per_turn` (real value IL 0.005m) for each population unit held, borrowing what it lacks (R-MONEY-003; Q-POW-4). They come home when that side's front's exchange card resolves, with no score effect.
+R-POW-005: A surrendered unit of the player's is added to `GameState.SoldiersHeld` under the side of the engagement's lowest-id attacker. In step 7, after the prisoners eat, the Treasury pays `mvp.held_soldier_cost_per_turn` (real value IL 0.005m) for each population unit held, borrowing what it lacks (R-MONEY-003; Q-POW-4). They come home when that side's front's exchange card resolves, with no score effect. On the dark start's Historical ledger (#1710, #1725 PR 7) the surrender also makes the formation's serving soldier records Captured, in one validated ledger commit after every check. Their captor is that same side: every enemy side with military units (a `unit_types.yaml` side other than `israel` and `""`) is bound as a captor when the Historical ledger is initialized (owner, 8 November 2026: "Winning side, set at start (Recommended)"). Their Home is the formation's region, region only ("Formation's region (Recommended)"). Each keeps its id, history and issued military item, unchanged while held; what happens to the item on return is #2473's (docs/GDD.md Q10; "Stays on record (Recommended)"). `GameState.SoldiersHeld` keeps its count beside the records, and per captor side it must equal the Captured records with that captor: Take and Upkeep check this before any write ("Keep count + check (Recommended)"). The held soldiers keep this Money cost ("Yes, as today (Recommended)"; docs/gdd/military-combat.md calls the exemption non-operative). A surrender whose serving records do not number its strength, to a side that is not a bound captor, or of a unit that is not a `units_1948.yaml` formation (a trained formation, whose records come with #2964), is refused: Take throws before it writes anything. Called from combat, the throw comes after the engagement's draw and losses and after any earlier engagement of the same command or turn; on a direct call to `Combat.Strike` or `Combat.Resolve` those writes stay on the state object given. In the game that object is `Simulation.Step`'s clone (`sim/Statecraft.Sim/Simulation.cs:51`; combat's callers are `Simulation.cs:268` and `TurnResolver.cs:20`), so the whole command's or turn's result is discarded and the caller's state is unchanged. Today Step refuses an initialized ledger (`Simulation.cs:48`) and `Combat.Resolve` refuses one at its entry, so only a direct `Combat.Strike` reaches the refusal in combat (`LedgerPrisonersTests.ARefusedCaptureInCombatThrowsAndAPriorCloneIsUnchanged`).
-Under gdd-0.3 (#1710), the prisoners in these pins come from a real surrender (R-POW-001). `PrisonersGdd03Tests.PrisonersEatAndAFoodShortfallCostsCohesion` pins R-POW-002, `PrisonersGdd03Tests.PrisonersAreNeverAResource` pins R-POW-003, and `PrisonersGdd03Tests.OwnSoldiersAreCapturedCostMoneyAndComeHome` pins R-POW-005. The real per-front exchange cards wait on #751, so the return and homecoming pins use the synthetic card until those cards land.
+Under gdd-0.3 (#1710), the prisoners in these pins come from a real surrender (R-POW-001). `PrisonersGdd03Tests.PrisonersEatAndAFoodShortfallCostsCohesion` pins R-POW-002, `PrisonersGdd03Tests.PrisonersAreNeverAResource` pins R-POW-003, and `PrisonersGdd03Tests.OwnSoldiersAreCapturedCostMoneyAndComeHome` pins R-POW-005. The real per-front exchange cards wait on #751, so the return and homecoming pins use the synthetic card until those cards land. On the dark start, `LedgerPrisonersTests` pins R-POW-001, R-POW-002 and R-POW-005 against the aggregate start with the same counts.
## Objectives
@@ -605,7 +605,7 @@ These contracts cover #1689 steps 1–2 and the Historical start inventory (R-PO
R-POP-001: Only exact `gdd-0.3` enables the population-ledger capability, independently of the broad GDD loop and Attention (R-LOOP-002/005). An immutable own-population record has a dedicated nonnegative ordinal id. Synthetic fixture inventory is ordered by source key (ordinal string comparison), then within-source ordinal. Registered arrivals allocate monotonically; only explicit combat losses remove living ids. Sources remain registered after loss, and ids are never reused. Reconciliation checks the exact created-minus-lost id set against the living ledger, not just equal totals. Status/region counts include every matching record once. The gdd-0.3 scale of a synthetic or Open fixture reads one positive Agreed integer from `population.people_per_unit` in its catalogue (currently 10,000, Open mode's scale under D2); a Historical fixture reads `rules.yaml`'s `people_per_unit` for the start day (1,000), as R-UNIT-006 does (owner, 1 November 2026, D2: "Approve all six (Recommended)", "The Historical MVP keeps main's start: census cities at 1,000 people a unit (`R-CITY-007`)"; R-POP-004); rows with a `census/`, `units_1948/` or `field/` source key are the Historical start's and are refused in any other fixture. Old identities retain the common rules scale. Missing, fractional, nonpositive, overflowing or Deferred values have no fallback, in either source.
-R-POP-002: A ledger record has exactly one typed status and assignment, validated location, home and captor references, whole reception-turn ticks capped by the catalogue requirement, civilian profession-specific tier and actual-work XP, separate military qualification/combat XP, and distinct issued civilian/military equipment and paid facts. Unknown references, unresolved teacher ids, incompatible statuses/assignments, inconsistent region/hex/facility bindings, invalid progress/tiers and duplicate issued-item ownership are refused before mutation. Moves and atomic status/location/assignment transitions retain identity/history. Capture retains home context without inventing a prison hex or refunding equipment. Ledger changes never touch resources, causes, RNG or Attention. Initialization is internal and fixture-only; initialized ledger fixtures refuse aggregate Simulation commands and turns. The dark start (#1725 PR 5) is the internal, fixture-only `Simulation.NewGame` overload that initializes the Historical ledger (R-POP-004) in place before `Pools.Init`: `Pools.Init` then reads the ledger's need, one ration for each living own population id (R-FOOD-001, #2470), after the ledger reconciles, and `StartingForces.Init` places the forces once each own starting formation's strength is its ledger soldiers, refusing otherwise. Both read only a ledger initialized with mode Historical, the dark start's; a synthetic or Open ledger is refused by both, as by the other aggregate systems, with the state unchanged. An aggregate system whose own rule says it runs on that Historical ledger (#1725 PR 7: civilian upkeep, R-MONEY-002, the first, and food_supply's stock term, R-FOOD-003; training, R-TRAIN-001 to R-TRAIN-004) also reads only that ledger; a synthetic or Open ledger is still refused by it. `EventSystem.Trigger` still refuses a ledger, so a dark start fires no opening event; the public `NewGame` is unchanged. The step-7 Food settlement given a month's synthetic context is another exception to that refusal: it reads its need from that month's frozen snapshot (R-FOOD-002, #2470). Old identities refuse ledger mutation. Prices, progression awards, return destinations, tool lock-in and captive-equipment outcomes remain with their owning issues. A craftsman's tier is novice, apprentice or expert (R-CRAFT-003); a farmer's or pioneer's is novice, trained or veteran.
+R-POP-002: A ledger record has exactly one typed status and assignment, validated location, home and captor references, whole reception-turn ticks capped by the catalogue requirement, civilian profession-specific tier and actual-work XP, separate military qualification/combat XP, and distinct issued civilian/military equipment and paid facts. Unknown references, unresolved teacher ids, incompatible statuses/assignments, inconsistent region/hex/facility bindings, invalid progress/tiers and duplicate issued-item ownership are refused before mutation. Moves and atomic status/location/assignment transitions retain identity/history. Capture retains home context without inventing a prison hex or refunding equipment. Ledger changes never touch resources, causes, RNG or Attention. Initialization is internal and fixture-only; initialized ledger fixtures refuse aggregate Simulation commands and turns. The dark start (#1725 PR 5) is the internal, fixture-only `Simulation.NewGame` overload that initializes the Historical ledger (R-POP-004) in place before `Pools.Init`: `Pools.Init` then reads the ledger's need, one ration for each living own population id (R-FOOD-001, #2470), after the ledger reconciles, and `StartingForces.Init` places the forces once each own starting formation's strength is its ledger soldiers, refusing otherwise. Both read only a ledger initialized with mode Historical, the dark start's; a synthetic or Open ledger is refused by both, as by the other aggregate systems, with the state unchanged. An aggregate system whose own rule says it runs on that Historical ledger (#1725 PR 7: civilian upkeep, R-MONEY-002, the first, and food_supply's stock term, R-FOOD-003; training, R-TRAIN-001 to R-TRAIN-004) also reads only that ledger; a synthetic or Open ledger is still refused by it. Prisoners.Take and Prisoners.Upkeep are such systems (#1710, R-POW-001, R-POW-002, R-POW-005): a capture turns the surrendered formation's serving records into captives with their captor and home, all or nothing, and records no loss. `EventSystem.Trigger` still refuses a ledger, so a dark start fires no opening event; the public `NewGame` is unchanged. The step-7 Food settlement given a month's synthetic context is another exception to that refusal: it reads its need from that month's frozen snapshot (R-FOOD-002, #2470). Old identities refuse ledger mutation. Prices, progression awards, return destinations, tool lock-in and captive-equipment outcomes remain with their owning issues. A craftsman's tier is novice, apprentice or expert (R-CRAFT-003); a farmer's or pioneer's is novice, trained or veteran.
R-POP-003: Clone copies all ledger containers; immutable records and frozen bindings may be shared. The canonical writer emits a gdd-0.3-only section ordered by numeric population id, with fixed field order, stable machine tokens, invariant integer formatting and length-prefixed reference strings. It covers every record/assignment/equipment/reference field, binding, creation/loss provenance and allocator even after the last combat loss. Legacy/gdd-0.1 emit no ledger section or allocator marker. A location's optional city (a `regions.yaml` member location of its region that is a census city of `cities.yaml` or one of that region's field hosts, where R-POP-004 houses own people: a settlement hosts only F19 and F20, owner, 7 November 2026, #1689: "These two only (Recommended)"; any other, including a locality, a `sites.yaml` id or a map location, is refused when a fixture is created, naming the city and the region, R-POP-002) is written after its other fields as `|city=` with a length-prefixed id, only when set, as R-UNIT-002's `|home=` is, so a location without a city keeps its canonical text and hash. R-SAVE-001/002 still govern identity mismatch refusal and replay: no ledger snapshot or new command syntax is added in this foundation, and fixture injection is not replay evidence. Existing unpublished schema-4 draft hashes change; no migration promise is made.
diff --git a/sim/Statecraft.Sim.Tests/LedgerPrisonersTests.cs b/sim/Statecraft.Sim.Tests/LedgerPrisonersTests.cs
new file mode 100644
index 000000000..8fb84f277
--- /dev/null
+++ b/sim/Statecraft.Sim.Tests/LedgerPrisonersTests.cs
@@ -0,0 +1,307 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Statecraft.Sim;
+
+/// <summary>#1725 PR 7, #1710: Prisoners.Take and Prisoners.Upkeep on a game with an initialized Historical ledger, the
+/// dark start. A surrendering opening formation's serving soldier records become Captured records under the captor's side
+/// (R-POW-005, R-POP-002), and SoldiersHeld keeps its count next to them, with an invariant that the count per captor is the
+/// Captured records with that captor. The prisoners eat and the held soldiers cost Money as today (R-POW-002, R-POW-005).
+/// Owner rulings, 8 November 2026 (#1725): "Yes, as today (Recommended)", "Winning side, set at start (Recommended)",
+/// "Formation's region (Recommended)", "Stays on record (Recommended)", "Keep count + check (Recommended)", "No, keep
+/// count (Recommended)" and "Prisoners #1710 first (Recommended)".</summary>
+public class LedgerPrisonersTests
+{
+ static Content Gdd03() => HistoricalPopulationTests.Real(true);
+
+ static GameState Dark(Content c) => Simulation.NewGame(c, 1, Mode.Historical, darkStart: true);
+
+ static string Take(Content c, GameState s, Unit u, Unit captor) => Prisoners.Take(c, s, u, captor);
+
+ // The own opening formations on the board, lowest id first: unit id i is c.StartingForces[i] (StartingForces.Init).
+ static List<Unit> Own(Content c, GameState s) => s.Units.Values
+ .Where(u => u.Side == Movement.PlayerSide && u.Id < c.StartingForces.Count && u.Strength > 0).OrderBy(u => u.Id).ToList();
+
+ static Unit Enemy(GameState s, string side) => s.Units.Values.Where(u => u.Side == side).OrderBy(u => u.Id).First();
+
+ static string Key(Content c, Unit u) => HistoricalPopulation.FormationPrefix + c.StartingForces[u.Id].Row;
+
+ static List<PopulationUnit> Serving(Content c, GameState s, Unit u) => s.PopulationLedger.Units
+ .Where(p => p.Status == PopulationStatus.ActiveSoldier && p.Assignment.Target == Key(c, u)).OrderBy(p => p.Id).ToList();
+
+ // "Keep count + check (Recommended)": per captor, SoldiersHeld equals the Captured records with that captor.
+ static void AssertHeldMatchesRecords(GameState s)
+ {
+ var records = s.PopulationLedger.Units.Where(p => p.Status == PopulationStatus.Captured)
+ .GroupBy(p => p.Captor!, StringComparer.Ordinal).ToDictionary(g => g.Key, g => g.Count(), StringComparer.Ordinal);
+ foreach (var side in records.Keys.Union(s.SoldiersHeld.Keys, StringComparer.Ordinal))
+ Assert.Equal(records.TryGetValue(side, out var n) ? n : 0, s.SoldiersHeld.TryGetValue(side, out var m) ? m : 0);
+ }
+
+ // R-POW-005, R-POP-002: each serving record of the surrendering opening formation becomes Captured, captor the side of
+ // the lowest-id attacker passed in ("Winning side, set at start (Recommended)"), Home the formation's region, region
+ // only ("Formation's region (Recommended)"), no location and no assignment, its issued military item kept unchanged
+ // ("Stays on record (Recommended)"), and its id, qualification, combat XP and reception kept. Nobody dies.
+ [Fact]
+ public void AnOwnSurrenderMakesItsRecordsCapturedWithTheirCaptor()
+ {
+ var c = Gdd03();
+ var s = Dark(c);
+ var u = Own(c, s)[0]; var captor = Enemy(s, "egypt");
+ var before = Serving(c, s, u);
+ Assert.Equal(u.Strength, before.Count);
+ var next = s.PopulationLedger.NextPopulationId; var people = s.PopulationLedger.TotalPeople;
+ var others = s.PopulationLedger.Units.Where(p => !before.Any(b => b.Id == p.Id)).Select(p => p.Canonical()).ToList();
+ Assert.Equal("They are held by the enemy", Take(c, s, u, captor));
+ foreach (var b in before)
+ {
+ var p = s.PopulationLedger.Get(b.Id);
+ Assert.Equal(PopulationStatus.Captured, p.Status);
+ Assert.Equal("egypt", p.Captor);
+ Assert.Null(p.Location);
+ Assert.Equal(b.Location!.Canonical(), p.Home!.Canonical());
+ Assert.Null(p.Home!.City); Assert.Null(p.Home.Q);
+ Assert.Equal(PopulationAssignmentKind.Unassigned, p.Assignment.Kind);
+ Assert.Equal(b.Equipment.Canonical(), p.Equipment.Canonical());
+ Assert.NotNull(p.Equipment.MilitaryId);
+ Assert.Equal((b.Qualification, b.CombatXp, b.ReceptionTicks, b.Profession, b.Tier, b.WorkXp),
+ (p.Qualification, p.CombatXp, p.ReceptionTicks, p.Profession, p.Tier, p.WorkXp));
+ }
+ Assert.Empty(Serving(c, s, u));
+ Assert.Equal(others, s.PopulationLedger.Units.Where(p => !before.Any(b => b.Id == p.Id)).Select(p => p.Canonical()));
+ Assert.Equal((next, people), (s.PopulationLedger.NextPopulationId, s.PopulationLedger.TotalPeople));
+ Assert.DoesNotContain(s.PopulationLedger.Canonical(), l => l.StartsWith("4:loss|", StringComparison.Ordinal));
+ s.PopulationLedger.Reconcile();
+ }
+
+ // "Winning side, set at start (Recommended)": every enemy side with a military unit type in unit_types.yaml (sides other
+ // than israel and "") is bound as a captor when the Historical ledger is initialized.
+ [Fact]
+ public void EveryEnemySideIsBoundAsACaptorAtTheStart()
+ {
+ var c = Gdd03();
+ var sides = c.UnitTypes.Select(t => t.Side).Where(x => x != "" && x != Movement.PlayerSide).Distinct(StringComparer.Ordinal)
+ .OrderBy(x => x, StringComparer.Ordinal).ToList();
+ Assert.Contains("egypt", sides); Assert.Contains("ala", sides);
+ // The canonical text writes each field as its length, a colon and its value (PopulationText.Fields).
+ var lines = Dark(c).PopulationLedger.Canonical().Where(l => l.StartsWith("6:captor|", StringComparison.Ordinal)).ToList();
+ Assert.Equal(sides.Select(x => $"6:captor|{x.Length}:{x}"), lines);
+ }
+
+ // "Keep count + check (Recommended)": SoldiersHeld rises by the formation's strength under the captor's side, as in the
+ // aggregate game, and the count per captor equals the Captured records with that captor, over two captors.
+ [Fact]
+ public void SoldiersHeldRisesByTheSameCountAndMatchesTheRecords()
+ {
+ var c = Gdd03();
+ var s = Dark(c); var pub = Simulation.NewGame(c, 1, Mode.Historical);
+ var own = Own(c, s);
+ Assert.True(own.Count >= 3);
+ foreach (var (i, side) in new[] { (0, "egypt"), (1, "jordan"), (2, "egypt") })
+ {
+ Take(c, s, own[i], Enemy(s, side));
+ Take(c, pub, pub.Units[own[i].Id], Enemy(pub, side));
+ AssertHeldMatchesRecords(s);
+ }
+ Assert.Equal(own[0].Strength + own[2].Strength, s.SoldiersHeld["egypt"]);
+ Assert.Equal(own[1].Strength, s.SoldiersHeld["jordan"]);
+ Assert.Equal(pub.SoldiersHeld, s.SoldiersHeld);
+ s.PopulationLedger.Reconcile();
+ }
+
+ // R-POW-001, "No, keep count (Recommended)": an enemy surrender adds its strength to PrisonersHeld under its side, as
+ // today, and writes no ledger record (R-POP-004: enemy formations are not own population).
+ [Fact]
+ public void AnEnemySurrenderAddsPrisonersAndNoRecord()
+ {
+ var c = Gdd03();
+ var s = Dark(c);
+ var e = Enemy(s, "egypt");
+ var ledger = s.PopulationLedger.Canonical().ToList();
+ Assert.Equal("They are held as prisoners", Take(c, s, e, Own(c, s)[0]));
+ Assert.Equal(e.Strength, s.PrisonersHeld["egypt"]);
+ Assert.Empty(s.SoldiersHeld);
+ Assert.Equal(ledger, s.PopulationLedger.Canonical());
+ s.PopulationLedger.Reconcile();
+ }
+
+ // R-POW-002, R-POW-005, "Yes, as today (Recommended)": on the dark start Upkeep feeds the prisoners from Food, a
+ // shortfall costs cohesion, and the Treasury pays held_soldier_cost_per_turn a held unit, borrowing what it lacks, all
+ // exactly as on the aggregate start with the same counts and stocks. Upkeep changes no ledger record; the captured own
+ // records are not fed here (they eat the national ration, mvp.md R-FOOD-001/002 ledger paragraph).
+ [Theory]
+ [InlineData(1_000_000, 50.0)] [InlineData(3, 0.0)]
+ public void UpkeepChargesAsTodayOnALedgerGame(int food, double treasury)
+ {
+ var c = Gdd03();
+ var dark = Dark(c); var pub = Simulation.NewGame(c, 1, Mode.Historical);
+ var own = Own(c, dark)[0]; var e = Enemy(dark, "egypt");
+ foreach (var s in new[] { dark, pub })
+ {
+ Take(c, s, s.Units[e.Id], s.Units[own.Id]);
+ Take(c, s, s.Units[own.Id], s.Units[e.Id]);
+ s.Food = food; s.Treasury = treasury; s.Debt = 0;
+ }
+ var r = c.RulesAt(dark.Date).Mvp!;
+ var ledger = dark.PopulationLedger.Canonical().ToList();
+ var moraleDark = dark.Indicators.GetValueOrDefault("morale"); var moralePub = pub.Indicators.GetValueOrDefault("morale");
+ var darkWhy = new List<Cause>(); var pubWhy = new List<Cause>();
+ Prisoners.Upkeep(c, dark, r, darkWhy);
+ Prisoners.Upkeep(c, pub, r, pubWhy);
+ Assert.Equal(pubWhy.Select(x => x.Message), darkWhy.Select(x => x.Message));
+ Assert.Equal(pubWhy.Select(x => x.Delta), darkWhy.Select(x => x.Delta));
+ Assert.Equal((pub.Food, pub.Treasury, pub.Debt), (dark.Food, dark.Treasury, dark.Debt));
+ Assert.Equal(pub.Indicators.GetValueOrDefault("morale") - moralePub, dark.Indicators.GetValueOrDefault("morale") - moraleDark, 12);
+ var need = (long)e.Strength * r.FoodPerPrisonerUnit!.Value;
+ Assert.Equal(Math.Max(0, food - need), dark.Food);
+ var cost = own.Strength * r.HeldSoldierCostPerTurn!.Value;
+ Assert.True(cost > 0);
+ Assert.Equal(treasury - cost + dark.Debt, dark.Treasury, 12);
+ Assert.Equal(ledger, dark.PopulationLedger.Canonical());
+ dark.PopulationLedger.Reconcile();
+ }
+
+ // R-POP-002 "refused before mutation": each refusal leaves the state, the ledger and the hash unchanged. A formation whose
+ // serving records do not match its strength; a trained formation (not an opening one: its records are #2964's
+ // formation/<id> target, not on main); a captor side the ledger does not bind; and a count that already disagrees with
+ // the Captured records ("Keep count + check (Recommended)").
+ [Theory]
+ [InlineData("mismatch", "serves it with")] [InlineData("trained", "no ledger records to capture")]
+ [InlineData("unbound", "is not a bound captor")] [InlineData("count", "captured records with that captor")]
+ public void ARefusedCaptureLeavesStateLedgerAndHashUnchanged(string why, string reason)
+ {
+ var c = Gdd03();
+ var s = Dark(c);
+ var u = Own(c, s)[0]; var captor = Enemy(s, "egypt");
+ switch (why)
+ {
+ case "mismatch": s.PopulationLedger.RegisterCombatLoss(Serving(c, s, u)[0].Id, "fixture"); break;
+ case "trained": u = new Unit(s.NextId, "recruit", u.Q, u.R, side: Movement.PlayerSide, strength: 1); s.Units.Add(u.Id, u); s.NextId++; break;
+ case "unbound": captor = new Unit(captor.Id, captor.Type, captor.Q, captor.R, side: "local", strength: captor.Strength); break;
+ case "count": s.SoldiersHeld["egypt"] = 1; break;
+ }
+ var before = s.Describe(); var hash = s.Hash(); var ledger = s.PopulationLedger.Canonical().ToList();
+ var units = s.Units.Values.Select(x => x.Canonical()).ToList();
+ Assert.Contains(reason, Assert.ThrowsAny<Exception>(() => Take(c, s, u, captor)).Message);
+ Assert.Equal(before, s.Describe()); Assert.Equal(hash, s.Hash());
+ Assert.Equal(ledger, s.PopulationLedger.Canonical());
+ Assert.Equal(units, s.Units.Values.Select(x => x.Canonical()));
+ }
+
+ // "Keep count + check (Recommended)": Upkeep refuses a count that disagrees with the records, with nothing paid or eaten.
+ [Fact]
+ public void UpkeepRefusesACountThatDisagreesWithTheRecords()
+ {
+ var c = Gdd03();
+ var s = Dark(c);
+ s.SoldiersHeld["egypt"] = 1;
+ var before = s.Describe(); var hash = s.Hash(); var why = new List<Cause>();
+ Assert.Contains("captured records with that captor",
+ Assert.Throws<InvalidOperationException>(() => Prisoners.Upkeep(c, s, c.RulesAt(s.Date).Mvp!, why)).Message);
+ Assert.Equal(before, s.Describe()); Assert.Equal(hash, s.Hash()); Assert.Empty(why);
+ }
+
+ // R-POP-002: only a ledger initialized with mode Historical is let through; an Open or synthetic one is still refused
+ // before any write, by Take and by Upkeep.
+ [Theory]
+ [InlineData(true, false)] [InlineData(false, false)] [InlineData(true, true)] [InlineData(false, true)]
+ public void AnOpenOrSyntheticLedgerIsStillRefused(bool open, bool upkeep)
+ {
+ var c = PopulationLedgerTests.Content();
+ var s = PopulationLedger.CreateFixture(c, PopulationLedgerTests.Bindings(),
+ new[] { new PopulationInventoryRow("fixture", 0, PopulationLedgerTests.Person()) }, mode: open ? Mode.Open : null);
+ Assert.Equal((true, false), (s.PopulationLedger.IsInitialized, s.PopulationLedger.IsHistorical));
+ var before = s.Describe(); var hash = s.Hash(); var why = new List<Cause>();
+ Action call = upkeep ? () => Prisoners.Upkeep(c, s, new MvpRules(), why)
+ : () => Take(c, s, new Unit(0, "missing", 0, 0, side: Movement.PlayerSide, strength: 1), new Unit(1, "missing", 0, 0, side: "egypt"));
+ Assert.Contains("integration is held", Assert.Throws<NotSupportedException>(call).Message);
+ Assert.Equal(before, s.Describe()); Assert.Equal(hash, s.Hash()); Assert.Empty(why);
+ }
+
+ // Where Take's refusal can be reached from combat, and what it leaves. Combat.Resolve (step 2, TurnResolver.cs:20) refuses
+ // any initialized ledger at its entry (Combat.cs:267), before any engagement, so on this branch only the player's instant
+ // attack, Combat.Strike (its one caller is Step, Simulation.cs:268), can reach Prisoners.Take on a dark start. Here an
+ // enemy unit boxed in by own units surrenders to a Strike while SoldiersHeld disagrees with the Captured records, so Take
+ // throws InvalidOperationException before it writes anything. The throw comes after the Strike's own writes (the
+ // attacker's order and the engagement's draw and losses), and those stay on the state object a direct call is given. In
+ // the game that object is never the caller's: Step works on a clone (Simulation.cs:51), so the throw discards the whole
+ // command's result and Step's caller is unchanged. A Clone() taken before the call pins that isolation. Step itself
+ // cannot be driven there: the refusal needs an initialized Historical ledger, and Step refuses any initialized ledger
+ // at Simulation.cs:48, while a game without a ledger skips every ledger check in Take.
+ [Fact]
+ public void ARefusedCaptureInCombatThrowsAndAPriorCloneIsUnchanged()
+ {
+ var c = Gdd03();
+ var s = Dark(c);
+ var resolve = s.Clone();
+ Assert.Contains("integration is held",
+ Assert.Throws<NotSupportedException>(() => Combat.Resolve(c, resolve, new List<Cause>())).Message);
+ Assert.Equal(s.Hash(), resolve.Hash());
+
+ // The weakest enemy unit (lowest id on a tie), attacked by the strongest own formation (lowest id on a tie).
+ var e = s.Units.Values.Where(u => Prisoners.FrontOf.ContainsKey(u.Side) && u.Strength > 0)
+ .OrderBy(u => u.Strength).ThenBy(u => u.Id).First();
+ var own = Own(c, s).OrderByDescending(u => u.Strength).ThenBy(u => u.Id).ToList();
+ var ring = Movement.Neighbours.Select(d => (Q: e.Q + d.Q, R: e.R + d.R))
+ .Where(h => c.HexAt(h.Q, h.R) is MapHex hex && hex.Land).ToList();
+ Assert.NotEmpty(ring);
+ Assert.True(own.Count >= ring.Count);
+ for (int i = 0; i < ring.Count; i++)
+ {
+ var u = own[i];
+ s.Units[u.Id] = new Unit(u.Id, u.Type, ring[i].Q, ring[i].R, u.Service, u.Side, u.Strength, "", "", u.HomeCity, u.Full, u.CombatXp);
+ }
+ var attacker = own[0].Id;
+ // A seed whose one draw makes the defender retreat with no hex to go to: with the counts in order, it surrenders.
+ string? Strike(GameState g, List<Cause> why) => Combat.Strike(c, g, attacker, e.Q, e.R, new Dictionary<int, int>(),
+ new Dictionary<int, AttackRecord>(), why);
+ ulong seed = 1;
+ for (; seed < 500; seed++)
+ {
+ var trial = s.Clone(); trial.RngState = seed; var why = new List<Cause>();
+ Assert.Null(Strike(trial, why));
+ if (why.Any(x => x.Key == WhyKeys.SurrenderedPrisoners && x.Units.Any(u => u.Id == e.Id))) break;
+ }
+ Assert.True(seed < 500, "no seed gave a surrender");
+ s.RngState = seed;
+ s.SoldiersHeld["egypt"] = 1; // the count disagrees with the records: Take refuses (R-POW-005)
+
+ var prior = s.Clone();
+ var hash = prior.Hash(); var ledger = prior.PopulationLedger.Canonical().ToList();
+ var lines = new List<Cause>();
+ Assert.Contains("captured records with that captor",
+ Assert.Throws<InvalidOperationException>(() => Strike(s, lines)).Message);
+ Assert.Equal(hash, prior.Hash());
+ Assert.Equal(ledger, prior.PopulationLedger.Canonical());
+ // Take wrote nothing: the ledger and the counts are as they were, and the defender is still on the board.
+ Assert.Equal(ledger, s.PopulationLedger.Canonical());
+ Assert.Equal(1, s.SoldiersHeld["egypt"]);
+ Assert.Equal(prior.PrisonersHeld.TryGetValue(e.Side, out var was) ? was : 0, s.PrisonersHeld.TryGetValue(e.Side, out var held) ? held : 0);
+ Assert.True(s.Units.ContainsKey(e.Id));
+ // The Strike's own writes before the throw remain on the object passed in: the draw, and the engagement's line.
+ Assert.NotEqual(prior.RngState, s.RngState);
+ Assert.NotEqual(hash, s.Hash());
+ Assert.Contains(lines, x => x.Key == WhyKeys.Engagement);
+ }
+
+ // Determinism: Take and Upkeep draw no RNG; two dark games given the same captures and upkeep end with the same hash and
+ // ledger text, and a capture changes the hash.
+ [Fact]
+ public void TheSameCapturesGiveTheSameHash()
+ {
+ var c = Gdd03();
+ string Run(out string start)
+ {
+ var s = Dark(c); start = s.Hash();
+ var own = Own(c, s); var rng = s.RngState;
+ Take(c, s, own[1], Enemy(s, "syria")); Take(c, s, own[0], Enemy(s, "egypt")); Take(c, s, Enemy(s, "iraq"), own[2]);
+ Prisoners.Upkeep(c, s, c.RulesAt(s.Date).Mvp!, new List<Cause>());
+ Assert.Equal(rng, s.RngState);
+ return s.Hash() + "\n" + string.Join("\n", s.PopulationLedger.Canonical());
+ }
+ var a = Run(out var startA); var b = Run(out var startB);
+ Assert.Equal(startA, startB);
+ Assert.Equal(a, b);
+ Assert.NotEqual(startA, a.Split('\n')[0]);
+ }
+}
diff --git a/sim/Statecraft.Sim.Tests/PopulationLedgerBoundaryTests.cs b/sim/Statecraft.Sim.Tests/PopulationLedgerBoundaryTests.cs
index b59b41308..182426317 100644
--- a/sim/Statecraft.Sim.Tests/PopulationLedgerBoundaryTests.cs
+++ b/sim/Statecraft.Sim.Tests/PopulationLedgerBoundaryTests.cs
@@ -61,7 +61,7 @@ public class PopulationLedgerBoundaryTests
case "combat.outcomes": Combat.Outcomes(c,s,0); break;
case "prisoners.upkeep": Prisoners.Upkeep(c,s,rules,why); break;
case "prisoners.return": Prisoners.Return(c,s,"missing",why); break;
- case "prisoners.take": Prisoners.Take(s,new Unit(1,"missing",0,0,side:"missing",strength:1),new Unit(2,"missing",0,0,side:Movement.PlayerSide)); break;
+ case "prisoners.take": Prisoners.Take(c,s,new Unit(1,"missing",0,0,side:"missing",strength:1),new Unit(2,"missing",0,0,side:Movement.PlayerSide)); break;
case "events.trigger": EventSystem.Trigger(c,s,why); break;
case "events.choose": EventSystem.Choose(c,s,"missing","missing",why); break;
case "events.delegate": EventSystem.Delegate(c,s,why); break;
diff --git a/sim/Statecraft.Sim/Combat.cs b/sim/Statecraft.Sim/Combat.cs
index abb5354e7..09b9fdbbb 100644
--- a/sim/Statecraft.Sim/Combat.cs
+++ b/sim/Statecraft.Sim/Combat.cs
@@ -387,9 +387,15 @@ namespace Statecraft.Sim
{
// The only way a unit is captured (impact plan section 4.3 item 1; R-POW-001). Its captor is the engagement's
// lowest-id attacker (not attackers[0]: the guns are listed last, R-COMBAT-007), whose side holds the
- // player's soldiers (R-POW-005).
+ // player's soldiers (R-POW-005). Take runs before the unit is removed (#1710). On a Historical ledger game
+ // it may refuse: it throws InvalidOperationException before it writes anything, but this engagement's draw
+ // and losses, and any earlier write to s (an earlier engagement, or the Strike's own), stay on s. In the
+ // game s is always a clone: Strike's caller (Simulation.cs:268) and Resolve's (TurnResolver.cs:20) run
+ // inside Simulation.Step on its clone (Simulation.cs:51; Preview and DelegatedTo clone too), so the whole
+ // command's or turn's result is discarded and the caller's state is unchanged. Today Step refuses a ledger
+ // game (Simulation.cs:48), and Resolve refuses one at its entry.
+ var held = Prisoners.Take(c, s, u, attackers.OrderBy(x => x.Id).First());
s.Units.Remove(u.Id);
- var held = Prisoners.Take(s, u, attackers.OrderBy(x => x.Id).First());
why.Add(UnitLines.Line(u.Side == Movement.PlayerSide ? WhyKeys.SurrenderedHeld : WhyKeys.SurrenderedPrisoners, // Prisoners.Take's two cases
FormattableString.Invariant($"Unit {u.Id} surrendered with {u.Strength * ppu:N0} people: it had no hex to retreat to. {held}"),
new[] { u }, (u.Strength * ppu).ToString(CultureInfo.InvariantCulture)));
diff --git a/sim/Statecraft.Sim/HistoricalPopulation.cs b/sim/Statecraft.Sim/HistoricalPopulation.cs
index 60b82bb46..d63247016 100644
--- a/sim/Statecraft.Sim/HistoricalPopulation.cs
+++ b/sim/Statecraft.Sim/HistoricalPopulation.cs
@@ -217,9 +217,14 @@ namespace Statecraft.Sim
// #1689 rows 5 to 8 and the 7th Brigade's combat XP: see SoldierValues.
var soldier = new Dictionary<string, (string Qualification, int CombatXp)>(StringComparer.Ordinal);
foreach (var f in c.StartingForces.Where(Bound)) soldier[FormationPrefix + f.Row] = SoldierValues(c, f);
+ // #1710 (#1725 PR 7). Owner, 8 November 2026, "Winning side, set at start (Recommended)": every enemy side with
+ // military units (a unit_types.yaml side other than israel and "") is a captor from the start, so a surrender's
+ // records can be Captured under the side of the engagement's lowest-id attacker (R-POW-005).
+ var captors = c.UnitTypes.Select(t => t.Side).Where(x => !string.IsNullOrEmpty(x) && x != Movement.PlayerSide)
+ .Distinct(StringComparer.Ordinal);
var bindings = new PopulationBindings(locations.Values.Concat(placed.Values.Where(l => l.City != null)
.GroupBy(l => l.Canonical(), StringComparer.Ordinal).Select(g => g.First())), targets,
- Array.Empty<string>(), soldier.Values.Select(x => x.Qualification).Concat(Training.TrainedClasses(c)).Distinct(StringComparer.Ordinal));
+ captors, soldier.Values.Select(x => x.Qualification).Concat(Training.TrainedClasses(c)).Distinct(StringComparer.Ordinal));
// reception.turns is the reception before free-civilian status (docs/gdd/balance.md:91), so a census free civilian
// starts with it done: R-VET-001 gives work XP only to a received free civilian. Soldiers keep 0 (not ruled).
var received = c.RequirePopulationInteger("reception.turns");
diff --git a/sim/Statecraft.Sim/PopulationLedger.cs b/sim/Statecraft.Sim/PopulationLedger.cs
index db88db9a7..bb0a5db08 100644
--- a/sim/Statecraft.Sim/PopulationLedger.cs
+++ b/sim/Statecraft.Sim/PopulationLedger.cs
@@ -219,6 +219,27 @@ namespace Statecraft.Sim
var candidate = new SortedDictionary<int, PopulationUnit>(units) { [replacement.Id] = replacement };
Validate(candidate); units = candidate;
}
+ /// <summary>#1710 (#1725 PR 7), R-POW-005, R-POP-002: the active soldiers <paramref name="ids"/> surrender to
+ /// <paramref name="captor"/>, all or nothing. Each becomes Captured with that captor, no location and no assignment, its
+ /// Home the place it served in (the formation's region; owner, 8 November 2026: "Formation's region (Recommended)"),
+ /// and keeps its id, history and issued item (owner: "Stays on record (Recommended)"). Every record is checked and the
+ /// candidate validated before any is committed, so a refusal changes nothing. Nobody is lost: no loss is written.</summary>
+ internal void Capture(IReadOnlyList<int> ids, string captor)
+ {
+ RequireInitialized();
+ if (captor == null || !bindings!.HasCaptor(captor))
+ throw new ArgumentException("Side '" + captor + "' is not a bound captor of this ledger (R-POP-002).");
+ var candidate = new SortedDictionary<int, PopulationUnit>(units);
+ var seen = new HashSet<int>();
+ foreach (var id in ids)
+ {
+ var p = Get(id);
+ if (p.Status != PopulationStatus.ActiveSoldier || !seen.Add(id))
+ throw new ArgumentException("Only an active soldier can surrender, once (R-POW-005).");
+ candidate[id] = p.WithPlacement(PopulationStatus.Captured, null, PopulationAssignment.Unassigned, captor, p.Location);
+ }
+ Validate(candidate); units = candidate;
+ }
/// <summary>A manifest item can arrive only once, including after its population id is lost.</summary>
public int RegisterArrival(string source, int ordinal, PopulationUnit template)
{
diff --git a/sim/Statecraft.Sim/Prisoners.cs b/sim/Statecraft.Sim/Prisoners.cs
index 9c5b9f7cd..aa43cf196 100644
--- a/sim/Statecraft.Sim/Prisoners.cs
+++ b/sim/Statecraft.Sim/Prisoners.cs
@@ -31,12 +31,18 @@ namespace Statecraft.Sim
/// <summary>R-POW-001, R-POW-005: unit <paramref name="u"/> surrendered to <paramref name="captor"/>'s side. An enemy unit's
/// people become prisoners under its own side; the player's soldiers are counted under the captor's side. Called only by
- /// Combat's surrender, the one way a unit is captured.</summary>
- internal static string Take(GameState s, Unit u, Unit captor)
+ /// Combat's surrender, the one way a unit is captured. With an initialized Historical ledger (the dark start, #1710,
+ /// #1725 PR 7) the player's surrendering formation's serving soldier records also become Captured under the captor's
+ /// side (<see cref="CaptureRecords"/>), checked in full before anything is written; enemy prisoners stay a count per
+ /// side (owner, 8 November 2026: "No, keep count (Recommended)"). A synthetic or Open ledger is still refused. A refusal
+ /// throws before Take writes anything; what the throw leaves in combat is set out at Combat.Fight's call.</summary>
+ internal static string Take(Content c, GameState s, Unit u, Unit captor)
{
- PopulationLedger.RefuseAggregate(s);
+ PopulationLedger.RefuseUnlessHistorical(s);
+ if (s.PopulationLedger.IsInitialized) RequireHeldMatchesRecords(s);
if (u.Side == Movement.PlayerSide)
{
+ if (s.PopulationLedger.IsInitialized) CaptureRecords(c, s, u, captor.Side);
Add(s.SoldiersHeld, captor.Side, u.Strength);
return "They are held by the enemy";
}
@@ -44,6 +50,38 @@ namespace Statecraft.Sim
return "They are held as prisoners";
}
+ /// <summary>R-POW-005, R-POP-002 on the dark start: the opening formation <paramref name="u"/>'s serving soldier records
+ /// (active soldiers on its units_1948 target; unit id i is c.StartingForces[i], StartingForces.Init) become Captured
+ /// under <paramref name="side"/>, in one validated ledger commit. Refused before any write when the unit is not a
+ /// units_1948 formation (a trained formation's soldiers serve a target this ledger does not have yet) or when its
+ /// records do not number its strength (R-POP-004).</summary>
+ static void CaptureRecords(Content c, GameState s, Unit u, string side)
+ {
+ if (u.Id < 0 || u.Id >= c.StartingForces.Count || c.StartingForces[u.Id].Side != Movement.PlayerSide)
+ throw new InvalidOperationException(FormattableString.Invariant(
+ $"Unit {u.Id} is not a formation of units_1948.yaml, so its soldiers have no ledger records to capture (R-POP-002)."));
+ var key = HistoricalPopulation.FormationPrefix + c.StartingForces[u.Id].Row;
+ var ids = s.PopulationLedger.Units.Where(p => p.Status == PopulationStatus.ActiveSoldier
+ && p.Assignment.Kind == PopulationAssignmentKind.ActiveService && p.Assignment.Target == key)
+ .Select(p => p.Id).OrderBy(x => x).ToList();
+ if (ids.Count != u.Strength)
+ throw new InvalidOperationException(FormattableString.Invariant(
+ $"Unit {u.Id} has strength {u.Strength} but the population ledger serves it with {ids.Count} (R-POP-004)."));
+ s.PopulationLedger.Capture(ids, side);
+ }
+
+ /// <summary>The owner's ruling of 8 November 2026, "Keep count + check (Recommended)": on an initialized ledger,
+ /// SoldiersHeld per captor side equals the Captured records with that captor. Read only; a mismatch is refused.</summary>
+ internal static void RequireHeldMatchesRecords(GameState s)
+ {
+ var records = s.PopulationLedger.Units.Where(p => p.Status == PopulationStatus.Captured)
+ .GroupBy(p => p.Captor!, StringComparer.Ordinal).ToDictionary(g => g.Key, g => g.Count(), StringComparer.Ordinal);
+ foreach (var side in records.Keys.Union(s.SoldiersHeld.Keys, StringComparer.Ordinal))
+ if ((records.TryGetValue(side, out var n) ? n : 0) != (s.SoldiersHeld.TryGetValue(side, out var m) ? m : 0))
+ throw new InvalidOperationException(FormattableString.Invariant(
+ $"Our soldiers held by {side} number {m} but the population ledger has {n} captured records with that captor (R-POW-005)."));
+ }
+
static IEnumerable<string> Sides(string front) => FrontOf.Where(kv => kv.Value == front).Select(kv => kv.Key).OrderBy(x => x, StringComparer.Ordinal);
/// <summary>True while <paramref name="front"/> holds the player's soldiers or the player holds its prisoners: its exchange
@@ -55,10 +93,14 @@ namespace Statecraft.Sim
/// <summary>R-POW-002, R-POW-005, step 7 after the nation eats and the import: the prisoners eat food_per_prisoner_unit a
/// unit from the stock, as far as it goes; each Food unit it cannot give costs prisoner_shortfall_cohesion of Social
/// cohesion and never a prisoner (Q-POW-5). Then the Treasury pays held_soldier_cost_per_turn for each unit of the
- /// player's soldiers held, borrowing what it lacks (Q-POW-4; R-MONEY-003).</summary>
+ /// player's soldiers held, borrowing what it lacks (Q-POW-4; R-MONEY-003). On an initialized Historical ledger (#1710,
+ /// #1725 PR 7) it runs as written, from the same counts: the held soldiers keep their Money cost (owner, 8 November
+ /// 2026: "Yes, as today (Recommended)"), the captured own records are not fed here (they eat the national ration), and
+ /// no record is read or written beyond <see cref="RequireHeldMatchesRecords"/>'s check, made before any write.</summary>
public static void Upkeep(Content c, GameState s, MvpRules r, List<Cause> why)
{
- PopulationLedger.RefuseAggregate(s);
+ PopulationLedger.RefuseUnlessHistorical(s);
+ if (s.PopulationLedger.IsInitialized) RequireHeldMatchesRecords(s);
var need = (long)s.PrisonersHeld.Values.Sum() * r.FoodPerPrisonerUnit!.Value;
if (need > 0)
{