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: test that a halutz still becomes a veteran, and label the aggregate camp, craft and harvest paths (Refs #2528) (#3084)
Eyal Golanfaeeae9db64c
diff --git a/docs/rules/mvp.md b/docs/rules/mvp.mdindex c7dab578d..a15209e6d 100644--- a/docs/rules/mvp.md+++ b/docs/rules/mvp.md@@ -174,7 +174,7 @@ Then changed (3 Nov 2026, [#1700](https://github.com/eyalgolan/statecraft-israel## Training-Training is step 4 of the turn in the approved order (§2.3, D-A6): it runs before production. One military camp and one Hakhshara exist in Tel Aviv at the start, a labelled design assumption (D-D5); pioneers build more at camp sites (R-CAMP-001). Scope note: this is the live `gdd-0.1` start. Under `gdd-0.3`, 27M-25 says: "Schneller and Tel HaShomer operate from the start, the other military camps are build sites, every camp uses `military.camp_capacity` 5, and the reception site is Kiryat Shmuel, Haifa" (that 5 is #1668's value at 10,000 people a unit; at D2's 1,000 people a unit it is 50 units, `content/gdd03-balance.yaml:307`). R-CAMP-003 defines the `gdd-0.3` start camps. The Hakhshara and its `Train` track stay under `gdd-0.3` (owner, 4 November 2026: "Keep the Hakhshara", [#2484](https://github.com/eyalgolan/statecraft-israel/issues/2484)).+Training is step 4 of the turn in the approved order (§2.3, D-A6): it runs before production. One military camp and one Hakhshara exist in Tel Aviv at the start, a labelled design assumption (D-D5); pioneers build more at camp sites (R-CAMP-001). Scope note: this is the live `gdd-0.1` start. Under `gdd-0.3`, 27M-25 says: "Schneller and Tel HaShomer operate from the start, the other military camps are build sites, every camp uses `military.camp_capacity` 5, and the reception site is Kiryat Shmuel, Haifa" (that 5 is #1668's value at 10,000 people a unit; at D2's 1,000 people a unit it is 50 units, `content/gdd03-balance.yaml:307`). Only the dark start enforces that camp capacity (R-TRAIN-001): a `gdd-0.3` game started without one (the public `Simulation.NewGame`) still runs the aggregate `Train`, which does not read `military.camp_capacity`, the `gdd-0.1` behaviour until #1689's last slice (#2528). R-CAMP-003 defines the `gdd-0.3` start camps. The Hakhshara and its `Train` track stay under `gdd-0.3` (owner, 4 November 2026: "Keep the Hakhshara", [#2484](https://github.com/eyalgolan/statecraft-israel/issues/2484)).R-TRAIN-001: `Train(city, track, n)` takes `n` of the city's civilians without a job (not a staffed arms workshop's worker, R-ARMS-005, or a builder, R-CITY-011) into a cohort that trains as `track` (a unit type with a `facility`: `recruit`, `artillery` and `armoured_car` in a military camp (R-UNIT-008), `halutz` in a Hakhshara, `craftsman` at industry, R-CRAFT-001) for the type's `training_turns`, counting the turn it was ordered in. The Treasury pays `n * training_cost` at once. When the Treasury holds less, the shortfall is borrowed, as for map actions: it is added to the debt and the Treasury stops at 0 (owner decision "Allow borrowing", 15 October 2026). The trainees leave the civilians at once; the cohort takes the next id, which units share. It is refused, with the state unchanged and the Attention refunded, when the city or track is unknown, `n` is below 1, the city lacks the facility, or it has fewer civilians without a job. A city has a facility when `cities.yaml` gives it one at the start, `gdd03-start.yaml` gives it one under R-CAMP-003, or a camp site of that kind built for it is in the state (R-CAMP-001). The legacy loop refuses it before charging Attention. `Reinforce` (R-TRAIN-004) starts a cohort by the same rules, aimed at a unit. A queued `ReassignCraftsmen` or `ReassignPioneers` (R-QUAL-004, R-QUAL-005) takes its civilians without a job as a queued `Train` does (counted in full, so the orders are accepted in any order), in `Training.Ordered` and `Training.Available` (#1548; owner, 24 October 2026: "Yes, count them", https://github.com/eyalgolan/statecraft-israel/issues/1511#issuecomment-6378360813). Under `gdd-0.3` the `halutz` track still trains in a Hakhshara (owner, 4 November 2026: "Keep the Hakhshara", [#2484](https://github.com/eyalgolan/statecraft-israel/issues/2484)). It runs on a game with an initialized Historical ledger (the dark start, R-POP-002; #1725 PR 7, producer 12) under the owner's rulings of 8 November 2026 (#1725 issuecomment-6724941867). "Recruit+crews+halutz (Rec.)": the recruit, crew and halutz tracks run, and the craftsman track is refused with a plain reason until #2476, the reason "Craft training does not run on the population ledger yet (#2476)". "Cohorts stay main (Rec.)": `State.Cohorts` stays the record of truth, each trainee's Course target is per facility (`military_camp/<city>`, `hakhshara/<city>`), and the cohort keeps a sorted list of its members' ids, hashed only when set. "Unskilled first, keep (Rec.)": civilians with no profession first, then the qualified, each in ascending id, and a qualified trainee's profession is kept dormant, not cleared. "Keep costs, pool rest (Rec.)": one item is issued per record, and the rest of `training_arms` is taken from the stock and kept in `Cohort.Arms`, so a cancel returns it. "Enforce it here (Rec.)": the camp capacity, 50 records per camp city over all military tracks, is enforced here, refused with "<city>'s military camp has room for <n> more trainees (capacity 50)". "Start + runtime bind (Rec.)": the start facilities' Course targets are bound at the start, plus one all-or-nothing runtime bind for new formations and built camps. There the trainees are the city's free-civilian records without an assignment, located in the city; a refugee, a worker and a farmer on a field are not idle. Each becomes a trainee on its facility's course in the same place (27M-7), and each military trainee is issued one military item, `training/<cohort>/<id>`, from the Arms stock. Every check (city, track, count, facility, idle records, camp capacity, Arms) comes before the first write, and the records and any Course target a built camp still needs are validated as one candidate. The Money, the cohort id and the Why lines are the aggregate game's; no aggregate city field is written. The ledger also binds each military track's unit class as a qualification at Initialize. A trainee who already carries a military item, and a farmer or craftsman on the halutz track, are refused before any write, the state unchanged (owner, 8 November 2026, Q3: "Refuse, with reason (Recommended)"), with "A civilian without work in <city> already carries a military item" and "A farmer or craftsman in <city> cannot train as a halutz"; neither is idle on the dark start, and a replacement cohort (R-TRAIN-004) is refused the same way. These ledger refusals are internal English text: their Hebrew comes with the UI wiring PR (owner, 8 November 2026, Q4: "With the UI PR (Recommended)"). A synthetic or Open ledger is still refused.@@ -194,7 +194,7 @@ R-TRAIN-008: The fixture refuses, with a "Deferred:" reason and the state unchan## Craftsmen-R-CRAFT-001: A civilian becomes a craftsman by training (D-D4; Q-CRAFT-1, owner, 15 October 2026): `Train(city, craftsman, n)` follows R-TRAIN-001 to R-TRAIN-003, and the city's facility is a completed `industry` project (R-PROJ-003); one still being built does not count. `unit_types.yaml` gives the course's `training_turns` (3) and `training_cost` (IL 0.5m a group), labelled design values (Q-CRAFT-3). A finished cohort adds to the city's count of craftsmen, which is not part of its civilians and is written into the state hash only when not 0. A craftsman can return to civilian life and keep the qualification (R-QUAL-002). Under `gdd-0.3`, the craftsman course on the population ledger is R-CRAFT-003 (fixture only).+R-CRAFT-001: A civilian becomes a craftsman by training (D-D4; Q-CRAFT-1, owner, 15 October 2026): `Train(city, craftsman, n)` follows R-TRAIN-001 to R-TRAIN-003, and the city's facility is a completed `industry` project (R-PROJ-003); one still being built does not count. `unit_types.yaml` gives the course's `training_turns` (3) and `training_cost` (IL 0.5m a group), labelled design values (Q-CRAFT-3). A finished cohort adds to the city's count of craftsmen, which is not part of its civilians and is written into the state hash only when not 0. A craftsman can return to civilian life and keep the qualification (R-QUAL-002). Under `gdd-0.3`, the craftsman course on the population ledger is R-CRAFT-003 (fixture only). A `gdd-0.3` game started without the dark start (the public `Simulation.NewGame`) still runs this aggregate course, the `gdd-0.1` behaviour until #1689's last slice (#2528).R-CRAFT-002: A craftsman fills an ordinary job slot (Q-CRAFT-2, owner, 15 October 2026). Of a city's employed, its craftsmen are counted first, and each employed craftsman earns `craftsman_income_multiple` (2, a labelled design value) times `income_per_job_per_year`; every other employed unit earns the R-CITY-002 rate. Under `gdd-0.3`, a craftsman is a novice from the course start, then an apprentice or an expert (R-CRAFT-003); the course's Industry slot and income stay with #1692. Work XP under `gdd-0.3`, in synthetic fixtures only (#2472, `Gdd03CraftWorkFixture`; nothing in the game calls it): `docs/gdd/training.md` records "Apprentices become experts after `craft.expert_work_turns` actual turns in Industry or an arms workshop. Each turn counts once, regardless of output/work rate." Each apprentice or expert craftsman the month's snapshot (#1716) has working an Industry or arms-workshop slot gives one work receipt for that population id and month; idle, travel, course, teaching, service, farming and building months give none, and a novice craftsman's workshop month changes no qualification (Q55). Receipts are deduplicated by id and month, within a batch and against those already applied, before any XP, so a repeated receipt adds nothing and cannot promote twice. Each receipt adds one tick whatever the output or pay, and an apprentice whose tick reaches `craft.expert_work_turns` (36) becomes an expert: the month's snapshot keeps the apprentice tier for that month's output, and the expert tier counts from the next snapshot. Only the tier and work XP change; the id, assignment, location, equipment and military history stay. An expert's work XP keeps counting past 36 (maintainer reading: `Gdd03CraftArithmetic.WorkTick` already counts it, and no ruling stops it). The detached `Gdd03CraftArithmetic` no longer counts a building turn as work XP; it still quotes the builder's work.@@ -242,7 +242,7 @@ R-SITE-005: At most one `yishuv` site sits in a hex, so a hex shows at most oneR-FIELD-001: `PioneerWork(unit, plow_fields, site)` plows a field at a site whose kinds include `field`, by R-SITE-001 to R-SITE-003's rules, with `plow_fields_turns` and `plow_fields_cost` (labelled design values, Q-FIELD-3, decided 17 October 2026). A field site in a yishuv site's hex is ready only once that yishuv is built; before that the order is refused with the state unchanged and the Attention refunded (Q-FIELD-1, decided 17 October 2026). Built, the field site is plowed. A field site is not also a yishuv site, so building a yishuv cannot plow it; the loader refuses a row that gives it both kinds.-R-FIELD-002: Each turn in step 6, after the cities' production and in ordinal site id order, every plowed field adds `field_food_per_turn` Food units to the national stock (R-FOOD-001), with no workers (Q-FIELD-2, decided 17 October 2026). A field being plowed adds nothing. The Food arrives before the nation eats in step 7, so in a turn with imports (R-FOOD-002) the import tops the stock up by that much less. `field_food_per_turn` is 1, a labelled design value (Q-FIELD-3: "1 Food a turn"), and required in the GDD loop; a value below 0 or above 1,000 (`Pools.MaxFieldFoodPerTurn`, #2804) is a load error.+R-FIELD-002: Each turn in step 6, after the cities' production and in ordinal site id order, every plowed field adds `field_food_per_turn` Food units to the national stock (R-FOOD-001), with no workers (Q-FIELD-2, decided 17 October 2026). A field being plowed adds nothing. The Food arrives before the nation eats in step 7, so in a turn with imports (R-FOOD-002) the import tops the stock up by that much less. `field_food_per_turn` is 1, a labelled design value (Q-FIELD-3: "1 Food a turn"), and required in the GDD loop; a value below 0 or above 1,000 (`Pools.MaxFieldFoodPerTurn`, #2804) is a load error. A `gdd-0.3` game started without the dark start (the public `Simulation.NewGame`) still runs this aggregate harvest, the `gdd-0.1` behaviour until #1689's last slice (#2528).Then changed (3 Nov 2026): under exact `gdd-0.3`, in synthetic fixtures only (R-POP-004), each authored starting field (`regions.yaml` `field_hexes`, Q36) is one Work slot for one farmer (`field.slots` 1; owner, 3 November 2026, "One farmer per field (Recommended)"), staffed only by a farmer located in its region (Q27) while the field is Israeli-held (Q37). Only a farmer may hold a field (owner, 4 November 2026: asked "May only a unit with the Farmer profession staff a field?", the owner answered "yes", [recorded on #1694](https://github.com/eyalgolan/statecraft-israel/issues/1694#issuecomment-6623124984)). A field staffed in the month's snapshot (27M-2) and still Israeli-held yields `farmer.output` (2 / 3 / 5) times `field_food_per_turn` by the snapshot tier, and no Money; an unworked field yields nothing. Then changed (#2471): the fixture's settlement adds that yield to the national Food stock (R-FOOD-001), each field's once and in ordinal field-id order, with one Why line per field that yields. Control is checked again at settlement as well as at the snapshot's freeze, and a field lost by either adds nothing while its farmer keeps the same id, tier and assignment (D6: "its people stay"); once retaken, the next month's snapshot yields again with no new assignment (D6: "On retaking, everything resumes and nothing is deleted."). The caller states which fields are Israeli-held (maintainer reading: the sim has no hex control for fields yet). No game-loop caller is added, and the legacy and gdd-0.1 plowed-field harvest above is unchanged.diff --git a/sim/Statecraft.Sim.Tests/VeteranTests.cs b/sim/Statecraft.Sim.Tests/VeteranTests.csindex ce28fed84..022dd7be5 100644--- a/sim/Statecraft.Sim.Tests/VeteranTests.cs+++ b/sim/Statecraft.Sim.Tests/VeteranTests.cs@@ -75,6 +75,28 @@ public class VeteranTestsAssert.NotNull(s.Sites[site].BuiltOn);}+ // R-VET-001 under gdd-0.3 (#2528): the owner kept the promotion "until the population ledger's work-XP tiers are live"+ // (#2814, "Keep promotion (Recommended)"; #2828). The shipped content with only eras.yaml's ruleset switched: a halutz+ // building a yishuv becomes a veteran_halutz after veteran_halutz_service turns of work, as in gdd-0.1.+ [Fact]+ public void AHalutzBuildingASiteStillBecomesAVeteranUnderGdd03()+ {+ var c = HistoricalPopulationTests.Real(true);+ Assert.Equal(SaveGame.Gdd03Ruleset, c.Ruleset);+ var r = c.Rules.Mvp!;+ var s = WithUnit(c, "halutz", out var id);+ var site = c.Sites.First(x => x.Kinds.Contains(Projects.YishuvKind)).Id;+ var step = Step(c, s, new PioneerWork(id, Projects.BuildYishuv, site));+ for (int i = 1; i < r.VeteranHalutzService; i++)+ {+ Assert.Equal(("halutz", i), (step.State.Units[id].Type, step.State.Units[id].Service));+ step = Step(c, step.State);+ }+ var u = step.State.Units[id];+ Assert.Equal(("veteran_halutz", r.VeteranHalutzService!.Value), (u.Type, u.Service));+ Assert.Contains(step.Why, x => x.System == "map" && x.Message == "A group of halutzim became veteran pioneers");+ }+// R-VET-002: a veteran may start pioneer work, and the same build finishes sooner, by veteran_progress turns a turn.[Fact]public void AVeteranBuildsFaster()