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 start, PR 2: opening soldiers carry their formation's class and combat XP in the ledger fixture (Refs #1725, Refs #1689) (#2937)
Eyal Golan1905e9413282
diff --git a/changelog.d/1689-opening-formation-values.md b/changelog.d/1689-opening-formation-values.mdnew file mode 100644index 000000000..077b0373f--- /dev/null+++ b/changelog.d/1689-opening-formation-values.md@@ -0,0 +1,7 @@+- GDD 0.3 starting population (Refs #1689): in the inactive Historical ledger fixture, each starting soldier now carries+ its formation's class (infantry) as its military qualification and its formation's opening combat experience from+ `content/gdd03-start.yaml`: 1 for Golani, Carmeli, Alexandroni, Kiryati, Givati, Etzioni and Harel, 0 for Negev, a+ labelled stand-in (owner, 7 November 2026: "Veteran for all 8 (Recommended)" and "1 each, Negev 0 (Recommended)").+ Keeping the veteran level on the formation and reading the class from `unit_types.yaml` is a maintainer call+ (eyalgolan-30's coordinator, 7 November 2026), not an owner ruling. The units a new game starts with keep 0 combat+ experience. No new-game wiring, so there is no change in the game.diff --git a/content/gdd03-start.yaml b/content/gdd03-start.yamlindex 0a60c2545..6e794db3b 100644--- a/content/gdd03-start.yaml+++ b/content/gdd03-start.yaml@@ -8,3 +8,20 @@ ruleset: gdd-0.3military_camps:- { city: tel_aviv, location: military_tel_litvinsky } # Existing cities.yaml camp; the ruling names it Tel HaShomer.- { city: jerusalem, location: military_schneller }+# #1689 rows 5 to 8: the own opening formations of map/units_1948.yaml in the Historical population ledger fixture+# (R-POP-004), each one's combat XP in R-UNIT-011 ticks of military.combat_xp_full (5).+# Owner, 7 November 2026 (#1689, issuecomment-6704389240): rows 5 and 6 "Veteran for all 8 (Recommended)", rows 7 and 8+# "1 each, Negev 0 (Recommended)", Negev's 0 a labelled stand-in. The veteran level needs no value here: the eight are+# veteran_soldier rows, and a soldier's qualification is its type's unit_types.yaml class (maintainer call, eyalgolan-30's+# coordinator, 7 November 2026). Ledger fixture only: the units NewGame starts with keep 0 (same maintainer call).+# Evidence: research_notes/GDD phase 4/opening-ledger-values-1689.md, sections 3b and 3c: dated fights before+# 15 May 1948 for seven formations, none found for Negev; no source gives a count, so these are not historical figures.+formation_combat_xp:+ - { row: golani, combat_xp: 1 } # DESIGN VALUE: owner-set, not a historical figure (#1689 row 7)+ - { row: carmeli, combat_xp: 1 } # DESIGN VALUE: owner-set, not a historical figure (#1689 row 7)+ - { row: alexandroni, combat_xp: 1 } # DESIGN VALUE: owner-set, not a historical figure (#1689 row 7)+ - { row: kiryati, combat_xp: 1 } # DESIGN VALUE: owner-set, not a historical figure (#1689 row 7)+ - { row: givati, combat_xp: 1 } # DESIGN VALUE: owner-set, not a historical figure (#1689 row 7)+ - { row: etzioni, combat_xp: 1 } # DESIGN VALUE: owner-set, not a historical figure (#1689 row 7)+ - { row: harel, combat_xp: 1 } # DESIGN VALUE: owner-set, not a historical figure (#1689 row 7)+ - { row: negev, combat_xp: 0 } # DESIGN VALUE: owner's labelled stand-in, no dated fight found (#1689 row 8)diff --git a/content/schema/gdd03-start.schema.json b/content/schema/gdd03-start.schema.jsonindex 386b256ee..c4a58643e 100644--- a/content/schema/gdd03-start.schema.json+++ b/content/schema/gdd03-start.schema.json@@ -5,7 +5,8 @@"additionalProperties": false,"required": ["ruleset",- "military_camps"+ "military_camps",+ "formation_combat_xp"],"properties": {"ruleset": {@@ -34,6 +35,27 @@}}}+ },+ "formation_combat_xp": {+ "type": "array",+ "items": {+ "type": "object",+ "additionalProperties": false,+ "required": [+ "row",+ "combat_xp"+ ],+ "properties": {+ "row": {+ "type": "string",+ "pattern": "^[a-z][a-z0-9_]*$"+ },+ "combat_xp": {+ "type": "integer",+ "minimum": 0+ }+ }+ }}}}diff --git a/docs/population-ledger.md b/docs/population-ledger.mdindex 2e6faae96..2905a5f7f 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, and its location names that city (`PopulationLocation.City`), a formation record the region whose member hexes hold its starting anchor hex (R-POP-004); a source with no region is refused. Census records start with their reception done (`reception.turns`), so R-VET-001's received-free-civilian work XP can apply to them. 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.+`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, and its location names that city (`PopulationLocation.City`), a formation record the region whose member hexes hold its starting anchor hex (R-POP-004); a source with no region is refused. Census records start with their reception done (`reception.turns`), so R-VET-001's received-free-civilian work XP can apply to them. Each formation record carries one issued military item (`units_1948/<row id>/<ordinal>`, recorded as paid), apart from the spare Arms (#1717). A formation record's military qualification is its type's `unit_types.yaml` class, and its combat XP is `gdd03-start.yaml`'s `formation_combat_xp` (#1689 rows 5 to 8, R-POP-004). `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 03ec99470..c61cf1cf3 100644--- a/docs/rules/mvp.md+++ b/docs/rules/mvp.md@@ -607,7 +607,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. 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.-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. The 20 farmer units are added to the census total (owner, 7 November 2026: "On top, change the rule (Recommended)", which reverses this rule's earlier "no more and no less"); the inventory does not hold them until they are wired in. 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 its location names that city, 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 their reception done: they start at `reception.turns`, the "actual reception turns before free-civilian status" (`docs/gdd/balance.md:91`), the ledger's cap (R-POP-002), since R-VET-001 gives work XP only to a received free civilian (an agent reading of `balance.md:91`, not an owner ruling); formation records keep 0, which no ruling sets. 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 not in the inventory or the fixture: the work assignments of the employed share, the opening field 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 paragraphs below record the owner's decision on each. 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. The 20 farmer units are added to the census total (owner, 7 November 2026: "On top, change the rule (Recommended)", which reverses this rule's earlier "no more and no less"); the inventory does not hold them until they are wired in. 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 its location names that city, 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 their reception done: they start at `reception.turns`, the "actual reception turns before free-civilian status" (`docs/gdd/balance.md:91`), the ledger's cap (R-POP-002), since R-VET-001 gives work XP only to a received free civilian (an agent reading of `balance.md:91`, not an owner ruling); formation records keep 0, which no ruling sets. 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 not in the inventory or the fixture: the work assignments of the employed share and the opening field farmers (fields, #1691/#1717; the owner's 1:2:1 novice/trained/veteran ratio then applies per host, which gives 1 / 18 / 1 nationally: owner, 7 November 2026, "Per host, 1/18/1 (Recommended)", [#1689](https://github.com/eyalgolan/statecraft-israel/issues/1689#issuecomment-6704985642)). The formations' rows 5 to 8 are in the fixture (owner, 7 November 2026, #1689 comment 6704389240: "Veteran for all 8 (Recommended)" and "1 each, Negev 0 (Recommended)", Negev's 0 a labelled stand-in). The veteran level lives on the formation, a `veteran_soldier` (R-UNIT-006) that is each soldier's ActiveService target, so a formation record's military qualification is its type's `unit_types.yaml` class (`infantry`), the source basic-training graduates use, with no new level field (maintainer call, eyalgolan-30's coordinator, 7 November 2026). Its combat XP is `content/gdd03-start.yaml`'s `formation_combat_xp`: 1 for Golani, Carmeli, Alexandroni, Kiryati, Givati, Etzioni and Harel, 0 for Negev. The loader requires the list, refuses a row that is not an own opening formation, a duplicate, a missing formation or a value outside 0 to `military.combat_xp_full`, and the fixture refuses without it (no fallback). Only the ledger fixture reads it: the units `NewGame` starts with keep 0 combat XP (same maintainer call); a `veteran_soldier` gains none (R-UNIT-011). The paragraphs below record the owner's decision on each. 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`)").The four opening-ledger values were Deferred pending a separate sourced draft for owner approval (4 November 2026, Q24; the coordinator asked: "How should the four deferred opening-ledger values be approved before Historical NewGame initializes the ledger?"; the owner answered: "do the recommended for all"; the chosen option read: "Request and approve a separate sourced draft for employed assignments, farmer identities, formation qualifications and combat XP before wiring NewGame"; [recorded on #1689](https://github.com/eyalgolan/statecraft-israel/issues/1689#issuecomment-6623135448)). Farmer home cities needed a source-backed city-by-field proposal for owner approval (4 November 2026, Q26; the coordinator asked: "How should the census-city home of each opening field’s farmer be selected when its region contains several cities?"; the owner answered: "do the recommended for all"; the chosen option read: "Have an agent prepare a source-backed city-by-field proposal for owner approval"; [recorded on #1717](https://github.com/eyalgolan/statecraft-israel/issues/1717#issuecomment-6623136302)).Owner decision on both drafts, 7 November 2026: "all reccomended in "Decisions for the owner: the GDD 0.3 starting population (#1689) and where the field farmers live (#1717)" - approved" ([recorded on #1689](https://github.com/eyalgolan/statecraft-israel/issues/1689#issuecomment-6703676150)). This wires nothing into `Simulation.NewGame`.diff --git a/sim/Statecraft.Sim.Tests/Gdd03StartFacilitiesTests.cs b/sim/Statecraft.Sim.Tests/Gdd03StartFacilitiesTests.csindex ef0dc7ff8..c1827e6c0 100644--- a/sim/Statecraft.Sim.Tests/Gdd03StartFacilitiesTests.cs+++ b/sim/Statecraft.Sim.Tests/Gdd03StartFacilitiesTests.cs@@ -128,8 +128,8 @@ public class Gdd03StartFacilitiesTestspublic static IEnumerable<object[]> InvalidOverlays(){- yield return Case("ruleset: gdd-0.1\nmilitary_camps: []\n", "ruleset", "must be gdd-0.3");- yield return Case("ruleset: gdd-0.3\n", "military_camps", "must be a list");+ yield return Case("ruleset: gdd-0.1\nmilitary_camps: []\n" + Formations(AllEight()), "ruleset", "must be gdd-0.3");+ yield return Case("ruleset: gdd-0.3\n" + Formations(AllEight()), "military_camps", "must be a list");yield return Case(One("missing", "military_schneller"), "military_camps[0].city", "must name an existing city");yield return Case(Two(("tel_aviv", "military_tel_litvinsky"), ("tel_aviv", "military_schneller")),"military_camps[1].city", "duplicate city");@@ -139,12 +139,42 @@ public class Gdd03StartFacilitiesTestsyield return Case(One("jerusalem", "negba"), "military_camps[0].location", "must name a military_camp map location");yield return Case(One("tel_aviv", "military_tel_litvinsky"), "military_camps","effective military-camp city count 1 must equal start.military_camps 2");+ // #1689 PR 2: formation_combat_xp is required, like every list the loader reads, and names each own opening formation+ // once, with 0 to military.combat_xp_full (5).+ yield return Case(Camps(("tel_aviv", "military_tel_litvinsky"), ("jerusalem", "military_schneller")),+ "formation_combat_xp", "must be a list");+ const string full = "an integer from 0 to military.combat_xp_full 5";+ yield return Case(Xp(("golani", "1"), ("golani", "1")), "formation_combat_xp[1].row", "duplicate formation");+ yield return Case(Xp(("yiftach", "1")), "formation_combat_xp[0].row", "must name an own opening formation of map/units_1948.yaml");+ yield return Case(Xp(("arab_legion", "1")), "formation_combat_xp[0].row", "must name an own opening formation of map/units_1948.yaml");+ yield return Case(Xp(("golani", "-1")), "formation_combat_xp[0].combat_xp", "required: " + full);+ yield return Case(Xp(("golani", "6")), "formation_combat_xp[0].combat_xp", "required: " + full);+ yield return Case(Xp(("golani", "null")), "formation_combat_xp[0].combat_xp", "required: " + full);+ yield return Case(Xp(AllEight().Where(x => x.Row != "negev").ToArray()), "formation_combat_xp", "missing opening formation negev");+ }++ static (string Row, string Xp)[] AllEight() => new[] { "golani", "carmeli", "alexandroni", "kiryati", "givati", "etzioni",+ "harel", "negev" }.Select(r => (r, r == "negev" ? "0" : "1")).ToArray();+ static string Xp(params (string Row, string Xp)[] rows) =>+ Camps(("tel_aviv", "military_tel_litvinsky"), ("jerusalem", "military_schneller")) + Formations(rows);++ // Without gdd03-start.yaml there is no formation_combat_xp; the ledger fixture then refuses, with no fallback value.+ [Fact]+ public void WithoutTheStartFileTheLedgerFixtureRefuses()+ {+ var c = LoadShipped(true, null);+ Assert.Null(c.Gdd03FormationCombatXp);+ var e = Assert.Throws<InvalidOperationException>(() => HistoricalPopulation.LedgerFixture(c));+ Assert.Contains("formation_combat_xp", e.Message);}static object[] Case(string yaml, string field, string reason) => new object[] { yaml, field, reason };static string One(string city, string location) => Two((city, location));- static string Two(params (string City, string Location)[] rows) =>+ static string Two(params (string City, string Location)[] rows) => Camps(rows) + Formations(AllEight());+ static string Camps(params (string City, string Location)[] rows) =>"ruleset: gdd-0.3\nmilitary_camps:\n" + string.Concat(rows.Select(x => $" - {{ city: {x.City}, location: {x.Location} }}\n"));+ static string Formations((string Row, string Xp)[] rows) =>+ "formation_combat_xp:\n" + string.Concat(rows.Select(x => $" - {{ row: {x.Row}, combat_xp: {x.Xp} }}\n"));[Theory][MemberData(nameof(InvalidOverlays))]diff --git a/sim/Statecraft.Sim.Tests/HistoricalPopulationTests.cs b/sim/Statecraft.Sim.Tests/HistoricalPopulationTests.csindex e93068ba8..3d9282b6a 100644--- a/sim/Statecraft.Sim.Tests/HistoricalPopulationTests.cs+++ b/sim/Statecraft.Sim.Tests/HistoricalPopulationTests.cs@@ -462,22 +462,52 @@ public class HistoricalPopulationTests});}- // R-POP-004 (owner, 7 November 2026): rows 5 to 8 are decided (Veteran for all 8; 1 tick each, Negev 0) but not wired in,- // so a starting soldier has no qualification and no XP of either kind yet.+ // R-POP-004, #1689 rows 5 to 8. Owner, 7 November 2026 (comment 6704389240): "Veteran for all 8 (Recommended)" and+ // "1 each, Negev 0 (Recommended)", Negev's 0 a labelled stand-in. Maintainer call, eyalgolan-30's coordinator,+ // 7 November 2026: the veteran level lives on the formation (each is a veteran_soldier, R-UNIT-006, and each soldier's+ // ActiveService target is its formation), so a soldier's qualification is its formation type's unit_types.yaml class+ // (infantry), as Gdd03BasicTrainingFixture's graduates are; combat XP comes from gdd03-start.yaml. No work XP.[Fact]- public void StartingSoldiersHaveNoQualificationOrXp()+ public void StartingSoldiersHaveTheirClassAndTheirFormationsCombatXp(){var c = Real(true);var inventory = HistoricalPopulation.Inventory(c);var units = HistoricalPopulation.LedgerFixture(c).PopulationLedger.Units;- var soldiers = units.Where((u, i) => inventory[i].Source.StartsWith(HistoricalPopulation.FormationPrefix, StringComparison.Ordinal)).ToList();- Assert.NotEmpty(soldiers);- Assert.All(soldiers, u =>+ var expected = new Dictionary<string, int> { ["golani"] = 1, ["carmeli"] = 1, ["alexandroni"] = 1, ["kiryati"] = 1,+ ["givati"] = 1, ["etzioni"] = 1, ["harel"] = 1, ["negev"] = 0 };+ var rows = inventory.Where(r => r.Source.StartsWith(HistoricalPopulation.FormationPrefix, StringComparison.Ordinal))+ .Select(r => r.Source.Substring(HistoricalPopulation.FormationPrefix.Length)).Distinct().OrderBy(x => x, StringComparer.Ordinal);+ Assert.Equal(expected.Keys.OrderBy(x => x, StringComparer.Ordinal), rows);+ for (int i = 0; i < inventory.Count; i++){- Assert.Equal("", u.Qualification);- Assert.Equal(0, u.CombatXp);- Assert.Equal(0, u.WorkXp);- });+ if (!inventory[i].Source.StartsWith(HistoricalPopulation.FormationPrefix, StringComparison.Ordinal)) continue;+ var row = inventory[i].Source.Substring(HistoricalPopulation.FormationPrefix.Length);+ var type = c.StartingForces.Single(f => f.Row == row).Type;+ Assert.Equal("veteran_soldier", type);+ Assert.Equal(c.UnitTypes.Single(t => t.Id == type).Class, units[i].Qualification);+ Assert.Equal("infantry", units[i].Qualification);+ Assert.Equal(expected[row], units[i].CombatXp);+ Assert.Equal(0, units[i].WorkXp);+ }+ }++ // #1689 PR 2 scope (maintainer call, eyalgolan-30's coordinator, 7 November 2026): the opening combat XP is the ledger+ // fixture's only; the aggregate units a gdd-0.3 NewGame starts with keep 0.+ [Fact]+ public void NewGameUnitsKeepNoCombatXp()+ {+ var s = Simulation.NewGame(Real(true), 1, Mode.Historical);+ Assert.NotEmpty(s.Units);+ Assert.All(s.Units.Values, u => Assert.Equal(0, u.CombatXp));+ }++ // The shipped gdd03-start.yaml names each own opening formation once, with the owner's values.+ [Fact]+ public void ShippedStartGivesEachOpeningFormationItsCombatXp()+ {+ var c = Real(true);+ Assert.Equal(new[] { ("alexandroni", 1), ("carmeli", 1), ("etzioni", 1), ("givati", 1), ("golani", 1), ("harel", 1),+ ("kiryati", 1), ("negev", 0) }, c.Gdd03FormationCombatXp!.Select(x => (x.Key, x.Value)));}// R-POP-004, 27M-24: the issued items are distinct, one per population unit of each own starting formation, so theirdiff --git a/sim/Statecraft.Sim.Tests/SchemaTests.cs b/sim/Statecraft.Sim.Tests/SchemaTests.csindex a48629a81..3d3cd4646 100644--- a/sim/Statecraft.Sim.Tests/SchemaTests.cs+++ b/sim/Statecraft.Sim.Tests/SchemaTests.cs@@ -227,6 +227,7 @@ public class SchemaTestsyield return new object[] { "gdd03-events.schema.json", "/properties/exclusions/items", typeof(ContentLoader).GetNestedType("EventExclusion", BindingFlags.NonPublic)! };yield return new object[] { "gdd03-start.schema.json", "", typeof(ContentLoader).GetNestedType("Gdd03StartFile", BindingFlags.NonPublic)! };yield return new object[] { "gdd03-start.schema.json", "/properties/military_camps/items", typeof(ContentLoader).GetNestedType("StartCampBinding", BindingFlags.NonPublic)! };+ yield return new object[] { "gdd03-start.schema.json", "/properties/formation_combat_xp/items", typeof(ContentLoader).GetNestedType("StartFormationCombatXp", BindingFlags.NonPublic)! };yield return new object[] { "event.schema.json", "", typeof(GameEvent) };yield return new object[] { "event.schema.json", "/properties/conditions/items", typeof(EventCondition) };yield return new object[] { "event.schema.json", "/definitions/requirement", typeof(EventRequirement) };diff --git a/sim/Statecraft.Sim/Content.cs b/sim/Statecraft.Sim/Content.csindex df42223cd..37be51f88 100644--- a/sim/Statecraft.Sim/Content.cs+++ b/sim/Statecraft.Sim/Content.cs@@ -1488,6 +1488,9 @@ namespace Statecraft.Sim/// <summary>The forces a Historical game starts with (map/units_1948.yaml; R-UNIT-006), in file order: the unit with id i/// of a new game is the i-th. Empty in the legacy loop.</summary>public List<StartingForce> StartingForces = new List<StartingForce>();+ /// <summary>Exact gdd-0.3 only: gdd03-start.yaml's formation_combat_xp, each own opening formation's combat XP in the+ /// Historical ledger fixture (#1689 rows 7 and 8), by row id. Null when the file or the list is absent.</summary>+ public SortedDictionary<string, int>? Gdd03FormationCombatXp { get; internal set; }/// <summary>Every anchor's hex of map/unit_anchor_hexes.yaml by (row id, anchor index), the only hexes an operation/// card may order a row's unit to (R-ENEMY-005). Empty in the legacy loop.</summary>public Dictionary<(string Row, int Anchor), (int Q, int R)> UnitAnchorHexes = new Dictionary<(string Row, int Anchor), (int Q, int R)>();diff --git a/sim/Statecraft.Sim/ContentLoader.cs b/sim/Statecraft.Sim/ContentLoader.csindex 3dd5d4410..35acde139 100644--- a/sim/Statecraft.Sim/ContentLoader.cs+++ b/sim/Statecraft.Sim/ContentLoader.cs@@ -66,6 +66,12 @@ namespace Statecraft.Sim{public string Ruleset { get; set; } = "";public List<StartCampBinding>? MilitaryCamps { get; set; }+ public List<StartFormationCombatXp>? FormationCombatXp { get; set; }+ }+ sealed class StartFormationCombatXp+ {+ public string Row { get; set; } = "";+ public int? CombatXp { get; set; }}sealed class StartCampBinding{@@ -488,11 +494,12 @@ namespace Statecraft.Simc.ProjectKinds = kinds.Where(k => k.Rulesets.Count == 0 || k.Rulesets.Contains(c.Ruleset)).ToList();c.ProjectKindsOfOtherRulesets = kinds.Except(c.ProjectKinds).ToList();c.Corridors = Read<CorridorsFile>(readFile, "corridors.yaml").Corridors; // sourced, hexes derived (Phase 4 PR 2)- if (c.Ruleset == SaveGame.Gdd03Ruleset) ApplyGdd03Start(readFile, c);+ var formationXp = c.Ruleset == SaveGame.Gdd03Ruleset ? ApplyGdd03Start(readFile, c) : null;ValidateGdd(c, settlementIds, settlements.Where(x => x.type is "city" or "town").Select(x => x.id).ToList());Gdd03Military.Validate(c); // after effective map overrides and role validation, only exact gdd-0.3// The sourced starting forces (Phase 5 PR 4, R-UNIT-006), once the types and people_per_unit are known valid.c.StartingForces = StartingForces.Read(readFile, c);+ if (formationXp != null) ApplyGdd03FormationCombatXp(formationXp, c);}// R-CITY-006: no read or hash input in either old identity. Absence leaves the capability inactive. After the// sites (a site id may be a member) and the effective map overrides; the locality hexes are read only with regions, and are required then (#2298).@@ -512,11 +519,11 @@ namespace Statecraft.Sim// R-CAMP-003: exact-gdd-0.3 start bindings add facilities to the shared city catalogue without changing gdd-0.1.// The optional file keeps synthetic gdd-0.3 fixtures independent of the shipped map and city ids.- static void ApplyGdd03Start(Func<string, string?> readFile, Content c)+ static List<StartFormationCombatXp>? ApplyGdd03Start(Func<string, string?> readFile, Content c){const string file = "gdd03-start.yaml";var start = ReadOptional<Gdd03StartFile>(readFile, file);- if (start == null) return;+ if (start == null) return null;if (start.Ruleset != SaveGame.Gdd03Ruleset)throw new ContentException(file, "ruleset", "must be gdd-0.3");if (start.MilitaryCamps == null)@@ -544,6 +551,33 @@ namespace Statecraft.Simif (actual != expected)throw new ContentException(file, "military_camps",FormattableString.Invariant($"effective military-camp city count {actual} must equal start.military_camps {expected}"));+ return start.FormationCombatXp;+ }++ /// <summary>#1689 rows 7 and 8 (owner, 7 November 2026, comment 6704389240: "1 each, Negev 0 (Recommended)"): each own+ /// opening formation's combat XP in the Historical ledger fixture, once each, from 0 to military.combat_xp_full. Read+ /// after the starting forces. An absent list leaves the value unset; the ledger fixture then refuses (no fallback).+ /// Ledger fixture only (maintainer call, eyalgolan-30's coordinator, 7 November 2026): NewGame's units keep 0.</summary>+ static void ApplyGdd03FormationCombatXp(List<StartFormationCombatXp> rows, Content c)+ {+ const string file = "gdd03-start.yaml";+ var full = Gdd03Military.Scalar(c, "military.combat_xp_full");+ var opening = new HashSet<string>(HistoricalPopulation.OpeningFormationRows(c), StringComparer.Ordinal);+ var xp = new SortedDictionary<string, int>(StringComparer.Ordinal);+ for (int i = 0; i < rows.Count; i++)+ {+ var row = rows[i];+ var at = FormattableString.Invariant($"formation_combat_xp[{i}]");+ if (row == null || !opening.Contains(row.Row))+ throw new ContentException(file, at + ".row", "must name an own opening formation of map/units_1948.yaml");+ if (xp.ContainsKey(row.Row)) throw new ContentException(file, at + ".row", "duplicate formation");+ if (!(row.CombatXp is int value) || value < 0 || value > full)+ throw new ContentException(file, at + ".combat_xp", FormattableString.Invariant($"required: an integer from 0 to military.combat_xp_full {full}"));+ xp.Add(row.Row, value);+ }+ var missing = opening.Where(r => !xp.ContainsKey(r)).OrderBy(r => r, StringComparer.Ordinal).ToList();+ if (missing.Count > 0) throw new ContentException(file, "formation_combat_xp", "missing opening formation " + string.Join(", ", missing));+ c.Gdd03FormationCombatXp = xp;}// R-EFX-001: this file is deliberately never read by legacy/gdd-0.1, including for hashing.diff --git a/sim/Statecraft.Sim/HistoricalPopulation.cs b/sim/Statecraft.Sim/HistoricalPopulation.csindex f33f7fabc..19f37df9c 100644--- a/sim/Statecraft.Sim/HistoricalPopulation.cs+++ b/sim/Statecraft.Sim/HistoricalPopulation.cs@@ -32,6 +32,11 @@ namespace Statecraft.Siminternal const string CensusPrefix = "census/";internal const string FormationPrefix = "units_1948/";+ /// <summary>The map/units_1948.yaml rows that give the start inventory soldiers: Israeli, in the start (no dated+ /// arrival), with a strength.</summary>+ internal static IEnumerable<string> OpeningFormationRows(Content c) => c.StartingForces+ .Where(f => f.Side == Movement.PlayerSide && f.Arrives == null && f.Strength > 0).Select(f => f.Row);+internal static IReadOnlyList<HistoricalPopulationRow> Inventory(Content c){if (c == null) throw new ArgumentNullException(nameof(c));@@ -76,8 +81,25 @@ namespace Statecraft.Sim// A formation is its soldiers' ActiveService target, in the formation's region.var targets = regions.Where(x => x.Key.StartsWith(FormationPrefix, StringComparison.Ordinal)).Select(x => new PopulationTarget(x.Key, PopulationAssignmentKind.ActiveService, x.Value));+ // #1689 rows 5 to 8. Owner, 7 November 2026 (comment 6704389240): "Veteran for all 8 (Recommended)" and "1 each,+ // Negev 0 (Recommended)", Negev's 0 a labelled stand-in. Maintainer call, eyalgolan-30's coordinator, 7 November+ // 2026: the veteran level lives on the formation (a veteran_soldier, R-UNIT-006, each soldier's ActiveService+ // target), so a soldier's qualification is its formation type's unit_types.yaml class, the source+ // Gdd03BasicTrainingFixture's graduates use; its combat XP is gdd03-start.yaml's formation_combat_xp, no fallback.+ var xp = c.Gdd03FormationCombatXp+ ?? throw new InvalidOperationException("The Historical ledger fixture needs gdd03-start.yaml's formation_combat_xp; no fallback (#1689).");+ var soldier = new Dictionary<string, (string Qualification, int CombatXp)>(StringComparer.Ordinal);+ foreach (var f in c.StartingForces.Where(f => sources.Contains(FormationPrefix + f.Row)))+ {+ var cls = c.UnitTypes.FirstOrDefault(t => string.Equals(t.Id, f.Type, StringComparison.Ordinal))?.Class;+ if (string.IsNullOrWhiteSpace(cls))+ throw new InvalidOperationException("No unit_types.yaml class for formation " + f.Row + "'s type " + f.Type + " (#1689).");+ if (!xp.TryGetValue(f.Row, out var combatXp))+ throw new InvalidOperationException("No gdd03-start.yaml formation_combat_xp for formation " + f.Row + "; no fallback (#1689).");+ soldier[FormationPrefix + f.Row] = (cls!, combatXp);+ }var bindings = new PopulationBindings(locations.Values.Concat(placed.Values.Where(l => l.City != null)), targets,- Array.Empty<string>(), Array.Empty<string>());+ Array.Empty<string>(), soldier.Values.Select(x => x.Qualification).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");@@ -85,7 +107,9 @@ namespace Statecraft.Simr.Status == PopulationStatus.FreeCivilian ? received : 0,placed[r.Source], r.Status == PopulationStatus.ActiveSoldier? new PopulationAssignment(PopulationAssignmentKind.ActiveService, r.Source) : PopulationAssignment.Unassigned,- CivilianProfession.None, CivilianTier.None, 0, "", 0, r.Status == PopulationStatus.ActiveSoldier+ CivilianProfession.None, CivilianTier.None, 0,+ r.Status == PopulationStatus.ActiveSoldier ? soldier[r.Source].Qualification : "",+ r.Status == PopulationStatus.ActiveSoldier ? soldier[r.Source].CombatXp : 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);