A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
event_timeline: --status takes only the four schema statuses (Fixes #1461) (#1755)
Eyal Golan61b76060b805
diff --git a/scripts/event_timeline.py b/scripts/event_timeline.pyindex fd85ca74d..6bdecfc44 100644--- a/scripts/event_timeline.py+++ b/scripts/event_timeline.py@@ -18,6 +18,8 @@ ROOT = Path(__file__).resolve().parents[1]# The sim's defaults for a missing key (GameEvent in sim/Statecraft.Sim/Content.cs; a test keeps them equal).DEFAULT_ANCHOR = "soft"DEFAULT_STATUS = "draft"+# The review statuses, as in content/schema/event.schema.json (a test keeps them equal); --status takes only these.+STATUSES = ("draft", "fact-checked", "historian-reviewed", "sensitivity-reviewed")def load(root: Path) -> list[dict]:@@ -48,7 +50,7 @@ def render(rows: list[dict]) -> str:def main(argv: list[str] | None = None) -> int:p = argparse.ArgumentParser(description=__doc__.split("\n")[0])p.add_argument("--root", type=Path, default=ROOT)- p.add_argument("--status", help="only events with this review status")+ p.add_argument("--status", choices=STATUSES, help="only events with this review status")a = p.parse_args(argv)rows = load(a.root)if a.status:diff --git a/scripts/oss/tests/test_event_timeline.py b/scripts/oss/tests/test_event_timeline.pyindex ebdd7b2c2..72c5d162a 100644--- a/scripts/oss/tests/test_event_timeline.py+++ b/scripts/oss/tests/test_event_timeline.py@@ -1,7 +1,10 @@"""Event timeline (#324): sorting, era lookup, open windows, status filter and the real content."""import importlib.util+import jsonfrom pathlib import Path+import pytest+ROOT = Path(__file__).resolve().parents[3]SPEC = importlib.util.spec_from_file_location('event_timeline', ROOT / 'scripts/event_timeline.py')m = importlib.util.module_from_spec(SPEC)@@ -48,3 +51,19 @@ def test_defaults_match_the_sim():def test_real_content_every_event_lands_in_an_era():rows = m.load(ROOT)assert rows and all(r['era'] != '-' for r in rows)+++def test_misspelled_status_is_rejected(tmp_path, capsys):+ # #1461: a typo must not look like an empty review queue+ with pytest.raises(SystemExit) as e:+ m.main(['--root', str(repo(tmp_path)), '--status', 'drfat'])+ assert e.value.code != 0+ err = capsys.readouterr().err+ assert 'drfat' in err+ for s in ('draft', 'fact-checked', 'historian-reviewed', 'sensitivity-reviewed'):+ assert s in err+++def test_statuses_match_the_schema():+ schema = json.loads((ROOT / 'content/schema/event.schema.json').read_text())+ assert list(m.STATUSES) == schema['properties']['status']['enum']