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 1: census civilians start received; a population location can name its city (Refs #1725, Refs #1689) (#2936)
Eyal Golancd9085f01b15
diff --git a/changelog.d/1689-opening-reception-done.md b/changelog.d/1689-opening-reception-done.mdnew file mode 100644index 000000000..4178cb2ec--- /dev/null+++ b/changelog.d/1689-opening-reception-done.md@@ -0,0 +1,4 @@+- GDD 0.3 starting population (Refs #1689): in the inactive Historical ledger fixture, each census civilian now starts+ with its reception done (`reception.turns`), so opening civilians can earn work experience once they work. This is an+ agent reading, not an owner ruling, of `docs/gdd/balance.md:91` ("actual reception turns before free-civilian status").+ Starting soldiers are unchanged. No new-game wiring, so there is no change in the game.diff --git a/changelog.d/1689-population-city-binding.md b/changelog.d/1689-population-city-binding.mdnew file mode 100644index 000000000..a847d6815--- /dev/null+++ b/changelog.d/1689-population-city-binding.md@@ -0,0 +1,4 @@+- GDD 0.3 starting population (Refs #1689): a population record's location can now name its city, and the inactive+ Historical ledger fixture binds each census record to its city. A city outside the location's region is refused,+ naming both, and so is a member location that is neither a census city nor a field host. A location without a city keeps its saved text and hash. No new-game wiring, so there is no change in+ the game.diff --git a/docs/population-ledger.md b/docs/population-ledger.mdindex 805decd09..2e6faae96 100644--- a/docs/population-ledger.md+++ b/docs/population-ledger.md@@ -8,10 +8,10 @@ The public read surface returns immutable records and a read-only snapshot list.Validation builds a candidate map first, including teacher resolution and unique issued-item ownership across both equipment categories. A referenced teacher cannot disappear or leave teaching while pupils still refer to it; future integrated operations must release/reassign references atomically before that loss/transition. No resources, RNG or cause log are involved. Explicit arrival provenance remains consumed after death. `int.MaxValue` is the allocator exhaustion sentinel; allocation refuses before changing anything. Reconcile checks the exact source/loss/living id relation. Fixture-only `nextPopulationId` allows boundary coverage without allocating billions of records.-GameState.Clone owns a copied ledger; frozen bindings and records can be shared. Canonical output covers the full binding inventory, all unit fields, source/loss records, initialization flag, scale/reception requirement and allocator in one shared Describe/Hash writer. Reference strings use invariant length-prefixed encoding with an explicit null marker; embedded delimiters cannot alias another record. All accepted reference/provenance strings reject malformed UTF-16 before admission, so UTF-8 hashing cannot collapse invalid surrogate sequences; valid supplementary characters remain lossless. Enum declaration order is never serialized. Older identities enter none of this writer. The new empty gdd-0.3 section changes unpublished schema-4 draft hashes only; no legacy/schema-3 migration or byte change is intended.+GameState.Clone owns a copied ledger; frozen bindings and records can be shared. A location may name a city; `CreateFixture` refuses one that `regions.yaml` does not list in the location's region, or one that is neither a census city of `cities.yaml` nor a field host of that region (a locality, a `sites.yaml` id or a map location), naming both. Canonical output writes the city as `|city=` only when set, so a location without one keeps its text and hash, and covers the full binding inventory, all unit fields, source/loss records, initialization flag, scale/reception requirement and allocator in one shared Describe/Hash writer. Reference strings use invariant length-prefixed encoding with an explicit null marker; embedded delimiters cannot alias another record. All accepted reference/provenance strings reject malformed UTF-16 before admission, so UTF-8 hashing cannot collapse invalid surrogate sequences; valid supplementary characters remain lossless. Enum declaration order is never serialized. Older identities enter none of this writer. The new empty gdd-0.3 section changes unpublished schema-4 draft hashes only; no legacy/schema-3 migration or byte change is intended.No save/reload round trip for population identity is claimed. The existing seed/content/command replay envelope is unchanged; step 3 must introduce actual identity-addressed replayable producers before population fixtures can be saved as campaigns. Captured Food selection and arrival meal timing, course/combat/prisoner integration, production initialization and all of #1704 remain held. The #2470 fixture counts a captured own record as one national ration, the reading of `docs/gdd/balance.md` `population.food_per_turn` ("Food per own population unit, every status") that the owner chose on 5 November 2026 (the recommended option, [recorded on #2678](https://github.com/eyalgolan/statecraft-israel/pull/2678#issuecomment-6652800885) as "Captured own-population records do eat the national ration"); this is settled. This foundation does not close #1689.## 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. 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). `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 6715b9724..03ec99470 100644--- a/docs/rules/mvp.md+++ b/docs/rules/mvp.md@@ -180,7 +180,7 @@ R-TRAIN-003: Each turn, in ascending id, every cohort has one turn less to go. AR-TRAIN-004: `Reinforce(unit, city, n)` (#1510; owner, 23 October 2026: "Replacements cost Arms", https://github.com/eyalgolan/statecraft-israel/issues/1510#issuecomment-6372356139, and "Default (Recommended)") refills a damaged formation of the player's with trained replacements. The unit must be a military unit of the player's side standing on `city`'s settlement hex. Its course is the trained type of the unit's side and class (a type with a `facility`): the recruit's basic training for a recruit or a veteran soldier, the guns' and the armoured cars' own for artillery and armoured cars (R-UNIT-008); a type no course trains (any enemy type) takes none. The cohort then follows R-TRAIN-001: the city's facility, `n` of its civilians without a job, `n * training_cost` with borrowing (R-MONEY-003), and the Arms of R-ARMS-003 for that course; it carries the unit's id, written into the state hash (`|unit=<id>`) only when set. The cap is the strength the unit had before its first loss, `Unit.Full`: combat stores it on a player's unit at its first loss (R-COMBAT-003) and clears it when replacements bring the unit back to it, and it is written into the state hash (`|full=<n>`) only when set, so a unit that has lost nobody, and every enemy unit, hashes as before. The order is refused, the state and Attention unchanged, for an unknown unit ("There is no such unit"), a unit with no side or an enemy unit (R-ORDER-001's wording), an unknown city, a unit off the city's hex ("Unit N is not in <city>"), a type no course trains ("Unit N cannot take replacements"), a unit with nothing to refill ("Unit N has no losses to replace") and `n` past the cap less the unit's strength and the replacements already training for it ("Unit N can take K more groups"), then for R-TRAIN-001's and R-ARMS-003's reasons. A queued `Reinforce` takes its city's civilians as a queued `Train` does (R-CITY-001). In step 4, before a turn is counted, replacements whose unit has left the state (destroyed, captured, sent home) or stands off the city's hex are cancelled as R-TRAIN-002 cancels a cohort: people and Arms back, the Money spent, with a Why line. A cohort that finishes adds its count to the unit's strength and makes no unit and takes no id; the unit keeps its type, service, order and home (a veteran stays a veteran, R-UNIT-004). The people join the unit's home city's housing (R-HOUSE-003). `attention_cost.reinforce` is 1, Train's cost, a design value (owner, 24 October 2026: "1, like Train (Recommended)", https://github.com/eyalgolan/statecraft-israel/issues/1510#issuecomment-6375591436). The save line is `reinforce <unit> <city> <n>` and the scenario form `{ kind: reinforce, unit, city, count }`.-R-TRAIN-005: In gdd-0.3 synthetic fixtures only (#1697; nothing in the game calls it), a farmer or pioneer course starts at an operating training centre, a facility in its host city with no reception camp, centre upgrade or reception bed (owner, 1 November 2026, "No reception-bed layer (Recommended)"; `docs/gdd/training.md:38`, "The MVP has no reception-bed layer"). A centre has one veteran teacher and one pupil, the teacher housed in the centre's city (GDD, 1 November 2026 answers, `docs/GDD.md:372`: "One veteran teacher and one pupil per centre, the teacher housed in the centre's city (Q42)."). A population location has a region and an optional hex or facility but no city, so the centre's region stands in for its host city, an approximation until real places are bound (#1691). A teacher outside the centre's region is refused with a plain reason that cites Q42. Q42 rules only on the teacher; that the trainee lives in the centre's host city too was our reading (#1697 body: "the teacher and the trainee are housed there as ordinary residents"; `docs/GDD.md:374`, "Training is ordered in the camp's city, with no travel (27M-7)."), and is now the owner's ruling (owner, 4 November 2026, Q23: asked "Must a farmer-course or pioneer-course pupil live in the training centre's host city?", the owner answered "yes", [recorded on #1697](https://github.com/eyalgolan/statecraft-israel/issues/1697#issuecomment-6623127820)). The fixture still uses the centre's region as the stand-in for its host city, so a trainee outside the region is refused with a plain reason that says so; the rule tightens to the host city once centres are bound to real cities (#1691). A centre takes at most one teacher and one pupil, whatever `profession.trainees_per_teacher` says: a second teacher, or a second pupil while one is on a course there, is refused with a plain reason that cites Q42, not as Deferred, and an inventory with either is refused the same way. The teacher is a free civilian, a veteran of the matching profession; the trainee is a free civilian who is a novice of that profession, or a free civilian with no profession (#2464; `docs/gdd/training.md:48`: "An eligible free civilian may train under the retained course rules."). That such a pupil stays without a profession on the course is a maintainer reading, not an owner ruling: [#1697](https://github.com/eyalgolan/statecraft-israel/issues/1697), update of 3 November 2026, "the MVP has no novice stage for farmers or pioneers: an entrant is a free civilian with no profession label until completion, and a cancel leaves an ordinary civilian", built on the owner's #1693 answers of 3 November 2026 ([answers](https://github.com/eyalgolan/statecraft-israel/issues/1693#issuecomment-6606032643)), which do not say this in those words. The craftsman course differs under an owner-approved answer: "The novice craftsman label starts with the craftsman course" (`docs/GDD.md:372`, #1698 follow-up; R-CRAFT-003). Either may hold a job, which is released in the same commit that starts the course (a reading of `docs/gdd/cities.md:42`, "Reassignment releases old capacity atomically.", with `docs/GDD.md:372`, Q43(b) and (c), "can be assigned from the next planning, or at once on cancellation", and `docs/gdd/training.md:66`, people "return at once"); a teacher teaching elsewhere, or a pupil on a course, is refused, since only a cancel or a graduation ends those here. No reception progress is read (`docs/GDD.md:374`, "Refugees cannot train until they become civilians"), and refugees in a reception camp take no course place. No tools are needed or charged: tools are post-MVP (#1693, owner answers of 3 November 2026, answer 1: "Tools in the MVP: no."), and the record's tools fields are kept unchanged. A teacher also takes at most Agreed `profession.trainees_per_teacher` pupils (currently 1; the approved Q42 answer names this value as its basis), so a busy teacher refuses another pupil; a synthetic value above 1 admits no second pupil, because the centre's own limit is one. No Money is charged. Teacher and trainee then hold exclusive Teaching and Course assignments, so other assignment paths refuse them (`docs/gdd/training.md:31` at `605277dfa511dc512562ececeb273b8393b21d35`, "The teacher is fully occupied and cannot work, fight, build, travel or teach another pupil simultaneously."). Every refusal leaves the state unchanged. Craftsmen, soldiers and refugees cannot enrol. Only exact gdd-0.3 states with an initialized population ledger are accepted; legacy and gdd-0.1 are refused unchanged. The centre course does not retire the Hakhshara: the owner kept it under `gdd-0.3` (4 November 2026: "Keep the Hakhshara", [#2484](https://github.com/eyalgolan/statecraft-israel/issues/2484)), and R-TRAIN-001's `halutz` track stays.+R-TRAIN-005: In gdd-0.3 synthetic fixtures only (#1697; nothing in the game calls it), a farmer or pioneer course starts at an operating training centre, a facility in its host city with no reception camp, centre upgrade or reception bed (owner, 1 November 2026, "No reception-bed layer (Recommended)"; `docs/gdd/training.md:38`, "The MVP has no reception-bed layer"). A centre has one veteran teacher and one pupil, the teacher housed in the centre's city (GDD, 1 November 2026 answers, `docs/GDD.md:372`: "One veteran teacher and one pupil per centre, the teacher housed in the centre's city (Q42)."). A population location has a region and an optional hex, facility or city (R-POP-003; the Historical fixture names each census record's city, R-POP-004), but this fixture does not read the city yet, so the centre's region stands in for its host city, an approximation until it does (#1691). A teacher outside the centre's region is refused with a plain reason that cites Q42. Q42 rules only on the teacher; that the trainee lives in the centre's host city too was our reading (#1697 body: "the teacher and the trainee are housed there as ordinary residents"; `docs/GDD.md:374`, "Training is ordered in the camp's city, with no travel (27M-7)."), and is now the owner's ruling (owner, 4 November 2026, Q23: asked "Must a farmer-course or pioneer-course pupil live in the training centre's host city?", the owner answered "yes", [recorded on #1697](https://github.com/eyalgolan/statecraft-israel/issues/1697#issuecomment-6623127820)). The fixture still uses the centre's region as the stand-in for its host city, so a trainee outside the region is refused with a plain reason that says so; the rule tightens to the host city once centres are bound to real cities (#1691). A centre takes at most one teacher and one pupil, whatever `profession.trainees_per_teacher` says: a second teacher, or a second pupil while one is on a course there, is refused with a plain reason that cites Q42, not as Deferred, and an inventory with either is refused the same way. The teacher is a free civilian, a veteran of the matching profession; the trainee is a free civilian who is a novice of that profession, or a free civilian with no profession (#2464; `docs/gdd/training.md:48`: "An eligible free civilian may train under the retained course rules."). That such a pupil stays without a profession on the course is a maintainer reading, not an owner ruling: [#1697](https://github.com/eyalgolan/statecraft-israel/issues/1697), update of 3 November 2026, "the MVP has no novice stage for farmers or pioneers: an entrant is a free civilian with no profession label until completion, and a cancel leaves an ordinary civilian", built on the owner's #1693 answers of 3 November 2026 ([answers](https://github.com/eyalgolan/statecraft-israel/issues/1693#issuecomment-6606032643)), which do not say this in those words. The craftsman course differs under an owner-approved answer: "The novice craftsman label starts with the craftsman course" (`docs/GDD.md:372`, #1698 follow-up; R-CRAFT-003). Either may hold a job, which is released in the same commit that starts the course (a reading of `docs/gdd/cities.md:42`, "Reassignment releases old capacity atomically.", with `docs/GDD.md:372`, Q43(b) and (c), "can be assigned from the next planning, or at once on cancellation", and `docs/gdd/training.md:66`, people "return at once"); a teacher teaching elsewhere, or a pupil on a course, is refused, since only a cancel or a graduation ends those here. No reception progress is read (`docs/GDD.md:374`, "Refugees cannot train until they become civilians"), and refugees in a reception camp take no course place. No tools are needed or charged: tools are post-MVP (#1693, owner answers of 3 November 2026, answer 1: "Tools in the MVP: no."), and the record's tools fields are kept unchanged. A teacher also takes at most Agreed `profession.trainees_per_teacher` pupils (currently 1; the approved Q42 answer names this value as its basis), so a busy teacher refuses another pupil; a synthetic value above 1 admits no second pupil, because the centre's own limit is one. No Money is charged. Teacher and trainee then hold exclusive Teaching and Course assignments, so other assignment paths refuse them (`docs/gdd/training.md:31` at `605277dfa511dc512562ececeb273b8393b21d35`, "The teacher is fully occupied and cannot work, fight, build, travel or teach another pupil simultaneously."). Every refusal leaves the state unchanged. Craftsmen, soldiers and refugees cannot enrol. Only exact gdd-0.3 states with an initialized population ledger are accepted; legacy and gdd-0.1 are refused unchanged. The centre course does not retire the Hakhshara: the owner kept it under `gdd-0.3` (4 November 2026: "Keep the Hakhshara", [#2484](https://github.com/eyalgolan/statecraft-israel/issues/2484)), and R-TRAIN-001's `halutz` track stays.R-TRAIN-006: In the same fixture, the enrolment month is course turn 1 (#1668 question 43(a); GDD, 1 November 2026 answers: "A course occupies its people from its first turn"), so a course turn is counted in the enrolment month, even with a snapshot taken before the course started, unless the centre was not available at that month's freeze, and in a later month only when its opening snapshot (the #1716 synthetic month context) already holds that course with the same teacher. It is counted at most once per month ordinal: an ordinal before the enrolment month, or not above the last one counted for that pupil, is refused. A counted turn keeps the same population id and every record field (work XP, reception progress, equipment, location, military history); no person is created, and teaching and the course earn no work XP (`docs/gdd/training.md:17` at `605277dfa511dc512562ececeb273b8393b21d35`, "Travel, idle time, teaching and courses do not count."). The turn that brings a course to Agreed `profession.course_turns` counted turns (currently 3) graduates it: a novice takes the trained tier through R-QUAL-008's transform; a pupil with no profession takes the course teacher's profession at the trained tier here, not through that transform, with work XP 0 (#2464; the ledger requires work XP 0 with no profession, `PopulationLedger.cs:212`). The pupil keeps the same id, work XP, reception progress, equipment and the tools' payment fact, location and military history; the pupil and the teacher (a centre has one pupil, R-TRAIN-005) are released in that turn, in one change, as civilians without a job. Nothing is charged and no person is created. #1697: "A free civilian or a matching equipped novice may enrol; completion gives the trained tier." Release timing follows R-TRAIN-008. The fixture also refuses a unit already trained, because Amir's proposal made a trained profession permanent (`docs/gdd/training.md:13` at the same commit, "Once trained, a civilian profession cannot be replaced."). That lock is post-MVP: D3 keeps two-way professions (R-QUAL-006), and the GDD's 1 November 2026 answers say "Graduates join their city's civilians and may re-enrol at any time" (27M-5).@@ -605,9 +605,9 @@ R-POP-001: Only exact `gdd-0.3` enables the population-ledger capability, indepeR-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 step-7 Food settlement given a month's synthetic context is the exception: 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. 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-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 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 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, 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`)").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/HistoricalPopulationTests.cs b/sim/Statecraft.Sim.Tests/HistoricalPopulationTests.csindex fd94bd3c0..e93068ba8 100644--- a/sim/Statecraft.Sim.Tests/HistoricalPopulationTests.cs+++ b/sim/Statecraft.Sim.Tests/HistoricalPopulationTests.cs@@ -293,6 +293,27 @@ public class HistoricalPopulationTestsAssert.DoesNotContain(inventory, r => r.Source == HistoricalPopulation.CensusPrefix + "jaffa");}+ // R-POP-004, #1689 PR 1 city binding: each census record's location names its city, in that city's region; a formation+ // record's location names no city.+ [Fact]+ public void EveryCensusRecordIsBoundToItsCity()+ {+ var c = Real(true);+ var inventory = HistoricalPopulation.Inventory(c);+ var units = HistoricalPopulation.LedgerFixture(c).PopulationLedger.Units;+ for (int i = 0; i < inventory.Count; i++)+ {+ var source = inventory[i].Source;+ if (source.StartsWith(HistoricalPopulation.CensusPrefix, StringComparison.Ordinal))+ {+ var city = source.Substring(HistoricalPopulation.CensusPrefix.Length);+ Assert.Equal(city, units[i].Location!.City);+ Assert.Equal(c.PlayerRegions.AtLocation(city)!.Id, units[i].Location!.Region);+ }+ else Assert.Null(units[i].Location!.City);+ }+ }+// R-POP-001, R-POP-004, Q10: ids run from 0 with no gaps in the inventory's order (source key by ordinal string compare,// then ordinal), and two builds are identical.[Fact]@@ -315,6 +336,38 @@ public class HistoricalPopulationTestsl.Reconcile();}+ // R-POP-004, R-VET-001 (#1689 PR 1): reception.turns is the "actual reception turns before free-civilian status"+ // (docs/gdd/balance.md:91; content/gdd03-balance.yaml "reception.turns"), and the census gives its units as free+ // civilians (R-POP-004), so each census record starts with its reception done: the catalogue requirement, the+ // ledger's own cap (R-POP-002). R-VET-001 gives work XP only to a "received free civilian"; with 0 ticks an opening+ // civilian could never earn it.+ [Fact]+ public void CensusRecordsStartWithTheirReceptionDone()+ {+ var c = Real(true);+ var inventory = HistoricalPopulation.Inventory(c);+ var ledger = HistoricalPopulation.LedgerFixture(c).PopulationLedger;+ var turns = c.RequirePopulationInteger("reception.turns");+ Assert.True(turns > 0);+ Assert.Equal(turns, ledger.ReceptionLimit);+ var census = ledger.Units.Where((u, i) => inventory[i].Source.StartsWith(HistoricalPopulation.CensusPrefix, StringComparison.Ordinal)).ToList();+ Assert.NotEmpty(census);+ Assert.All(census, u => Assert.Equal(turns, u.ReceptionTicks));+ }++ // R-POP-004, mvp.md R-CITY-004 fixture paragraph ("the standalone eligibility predicate requires completed reception,+ // free-civilian status and no assignment"): every opening census civilian may start a civilian activity at once.+ [Fact]+ public void EveryCensusCivilianCanStartCivilianActivity()+ {+ var c = Real(true);+ var inventory = HistoricalPopulation.Inventory(c);+ var ledger = HistoricalPopulation.LedgerFixture(c).PopulationLedger;+ var census = ledger.Units.Where((u, i) => inventory[i].Source.StartsWith(HistoricalPopulation.CensusPrefix, StringComparison.Ordinal)).ToList();+ Assert.NotEmpty(census);+ Assert.All(census, u => Assert.True(Gdd03ReceptionFixture.CanStartCivilianActivity(c, ledger, u)));+ }+// R-POP-004: a record whose city or formation has no region in regions.yaml is refused; no region is invented.[Fact]public void ARecordWithNoRegionIsRefused()diff --git a/sim/Statecraft.Sim.Tests/PopulationLocationCityTests.cs b/sim/Statecraft.Sim.Tests/PopulationLocationCityTests.csnew file mode 100644index 000000000..a44eb14c0--- /dev/null+++ b/sim/Statecraft.Sim.Tests/PopulationLocationCityTests.cs@@ -0,0 +1,69 @@+using Statecraft.Sim;++/// <summary>#1689 PR 1, city binding (coordinator ruling, 7 November 2026, option (a)): a population location may name its+/// city, a regions.yaml member location of its region. The city is written into the canonical text only when set, as+/// R-UNIT-002's <c>|home=</c> is, so a location without one, and a ledger without one, hashes as before.</summary>+public class PopulationLocationCityTests+{+ // R-POP-003: pinned from bfdfc3222 + the reception commit, before the City field existed.+ [Fact]+ public void ALocationWithNoCityKeepsItsCanonicalTextAndLedgerHash()+ {+ Assert.Equal("5:north|1:0|1:0|4:camp", new PopulationLocation("north", 0, 0, "camp").Canonical());+ Assert.Equal("5:north|-|-|-", new PopulationLocation("north").Canonical());+ Assert.Equal("98a09ec203e20e197141395397c041383454b74b5c7d204b78a239693bd87ec2",+ PopulationLedgerTests.State(new PopulationInventoryRow("start", 0, PopulationLedgerTests.Person())).Hash());+ }+ // R-POP-003: a set city is written after the other fields, length-prefixed, so it reaches the hash.+ [Fact]+ public void ACityIsWrittenOnlyWhenSet()+ {+ Assert.Equal("5:north|-|-|-|city=5:haifa", new PopulationLocation("north", city: "haifa").Canonical());+ Assert.NotEqual(new PopulationLocation("north").Canonical(), new PopulationLocation("north", city: "haifa").Canonical());+ Assert.Throws<ArgumentException>(() => new PopulationLocation("north", city: " "));+ }++ static GameState Fixture(Content c, PopulationLocation location) => PopulationLedger.CreateFixture(c,+ new PopulationBindings(new[] { location }, Array.Empty<PopulationTarget>(), Array.Empty<string>(), Array.Empty<string>()),+ Array.Empty<PopulationInventoryRow>(), mode: Mode.Historical);++ // R-POP-002: a location's city must be in its region by regions.yaml (AtLocation); the refusal names both.+ [Fact]+ public void ACityOutsideItsRegionIsRefusedNamingBoth()+ {+ var c = HistoricalPopulationTests.Real(true);+ var haifa = c.PlayerRegions.AtLocation("haifa")!.Id;+ var other = c.PlayerRegions.Regions.Keys.First(r => r != haifa);+ var e = Assert.Throws<ArgumentException>(() => Fixture(c, new PopulationLocation(other, city: "haifa")));+ Assert.Contains("haifa", e.Message);+ Assert.Contains(other, e.Message);+ var unknown = Assert.Throws<ArgumentException>(() => Fixture(c, new PopulationLocation(haifa, city: "atlantis")));+ Assert.Contains("atlantis", unknown.Message);+ Assert.Contains(haifa, unknown.Message);+ Assert.True(Fixture(c, new PopulationLocation(haifa, city: "haifa")).PopulationLedger.IsInitialized);+ }++ // S1-1 (review of #2936): a location's city is a place where own people live by R-POP-004's rulings, a census city+ // (cities.yaml, R-CITY-006) or a field host of its region (regions.yaml field_hexes host; owner, 7 November 2026, #1689:+ // "These two only (Recommended)", a settlement hosts F19 and F20 only). Any other member location of the region, a+ // locality, a sites.yaml id or a map location, is refused, naming it and the region.+ [Fact]+ public void AMemberLocationThatIsNeitherACensusCityNorAFieldHostIsRefused()+ {+ var c = HistoricalPopulationTests.Real(true);+ var census = new HashSet<string>(c.Cities.Select(x => x.Id), StringComparer.Ordinal);+ var region = c.PlayerRegions.AtLocation("haifa")!;+ var hosts = new HashSet<string>(region.FieldHosts.Select(h => h.Host), StringComparer.Ordinal);+ var place = region.MemberLocations.First(p => !census.Contains(p) && !hosts.Contains(p));+ var e = Assert.Throws<ArgumentException>(() => Fixture(c, new PopulationLocation(region.Id, city: place)));+ Assert.Contains(place, e.Message);+ Assert.Contains(region.Id, e.Message);+ // The two settlement hosts stay accepted in their own region, and no other region.+ foreach (var host in new[] { "nir_am", "nirim" })+ {+ var home = c.PlayerRegions.AtLocation(host)!;+ Assert.Contains(home.FieldHosts, h => h.Host == host);+ Assert.True(Fixture(c, new PopulationLocation(home.Id, city: host)).PopulationLedger.IsInitialized);+ }+ }+}diff --git a/sim/Statecraft.Sim/HistoricalPopulation.cs b/sim/Statecraft.Sim/HistoricalPopulation.csindex 762d04491..f33f7fabc 100644--- a/sim/Statecraft.Sim/HistoricalPopulation.cs+++ b/sim/Statecraft.Sim/HistoricalPopulation.cs@@ -50,11 +50,11 @@ namespace Statecraft.Sim}/// <summary>R-POP-004 (#1689 region slice): the Inventory as an initialized Historical ledger fixture, each record in- /// its real region of regions.yaml. A census record takes the region that lists its city (AtLocation). A formation+ /// its real region of regions.yaml. A census record takes the region that lists its city (AtLocation), and its location names that city. A formation/// 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). Each soldier carries one issued military item, id+ /// are free civilians with no assignment and their reception done (reception.turns), and soldiers serving in their own+ /// formation, with no profession, tier or 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)@@ -70,12 +70,20 @@ namespace Statecraft.Simif (missing.Count > 0)throw new InvalidOperationException("No region in regions.yaml for " + string.Join(", ", missing) + " (R-POP-004).");var locations = regions.Values.Distinct(StringComparer.Ordinal).ToDictionary(r => r, r => new PopulationLocation(r), StringComparer.Ordinal);+ // A census record is bound to its city in that region; a formation record keeps the region-only location.+ var placed = regions.ToDictionary(x => x.Key, x => x.Key.StartsWith(CensusPrefix, StringComparison.Ordinal)+ ? new PopulationLocation(x.Value, city: x.Key.Substring(CensusPrefix.Length)) : locations[x.Value], StringComparer.Ordinal);// 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));- var bindings = new PopulationBindings(locations.Values, targets, Array.Empty<string>(), Array.Empty<string>());- var rows = inventory.Select(r => new PopulationInventoryRow(r.Source, r.Ordinal, new PopulationUnit(0, r.Status, 0,- locations[regions[r.Source]], r.Status == PopulationStatus.ActiveSoldier+ var bindings = new PopulationBindings(locations.Values.Concat(placed.Values.Where(l => l.City != null)), targets,+ Array.Empty<string>(), Array.Empty<string>());+ // 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");+ var rows = inventory.Select(r => new PopulationInventoryRow(r.Source, r.Ordinal, new PopulationUnit(0, r.Status,+ r.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? new PopulationEquipment(militaryId: r.Source + "/" + r.Ordinal.ToString(CultureInfo.InvariantCulture), militaryPaid: true)diff --git a/sim/Statecraft.Sim/PopulationLedger.cs b/sim/Statecraft.Sim/PopulationLedger.csindex 785e0bc6f..4f2af2846 100644--- a/sim/Statecraft.Sim/PopulationLedger.cs+++ b/sim/Statecraft.Sim/PopulationLedger.cs@@ -71,6 +71,23 @@ namespace Statecraft.Simthrow new ArgumentException("Unknown or incompatible assignment target.");return t;}+ /// <summary>R-POP-002: a location's city must be a member location of its region in regions.yaml (AtLocation), and a+ /// place where own people live by R-POP-004's rulings: a census city (cities.yaml, R-CITY-006) or a field host of that+ /// region (field_hexes host; owner, 7 November 2026, #1689: "These two only (Recommended)"). Any other member, a+ /// locality, a sites.yaml id or a map location, is refused (review of #2936, S1-1).</summary>+ internal void ValidateCities(Content c)+ {+ foreach (var l in locations)+ {+ if (l.City == null) continue;+ var region = c.PlayerRegions.AtLocation(l.City);+ if (region?.Id != l.Region)+ throw new ArgumentException("City " + l.City + " is not in region " + l.Region + " in regions.yaml (R-POP-002).");+ if (!c.Cities.Any(x => x.Id == l.City) && !region.FieldHosts.Any(h => h.Host == l.City))+ throw new ArgumentException("City " + l.City + " of region " + l.Region+ + " is neither a census city of cities.yaml nor a field host in regions.yaml (R-POP-002).");+ }+ }internal bool HasCaptor(string captor) => captors.Contains(captor);internal bool HasQualification(string qualification) => qualification == "" || qualifications.Contains(qualification);internal IEnumerable<string> Canonical()@@ -265,6 +282,7 @@ namespace Statecraft.Simvar s = new GameState(c); var l = s.PopulationLedger;if (mode is Mode m) s.Mode = m;l.bindings = bindings ?? throw new ArgumentNullException(nameof(bindings));+ bindings.ValidateCities(c);var ordered = rows.OrderBy(x => x.Source, StringComparer.Ordinal).ThenBy(x => x.Ordinal).ToList();if (mode != Mode.Historical && ordered.Any(x => x.Source.StartsWith(HistoricalPopulation.CensusPrefix, StringComparison.Ordinal)|| x.Source.StartsWith(HistoricalPopulation.FormationPrefix, StringComparison.Ordinal)))diff --git a/sim/Statecraft.Sim/PopulationUnit.cs b/sim/Statecraft.Sim/PopulationUnit.csindex 7af21571a..6d1485186 100644--- a/sim/Statecraft.Sim/PopulationUnit.cs+++ b/sim/Statecraft.Sim/PopulationUnit.cs@@ -10,21 +10,26 @@ namespace Statecraft.Simpublic enum CivilianProfession { None, Farmer, Pioneer, Craftsman }public enum CivilianTier { None, Novice, Trained, Veteran, Apprentice, Expert }- /// <summary>An exact authored binding, not a region inferred from a hex or a captive's invented prison.</summary>+ /// <summary>An exact authored binding, not a region inferred from a hex or a captive's invented prison. The optional+ /// city is a regions.yaml member location of the region (checked when a fixture is created, R-POP-002); it is written+ /// only when set (<c>|city=</c>, as R-UNIT-002's <c>|home=</c>), so a location without one keeps its canonical text.</summary>public sealed class PopulationLocation{public string Region { get; }public int? Q { get; }public int? R { get; }public string? FacilityOrPort { get; }- public PopulationLocation(string region, int? q = null, int? r = null, string? facilityOrPort = null)+ public string? City { get; }+ public PopulationLocation(string region, int? q = null, int? r = null, string? facilityOrPort = null, string? city = null){- if (string.IsNullOrWhiteSpace(region) || q.HasValue != r.HasValue || (facilityOrPort != null && string.IsNullOrWhiteSpace(facilityOrPort)))- throw new ArgumentException("A region, a complete optional hex and a nonempty optional facility/port are required.");- PopulationText.ValidateText(region); PopulationText.ValidateText(facilityOrPort);- Region = region; Q = q; R = r; FacilityOrPort = facilityOrPort;+ if (string.IsNullOrWhiteSpace(region) || q.HasValue != r.HasValue || (facilityOrPort != null && string.IsNullOrWhiteSpace(facilityOrPort))+ || (city != null && string.IsNullOrWhiteSpace(city)))+ throw new ArgumentException("A region, a complete optional hex and a nonempty optional facility/port and city are required.");+ PopulationText.ValidateText(region); PopulationText.ValidateText(facilityOrPort); PopulationText.ValidateText(city);+ Region = region; Q = q; R = r; FacilityOrPort = facilityOrPort; City = city;}- internal string Canonical() => PopulationText.Fields(Region, Q, R, FacilityOrPort);+ internal string Canonical() => PopulationText.Fields(Region, Q, R, FacilityOrPort)+ + (City == null ? "" : "|city=" + PopulationText.Fields(City));}public sealed class PopulationAssignment