A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
source_report: a --root with no content/ is an error (Fixes #1460) (#1753)
Eyal Golan9e127a293a4f
diff --git a/scripts/oss/tests/test_source_report.py b/scripts/oss/tests/test_source_report.pyindex f65f6b6c2..a71c6b8da 100644--- a/scripts/oss/tests/test_source_report.py+++ b/scripts/oss/tests/test_source_report.py@@ -52,3 +52,19 @@ def test_alias_counts_once_and_plain_url_lists_are_read(tmp_path):rows = m.collect(tmp_path, TODAY)assert sorted((r['url'], r['age']) for r in rows) == [('https://l.example/1', 2), ('https://l.example/2', 2),('https://p.example', 12)]+++def test_root_without_content_is_an_error(tmp_path, capsys):+ # #1460: a mistyped --root must not look like a repository with no sources+ for root in (tmp_path, tmp_path / 'missing'):+ assert m.main(['--root', str(root), '--today', '2026-10-13']) != 0+ cap = capsys.readouterr()+ assert str(root / 'content') in cap.err and 'sources' not in cap.out+ assert not (root / 'content').exists()+ assert not (tmp_path / 'missing').exists()+++def test_empty_content_is_still_a_report(tmp_path, capsys):+ (tmp_path / 'content').mkdir()+ assert m.main(['--root', str(tmp_path), '--today', '2026-10-13']) == 0+ assert capsys.readouterr().out.splitlines() == ['0 sources']diff --git a/scripts/source_report.py b/scripts/source_report.pyindex 24b18c289..609cd1ca3 100644--- a/scripts/source_report.py+++ b/scripts/source_report.py@@ -9,7 +9,9 @@A source is any mapping with `url` and `checked` anywhere in content/**/*.yaml, or a url in a plain `sources` list nextto a `checked` date. A YAML alias counts once. One line per source, oldest check first:age in days, checked date, file, url. `--older-than N` keeps only sources checked more than N days ago. A non-https url-is marked `http`; a source with no valid check date is marked `NO-DATE`. A report, not a gate: always exits 0. Reads only."""+is marked `http`; a source with no valid check date is marked `NO-DATE`. A report, not a gate: exits 0 for any root+with a content/ directory, even an empty one. A root with no content/ directory is a usage mistake (a mistyped --root):+it prints an error naming the missing path and exits 2. Reads only."""import argparseimport sysfrom datetime import date@@ -78,6 +80,9 @@ def main(argv: list[str] | None = None) -> int:p.add_argument("--older-than", type=int, metavar="DAYS")p.add_argument("--today", type=date.fromisoformat, default=date.today())a = p.parse_args(argv)+ if not (a.root / "content").is_dir():+ print(f"source_report: no content/ directory at {a.root / 'content'} (check --root)", file=sys.stderr)+ return 2rows = collect(a.root, a.today)if a.older_than is not None:rows = [r for r in rows if r["age"] is None or r["age"] > a.older_than]