A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
R-WAR-008: a separate early text for the armistice cards, mechanism with fixtures only (Refs #1709) (#2996)
Eyal Golan19527963c067
diff --git a/changelog.d/1709-early-text.md b/changelog.d/1709-early-text.mdnew file mode 100644index 000000000..7777b3718--- /dev/null+++ b/changelog.d/1709-early-text.md@@ -0,0 +1,4 @@+- Armistice cards can carry a separate early text (`early_text`, `early_text_he`) for the early path (R-WAR-008, #1709):+ shown before its date, a quiet front's card shows that text under an "Alternative course" banner, and on or after its+ date it shows its ordinary text. A card with an early text needs a person's sign-off before a shareable build+ (R-ALT-011). No real card has one yet: the four texts come with the owner's approval and sign-off.diff --git a/content/schema/event.schema.json b/content/schema/event.schema.jsonindex 1e3fb0dba..451726222 100644--- a/content/schema/event.schema.json+++ b/content/schema/event.schema.json@@ -110,11 +110,13 @@"site": { "$ref": "#/definitions/id", "description": "A swamp site (sites.yaml) whose works this event is about. In the GDD loop it fires only while that site is being worked; the legacy loop ignores it." },"prisoners": { "enum": ["egypt", "jordan", "lebanon", "syria"], "description": "The front whose prisoners this exchange card returns (R-POW-004). It fires only while that front holds prisoners or the player's soldiers, and has exactly one option. Jordan's card also returns the Iraqi prisoners." },"deported": { "$ref": "#/definitions/id", "description": "A settlement target (settlement_targets.yaml) whose residents stayed. This Deport follow-up card fires only once the player's Deport has depopulated that place, carries the displacement tag and has exactly one option (R-EVT-007)." },- "front_quiet": { "enum": ["egypt", "jordan", "lebanon", "syria"], "description": "The front of this armistice_<front> card, on that card only. Under gdd-0.3 the card may also come before its from, and again after a refusal, once that front is quiet (Armistice.MayOfferEarly), and then it takes the first soft slot (R-WAR-008, R-EVT-002)." },+ "front_quiet": { "enum": ["egypt", "jordan", "lebanon", "syria"], "description": "The front of this armistice_<front> card, on that card only. Under gdd-0.3 the card may also come before its from, and again after a refusal, once that front is quiet (Armistice.MayOfferEarly), and then it takes the first soft slot (R-WAR-008, R-EVT-002). Shown before its from, it shows its early_text when it has one." },"armistice_front": { "enum": ["egypt", "jordan", "lebanon", "syria"], "description": "On an operation card or a following card only: the front whose signed armistice ends the card. A pending operation lapses once it is signed, and the card never first fires after it (R-ENEMY-007)." },"follows": { "type": "boolean", "description": "Under the GDD loop: the card follows the decision its requires waits for, and fires on the turn after that decision even when its own window has closed, so a late operation still brings it (R-ENEMY-007). Needs requires." },"late_text": { "type": "string", "description": "On a following card or an operation card only: the text shown when the card is shown after its own window has closed (a late follow-up, or an operation shown again while it waits), with no dates that would mislead (R-ENEMY-007)." },"late_text_he": { "type": "string", "description": "late_text in Hebrew; required exactly when the card has Hebrew text (R-ENEMY-007)." },+ "early_text": { "type": "string", "description": "On a front_quiet armistice card only: the text shown when the card is shown before its from (the early path), saying the talks came sooner than in history. The card is then marked as an alternative course, and a shareable build needs the card's reviewed_by (R-WAR-008, R-ALT-011). Its office placeholders need a holder from 15 December 1948, the first early offer." },+ "early_text_he": { "type": "string", "description": "early_text in Hebrew; required exactly when the card has Hebrew text (R-WAR-008)." },"order": { "type": "integer", "description": "Default 0. Among the cards that fire on the same turn with the same from, a lower order comes first, then the id (R-EVT-006). Set it only to put one card after another on purpose." },"from": { "$ref": "#/definitions/date", "description": "First day of the window." },"to": { "$ref": "#/definitions/date", "description": "End of the window (exclusive). Leave out for an open window." },@@ -254,6 +256,7 @@{ "not": { "required": ["title_he"] } },{ "not": { "required": ["text_he"] } },{ "not": { "required": ["text_he_review"] } },+ { "not": { "required": ["early_text_he"] } },{"properties": {"options": {diff --git a/docs/WRITING_EVENTS.md b/docs/WRITING_EVENTS.mdindex 482bb7178..54eba5303 100644--- a/docs/WRITING_EVENTS.md+++ b/docs/WRITING_EVENTS.md@@ -47,11 +47,13 @@ schema too, or that test fails. Keep the comment when you copy a file.| `site` | no | A swamp site in `sites.yaml` whose works the event is about. In the GDD loop it fires only while that site is being worked (R-SWAMP-002); the legacy loop ignores it. See `docs/gdd/fields-and-swamps.md`. || `prisoners` | no | Makes the event a front's prisoner-exchange card: `egypt`, `jordan` (which also returns the Iraqi prisoners), `lebanon` or `syria`. It fires only while that front holds prisoners or the player's soldiers (GDD loop only), has exactly one option, and returns them and scores when it resolves (R-POW-004). || `deported` | no | Makes the event Deport's follow-up card for a settlement target whose residents stayed: it fires only once the player's Deport has depopulated that place, carries the `displacement` tag and has exactly one option (R-EVT-007). See "deported". |-| `front_quiet` | no | On a front's armistice card only (`armistice_<front>`, one of `egypt`, `jordan`, `lebanon`, `syria`). Under `gdd-0.3` the card may also come before its `from`, and again after a refusal, once that front has been quiet long enough; it then takes the first soft slot (R-WAR-008, R-EVT-002). |+| `front_quiet` | no | On a front's armistice card only (`armistice_<front>`, one of `egypt`, `jordan`, `lebanon`, `syria`). Under `gdd-0.3` the card may also come before its `from`, and again after a refusal, once that front has been quiet long enough; it then takes the first soft slot (R-WAR-008, R-EVT-002). Shown before its `from`, it shows its `early_text` when it has one. || `armistice_front` | no | On an operation card or a `follows` card only: a front (`egypt`, `jordan`, `lebanon`, `syria`) whose signed armistice ends the card. A pending operation lapses once it is signed, and waits while that front's armistice card is pending; the card never first fires after the signature (R-ENEMY-007). || `follows` | no | `true` on a card with `requires`, under the GDD loop: once its `requires` are met it fires on the turn after, even when its own window has closed, so a late operation still brings it (R-ENEMY-007). || `late_text` | no | On a following card or an operation card only, with a `to`: the card's text when it is shown after its own window has closed (a late follow-up, or an operation shown again while it waits), with no dates that would mislead (R-ENEMY-007). || `late_text_he` | with `late_text`, when the card has Hebrew | `late_text` in Hebrew, required exactly when the card's text is in Hebrew. |+| `early_text` | no | On a `front_quiet` armistice card only: the card's text when it is shown before its `from` (the early path), saying the talks came sooner than in history, with no date. The card then shows the "Alternative course" banner, and a shareable build refuses until a person has signed the card off (`reviewed_by`, R-ALT-011). Its office placeholders need a holder from 15 December 1948, the first early offer. A card shown on or after its `from`, on either path, shows its `text` (R-WAR-008). |+| `early_text_he` | with `early_text`, when the card has Hebrew | `early_text` in Hebrew, required exactly when the card's text is in Hebrew. || `options` | yes | One or more options. See below. || `sources` | no by the loader, yes by the rules | A list of `{ url, checked }`. See below. || `status` | no (default `draft`) | The review status. See below. |diff --git a/docs/m3-release.md b/docs/m3-release.mdindex fb9707ae7..d8613a499 100644--- a/docs/m3-release.md+++ b/docs/m3-release.md@@ -287,7 +287,8 @@ war-casualties; and displacement, R-GATE-001). The owner's sign-off for all seveare not gated, because web_check and the golden checks need them.- **Alternate-timeline content (R-ALT-011, Q-ALT-9):** Unity player builds made with `-shareable` and`Statecraft.Cli --release-gate`, and therefore `tools/package_release.py` and `scripts/oss/release_gate.sh`, refuse- while any consequence card (`kind: consequence`) or any event with `variants` has no `reviewed_by`, naming them+ while any consequence card (`kind: consequence`), any event with `variants` or any armistice card with an `early_text`+ (R-WAR-008, #1709) has no `reviewed_by`, naming them(`Statecraft.Sim.ReleaseGate.AlternateUnsigned`): Unity on its `BUILD REFUSED` line, the CLI on a `RELEASE GATE REFUSED`line, and the CLI also prints each as `unsigned alternate card: <id>`. Thesign-off is a person's `reviewed_by`, written only by that person.diff --git a/docs/rules/mvp.md b/docs/rules/mvp.mdindex 00d609d4e..4f67d98eb 100644--- a/docs/rules/mvp.md+++ b/docs/rules/mvp.md@@ -394,7 +394,7 @@ R-WAR-006: Under exact `gdd-0.3` (`gdd-0.1` in #752), refusing a front's armistiR-WAR-007: Under exact `gdd-0.3` (`gdd-0.1` in #752), signing a front's armistice (`sign` on `armistice_<front>`) removes every unit of that front from the board, Iraqi units with Jordan's, and no other (Q-OBJ-4, owner, 15 October 2026). Prisoners and the player's soldiers held stay as they are until the exchange card (R-POW-004), and Send home follows R-UNIT-005 unchanged: a unit whose nearest front-bearing enemy is on a signed front may go home. Because the signed front's units leave, a unit that also borders another front's unit now counts as on that other front and waits for its armistice. The armistice lines stay display-only.-R-WAR-008: Under exact `gdd-0.3` (`gdd-0.1` in #752), each front's armistice card (`armistice_<front>`, `front_quiet: <front>`) also comes while that front may have an early offer (R-WAR-005, R-WAR-006): before its `from`, and again after a refusal (#2478). It reads only its own front's count, so another front's quiet turns never bring it. On that path it is a soft event that takes the first soft slot (R-EVT-002). The sourced `from` stays the card's ordinary path, a hard anchor as before, so a front that never turns quiet gets its card on its date. A refused card, early or on its date, comes back only once two full quiet turns have followed the refusal, and its `from` does not bring it back again; a signed front gets no card again. Left unanswered, the card is still a hard anchor for R-EVT-003, so in Historical mode it takes its historical option (`sign`) on either path, as early as the 15 December 1948 turn (owner, 4 November 2026, #2508, option A: "keep early signing", https://github.com/eyalgolan/statecraft-israel/pull/2508#issuecomment-6630316010). The card's text, dates, options and effects are the same on both paths. Draws nothing.+R-WAR-008: Under exact `gdd-0.3` (`gdd-0.1` in #752), each front's armistice card (`armistice_<front>`, `front_quiet: <front>`) also comes while that front may have an early offer (R-WAR-005, R-WAR-006): before its `from`, and again after a refusal (#2478). It reads only its own front's count, so another front's quiet turns never bring it. On that path it is a soft event that takes the first soft slot (R-EVT-002). The sourced `from` stays the card's ordinary path, a hard anchor as before, so a front that never turns quiet gets its card on its date. A refused card, early or on its date, comes back only once two full quiet turns have followed the refusal, and its `from` does not bring it back again; a signed front gets no card again. Left unanswered, the card is still a hard anchor for R-EVT-003, so in Historical mode it takes its historical option (`sign`) on either path, as early as the 15 December 1948 turn (owner, 4 November 2026, #2508, option A: "keep early signing", https://github.com/eyalgolan/statecraft-israel/pull/2508#issuecomment-6630316010). Shown before its `from` (the early path), a card with an `early_text` shows it, in Hebrew its `early_text_he`: the talks came sooner than in history. The card is then marked as an alternative course by the `event.alt_early` banner (owner, 9 November 2026, #1709: "Separate early text (Recommended)", "Banner (Recommended)"). A card shown on or after its `from`, on either path, shows its `text`, so a refused card that comes back then shows its ordinary text and no saved state records the path ("Ordinary text (Recommended)"). Its dates, options and effects are the same on both paths. Draws nothing.## Prisoners@@ -596,7 +596,7 @@ R-ALT-009: An option of a consequence card may `rejoin` an event whose road theR-ALT-010: An event of `kind: reconvergence` has a historical option and may carry `variants`. The first variant whose every `when` entry holds supplies the card's title (if it gives one) and text; options and effects never vary. Each variant follows a road not taken, carries sources, has its placeholders checked over the event's window, and names only roads whose windows close on or before the event's `from` (for a road's historical option, also every consequence card that can `rejoin` it, R-ALT-009). Only a reconvergence event carries variants.-R-ALT-011: A shareable build refuses while any consequence card, or any event with variants, has no `reviewed_by` (a person's sign-off), alongside the sensitivity gate (Q-ALT-9). `Timeline.Entries` lists each resolved event, in window order, with the player's option beside the record's, and `Timeline.Origin` names the road a consequence card follows.+R-ALT-011: A shareable build refuses while any consequence card, any event with variants, or any armistice card with an `early_text` (R-WAR-008) has no `reviewed_by` (a person's sign-off), alongside the sensitivity gate (Q-ALT-9). `Timeline.Entries` lists each resolved event, in window order, with the player's option beside the record's, and `Timeline.Origin` names the road a consequence card follows.R-ALT-012: The historical run (the reference player's orders from 15 May 1948 to 15 January 1952) raises no consequence card and diverges nowhere.diff --git a/docs/translations.md b/docs/translations.mdindex c391154da..048ef0312 100644--- a/docs/translations.md+++ b/docs/translations.md@@ -22,7 +22,7 @@ language is checked with `CheckDeclaredLanguage`, which refuses one whose `ui.ya| File | Key | Entry ||---|---|---|| `ui.yaml` | the key in `strings.en.yaml` (`hud.turn`) | the text |-| `events.yaml` | the event id (`altalena`) | `title`, `text`, `late_text` (only for a card with one, R-ENEMY-007), `options` (option id: text, in the event's order), and `review` |+| `events.yaml` | the event id (`altalena`) | `title`, `text`, `late_text` (only for a card with one, R-ENEMY-007), `early_text` (only for a card with one, R-WAR-008), `options` (option id: text, in the event's order), and `review` || `content.yaml` | a content key (below) | `text`, `review`, and for a language other than Hebrew `sources` |```yamldiff --git a/sim/Statecraft.Cli/Program.cs b/sim/Statecraft.Cli/Program.csindex d605a12f4..c30a3d380 100644--- a/sim/Statecraft.Cli/Program.cs+++ b/sim/Statecraft.Cli/Program.cs@@ -79,9 +79,10 @@ catch (ContentException e) { Console.Error.WriteLine($"Content error: {e.Message// --release-gate: the sensitivity gate before a build is shared (spec 5.5; tools/package_release.py, Build -shareable).// Exit 0 and "RELEASE GATE OK" when every sensitive event is sensitivity-reviewed and (R-ALT-011, Q-ALT-9) every-// consequence card and every event with variants has a person's reviewed_by, and (R-UNIT-006, Q-START-3) every-// units_1948.yaml row a new game starts a unit from is fact-checked with no field sourced after its-// checked_on, and (Q-TGT-3 (b)) every settlement_targets.yaml row is sensitivity-reviewed; else exit 3 naming them.+// consequence card, every event with variants and every armistice card with an early_text (R-WAR-008) has a person's+// reviewed_by, and (R-UNIT-006, Q-START-3) every units_1948.yaml row a new game starts a unit from is fact-checked with+// no field sourced after its checked_on, and (Q-TGT-3 (b)) every settlement_targets.yaml row is sensitivity-reviewed;+// else exit 3 naming them.if (Array.IndexOf(args, "--release-gate") >= 0){var open = ReleaseGate.SensitiveUnreviewed(content);diff --git a/sim/Statecraft.Sim.Tests/FinalWaveTests.cs b/sim/Statecraft.Sim.Tests/FinalWaveTests.csindex d8883301a..217f07076 100644--- a/sim/Statecraft.Sim.Tests/FinalWaveTests.cs+++ b/sim/Statecraft.Sim.Tests/FinalWaveTests.cs@@ -91,6 +91,39 @@ public class FinalWaveTestsAssert.Empty(ReleaseGate.AlternateUnsigned(c2));}+ /// <summary>R-ALT-011, R-WAR-008 (#1709; owner, 9 November 2026: "Separate early text (Recommended)", checked through+ /// the alternate-timeline gate): an armistice card's early text is a what-if, so a card with one and no person's+ /// reviewed_by keeps a shareable build back; signed, it does not. A fixture card: no real card has an early text until the+ /// owner signs the four ("You, before they land (Recommended)"), which the first assert above pins.</summary>+ [Fact]+ public void AShareableBuildNeedsAnEarlyArmisticeTextSignedOff()+ {+ const string card = @"+id: armistice_egypt+title: Armistice with Egypt+text: 'Israel decides whether to sign.'+early_text: 'The talks came sooner. {prime_minister} must decide.'+office: prime_minister+anchor: hard+front_quiet: egypt+from: 1949-02-15+to: 1950-01-01+sources: [{ url: https://example.org/event, checked: 2026-10-18 }]+options:+ - id: sign+ text: Sign the armistice+ historical: true+ - id: hold_out+ text: Refuse and keep fighting+ alternative: { basis: design }+";+ Assert.Equal(new[] { "armistice_egypt" }, ReleaseGate.AlternateUnsigned(AlternateTimelineTests.Load(("armistice_egypt.yaml", card))));+ var ordinary = card.Replace("early_text: 'The talks came sooner. {prime_minister} must decide.'\n", "");+ Assert.Empty(ReleaseGate.AlternateUnsigned(AlternateTimelineTests.Load(("armistice_egypt.yaml", ordinary))));+ var signed = card + "status: fact-checked\nreviewed_by: a-reviewer\nreviewed_on: 2026-10-20\n";+ Assert.Empty(ReleaseGate.AlternateUnsigned(AlternateTimelineTests.Load(("armistice_egypt.yaml", signed))));+ }+// ---- M2: Cause text is derived output, deterministic ----[Fact]diff --git a/sim/Statecraft.Sim.Tests/Gdd03ArmisticeOfferTests.cs b/sim/Statecraft.Sim.Tests/Gdd03ArmisticeOfferTests.csindex cd9ad511f..fc5775f01 100644--- a/sim/Statecraft.Sim.Tests/Gdd03ArmisticeOfferTests.cs+++ b/sim/Statecraft.Sim.Tests/Gdd03ArmisticeOfferTests.cs@@ -317,6 +317,154 @@ options:Assert.Equal(new[] { "after_road", "a1", "a2" }, Fire(c, s));}+ // ---- R-WAR-008's early text (#1709; owner, 9 November 2026: "Separate early text (Recommended)", then "Ordinary text+ // (Recommended)": no new saved state). A fixture text, never a real card's: the four real texts wait for the owner's+ // approval of the words and their sign-off ("You approve the words (Recommended)", "You, before they land (Recommended)").++ const string Early = "The talks came sooner. {prime_minister} must decide.";+ const string EarlyHe = "השיחות הגיעו מוקדם יותר. על {prime_minister} להחליט.";++ static string WithEarly(string card, string text = Early) => card.Replace("office: prime_minister", $"early_text: '{text}'\noffice: prime_minister");++ static Content LoadEarly(string ruleset = SaveGame.Gdd03Ruleset)+ {+ var f = Gdd03MovementFortTests.Files(ruleset);+ f["events/armistice_egypt.yaml"] = WithEarly(Card("egypt", "1949-12-01"));+ f["events/armistice_jordan.yaml"] = WithEarly(Card("jordan", "1950-01-01"));+ return ContentLoader.Load(Fixture.Write(f));+ }++ static string Filled(Content c, GameState s, string text) => Cabinet.Fill(c, s, text, s.Date);++ // R-WAR-008: a card shown before its `from`, which only the quiet path can do, shows its early text, its placeholder filled.+ // Red without it: the loader refused early_text, and Render gave the ordinary text.+ [Fact]+ public void R_WAR_008_AnEarlyCardShowsItsEarlyText()+ {+ var c = LoadEarly();+ var s = At(c, December15, 2, 0);+ Assert.Equal(new[] { "armistice_egypt" }, Fire(c, s));+ var e = c.Events.Single(x => x.Id == "armistice_egypt");+ Assert.Equal(Filled(c, s, Early), EventSystem.Render(c, s, e));+ Assert.DoesNotContain("{", EventSystem.Render(c, s, e));+ }++ // R-WAR-008: the hard-anchor path. A front that never turns quiet gets its card on its `from`, with its ordinary text.+ [Fact]+ public void R_WAR_008_TheCardOnItsDateShowsItsOrdinaryText()+ {+ var c = LoadEarly();+ var s = At(c, new DateTime(1949, 12, 15), 0, 0);+ Assert.Equal(new[] { "armistice_egypt" }, Fire(c, s));+ var e = c.Events.Single(x => x.Id == "armistice_egypt");+ Assert.Equal(Filled(c, s, "Israel decides whether to sign."), EventSystem.Render(c, s, e));+ }++ // R-WAR-008, "Ordinary text (Recommended)": a card refused on its date and brought back by the quiet path after its+ // `from` shows its ordinary text: the talks are no longer early. Nothing saved records the path.+ [Fact]+ public void R_WAR_008_ACardRefusedOnItsDateReturnsWithItsOrdinaryText()+ {+ var c = LoadEarly();+ var s = At(c, new DateTime(1950, 2, 15), 2, 2);+ s.FiredEvents.Add("armistice_egypt"); s.ChosenOptions["armistice_egypt"] = "sign";+ s.FiredEvents.Add("armistice_jordan"); s.ChosenOptions["armistice_jordan"] = "hold_out";+ Assert.Equal(new[] { "armistice_jordan" }, Fire(c, s));+ var e = c.Events.Single(x => x.Id == "armistice_jordan");+ Assert.Equal(Filled(c, s, "Israel decides whether to sign."), EventSystem.Render(c, s, e));+ }++ // R-WAR-008, R-WAR-006: a card refused early comes back after two full quiet turns, still before its `from`, with its+ // early text again.+ [Fact]+ public void R_WAR_008_AnEarlyRefusalReturnsEarlyWithTheEarlyText()+ {+ var c = LoadEarly();+ var s = CombatTests.With(c, new Unit(1, "recruit", 0, 1, side: "israel", strength: 6));+ s.Date = December15;+ s.QuietTurns["jordan"] = 5;+ s.FiredEvents.Add("armistice_egypt");+ s.ChosenOptions["armistice_egypt"] = "sign";+ Assert.Equal(new[] { "armistice_jordan" }, Fire(c, s));+ var e = c.Events.Single(x => x.Id == "armistice_jordan");+ Assert.Equal(Filled(c, s, Early), EventSystem.Render(c, s, e));++ s = Turn(c, s, new ChooseEventOption("armistice_jordan", "hold_out"));+ s = Turn(c, s);+ s = Turn(c, s);+ Assert.Equal(new[] { "armistice_jordan" }, s.PendingEvents);+ Assert.True(s.Date < e.From);+ Assert.Equal(Filled(c, s, Early), EventSystem.Render(c, s, e));+ }++ // R-WAR-008 is gdd-0.3 only: under gdd-0.1 the card never comes before its `from`, so its early text is never shown.+ [Fact]+ public void Gdd01NeverShowsTheEarlyText()+ {+ var c = LoadEarly(SaveGame.GddRuleset);+ Assert.Empty(Fire(c, At(c, December15, 5, 5)));+ var s = At(c, new DateTime(1949, 12, 15), 5, 5);+ Assert.Equal(new[] { "armistice_egypt" }, Fire(c, s));+ Assert.Equal(Filled(c, s, "Israel decides whether to sign."), EventSystem.Render(c, s, c.Events.Single(x => x.Id == "armistice_egypt")));+ }++ // The loader (R-WAR-008): early text only on a `front_quiet` card, the only kind the quiet path can show before its+ // `from` (so EventSystem.ShowsEarly, which reads the date alone, never fires on a card that is never early); its Hebrew+ // exactly when the card has Hebrew, in Hebrew letters; its placeholders held from the first early offer+ // (Armistice.EarliestOffer, 15 December 1948), not only from the card's `from`.+ [Theory]+ [InlineData("no_front_quiet", "early_text", "front_quiet")]+ [InlineData("he_without_en", "early_text", "required: early_text_he is set but early_text is not")]+ [InlineData("he_missing", "early_text_he", "required: the card's text is in Hebrew too")]+ [InlineData("he_not_hebrew", "early_text_he", "must be Hebrew")]+ [InlineData("he_on_english_card", "early_text_he", "only a card with Hebrew text has early_text_he")]+ [InlineData("office_gap", "early_text", "has no holder on 1948-12-15")]+ public void TheLoaderRefusesAMisplacedOrIncompleteEarlyText(string fault, string field, string message)+ {+ var f = Gdd03MovementFortTests.Files();+ var card = Card("jordan", "1950-01-01");+ const string hebrew = "title_he: שביתת נשק עם ירדן\ntext_he: 'ישראל מחליטה אם לחתום.'\n";+ card = fault switch+ {+ "no_front_quiet" => WithEarly(card).Replace("front_quiet: jordan\n", ""),+ "he_without_en" => card.Replace("office: prime_minister", $"early_text_he: '{EarlyHe}'\noffice: prime_minister"),+ "he_missing" => WithHebrew(WithEarly(card)),+ "he_not_hebrew" => WithHebrew(WithEarly(card)).Replace("office: prime_minister", "early_text_he: 'Not Hebrew {prime_minister}.'\noffice: prime_minister"),+ "he_on_english_card" => WithEarly(card).Replace("office: prime_minister", $"early_text_he: '{EarlyHe}'\noffice: prime_minister"),+ "office_gap" => WithEarly(card, "The talks came sooner. {finance_minister} must decide."),+ _ => throw new ArgumentException(fault),+ };+ if (fault == "office_gap") // a holder from 1949-01-01 only: inside the early window, before the card's `from`+ f["people.yaml"] = Fixture.Files["people.yaml"].Replace(" - office: finance_minister\n from: 1948-05-14", " - office: finance_minister\n from: 1949-01-01");+ f["events/armistice_jordan.yaml"] = card;+ var ex = Assert.Throws<ContentException>(() => ContentLoader.Load(Fixture.Write(f)));+ Assert.Equal($"events[armistice_jordan].{field}", ex.Field);+ Assert.Contains(message, ex.Message);++ static string WithHebrew(string yaml) => yaml.Replace("office: prime_minister", hebrew + "office: prime_minister")+ .Replace(" text: Sign the armistice\n", " text: Sign the armistice\n text_he: לחתום על שביתת הנשק\n")+ .Replace(" text: Refuse and keep fighting\n", " text: Refuse and keep fighting\n text_he: לסרב ולהמשיך להילחם\n");+ }++ // The same card with every early-text rule met loads: the guard on each refusal above is the fault, not the shape.+ [Fact]+ public void TheLoaderTakesAFrontQuietCardWithItsEarlyTextInBothLanguages()+ {+ var f = Gdd03MovementFortTests.Files();+ f["events/armistice_jordan.yaml"] = WithEarly(Card("jordan", "1950-01-01")).Replace("office: prime_minister",+ $"title_he: שביתת נשק עם ירדן\ntext_he: 'ישראל מחליטה אם לחתום.'\nearly_text_he: '{EarlyHe}'\noffice: prime_minister")+ .Replace(" text: Sign the armistice\n", " text: Sign the armistice\n text_he: לחתום על שביתת הנשק\n")+ .Replace(" text: Refuse and keep fighting\n", " text: Refuse and keep fighting\n text_he: לסרב ולהמשיך להילחם\n");+ var c = ContentLoader.Load(Fixture.Write(f));+ // The Hebrew overlay (#1618) carries it: the snapshot writes it, and a cleared card gets it back from the set.+ var events = Translations.Write(HebrewOverlay.Snapshot(c)).Events;+ Assert.Contains("early_text: \"" + EarlyHe + "\"", events);+ HebrewOverlay.Clear(c);+ Assert.DoesNotContain("early_text", Translations.Write(HebrewOverlay.Snapshot(c)).Events);+ HebrewOverlay.Apply(c, Translations.Parse(Translations.Hebrew, null, events, null));+ Assert.Equal(events, Translations.Write(HebrewOverlay.Snapshot(c)).Events);+ }+// The loader: `front_quiet` names one of Prisoners.Fronts, and only on that front's own card (armistice_<front>), whose// refusal resets that front's count (R-WAR-006).[Theory]diff --git a/sim/Statecraft.Sim.Tests/translations_fixture/content/events/e_early.yaml b/sim/Statecraft.Sim.Tests/translations_fixture/content/events/e_early.yamlnew file mode 100644index 000000000..812a73420--- /dev/null+++ b/sim/Statecraft.Sim.Tests/translations_fixture/content/events/e_early.yaml@@ -0,0 +1,14 @@+id: early+title: Early+text: Sooner.+title_he: מוקדם+text_he: מוקדם יותר.+early_text: Sooner than in history.+early_text_he: מוקדם יותר מאשר בהיסטוריה.+front_quiet: egypt+from: 1949-01-01+options:+ - id: sign+ text: Sign+ text_he: לחתום+status: draftdiff --git a/sim/Statecraft.Sim.Tests/translations_fixture/expected/he/events.yaml b/sim/Statecraft.Sim.Tests/translations_fixture/expected/he/events.yamlindex eb2be7c75..e9503da04 100644--- a/sim/Statecraft.Sim.Tests/translations_fixture/expected/he/events.yaml+++ b/sim/Statecraft.Sim.Tests/translations_fixture/expected/he/events.yaml@@ -17,3 +17,9 @@ late:late_text: "מאוחר עוד יותר."options:continue: "להמשיך"+early:+ title: "מוקדם"+ text: "מוקדם יותר."+ early_text: "מוקדם יותר מאשר בהיסטוריה."+ options:+ sign: "לחתום"diff --git a/sim/Statecraft.Sim/Content.cs b/sim/Statecraft.Sim/Content.csindex 6b7048097..dc102e8b9 100644--- a/sim/Statecraft.Sim/Content.cs+++ b/sim/Statecraft.Sim/Content.cs@@ -1252,6 +1252,13 @@ namespace Statecraft.Sim/// an operation shown again while it waits), so its dates do not mislead. "" for none.</summary>public string LateText { get; set; } = "";public string LateTextHe { get; set; } = "";+ /// <summary>R-WAR-008 (#1709; owner, 9 November 2026: "Separate early text (Recommended)", then "Banner (Recommended)"+ /// and "Ordinary text (Recommended)"): on a front_quiet armistice card only, the card's text, and its Hebrew, when it is+ /// shown before its `from` (<see cref="EventSystem.ShowsEarly"/>): the talks came sooner than in history. The card is+ /// then marked as an alternative course, and the shareable build needs a person's sign-off of it (R-ALT-011). "" for+ /// none.</summary>+ public string EarlyText { get; set; } = "";+ public string EarlyTextHe { get; set; } = "";/// <summary>The place among the same turn's cards of the same `from` (R-EVT-006): a lower order comes first, before/// the id decides. Default 0; degania_defence has 1, so One Army opens the game (owner, 24 October 2026, #1568).</summary>public int Order { get; set; }diff --git a/sim/Statecraft.Sim/ContentLoader.cs b/sim/Statecraft.Sim/ContentLoader.csindex d6fe2340d..d11f7b20a 100644--- a/sim/Statecraft.Sim/ContentLoader.cs+++ b/sim/Statecraft.Sim/ContentLoader.cs@@ -459,6 +459,8 @@ namespace Statecraft.Sim// has exactly one option (R-EVT-007)// front_quiet the front (Prisoners.Fronts) of an armistice_<front> card: under gdd-0.3 it may also// come early, and again after a refusal, once that front is quiet (R-WAR-008)+ // early_text, early_text_he on a front_quiet card only: its text, and its Hebrew, when it is shown before its+ // `from` (R-WAR-008, #1709); a what-if, so it needs a reviewed_by (R-ALT-011)// armistice_front a front (Prisoners.Fronts) whose signed armistice ends the card: a pending// operation lapses once it is signed, and a card with it never first fires after// it (R-ENEMY-007); on an operation card or a following card onlydiff --git a/sim/Statecraft.Sim/EventRules.cs b/sim/Statecraft.Sim/EventRules.csindex 5a2b3d278..5861def55 100644--- a/sim/Statecraft.Sim/EventRules.cs+++ b/sim/Statecraft.Sim/EventRules.cs@@ -69,6 +69,25 @@ namespace Statecraft.SimCheckPlaceholders(c, e, F("late_text_he"), e.LateTextHe, offices);}}+ // R-WAR-008 (#1709; owner, 9 November 2026: "Separate early text (Recommended)"): early text, only on a+ // front_quiet card, the only kind the quiet path can show before its `from` (so EventSystem.ShowsEarly, which reads+ // the date alone, never shows it on another card), in Hebrew exactly when the card's text is. It can be shown from+ // the first early offer (Armistice.EarliestOffer), so its office placeholders must have a holder from then.+ if (e.EarlyText != "" || e.EarlyTextHe != "")+ {+ if (e.FrontQuiet == "")+ throw new ContentException(e.File, F("early_text"), "only an armistice card with front_quiet, which can be shown before its `from`, has early text");+ if (e.EarlyText.Trim() == "") throw new ContentException(e.File, F("early_text"), "required: early_text_he is set but early_text is not");+ var earliest = Armistice.EarliestOffer < e.From ? Armistice.EarliestOffer : e.From;+ CheckPlaceholders(c, e, F("early_text"), e.EarlyText, offices, earliest);+ if (e.TextHe == "" && e.EarlyTextHe != "") throw new ContentException(e.File, F("early_text_he"), "only a card with Hebrew text has early_text_he");+ if (e.TextHe != "")+ {+ if (e.EarlyTextHe == "") throw new ContentException(e.File, F("early_text_he"), "required: the card's text is in Hebrew too");+ if (!e.EarlyTextHe.Any(ch => ch >= '\u05D0' && ch <= '\u05EA')) throw new ContentException(e.File, F("early_text_he"), "must be Hebrew, in Hebrew letters");+ CheckPlaceholders(c, e, F("early_text_he"), e.EarlyTextHe, offices, earliest);+ }+ }// Chapters design 3.2: an event may only name model records that are active for its whole window.void Active(string field, string id){@@ -543,7 +562,10 @@ namespace Statecraft.Sim}}- static void CheckPlaceholders(Content c, GameEvent e, string field, string text, HashSet<string> offices)+ /// <summary>Each office placeholder in <paramref name="text"/> names a known, single-holder office with a holder on every+ /// day the text can be shown: the event's window, from <paramref name="from"/> when given (an early text, R-WAR-008),+ /// else from the event's own `from`.</summary>+ static void CheckPlaceholders(Content c, GameEvent e, string field, string text, HashSet<string> offices, DateTime? from = null){if (Offices.Placeholder.Replace(text, "").IndexOfAny(new[] { '{', '}' }) >= 0)throw new ContentException(e.File, field, "stray '{' or '}' outside an {office_id} placeholder");@@ -553,7 +575,7 @@ namespace Statecraft.Simif (!offices.Contains(office)) throw new ContentException(e.File, field, $"unknown office placeholder '{m.Value}'");if (c.Offices.Any(o => o.Id == office && o.SeveralHolders))throw new ContentException(e.File, field, $"office '{office}' can have several holders at once, so '{m.Value}' would not name one person");- var gap = FirstUncovered(c, office, e.From, e.To);+ var gap = FirstUncovered(c, office, from ?? e.From, e.To);if (gap.HasValue)throw new ContentException(e.File, field, FormattableString.Invariant($"office '{office}' has no holder on {gap.Value:yyyy-MM-dd}, inside the event window"));}diff --git a/sim/Statecraft.Sim/EventSystem.cs b/sim/Statecraft.Sim/EventSystem.csindex 47991303b..a5f4556ab 100644--- a/sim/Statecraft.Sim/EventSystem.cs+++ b/sim/Statecraft.Sim/EventSystem.cs@@ -644,10 +644,19 @@ namespace Statecraft.Sim/// <summary>Event text as the player sees it now: a matching variant's, with names following the player's appointments.</summary>public static string Render(Content c, GameState s, GameEvent e) =>- Cabinet.Fill(c, s, Timeline.Variant(c, s, e)?.Text ?? (ShowsLate(e, s.Date) ? e.LateText : e.Text), FillDate(e, s.Date));+ Cabinet.Fill(c, s, Timeline.Variant(c, s, e)?.Text+ ?? (ShowsEarly(e, s.Date) ? e.EarlyText : ShowsLate(e, s.Date) ? e.LateText : e.Text), FillDate(e, s.Date));/// <summary>R-ENEMY-007 ("Dateless variants (Recommended)"): whether <paramref name="e"/>, shown on <paramref name="date"/>,/// shows its late text: it has one, and its own window has closed. A road variant (R-ALT-010) still comes first.</summary>public static bool ShowsLate(GameEvent e, DateTime date) => e.LateText != "" && e.To.HasValue && date >= e.To.Value;++ /// <summary>R-WAR-008 (#1709; owner, 9 November 2026: "Separate early text (Recommended)", "Ordinary text+ /// (Recommended)"): whether <paramref name="e"/>, shown on <paramref name="date"/>, shows its early text: it has one, and+ /// it is shown before its `from`. The loader allows an early text only on a front_quiet card, which only the quiet path+ /// shows before its `from` (gdd-0.3, Armistice.MayOfferEarly), and a card is shown on the date it fired (it is answered+ /// or delegated before the date moves), so the date alone tells the early path: no saved state. A card refused and+ /// brought back on or after its `from` shows its ordinary text. A road variant (R-ALT-010) still comes first.</summary>+ public static bool ShowsEarly(GameEvent e, DateTime date) => e.EarlyText != "" && date < e.From;}}diff --git a/sim/Statecraft.Sim/HebrewOverlay.cs b/sim/Statecraft.Sim/HebrewOverlay.csindex 1d2299c88..f82222ae2 100644--- a/sim/Statecraft.Sim/HebrewOverlay.cs+++ b/sim/Statecraft.Sim/HebrewOverlay.cs@@ -58,7 +58,7 @@ namespace Statecraft.Simpublic static IEnumerable<(Type Type, string Property)> Covered =>Bindings.Select(b => (b.Value.DeclaringType!, b.Value.Name)).Concat(new[] { (typeof(GameEvent), nameof(GameEvent.TitleHe)), (typeof(GameEvent), nameof(GameEvent.TextHe)),- (typeof(GameEvent), nameof(GameEvent.LateTextHe)),+ (typeof(GameEvent), nameof(GameEvent.LateTextHe)), (typeof(GameEvent), nameof(GameEvent.EarlyTextHe)),(typeof(EventOption), nameof(EventOption.TextHe)) });/// <summary>The Hebrew the typed records hold, as a translation set (no UI strings: those are not content).</summary>@@ -69,7 +69,7 @@ namespace Statecraft.Simif (e.TitleHe != "")set.Events.Add(new EventTranslation{- Id = e.Id, Title = e.TitleHe, Text = e.TextHe, LateText = e.LateTextHe, Review = e.TextHeReview,+ Id = e.Id, Title = e.TitleHe, Text = e.TextHe, LateText = e.LateTextHe, EarlyText = e.EarlyTextHe, Review = e.TextHeReview,Options = e.Options.Where(o => o.TextHe != "").Select(o => new KeyValuePair<string, string>(o.Id, o.TextHe)).ToList(),});foreach (var b in Bindings)@@ -91,7 +91,7 @@ namespace Statecraft.Sim{foreach (var e in c.Events){- e.TitleHe = ""; e.TextHe = ""; e.LateTextHe = ""; e.TextHeReview = "";+ e.TitleHe = ""; e.TextHe = ""; e.LateTextHe = ""; e.EarlyTextHe = ""; e.TextHeReview = "";foreach (var o in e.Options) o.TextHe = "";}foreach (var b in Bindings)@@ -112,7 +112,7 @@ namespace Statecraft.Sim{var e = c.Events.FirstOrDefault(x => x.Id == t.Id)?? throw new ContentException(file + Translations.EventsFile, t.Id, "no event has this id");- e.TitleHe = t.Title; e.TextHe = t.Text; e.LateTextHe = t.LateText;+ e.TitleHe = t.Title; e.TextHe = t.Text; e.LateTextHe = t.LateText; e.EarlyTextHe = t.EarlyText;if (t.Review != "") e.TextHeReview = t.Review;foreach (var o in t.Options)(e.Options.FirstOrDefault(x => x.Id == o.Key)diff --git a/sim/Statecraft.Sim/ReleaseGate.cs b/sim/Statecraft.Sim/ReleaseGate.csindex d3588c273..877d90a5a 100644--- a/sim/Statecraft.Sim/ReleaseGate.cs+++ b/sim/Statecraft.Sim/ReleaseGate.cs@@ -21,10 +21,11 @@ namespace Statecraft.Simc.Events.Where(e => e.Tags.Any(EventRules.SensitiveTags.Contains) && e.Status != ReviewedStatus).Select(e => e.Id).OrderBy(x => x, StringComparer.Ordinal).ToList();- /// <summary>R-ALT-011 (Q-ALT-9): every consequence card and every event with variants that no person has signed off- /// (no reviewed_by), in id order. A shareable build refuses while it is not empty.</summary>+ /// <summary>R-ALT-011 (Q-ALT-9): every consequence card, every event with variants and (R-WAR-008, #1709; owner,+ /// 9 November 2026: "Separate early text (Recommended)") every armistice card with an early text that no person has+ /// signed off (no reviewed_by), in id order. A shareable build refuses while it is not empty.</summary>public static IReadOnlyList<string> AlternateUnsigned(Content c) =>- c.Events.Where(e => (e.Kind == EventKinds.Consequence || e.Variants.Count > 0) && e.ReviewedBy == "")+ c.Events.Where(e => (e.Kind == EventKinds.Consequence || e.Variants.Count > 0 || e.EarlyText != "") && e.ReviewedBy == "").Select(e => e.Id).OrderBy(x => x, StringComparer.Ordinal).ToList();/// <summary>R-UNIT-006, Q-START-3 (owner, 15 October 2026; #743, owner, 20 October 2026): the units_1948.yaml rows adiff --git a/sim/Statecraft.Sim/Translations.cs b/sim/Statecraft.Sim/Translations.csindex 074d822c2..f1a14b725 100644--- a/sim/Statecraft.Sim/Translations.cs+++ b/sim/Statecraft.Sim/Translations.cs@@ -51,6 +51,8 @@ namespace Statecraft.Simpublic string Text { get; set; } = "";/// <summary>The card's late text (R-ENEMY-007, the event's late_text_he), or "" for none.</summary>public string LateText { get; set; } = "";+ /// <summary>The card's early text (R-WAR-008, #1709; the event's early_text_he), or "" for none.</summary>+ public string EarlyText { get; set; } = "";/// <summary>Option id and text, in the event file's order.</summary>public List<KeyValuePair<string, string>> Options { get; set; } = new List<KeyValuePair<string, string>>();/// <summary><see cref="HebrewReview.AgentChecked"/> until a native speaker, or an AI-assisted contributor who@@ -145,7 +147,7 @@ namespace Statecraft.Sim{if (!Id.IsMatch(id)) throw new ContentException(Where(EventsFile), id, "not an event id");var map = Mapping(node, Where(EventsFile), id);- Only(map, Where(EventsFile), id, "title", "text", "late_text", "options", "review");+ Only(map, Where(EventsFile), id, "title", "text", "late_text", "early_text", "options", "review");var e = new EventTranslation{Id = id,@@ -154,6 +156,7 @@ namespace Statecraft.SimReview = Review(map, Where(EventsFile), id),};if (map.Children.TryGetValue(new YamlScalarNode("late_text"), out var late)) e.LateText = Text(late, Where(EventsFile), id + ".late_text");+ if (map.Children.TryGetValue(new YamlScalarNode("early_text"), out var early)) e.EarlyText = Text(early, Where(EventsFile), id + ".early_text");foreach (var (oid, text) in Entries(Mapping(Get(map, "options", Where(EventsFile), id), Where(EventsFile), id + ".options"),Where(EventsFile))){@@ -306,6 +309,7 @@ namespace Statecraft.Simevents.Append(" title: ").Append(Json(e.Title)).Append('\n');events.Append(" text: ").Append(Json(e.Text)).Append('\n');if (e.LateText != "") events.Append(" late_text: ").Append(Json(e.LateText)).Append('\n');+ if (e.EarlyText != "") events.Append(" early_text: ").Append(Json(e.EarlyText)).Append('\n');events.Append(" options:\n");foreach (var o in e.Options) events.Append(" ").Append(Key(o.Key)).Append(": ").Append(Json(o.Value)).Append('\n');if (e.Review != "") events.Append(" review: ").Append(Json(e.Review)).Append('\n');@@ -415,6 +419,7 @@ namespace Statecraft.Simvar t = new EventTranslation { Id = id, Title = StringOf(e, "title_he")!, Text = StringOf(e, "text_he") ?? "" };if (!string.IsNullOrEmpty(StringOf(e, "text_he_review"))) t.Review = StringOf(e, "text_he_review")!;if (!string.IsNullOrEmpty(StringOf(e, "late_text_he"))) t.LateText = StringOf(e, "late_text_he")!;+ if (!string.IsNullOrEmpty(StringOf(e, "early_text_he"))) t.EarlyText = StringOf(e, "early_text_he")!;if (Value(e, "options") is YamlSequenceNode options)foreach (var o in options.Children.OfType<YamlMappingNode>())if (StringOf(o, "id") is string oid && !string.IsNullOrEmpty(StringOf(o, "text_he")))diff --git a/tools/tests/test_translate.py b/tools/tests/test_translate.pyindex fc9ff6e75..291d6f659 100644--- a/tools/tests/test_translate.py+++ b/tools/tests/test_translate.py@@ -123,6 +123,30 @@ def test_a_late_text_gets_its_hebrew_after_it_and_is_part_of_the_event():assert cleared == LATE+EARLY = EVENT.replace("anchor: soft\n", "anchor: soft\n# The early text's comment.\nearly_text: 'Sooner than in history: {prime_minister} asks: vote now?'\n")+++def test_an_early_text_gets_its_hebrew_after_it_and_is_part_of_the_event():+ """R-WAR-008 (#1709, owner, 9 November 2026: "Separate early text (Recommended)"): early_text_he sits under+ early_text, and EventRules wants it exactly when the event has Hebrew."""+ early_he = "מוקדם יותר מאשר בהיסטוריה: {prime_minister} שואל: להצביע עכשיו?"+ out, _ = translate.set_event(EARLY, changes(early_text_he=early_he))+ lines = out.split("\n")+ assert lines[lines.index("early_text: 'Sooner than in history: {prime_minister} asks: vote now?'") + 1] == \+ f"early_text_he: {translate._scalar(early_he)}"+ assert yaml12.load(out)["early_text_he"] == early_he+ assert [line for line in EARLY.split("\n") if line not in lines] == []+ with pytest.raises(translate.Refused, match="all or none"):+ translate.set_event(EARLY, changes())+ with pytest.raises(translate.Refused, match="early text"):+ translate.set_event(EVENT, changes(early_text_he=early_he))+ with pytest.raises(translate.Refused, match="placeholders"):+ translate.set_event(EARLY, changes(early_text_he="מוקדם יותר מאשר בהיסטוריה"))+ cleared, _ = translate.set_event(out, changes(title_he="", text_he="", early_text_he="",+ options={"yes_vote": "", "wait": ""}))+ assert cleared == EARLY++UI_EN = 'a.one: "One {0}"\na.two: "Two"\nb.three: "Three"\n'UI_HE = '# Hebrew.\na.one: "אחד {0}"\nb.three: "שלוש"\n'@@ -241,6 +265,33 @@ def test_a_late_text_has_its_row_in_every_language(langs):"review": "agent-checked"}assert translate.load("fr")[0]["event:rhodes_talks:late_text"] == "Plus tard, {foreign_minister} décide."+def test_an_early_text_has_its_row_in_every_language(langs, tmp_path, monkeypatch):+ """R-WAR-008 (#1709): the early text's row, as the late text's above. No real card has one yet (the four armistice+ texts wait for the owner's approval and sign-off), so a fixture event in a temporary events folder stands in."""+ events = tmp_path / "events"+ events.mkdir()+ early = EARLY.replace("id: sample", "id: early_sample")+ he = translate.set_event(early, changes(early_text_he="מוקדם יותר מאשר בהיסטוריה: {prime_minister} שואל: להצביע עכשיו?"))[0]+ (events / "early_sample.yaml").write_text(he, encoding="utf-8")+ monkeypatch.setattr(translate, "EVENTS", events)+ r = rows()+ assert r["event:early_sample:early_text"]["en"].startswith("Sooner than in history")+ assert r["event:early_sample:early_text"]["unit"] == "event:early_sample"+ texts, _ = translate.load("he")+ assert texts["event:early_sample:early_text"].startswith("מוקדם יותר מאשר בהיסטוריה")+ edits = {"event:early_sample:title": "Le vote", "event:early_sample:text": "{prime_minister} demande.",+ "event:early_sample:option:yes_vote": "Voter", "event:early_sample:option:wait": "Attendre {foreign_minister}"}+ assert "all or none" in translate.save("fr", edits, {})["errors"]["event:early_sample"]+ sooner = {"event:early_sample:early_text": "Plus tôt, {prime_minister} demande."}+ assert translate.save("fr", {**edits, **sooner}, {})["errors"] == {}+ saved = yaml12.load((langs / "fr/events.yaml").read_text(encoding="utf-8"))+ assert saved["early_sample"] == {"title": "Le vote", "text": "{prime_minister} demande.",+ "early_text": "Plus tôt, {prime_minister} demande.",+ "options": {"yes_vote": "Voter", "wait": "Attendre {foreign_minister}"},+ "review": "agent-checked"}+ assert translate.load("fr")[0]["event:early_sample:early_text"] == "Plus tôt, {prime_minister} demande."++FR = {"event:altalena:title": "L'Altalena", "event:altalena:text": "{defense_minister} décide.","event:altalena:option:enforce": "Imposer", "event:altalena:option:compromise": "Céder"}diff --git a/tools/translate.py b/tools/translate.pyindex 5ca460fbe..a93f402fc 100644--- a/tools/translate.py+++ b/tools/translate.py@@ -8,7 +8,7 @@ the translation on the right.Usage: uv run tools/translate.py [--port 8765] [--no-open] (serves http://127.0.0.1:PORT; Ctrl+C stops it)-Hebrew is written where the game reads it: the events' title_he / text_he / late_text_he / options' text_he (#1064) and+Hebrew is written where the game reads it: the events' title_he / text_he / late_text_he / early_text_he / options' text_he (#1064) andunity/Assets/UI/strings.he.yaml (#12), changing only the edited lines so comments and layout stay. Hebrew content namesare shown but not edited here: they carry their own sources. Any other language is written totranslations/<lang>/{events,ui,content}.yaml, which the game does not read yet. Every language keeps the Hebrew rules@@ -162,8 +162,8 @@ def _put(lines: list[str], key: str, value: str, indent: int, after: int, lo: indef set_event(text: str, changes: dict) -> tuple[str, list[str]]:- """changes: title_he, text_he, late_text_he (optional), options {id: text_he}, native_read. Returns the new file text- and its warnings."""+ """changes: title_he, text_he, late_text_he and early_text_he (optional), options {id: text_he}, native_read. Returns+ the new file text and its warnings."""data = yaml12.load(text)options = {o["id"]: o for o in data.get("options") or []}if set(changes["options"]) - set(options):@@ -172,9 +172,14 @@ def set_event(text: str, changes: dict) -> tuple[str, list[str]]:has_late = isinstance(data.get("late_text"), str)if late_he and not has_late:raise Refused("a late text in Hebrew needs the event's late_text (R-ENEMY-007)")+ early_he = changes.get("early_text_he", "").strip()+ has_early = isinstance(data.get("early_text"), str)+ if early_he and not has_early:+ raise Refused("an early text in Hebrew needs the event's early_text (R-WAR-008)")fields = [("title", "title_he", changes["title_he"].strip(), data.get("title", "")),("text", "text_he", changes["text_he"].strip(), data.get("text", ""))]fields += [("late text", "late_text_he", late_he, data["late_text"])] if has_late else []+ fields += [("early text", "early_text_he", early_he, data["early_text"])] if has_early else []fields += [(f"option {oid}", oid, changes["options"].get(oid, "").strip(), o.get("text", ""))for oid, o in options.items()]warnings = check_unit([(name, v, en) for name, _, v, en in fields], hebrew=True)@@ -185,9 +190,10 @@ def set_event(text: str, changes: dict) -> tuple[str, list[str]]:title_he, text_he = fields[0][2], fields[1][2]review = REVIEW if filled and not changes.get("native_read") else ""keys = (("title_he", title_he), ("text_he", text_he), ("text_he_review", review)) + \- ((("late_text_he", late_he),) if has_late else ())+ ((("late_text_he", late_he),) if has_late else ()) + ((("early_text_he", early_he),) if has_early else ())for key, value in keys:- prev = {"title_he": "text", "text_he": "title_he", "text_he_review": "text_he", "late_text_he": "late_text"}[key]+ prev = {"title_he": "text", "text_he": "title_he", "text_he_review": "text_he", "late_text_he": "late_text",+ "early_text_he": "early_text"}[key]after = _find(lines, prev, 0)_put(lines, key, value, 0, _find(lines, "text", 0) if after is None else after)expected.pop(key, None)@@ -233,8 +239,8 @@ def check_unit(fields: list[tuple[str, str, str]], hebrew: bool) -> list[str]:"""fields: (name, value, English) of one event. All or none, then each value's own checks; returns the warnings."""filled = [f for f in fields if f[1]]if filled and len(filled) != len(fields):- raise Refused("all or none: the title, the body, the late text when the event has one, and every option's text "- "(docs/WRITING_EVENTS.md)")+ raise Refused("all or none: the title, the body, the late and early texts when the event has them, and every "+ "option's text (docs/WRITING_EVENTS.md)")return [w for name, value, english in filled for w in _check(name, value, english, hebrew, event=True)]@@ -289,6 +295,8 @@ def catalog() -> list[dict]:rows.append({"key": f"{unit}:text", "label": "Body", "en": d.get("text", ""), **group})if isinstance(d.get("late_text"), str):rows.append({"key": f"{unit}:late_text", "label": "Late text", "en": d["late_text"], **group})+ if isinstance(d.get("early_text"), str):+ rows.append({"key": f"{unit}:early_text", "label": "Early text", "en": d["early_text"], **group})rows += [{"key": f"{unit}:option:{o['id']}", "label": f"Option · {o['id']}", "en": o.get("text", ""), **group}for o in d.get("options") or []]for k, v in _parse(UI_EN).items():@@ -337,6 +345,8 @@ def load(lang: str) -> tuple[dict[str, str], set[str]]:texts[f"{unit}:title"], texts[f"{unit}:text"] = d["title_he"], d.get("text_he", "")if d.get("late_text_he"):texts[f"{unit}:late_text"] = d["late_text_he"]+ if d.get("early_text_he"):+ texts[f"{unit}:early_text"] = d["early_text_he"]texts.update({f"{unit}:option:{o['id']}": o["text_he"] for o in d.get("options") or [] if o.get("text_he")})if d.get("text_he_review"):flagged.add(unit)@@ -349,7 +359,7 @@ def load(lang: str) -> tuple[dict[str, str], set[str]]:return texts, flaggedfor eid, e in _lang_data(lang, "events").items():unit = f"event:{eid}"- texts.update({f"{unit}:{k}": e[k] for k in ("title", "text", "late_text") if e.get(k)})+ texts.update({f"{unit}:{k}": e[k] for k in ("title", "text", "late_text", "early_text") if e.get(k)})texts.update({f"{unit}:option:{oid}": t for oid, t in (e.get("options") or {}).items() if t})if e.get("review"):flagged.add(unit)@@ -401,6 +411,8 @@ def inline_hebrew(content: Path, ui_en: Path, ui_he: Path) -> tuple[str, str, ste = {"title": d["title_he"], "text": d.get("text_he") if isinstance(d.get("text_he"), str) else ""}if isinstance(d.get("late_text_he"), str) and d["late_text_he"]:e["late_text"] = d["late_text_he"]+ if isinstance(d.get("early_text_he"), str) and d["early_text_he"]:+ e["early_text"] = d["early_text_he"]e |= {"options": {o["id"]: o["text_he"] for o in d.get("options") or []if isinstance(o, dict) and isinstance(o.get("id"), str) and isinstance(o.get("text_he"), str) and o["text_he"]}}if isinstance(d.get("text_he_review"), str) and d["text_he_review"]:@@ -485,6 +497,7 @@ def save(lang: str, edits: dict[str, str], native: dict[str, bool], dry: bool =path, d = events[unit[6:]]changes = {"title_he": new.get(f"{unit}:title", ""), "text_he": new.get(f"{unit}:text", ""),"late_text_he": new.get(f"{unit}:late_text", ""),+ "early_text_he": new.get(f"{unit}:early_text", ""),"native_read": read(unit),"options": {o["id"]: new.get(f"{unit}:option:{o['id']}", "") for o in d.get("options") or []}}try:@@ -502,10 +515,11 @@ def save(lang: str, edits: dict[str, str], native: dict[str, bool], dry: bool =for unit in units:eid, keys = unit[6:], [r["key"] for r in rows.values() if r["unit"] == unit]entry = {k: v for k, v in events.get(eid, {}).items()- if k not in ("title", "text", "late_text", "options", "review")}+ if k not in ("title", "text", "late_text", "early_text", "options", "review")}if new.get(f"{unit}:title"):late = {"late_text": new[f"{unit}:late_text"]} if f"{unit}:late_text" in keys else {}- entry = {"title": new[f"{unit}:title"], "text": new[f"{unit}:text"], **late,+ early = {"early_text": new[f"{unit}:early_text"]} if f"{unit}:early_text" in keys else {}+ entry = {"title": new[f"{unit}:title"], "text": new[f"{unit}:text"], **late, **early,"options": {k.split(":")[-1]: new[k] for k in keys if k.startswith(f"{unit}:option:")}, **entry}if not read(unit):entry["review"] = REVIEWdiff --git a/unity/Assets/Editor/Build.cs b/unity/Assets/Editor/Build.csindex 305d02804..806b614aa 100644--- a/unity/Assets/Editor/Build.cs+++ b/unity/Assets/Editor/Build.cs@@ -56,8 +56,9 @@ namespace Statecraft.Game.EditorTools/// <summary>Why a shareable build may not be made, or null: every event with a sensitive tag needs the owner's/// sensitivity review first (status sensitivity-reviewed; docs/m3-release.md, M3 final review I4), every consequence- /// card and event with variants needs a person's reviewed_by (ReleaseGate.AlternateUnsigned; R-ALT-011), every row the- /// starting forces come from must be fact-checked (ReleaseGate.StartingForcesUnchecked; R-UNIT-006), every settlement+ /// card, event with variants and armistice card with an early text (R-WAR-008) needs a person's reviewed_by+ /// (ReleaseGate.AlternateUnsigned; R-ALT-011), every row the starting forces come from must be fact-checked+ /// (ReleaseGate.StartingForcesUnchecked; R-UNIT-006), every settlement/// target row sensitivity-reviewed (ReleaseGate.SettlementTargetsUnchecked; Q-TGT-3 (b)), and so does every/// sensitive event photograph the build would carry (EventImageCatalog; docs/event-images.md), and every sensitive/// illustration clip (<paramref name="clips"/>, event-videos.yaml; docs/event-videos.md). Seediff --git a/unity/Assets/Scripts/UI/EventCardPresenter.cs b/unity/Assets/Scripts/UI/EventCardPresenter.csindex 00365e534..833f54c67 100644--- a/unity/Assets/Scripts/UI/EventCardPresenter.cs+++ b/unity/Assets/Scripts/UI/EventCardPresenter.cs@@ -294,13 +294,18 @@ namespace Statecraft.Game.UIvar variant = Timeline.Variant(c, s, e);string Local(string english, string he) => ContentNames.Fill(text, c, s, date, english, he);card.Q<Label>("event-title").text = Local(EventSystem.Title(c, s, e), variant == null || variant.Title == "" ? e.TitleHe : "");- var banner = card.Q<Label>("event-alt-banner"); // a consequence card's road (#954); none on any other card- banner.text = OriginLine(c, s, e, text);+ // A consequence card's road (#954), or an armistice card's early path (R-WAR-008, #1709; owner, 9 November 2026:+ // "Banner (Recommended)"): an alternative course either way. None on any other card.+ var early = variant == null && EventSystem.ShowsEarly(e, s.Date);+ var banner = card.Q<Label>("event-alt-banner");+ banner.text = early ? text["event.alt_early"] : OriginLine(c, s, e, text);banner.style.display = banner.text.Length == 0 ? DisplayStyle.None : DisplayStyle.Flex;var office = holder == null ? null : c.Offices.First(o => o.Id == e.Office);card.Q<Label>("event-office").text = holder == null ? "" : text.Format("event.office", ContentNames.Of(text, office!, holder, date), ContentNames.Of(text, holder));- // R-ENEMY-007: a card shown after its window closed shows its late text, in Hebrew its late_text_he.- card.Q<Label>("event-text").text = Local(EventSystem.Render(c, s, e), variant == null ? (EventSystem.ShowsLate(e, s.Date) ? e.LateTextHe : e.TextHe) : "");+ // R-ENEMY-007: a card shown after its window closed shows its late text, in Hebrew its late_text_he; R-WAR-008: one+ // shown before its `from` shows its early text, in Hebrew its early_text_he (EventSystem.Render picks the English).+ card.Q<Label>("event-text").text = Local(EventSystem.Render(c, s, e),+ variant != null ? "" : early ? e.EarlyTextHe : EventSystem.ShowsLate(e, s.Date) ? e.LateTextHe : e.TextHe);var objective = card.Q<Label>("event-objective"); // an objective card's line (#380); none on any other cardobjective.text = ObjectiveLine(c, s, e, text);objective.style.display = objective.text.Length == 0 ? DisplayStyle.None : DisplayStyle.Flex;diff --git a/unity/Assets/Tests/EditMode/EventCardTests.cs b/unity/Assets/Tests/EditMode/EventCardTests.csindex 62bf065ec..8b9cff6bf 100644--- a/unity/Assets/Tests/EditMode/EventCardTests.cs+++ b/unity/Assets/Tests/EditMode/EventCardTests.cs@@ -868,6 +868,52 @@ sources: [{ url: ""https://example.org/record"", checked: 2026-10-17 }]Assert.AreEqual("Alternative course. It follows the government's decision: Hold the course (After the road).", banner.text);}+ // R-WAR-008 (#1709; owner, 9 November 2026: "Separate early text (Recommended)", "Banner (Recommended)", "Ordinary text+ // (Recommended)"): an armistice card shown before its `from` shows its early text, in Hebrew its early_text_he, under+ // the event.alt_early banner; the same card on its date shows its ordinary text and no banner. The early texts here are+ // the test's, in memory: no real card has one until the owner approves and signs the four.+ [Test]+ public void AnEarlyArmisticeCardShowsItsEarlyTextUnderTheWhatIfBannerInBothLanguages()+ {+ const string earlyEn = "The talks came sooner in this test.";+ const string earlyHe = "השיחות הגיעו מוקדם יותר בבדיקה הזאת.";+ var c = ContentLoader.Load(Paths.Content);+ var e = c.Events.Single(x => x.Id == "armistice_egypt");+ Assert.AreEqual("", e.EarlyText, "precondition: the real card has no early text yet");+ e.EarlyText = earlyEn;+ e.EarlyTextHe = earlyHe;+ foreach (var local in new[] { Text, He })+ {+ var hebrew = local["ui.lang"] == UiLanguage.Hebrew;+ foreach (var early in new[] { true, false })+ {+ var g = GameSession.New(c, GoldenRun.Seed, Mode.Historical);+ g.State.Date = early ? new System.DateTime(1948, 12, 15) : e.From;+ g.State.PendingEvents.Clear(); g.State.PendingEvents.Add(e.Id);+ using var ui = new UiTestKit();+ using var card = new EventCardPresenter(ui.Root, new SimBridge(g, local), local, null);+ card.Render();+ var banner = ui.Q<Label>("event-alt-banner");+ var body = ui.Q<Label>("event-text").text;+ var where = $"{(hebrew ? "he" : "en")} early={early}";+ if (early)+ {+ Assert.AreEqual(DisplayStyle.Flex, banner.style.display.value, where);+ Assert.AreEqual(local["event.alt_early"], banner.text, where);+ StringAssert.StartsWith(hebrew ? "מסלול חלופי." : "Alternative course.", banner.text, where);+ Assert.AreEqual(hebrew ? earlyHe : earlyEn, body, where);+ }+ else+ {+ Assert.AreEqual(DisplayStyle.None, banner.style.display.value, where);+ Assert.AreEqual("", banner.text, where);+ StringAssert.DoesNotContain(hebrew ? earlyHe : earlyEn, body, where);+ StringAssert.Contains(hebrew ? "מצרים" : "Egypt", body, where);+ }+ }+ }+ }+[Test]public void AnOrdinaryCardHasNoBanner(){diff --git a/unity/Assets/UI/strings.en.yaml b/unity/Assets/UI/strings.en.yamlindex 4b636a30c..4d7c73f19 100644--- a/unity/Assets/UI/strings.en.yaml+++ b/unity/Assets/UI/strings.en.yaml@@ -270,6 +270,9 @@ event.objective_late_one: "Completed 1 month later than in history."# event.alt_origin_no_record. event.rejoin sits under an option that returns the course to the record (R-ALT-009).event.alt_origin: "Alternative course. It follows the government's decision: {0} ({1}). In the record: {2}."event.alt_origin_no_record: "Alternative course. It follows the government's decision: {0} ({1})."+# event.alt_early: the banner of an armistice card shown before its date, with its early text (R-WAR-008, #1709; owner,+# 9 November 2026: "Banner (Recommended)", these words).+event.alt_early: "Alternative course. These talks came sooner than in the record."event.rejoin: "Returns to the recorded course."# The capture dialog (GDD Phase 6 PR 10, #802; CaptureDialogPresenter). SENSITIVE: the owner reviews every line here, in# both languages, before any shareable build (plan 2026-10-15-gdd-phase-6.md, PR 10's gate). Q-UI-1 (b) (owner, 18 Octoberdiff --git a/unity/Assets/UI/strings.he.yaml b/unity/Assets/UI/strings.he.yamlindex 5841380d5..7064d1663 100644--- a/unity/Assets/UI/strings.he.yaml+++ b/unity/Assets/UI/strings.he.yaml@@ -315,6 +315,8 @@ event.objective_late_one: "הושלם באיחור של חודש אחד לעומ# A consequence card's banner and the rejoin line (#954). Native review: owner, 3 Nov 2026 (HE batch 2: "approved").event.alt_origin: "מסלול חלופי. הוא נובע מהחלטת הממשלה: {0} ({1}). בהיסטוריה: {2}."event.alt_origin_no_record: "מסלול חלופי. הוא נובע מהחלטת הממשלה: {0} ({1})."+# For the native reviewer (#564): agent-drafted, #1709; the owner approves the exact words ("You approve the words (Recommended)")+event.alt_early: "מסלול חלופי. השיחות האלה התקיימו מוקדם יותר מאשר בהיסטוריה."event.rejoin: "חוזר למסלול ההיסטורי."# The capture dialog (GDD Phase 6 PR 10, #802). SENSITIVE: the owner reviews every line before any shareable build.# Agent-drafted; all 17 keys below: native review: owner, 3 Nov 2026 (HE batch 2: "approved"), "שחרור" included.