From a23965bf9c186bb0df2af209bb87a55f24c01b2b Mon Sep 17 00:00:00 2001 From: "nekomimi.pet" Date: Sun, 1 Nov 2026 08:48:13 -0500 Subject: [PATCH] perf: never publish an unfinished replay, and offer runs to compare when main has none --- test/perf/report/app.js | 9 +++++++-- test/perf/report/ci.py | 7 +++++++ test/perf/report/publish.py | 2 ++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/test/perf/report/app.js b/test/perf/report/app.js index 31d9d443c..7a5ac980a 100644 --- a/test/perf/report/app.js +++ b/test/perf/report/app.js @@ -173,7 +173,9 @@ return `${NAMES[key] ?? key}${rise} (${why})${more}.`; } if (!state.other) - return "First recorded run: nothing to compare with yet. Every number is within its budget."; + return state.runs.length > 1 + ? "No main run to compare with yet; choose a run above. Every number is within its budget." + : "First recorded run: nothing to compare with yet. Every number is within its budget."; const worse = moved().filter((c) => c.delta > 0); if (!worse.length) return `No regressions against ${runName(state.other)}.`; const top = worse[0]; @@ -310,7 +312,9 @@ el( "p", "calm", - "Nothing to compare with yet. Changes appear here once another run is recorded.", + state.runs.length > 1 + ? "Choose a run to compare with in the header." + : "Nothing to compare with yet. Changes appear here once another run is recorded.", ), ); return; @@ -743,6 +747,7 @@ select.disabled = true; return; } + select.append(new Option("choose a run", "")); for (const r of others) select.append( new Option(`${runName(r)} ยท ${r.createdAt.slice(0, 10)}`, r.rkey), diff --git a/test/perf/report/ci.py b/test/perf/report/ci.py index 0df352d7e..c1ef657ce 100644 --- a/test/perf/report/ci.py +++ b/test/perf/report/ci.py @@ -111,6 +111,13 @@ def main(): sandbox.close() result_path = root / "results.json" result = read_result(result_path) + # run.py writes after every scenario, so a crash leaves a partial + # result with no gated numbers. It is not a run; publish nothing. + if not result["gated"]: + scenarios = ", ".join(result["scenarios"]) or "none" + raise SystemExit( + f"replay did not finish (scenarios done: {scenarios}); nothing published" + ) # Logs remain useful on fork PRs where no site can be published. print(json.dumps(result, indent=2), flush=True) live_result = root / "live.json" diff --git a/test/perf/report/publish.py b/test/perf/report/publish.py index fccd2f5fd..13cbee150 100644 --- a/test/perf/report/publish.py +++ b/test/perf/report/publish.py @@ -56,6 +56,8 @@ def publish(result_path, live_path=None, live_status_path=None): result = read_result(result_path) if result["mode"] != "replay": raise ValueError("a run is published from its replay result") + if not result["gated"]: + raise ValueError("an unfinished replay has no gated numbers to publish") live = read_result(live_path) if live_path else None if live and live["commit"] != result["commit"]: raise ValueError("live result must belong to the replay commit") -- knotmirror 0.0.1