A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
Sim: Historical ledger fixture gives starting soldiers issued equipment (Refs #1717) (#2383)
Eyal Golan5bb3e0d34af0
diff --git a/changelog.d/1717-issued-equipment.md b/changelog.d/1717-issued-equipment.mdnew file mode 100644index 000000000..9e67ebd10--- /dev/null+++ b/changelog.d/1717-issued-equipment.md@@ -0,0 +1,4 @@+### Changed+- Under the gdd-0.3 rules only, the sim's test fixture of the Historical start's population ledger gives each starting+ formation's population unit one issued military item, owned and recorded as paid, kept apart from the 12 spare Arms+ (Refs #1717). The ledger is not yet in the game; the game players play (gdd-0.1) is unchanged.diff --git a/docs/population-ledger.md b/docs/population-ledger.mdindex a45c35a61..e92112f8f 100644--- a/docs/population-ledger.md+++ b/docs/population-ledger.md@@ -14,4 +14,4 @@ No save/reload round trip for population identity is claimed. The existing seed/## Historical start inventory (R-POP-004)-`HistoricalPopulation.Inventory` is internal and reads the shipped content under exact `gdd-0.3`: one free-civilian row per census city start unit (R-CITY-007) and one active-soldier row per population unit of each Israeli starting formation of `map/units_1948.yaml` (R-UNIT-006), at `rules.yaml`'s 1,000 people a unit (owner, 1 November 2026, D2). Rows carry a source key (`census/<city id>`, `units_1948/<row id>`) and a within-source ordinal, in R-POP-001's order. Enemy formations and dated arrivals (R-UNIT-009) are not in it. It builds no `PopulationUnit` itself. `HistoricalPopulation.LedgerFixture` (internal, fixture-only) turns it into an initialized Historical ledger and binds each record to a region of `content/regions.yaml`: a census record takes the region whose `member_locations` hold its city, a formation record the region whose member hexes hold its starting anchor hex (R-POP-004); a source with no region is refused. `NewGame` does not call it, because an initialized ledger refuses the aggregate systems a `gdd-0.3` game still runs (R-POP-002). The test `HistoricalPopulationTests` checks it, city by city and formation by formation, against the aggregate start of the same content.+`HistoricalPopulation.Inventory` is internal and reads the shipped content under exact `gdd-0.3`: one free-civilian row per census city start unit (R-CITY-007) and one active-soldier row per population unit of each Israeli starting formation of `map/units_1948.yaml` (R-UNIT-006), at `rules.yaml`'s 1,000 people a unit (owner, 1 November 2026, D2). Rows carry a source key (`census/<city id>`, `units_1948/<row id>`) and a within-source ordinal, in R-POP-001's order. Enemy formations and dated arrivals (R-UNIT-009) are not in it. It builds no `PopulationUnit` itself. `HistoricalPopulation.LedgerFixture` (internal, fixture-only) turns it into an initialized Historical ledger and binds each record to a region of `content/regions.yaml`: a census record takes the region whose `member_locations` hold its city, a formation record the region whose member hexes hold its starting anchor hex (R-POP-004); a source with no region is refused. Each formation record carries one issued military item (`units_1948/<row id>/<ordinal>`, recorded as paid), apart from the spare Arms (#1717). `NewGame` does not call it, because an initialized ledger refuses the aggregate systems a `gdd-0.3` game still runs (R-POP-002). The test `HistoricalPopulationTests` checks it, city by city and formation by formation, against the aggregate start of the same content.diff --git a/docs/rules/mvp.md b/docs/rules/mvp.mdindex ae44908dc..2385837ea 100644--- a/docs/rules/mvp.md+++ b/docs/rules/mvp.md@@ -573,7 +573,7 @@ R-POP-002: A ledger record has exactly one typed status and assignment, validateR-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. 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.-R-POP-004: The Historical start inventory under exact `gdd-0.3` (#1689; owner, 1 November 2026, D2: "Approve all six (Recommended)", and D4). It is read from the same content as the aggregate start: each census city (R-CITY-006) gives its R-CITY-007 start units as free civilians, and each Israeli starting formation of `map/units_1948.yaml` (R-UNIT-006) gives its strength as active soldiers, no more and no less. Enemy formations are not own population, and a dated arrival (R-UNIT-009) is not in the start inventory: it takes new ids when it arrives (Q11). Counts use `rules.yaml`'s `people_per_unit` (1,000, D2), as R-CITY-007 and R-UNIT-006 do; the `gdd-0.3` catalogue's `population.people_per_unit` (10,000) is Open mode's (D2). A city's records have source key `census/<city id>` and a formation's `units_1948/<row id>`, each with within-source ordinals from 0, so R-POP-001's order (source key by ordinal string comparison, then ordinal) gives the ascending population ids that Q10's "N units" commands take. Legacy and `gdd-0.1` content refuse it. It reads no RNG and changes no state. It is not yet wired into `Simulation.NewGame`: an initialized ledger refuses every aggregate system (R-POP-002), so a new `gdd-0.3` game keeps the aggregate start until the producers are integrated. A fixture builder (`HistoricalPopulation.LedgerFixture`, internal, fixture-only) turns the inventory into an initialized Historical ledger with mode Historical (R-POP-001's 1,000 a record), each record in a region of `content/regions.yaml` (#1691): a census record takes the region whose `member_locations` hold its city (`census/tel_aviv` is `tel_aviv_jaffa`; Jaffa gets no records), and a formation record takes the region whose member hexes hold the formation's starting anchor hex (owner, 3 November 2026, #1689 open question 1: "Its anchor hex's region (Recommended)"). A source with no region is refused; no region is invented. Census records are free civilians with no assignment, and formation records are active soldiers whose service target is their own formation. Still Deferred: the work assignments of the employed share, which census units are farmers (fields, #1691/#1717; the owner's 1:2:1 novice/trained/veteran ratio per city then applies), and the formations' military qualification, combat experience and issued equipment (#1717). The ledger scale for this start is no longer Deferred: a Historical ledger fixture counts each record at `rules.yaml`'s `people_per_unit` for the start day, 1,000 people (R-POP-001; D2: "The Historical MVP keeps main's start: census cities at 1,000 people a unit (`R-CITY-007`)").+R-POP-004: The Historical start inventory under exact `gdd-0.3` (#1689; owner, 1 November 2026, D2: "Approve all six (Recommended)", and D4). It is read from the same content as the aggregate start: each census city (R-CITY-006) gives its R-CITY-007 start units as free civilians, and each Israeli starting formation of `map/units_1948.yaml` (R-UNIT-006) gives its strength as active soldiers, no more and no less. Enemy formations are not own population, and a dated arrival (R-UNIT-009) is not in the start inventory: it takes new ids when it arrives (Q11). Counts use `rules.yaml`'s `people_per_unit` (1,000, D2), as R-CITY-007 and R-UNIT-006 do; the `gdd-0.3` catalogue's `population.people_per_unit` (10,000) is Open mode's (D2). A city's records have source key `census/<city id>` and a formation's `units_1948/<row id>`, each with within-source ordinals from 0, so R-POP-001's order (source key by ordinal string comparison, then ordinal) gives the ascending population ids that Q10's "N units" commands take. Legacy and `gdd-0.1` content refuse it. It reads no RNG and changes no state. It is not yet wired into `Simulation.NewGame`: an initialized ledger refuses every aggregate system (R-POP-002), so a new `gdd-0.3` game keeps the aggregate start until the producers are integrated. A fixture builder (`HistoricalPopulation.LedgerFixture`, internal, fixture-only) turns the inventory into an initialized Historical ledger with mode Historical (R-POP-001's 1,000 a record), each record in a region of `content/regions.yaml` (#1691): a census record takes the region whose `member_locations` hold its city (`census/tel_aviv` is `tel_aviv_jaffa`; Jaffa gets no records), and a formation record takes the region whose member hexes hold the formation's starting anchor hex (owner, 3 November 2026, #1689 open question 1: "Its anchor hex's region (Recommended)"). A source with no region is refused; no region is invented. Census records are free civilians with no assignment, and formation records are active soldiers whose service target is their own formation. Each formation record carries one issued military item, id `units_1948/<row id>/<ordinal>`, owned and recorded as paid; census records carry none. Issued items are apart from the spare Arms: the fixture leaves the Arms stock untouched, and a new game still starts with `arms_start`'s 12 (#1717, 27M-24: "The starting formations are equipped, and the Arms stock starts at 12"). Still Deferred: the work assignments of the employed share, which census units are farmers (fields, #1691/#1717; the owner's 1:2:1 novice/trained/veteran ratio per city then applies), and the formations' military qualification and combat experience (#1717). The ledger scale for this start is no longer Deferred: a Historical ledger fixture counts each record at `rules.yaml`'s `people_per_unit` for the start day, 1,000 people (R-POP-001; D2: "The Historical MVP keeps main's start: census cities at 1,000 people a unit (`R-CITY-007`)").#1706 slices 0/1 (coordinator decision, 26 Oct 2026, Q5): the synthetic combat catalogue foundation is inactive in the actual game. R-COMBAT-001 through R-COMBAT-008 retain their current runtime meanings. See [the catalogue foundation](../gdd03-catalogue.md#1706-slices-01-inactive-combat-catalogue-foundation) for its data contract and sources.diff --git a/sim/Statecraft.Sim.Tests/HistoricalPopulationTests.cs b/sim/Statecraft.Sim.Tests/HistoricalPopulationTests.csindex d742608bc..f93b4799e 100644--- a/sim/Statecraft.Sim.Tests/HistoricalPopulationTests.cs+++ b/sim/Statecraft.Sim.Tests/HistoricalPopulationTests.cs@@ -329,4 +329,60 @@ public class HistoricalPopulationTestse = Assert.Throws<InvalidOperationException>(() => HistoricalPopulation.LedgerFixture(c));Assert.Contains("units_1948/golani", e.Message);}++ // R-POP-004, 27M-24 (#1717: "The starting formations carry issued equipment, recorded apart from the 12 spare Arms"):+ // each starting soldier record carries one issued military item, id <source>/<ordinal>; census records carry none, and+ // no record carries tools.+ [Fact]+ public void EveryStartingSoldierRecordCarriesOneIssuedItem()+ {+ var c = Real(true);+ var inventory = HistoricalPopulation.Inventory(c);+ var units = HistoricalPopulation.LedgerFixture(c).PopulationLedger.Units;+ Assert.Contains(inventory, r => r.Status == PopulationStatus.ActiveSoldier);+ for (int i = 0; i < inventory.Count; i++)+ {+ Assert.Null(units[i].Equipment.ToolsId);+ if (inventory[i].Source.StartsWith(HistoricalPopulation.FormationPrefix, StringComparison.Ordinal))+ Assert.Equal(inventory[i].Source + "/" + inventory[i].Ordinal, units[i].Equipment.MilitaryId);+ else+ Assert.Null(units[i].Equipment.MilitaryId);+ }+ }++ // R-POP-004, 27M-24: the issued items are distinct, one per population unit of each own starting formation, so their+ // count is the formations' total strength.+ [Fact]+ public void IssuedItemsAreDistinctAndCountTheFormationStrengths()+ {+ var c = Real(true);+ var items = HistoricalPopulation.LedgerFixture(c).PopulationLedger.Units+ .Select(u => u.Equipment.MilitaryId).Where(id => id != null).ToList();+ var strength = c.StartingForces.Where(f => f.Side == Movement.PlayerSide && f.Arrives == null).Sum(f => f.Strength);+ Assert.True(strength > 0);+ Assert.Equal(strength, items.Count);+ Assert.Equal(items.Count, items.Distinct(StringComparer.Ordinal).Count());+ }++ // R-ARMS-001, 27M-24: issued equipment is apart from the spare Arms. Building the fixture leaves the spare stock as a+ // fresh state has it, and NewGame's arms_start (12) is not reduced by any issue.+ [Fact]+ public void IssuedItemsAreApartFromTheSpareArms()+ {+ var c = Real(true);+ Assert.Equal(new GameState(c).Arms, HistoricalPopulation.LedgerFixture(c).Arms);+ Assert.Equal(12, c.RulesAt(c.Rules.Start).Mvp!.ArmsStart);+ Assert.Equal(12, Simulation.NewGame(c, 1, Mode.Historical).Arms);+ }++ // R-POP-004, 27M-24 (#1717: "Starting professions, tools and buildings are owned: turn 1 charges none of them"): the+ // starting formations' issued items are owned, recorded as paid so they are not paid for again.+ [Fact]+ public void StartingEquipmentIsOwned()+ {+ var soldiers = HistoricalPopulation.LedgerFixture(Real(true)).PopulationLedger.Units+ .Where(u => u.Status == PopulationStatus.ActiveSoldier).ToList();+ Assert.NotEmpty(soldiers);+ Assert.All(soldiers, u => Assert.True(u.Equipment.MilitaryPaid));+ }}diff --git a/sim/Statecraft.Sim/HistoricalPopulation.cs b/sim/Statecraft.Sim/HistoricalPopulation.csindex 7d0ce4e9d..762d04491 100644--- a/sim/Statecraft.Sim/HistoricalPopulation.cs+++ b/sim/Statecraft.Sim/HistoricalPopulation.cs@@ -1,5 +1,6 @@using System;using System.Collections.Generic;+using System.Globalization;using System.Linq;namespace Statecraft.Sim@@ -53,8 +54,9 @@ namespace Statecraft.Sim/// record takes the region of its starting anchor hex (AtHex): the owner's ruling on #1689's open question 1/// (3 November 2026: "Its anchor hex's region (Recommended)"). A source with no region is refused; no region is invented. Records/// are free civilians with no assignment and soldiers serving in their own formation, with no profession, tier or- /// qualification (#1717 and #1692 add those). mode Historical gives #2299's 1,000-a-record scale (D2). Fixture-only:- /// NewGame does not call it (R-POP-002).</summary>+ /// qualification (#1717 and #1692 add those). Each soldier carries one issued military item, id+ /// <c>units_1948/<row>/<ordinal></c>, owned and recorded as paid, apart from the spare Arms (#1717, 27M-24).+ /// mode Historical gives #2299's 1,000-a-record scale (D2). Fixture-only: NewGame does not call it (R-POP-002).</summary>internal static GameState LedgerFixture(Content c){var inventory = Inventory(c);@@ -75,7 +77,9 @@ namespace Statecraft.Simvar rows = inventory.Select(r => new PopulationInventoryRow(r.Source, r.Ordinal, new PopulationUnit(0, r.Status, 0,locations[regions[r.Source]], r.Status == PopulationStatus.ActiveSoldier? new PopulationAssignment(PopulationAssignmentKind.ActiveService, r.Source) : PopulationAssignment.Unassigned,- CivilianProfession.None, CivilianTier.None, 0, "", 0, PopulationEquipment.None)));+ CivilianProfession.None, CivilianTier.None, 0, "", 0, r.Status == PopulationStatus.ActiveSoldier+ ? new PopulationEquipment(militaryId: r.Source + "/" + r.Ordinal.ToString(CultureInfo.InvariantCulture), militaryPaid: true)+ : PopulationEquipment.None)));return PopulationLedger.CreateFixture(c, bindings, rows, mode: Mode.Historical);}}