Skip to content

A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.

Nightly: savetest prints the line it records and its evidence path (#3148)

Eyal Golaneeb6a667356d
diff --git a/docs/RELEASING.md b/docs/RELEASING.md
index df16260d2..45a52be53 100644
--- a/docs/RELEASING.md
+++ b/docs/RELEASING.md
@@ -317,7 +317,7 @@ is shown. The stage is skipped while `steam/steam.json` still has a `null` ID (u
**itch.io.** Pushes stay off until the owner or an agent (owner, 2 Nov 2026, "2 (a)") runs
`uv run tools/nightly.py savetest --tag <a published nightly>` once
and it prints `PASS` (the two-upload save test of `docs/m3-release.md`, "Upload to itch.io"); until then each night
-logs `itch: skipped (<reason>)`, naming the missing config key or the problem, and pushes nothing to itch. The save test pushes only to a separate test page, named in the job's `config.json` as
+logs `itch: skipped (<reason>)`, naming the missing config key or the problem, and pushes nothing to itch. Once the test has run, the command prints the line it records in the job's `LOG.md` (`SAVETEST <result> tag=<tag> <why>`), then the path of the run's `evidence.json` when it wrote one, then the result word; a run refused before the test starts prints only the refusal, on stderr. The save test pushes only to a separate test page, named in the job's `config.json` as
`savetest_itch_target` (`user/project:channel`), and refuses to run without it or if it names the public project:
each upload hides the game while itch unpacks it, which took up to an hour on 28 October 2026. It never reads the
test page: it loads each upload's game frame from the upload and build ids `butler status` shows, so the test page
diff --git a/tools/nightly.py b/tools/nightly.py
index 010cb2e0a..7777162f4 100644
--- a/tools/nightly.py
+++ b/tools/nightly.py
@@ -1188,6 +1188,7 @@ def savetest(cfg: Config, config_path: Path, job: Path, runner: Runner, gh: GitH
work = Path(job) / "savetest" / stamp
evidence: dict = {"tag": tag, "target": cfg.savetest_itch_target}
result, detail = "INCONCLUSIVE", ""
+ written: Path | None = None # the evidence.json this run wrote, if any
try:
with savetest_lock(Path(job)) as held:
if not held:
@@ -1204,19 +1205,29 @@ def savetest(cfg: Config, config_path: Path, job: Path, runner: Runner, gh: GitH
evidence.update(result=result, detail=detail)
if work.is_dir():
(work / "evidence.json").write_text(json.dumps(evidence, indent=2, sort_keys=True) + "\n", encoding="utf-8")
+ written = work / "evidence.json"
if result == "PASS":
enable_itch(config_path, work / "evidence.json")
except (Stop, OSError) as e: # #2684 review: a failure after the test still gets its one SAVETEST record
result = "INCONCLUSIVE"
detail = f"{e.gate}: {e.detail}" if isinstance(e, Stop) else f"{type(e).__name__}: {e}"
evidence.update(result=result, detail=detail)
+ written = None # a file from the first write now disagrees with this result
if work.is_dir():
try:
(work / "evidence.json").write_text(json.dumps(evidence, indent=2, sort_keys=True) + "\n",
encoding="utf-8")
+ written = work / "evidence.json"
except OSError:
pass # LOG.md stays the record when the evidence file itself cannot be written
- record(Path(job) / "LOG.md", cfg.handoff, f"SAVETEST {result} tag={tag} {detail}".rstrip())
+ line = f"SAVETEST {result} tag={tag} {detail}".rstrip()
+ record(Path(job) / "LOG.md", cfg.handoff, line)
+ try: # the command's own output says why, not only the result word; LOG.md stays the record
+ print(line)
+ if written:
+ print(f"evidence: {written}")
+ except (OSError, UnicodeError):
+ pass # a terminal that cannot take the line never changes the result
return result
diff --git a/tools/tests/test_nightly.py b/tools/tests/test_nightly.py
index f5631f263..594d3aed5 100644
--- a/tools/tests/test_nightly.py
+++ b/tools/tests/test_nightly.py
@@ -2418,6 +2418,40 @@ def test_any_other_http_answer_from_the_frame_ends_inconclusive_at_once(saved, c
assert t.runner.runs == [] and len(t.fetched) == 1 and f"HTTP {code}" in t.evidence()["detail"]
+def test_an_inconclusive_save_test_prints_its_recorded_line_and_evidence_path(saved, capsys):
+ # The v0.4.1 run (11 Nov 2026) printed only INCONCLUSIVE; the why was in LOG.md, HANDOFF.md and evidence.json alone.
+ t = saved()
+ assert t.run(frame_for(t.itch, t.fetched, missing=10_000, code=404)) == "INCONCLUSIVE"
+ recorded = next(line for line in t.log().splitlines() if "SAVETEST" in line).removeprefix("- ")
+ evidence = next((t.job / "savetest").glob("*/evidence.json"))
+ assert "still answered HTTP 404" in recorded
+ assert capsys.readouterr().out.splitlines() == [recorded, f"evidence: {evidence}"]
+
+
+def test_a_save_test_prints_no_evidence_path_when_its_file_disagrees_with_the_result(saved, monkeypatch, capsys):
+ # A PASS evidence file is written, enabling itch fails and the INCONCLUSIVE rewrite fails: the file on disk still
+ # says PASS, so the command prints only the recorded line.
+ t = saved()
+ real_write, writes = Path.write_text, []
+
+ def write(path, text, *args, **kwargs):
+ if path.name == "evidence.json":
+ writes.append(path)
+ if len(writes) > 1:
+ raise OSError("evidence disk full")
+ return real_write(path, text, *args, **kwargs)
+
+ def enable_itch(*args):
+ raise OSError("config read-only")
+
+ monkeypatch.setattr(Path, "write_text", write)
+ monkeypatch.setattr(nightly, "enable_itch", enable_itch)
+ assert t.run() == "INCONCLUSIVE" and len(writes) == 2 and t.evidence()["result"] == "PASS"
+ recorded = next(line for line in t.log().splitlines() if "SAVETEST" in line).removeprefix("- ")
+ assert recorded == f"SAVETEST INCONCLUSIVE tag={TAG} OSError: config read-only"
+ assert capsys.readouterr().out.splitlines() == [recorded]
+
+
def test_a_b_frame_that_is_never_served_is_inconclusive_not_fail(saved):
t = saved()
def fetch(url, timeout=30):