A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
sim: the displacement tag, its no-gain rule and the release gate (R-EFX-007, R-GATE-001; refs #794) (#1070)
Eyal Golanf30d6cb372b4
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 798416845..c83db4e29 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -13,6 +13,8 @@ adds a line under **Unreleased**; CI's `Changelog` job checks this (see `CONTRIB- After End Turn, a short turn report names each top-bar number that changed, with the change the bar shows and its maincauses, the sim's own cause messages, and a link to the Why screen; hovering or tapping a top-bar number shows the sameexplanation under the bar. English and Hebrew; no rule or number is computed in the UI (refs #1037).+- The `displacement` event tag now has an absolute no-gain rule and blocks a shareable build until the event is+ sensitivity-reviewed (R-EFX-007, R-GATE-001; refs #794). No content uses the tag, so no golden moves.- The military unit record (GDD Phase 5 PR 2): a unit can hold a side, a strength and a standing order with its target,each written into the state hash only when set, so a halutz hashes as before and no golden moves. `unit_types.yaml`gains Israel's `veteran_soldier` (infantry), `artillery` and `armoured_car` (armour) with a `side` and a `class`; thediff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex e20830c89..429678145 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -57,7 +57,7 @@ Follow [docs/dev-setup.md](docs/dev-setup.md). In short:- **Every fact needs a source.** Every event, minister, office term, date and number in `content/` carries `sources:` with a URL and the date you checked it. A claim without a source can't be merged.- **No invented quotes.** Paraphrase, and never put words in a real person's mouth.- **Framing.** The project tells the story from the Israeli perspective. Contested narratives are not shown as parallel accounts.-- **Sensitive events.** Events tagged `holocaust`, `terror`, `massacre` or `war-casualties` need the maintainer's sensitivity review before they can ship. A release build refuses to package until that review is done.+- **Sensitive events.** Events tagged `holocaust`, `terror`, `massacre`, `war-casualties` or `displacement` need the maintainer's sensitivity review before they can ship. A release build refuses to package until that review is done.- **Reporting a mistake.** Use the **Historical accuracy** issue form; it asks for the source that shows the correct fact.## AI-assisted contributionsdiff --git a/content/schema/event.schema.json b/content/schema/event.schema.jsonindex 9c7bb72a8..87cc045be 100644--- a/content/schema/event.schema.json+++ b/content/schema/event.schema.json@@ -72,7 +72,7 @@"kind": { "enum": ["historical", "consequence", "reconvergence"], "description": "Default historical. consequence: a soft card that exists only on a road not taken (R-ALT-005 to R-ALT-008). reconvergence: a real outside event that may carry variants (R-ALT-010)." },"title": { "type": "string", "minLength": 1, "description": "May contain office placeholders such as {prime_minister}." },"text": { "type": "string", "minLength": 1, "description": "May contain office placeholders. No invented quotes." },- "tags": { "type": "array", "items": { "type": "string" }, "description": "holocaust, terror, massacre and war-casualties are sensitive." },+ "tags": { "type": "array", "items": { "type": "string" }, "description": "holocaust, terror, massacre, war-casualties and displacement are sensitive. A displacement option cannot raise Money, Food, Arms, Social cohesion, International Support or score (R-EFX-007), and the event must be sensitivity-reviewed before release (R-GATE-001)." },"anchor": { "enum": ["hard", "soft"], "description": "Default soft. A hard anchor needs a historical option." },"office": { "$ref": "#/definitions/id", "description": "The office the event goes to when the player does not answer." },"objective": { "$ref": "#/definitions/id", "description": "The objective (objectives.yaml) whose completion card this is. It fires only once that objective is completed, and has exactly one option." },diff --git a/docs/WRITING_EVENTS.md b/docs/WRITING_EVENTS.mdindex a9987aaf6..b7471d611 100644--- a/docs/WRITING_EVENTS.md+++ b/docs/WRITING_EVENTS.md@@ -32,7 +32,7 @@ schema too, or that test fails. Keep the comment when you copy a file.| `title` | yes | The card title. May contain office placeholders. || `text` | yes | The card body. May contain office placeholders. || `anchor` | no (default `soft`) | `hard` or `soft`. See below. |-| `tags` | no | A list of free-form labels. Four are sensitive. See below. |+| `tags` | no | A list of free-form labels. Five are sensitive. See below. || `office` | no | The office id of the minister the event goes to when the player does not answer it. || `from` | yes | First day of the window, `YYYY-MM-DD`. || `to` | no | Day the window ends (exclusive). Must be after `from`. Leave it out for an open window. |@@ -75,8 +75,8 @@ Write plain description. Do not put words in anyone's mouth: no invented quotes### tags and the sensitive review-Tags are free-form, but these four are sensitive (checked without regard to case): `holocaust`, `terror`, `massacre`,-`war-casualties`. An event with any of them:+Tags are free-form, but these five are sensitive (checked without regard to case): `holocaust`, `terror`, `massacre`,+`war-casualties`, `displacement`. An event with any of them:- cannot give a positive delta to any resource in any option: `treasury`, `fx_reserves`, `food`, `food_supply`, `morale`(standing for Social cohesion) or `intl_standing` (standing for International Support). The loader refuses: it would@@ -86,6 +86,11 @@ Tags are free-form, but these four are sensitive (checked without regard to caserefuse to release while any sensitive event is not `sensitivity-reviewed`, and a test requires every sensitive eventin `content/` to carry exactly that status once reviewed.+For `displacement`, the no-gain rule has no exception: no option may raise Money, Food, Arms, Social cohesion,+International Support or score (R-EFX-007). Arms and score are not event-effect targets yet, so the loader already+refuses them as unknown; do not add either target to an event. The rule applies when those targets exist. No event in+`content/` uses `displacement` yet.+The other tag used so far is `security`. It has no rule attached.### officediff --git a/docs/rules/mvp.md b/docs/rules/mvp.mdindex edab36579..5840d2465 100644--- a/docs/rules/mvp.md+++ b/docs/rules/mvp.md@@ -194,7 +194,9 @@ R-NAT-004: "Low international support" (`low_intl_support`) is a situation on `iR-EFX-001: An option's effect may target an indicator id from `model.yaml`, `treasury` or `fx_reserves` (game money), or `food`, the national Food stock: the effect moves the stock by whole units (the delta rounds half away from zero) and the stock never drops below 0, so a cut larger than the stock applies only to what is there. Any other target is a load error naming file and field. The Arms stock becomes a target with its pool (#781).-R-EFX-002: An option of an event tagged `holocaust`, `terror`, `massacre` or `war-casualties` cannot raise `treasury`, `fx_reserves`, `food`, `food_supply`, `morale` or `intl_standing` (Q-EFX-2, decided 15 October 2026: the no-gain rule covers all five resources, with the legacy indicators standing for Food, Social cohesion and International Support; `food` is Food's own target, and Arms joins the rule with its pool, #781). A cost stays allowed. The rule for the Phase 6 `displacement` tag is Q-DEP-6 (open).+R-EFX-002: An option of an event tagged `holocaust`, `terror`, `massacre` or `war-casualties` cannot raise `treasury`, `fx_reserves`, `food`, `food_supply`, `morale` or `intl_standing` (Q-EFX-2, decided 15 October 2026: the no-gain rule covers all five resources, with the legacy indicators standing for Food, Social cohesion and International Support; `food` is Food's own target, and Arms joins the rule with its pool, #781). A cost stays allowed.++R-EFX-007: An option of an event tagged `displacement` cannot raise Money (`treasury` or `fx_reserves`), Food (`food` or `food_supply`), Arms, Social cohesion (`morale`), International Support (`intl_standing`) or score, with no exception (Q-DEP-6(a), owner ruling of 18 October 2026). Arms and score are not event-effect targets yet and remain unknown targets under R-EFX-001; when those targets exist, this rule covers them. The tag also receives R-EFX-005's ban on unit grants and positive city effects.D-H2 in the GDD loop (GDD Phase 7 PR 2, #806). The owner took the plan's recommendations for Q-HFX-1 to Q-HFX-3 on 17 October 2026 (#784): grants of units, a city's housing capacity, condition and job slots, and project unlock, each validated at load; a grant is free and stands at the military camp or at the site the event names (in this slice, a city the event names: a site waits until sites carry a date, R-EFX-006); the no-reward rule covers them. The first slice built unit grants and the housing capacity and job slots; the second adds the housing condition (#855); project unlock comes with the records it acts on (#735).@@ -202,7 +204,9 @@ R-EFX-003: An option's `grant_units` entry `{ type, n, at }` adds `n` (at leastR-EFX-004: An option's `city_effects` entry `{ city, field, delta }` changes only that city's `housing_capacity` or `job_slots`, by a whole, non-zero `delta`, or its housing `condition` by a non-zero `delta` from -1 to 1. Housing capacity never drops below 0, and job slots never drop below the city's employed, so a larger cut applies only to what is free. Capacity may fall below the city's civilians, as overcrowding already can. The condition stays from 0 to 1 (R-HOUSE-001). The other fields of the city, its condition included, do not change. The cause carries the change that applied.-R-EFX-005: An option of an event tagged `holocaust`, `terror`, `massacre` or `war-casualties` carries no unit grant and no `city_effects` gain, whether capacity, slots or condition (Q-HFX-3; extends R-EFX-002). A cut stays allowed.+R-EFX-005: An option of an event carrying any sensitive tag (`holocaust`, `terror`, `massacre`, `war-casualties` or `displacement`) carries no unit grant and no `city_effects` gain, whether capacity, slots or condition (Q-HFX-3; extends R-EFX-002 and R-EFX-007). A cut stays allowed.++R-GATE-001: An event tagged `displacement` must have `status: sensitivity-reviewed` before a shareable build. The release gate lists every such event whose status is not reviewed and refuses the build (Q-GATE-1(c), owner ruling of 18 October 2026).R-EFX-006: The structured effects apply after the numeric effects, grants first and then city effects, each in the option's list order. A target that does not exist on the date (an unbuilt site, a city not yet in the game) is refused at load with file and field, never skipped at run time; so is an unknown type, city or field. Every `cities.yaml` city is in the game from the first turn. A site has no window and starts unbuilt, so a site id as `at` is refused until sites carry a date. The legacy loop, which has no cities or units, refuses them. The preview (R-EVT-005) lists them in the same order.diff --git a/scripts/new_event.py b/scripts/new_event.pyindex 061d59392..44b7a3998 100644--- a/scripts/new_event.py+++ b/scripts/new_event.py@@ -21,7 +21,7 @@ title: TODO titletext: TODO what the player reads, and who must decide# text may name an office, e.g. {defense_minister}; the office needs a holder on every day of the window.anchor: soft-# tags: [security] # holocaust, terror, massacre and war-casualties are sensitive (docs/CONTENT_POLICY.md)+# tags: [security] # holocaust, terror, massacre, war-casualties and displacement are sensitive (docs/CONTENT_POLICY.md)# office: prime_minister# Say in a comment what happened and when, with the source.from: @FROM@@@ -42,7 +42,10 @@ def build(event_id: str, start: str, end: str | None) -> str:def main(argv: list[str] | None = None, root: Path = ROOT) -> int:- p = argparse.ArgumentParser(description=__doc__.split("\n")[0])+ p = argparse.ArgumentParser(+ description=__doc__.split("\n")[0],+ epilog="Sensitive tags: holocaust, terror, massacre, war-casualties and displacement.",+ )p.add_argument("id")p.add_argument("--from", dest="start", default="1948-05-15")p.add_argument("--to", dest="end")diff --git a/scripts/oss/tests/test_new_event.py b/scripts/oss/tests/test_new_event.pyindex c49ca455d..b74a03fc2 100644--- a/scripts/oss/tests/test_new_event.py+++ b/scripts/oss/tests/test_new_event.py@@ -5,6 +5,8 @@ import reimport sysfrom pathlib import Path+import pytest+ROOT = Path(__file__).resolve().parents[3]sys.path.insert(0, str(ROOT / 'tools'))import yaml12 # noqa: E402 (tools/yaml12.py: YAML 1.2, no 1.1 coercions)@@ -46,3 +48,10 @@ def test_refuses_overwrite_bad_id_and_bad_dates(tmp_path):assert m.main(['e3', '--from', '1949-02-01', '--to', '1949-01-01'], root=tmp_path) == 2assert m.main(['e4', '--from', '19490101'], root=tmp_path) == 2assert not (tmp_path / 'content/events/e2.yaml').exists()+++def test_help_names_the_displacement_tag(capsys):+ with pytest.raises(SystemExit) as ex:+ m.main(['--help'])+ assert ex.value.code == 0+ assert 'displacement' in capsys.readouterr().outdiff --git a/scripts/oss/tests/test_policies.py b/scripts/oss/tests/test_policies.pyindex 3cd500993..4ee33829e 100644--- a/scripts/oss/tests/test_policies.py+++ b/scripts/oss/tests/test_policies.py@@ -27,7 +27,7 @@ def test_contributing_links_security_and_untrusted_review():def test_contributing_has_no_cla_and_names_every_sensitive_tag():text = read("CONTRIBUTING.md")assert "There is no CLA and no sign-off" in text- for tag in ("holocaust", "terror", "massacre", "war-casualties"):+ for tag in ("holocaust", "terror", "massacre", "war-casualties", "displacement"):assert f"`{tag}`" in text, tagdiff --git a/sim/Statecraft.Sim.Tests/EventTests.cs b/sim/Statecraft.Sim.Tests/EventTests.csindex 0649c0ba5..e0e0792ba 100644--- a/sim/Statecraft.Sim.Tests/EventTests.cs+++ b/sim/Statecraft.Sim.Tests/EventTests.cs@@ -524,6 +524,26 @@ options:Assert.Single(LoadWithStanding(Sensitive("terror", target, delta)).Events);}+ /// <summary>R-EFX-007 (Q-DEP-6(a)): a displacement option cannot raise any available resource target. Arms and+ /// score are kept in this test as explicit boundaries: neither is an event-effect target on this HEAD, so the+ /// loader refuses them as unknown rather than inventing a target in this PR.</summary>+ [Theory]+ [InlineData("treasury", "sensitive events cannot reward")]+ [InlineData("fx_reserves", "sensitive events cannot reward")]+ [InlineData("food", "sensitive events cannot reward")]+ [InlineData("food_supply", "sensitive events cannot reward")]+ [InlineData("morale", "sensitive events cannot reward")]+ [InlineData("intl_standing", "sensitive events cannot reward")]+ [InlineData("arms", "unknown target")]+ [InlineData("score", "unknown target")]+ public void ADisplacementOptionCannotRaiseAnything(string target, string reason)+ {+ var ex = Assert.Throws<ContentException>(() => LoadWithStanding(Sensitive("displacement", target, "0.02")));+ Assert.Equal("events/shortage.yaml", ex.File);+ Assert.Equal($"events[shortage].options[import].effects.{target}", ex.Field);+ Assert.Contains(reason, ex.Message);+ }+/// <summary>A non-sensitive event may still raise them.</summary>[Fact]public void AnUntaggedEventMayRaiseCohesionAndSupport()diff --git a/sim/Statecraft.Sim.Tests/ReleaseGateTests.cs b/sim/Statecraft.Sim.Tests/ReleaseGateTests.csnew file mode 100644index 000000000..55864d533--- /dev/null+++ b/sim/Statecraft.Sim.Tests/ReleaseGateTests.cs@@ -0,0 +1,25 @@+using System.Collections.Generic;+using System.Linq;+using Statecraft.Sim;++public class ReleaseGateTests+{+ /// <summary>R-GATE-001: an event tagged displacement must be sensitivity-reviewed before a shareable build.</summary>+ [Fact]+ public void AnUnreviewedDisplacementEventIsRefused()+ {+ var files = Fixture.Write(events: new Dictionary<string, string>+ {+ ["displacement.yaml"] = "id: displacement\ntitle: A decision\ntext: A decision is required.\nfrom: 1948-06-01\ntags: [displacement]\noptions:\n - id: continue\n text: Continue\nstatus: fact-checked\n",+ });++ Assert.Equal(new[] { "displacement" }, ReleaseGate.SensitiveUnreviewed(ContentLoader.Load(files)));+ }++ [Fact]+ public void TheRealContentHasNoDisplacementEventYet()+ {+ var content = ContentLoader.Load(RealContentTests.ContentRoot());+ Assert.DoesNotContain(content.Events, e => e.Tags.Contains("displacement", System.StringComparer.OrdinalIgnoreCase));+ }+}diff --git a/sim/Statecraft.Sim/ContentLoader.cs b/sim/Statecraft.Sim/ContentLoader.csindex 4852c4bb3..a00578e5d 100644--- a/sim/Statecraft.Sim/ContentLoader.cs+++ b/sim/Statecraft.Sim/ContentLoader.cs@@ -329,7 +329,7 @@ namespace Statecraft.Sim// id, title, text text may name office holders only through {office_id} placeholders, which// must have a holder on every day of the window// anchor: hard | soft hard needs a historical option; in Historical mode it resolves to it- // tags: [...] holocaust, terror, massacre, war-casualties are sensitive (no money reward)+ // tags: [...] holocaust, terror, massacre, war-casualties, displacement are sensitive (no gain)// office the minister the event is delegated to// from, to the window [from, to); it fires on the first turn that overlaps it// conditions: [{ indicator, min, max }] indicator bounds that must hold when it firesdiff --git a/sim/Statecraft.Sim/EventRules.cs b/sim/Statecraft.Sim/EventRules.csindex 7c2fabb69..38ec13382 100644--- a/sim/Statecraft.Sim/EventRules.cs+++ b/sim/Statecraft.Sim/EventRules.cs@@ -8,7 +8,7 @@ namespace Statecraft.Sim/// <summary>Load-time checks for events, including the sensitive-content rule.</summary>static class EventRules{- public static readonly HashSet<string> SensitiveTags = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "holocaust", "terror", "massacre", "war-casualties" };+ public static readonly HashSet<string> SensitiveTags = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "holocaust", "terror", "massacre", "war-casualties", "displacement" };public static readonly HashSet<string> SpecialTargets = new HashSet<string> { "treasury", "fx_reserves", Pools.FoodTarget };/// <summary>Targets a sensitive event's options may not raise (CONTENT_POLICY section 4: no mechanic rewards violence against/// civilians). Owner decision of 15 October 2026 on Q-EFX-2, "Extend it": every resource, not money alone. Until thediff --git a/sim/Statecraft.Sim/ReleaseGate.cs b/sim/Statecraft.Sim/ReleaseGate.csindex 64ed667b3..738aeb484 100644--- a/sim/Statecraft.Sim/ReleaseGate.cs+++ b/sim/Statecraft.Sim/ReleaseGate.cs@@ -5,7 +5,7 @@ using System.Linq;namespace Statecraft.Sim{/// <summary>The release gate for sensitive content (spec 5.5; M3 final review I4). An event with a sensitive tag- /// (holocaust, terror, massacre, war-casualties) needs the owner's sensitivity review, recorded by moving its YAML+ /// (holocaust, terror, massacre, war-casualties, displacement) needs the owner's sensitivity review, recorded by moving its YAML/// <c>status</c> to <c>sensitivity-reviewed</c>, before any build is shared. Build.Web -shareable refuses to build while/// <see cref="SensitiveUnreviewed"/> is not empty. Setting that status is an OWNER step (docs/m3-release.md).</summary>public static class ReleaseGate