Skip to content

Commit 062eebc

Browse files
Sravan1011claude
andcommitted
fix: regression guards fail in trusted CI when measurement data is missing
The guards previously skipped on absent latency/recall data, so a run with --baseline-file could go green without ever measuring anything (e.g. a random-ordering plugin collecting a guard before the measurement tests, or measurement crashing in a way that left results empty). Both guards now route missing measurement data through the shared skip-or-fail policy: skip on fork PRs and local runs where measurement legitimately cannot happen, FAIL in trusted CI where a silently passing regression gate is a green no-op. The measure-guard-write ordering comment updated to match: random ordering now fails loudly in trusted CI by design. Verified: local+baseline skips, CI=true without measurements fails both guards, fork PR skips. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 3e6ac46 commit 062eebc

1 file changed

Lines changed: 17 additions & 8 deletions

File tree

benchmarks/ci/test_bench_ci_moss.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,16 @@ def _git_sha() -> str:
103103

104104

105105
def _missing_required_input(message: str):
106-
"""Handle a missing required benchmark input (corpus, ground truth, …).
106+
"""Handle a missing benchmark prerequisite (inputs, measurement data, …).
107107
108108
Skip on fork PRs (``ALLOW_BENCHMARK_SKIP=1``) and local runs, but FAIL
109-
in trusted CI — a missing required input must not turn the benchmark
109+
in trusted CI — a missing prerequisite must not turn the benchmark
110110
workflow into a green no-op.
111111
"""
112112
if os.getenv("ALLOW_BENCHMARK_SKIP") == "1":
113113
pytest.skip(f"{message} — fork PR, skipping benchmarks")
114114
if os.getenv("CI"):
115-
pytest.fail(f"{message}required input missing in a trusted CI run")
115+
pytest.fail(f"{message}must not silently pass in a trusted CI run")
116116
pytest.skip(message)
117117

118118

@@ -280,9 +280,11 @@ def benchmark_results(corpus_sig) -> dict:
280280

281281
# ---------------------------------------------------------------------------
282282
# Tests — pytest collects these in declaration order (measure → guard →
283-
# write). The ordering is a soft dependency only: the guard and writer
284-
# degrade gracefully (skip / write partial results) if measurement data is
285-
# missing, so a random-ordering plugin breaks nothing, it just skips checks.
283+
# write). Locally and on fork PRs the guards degrade gracefully (skip) when
284+
# measurement data is missing. In trusted CI the guards FAIL on missing
285+
# measurement data — a regression gate that silently passes without
286+
# measurements is a green no-op — so a random-ordering plugin that runs a
287+
# guard before the measurement tests will fail loudly there, by design.
286288
# ---------------------------------------------------------------------------
287289

288290

@@ -416,7 +418,12 @@ def test_no_latency_regression(self, request, benchmark_results):
416418
current_p95 = benchmark_results.get("latency_ms", {}).get("p95")
417419

418420
if baseline_p95 is None or current_p95 is None:
419-
pytest.skip("Latency data not yet available — run latency test first")
421+
# A baseline comparison was requested but there is nothing to
422+
# compare: fine when measurement legitimately skipped (fork PR /
423+
# local run without credentials), a red flag in trusted CI.
424+
_missing_required_input(
425+
"Latency measurement data missing — the latency test did not run"
426+
)
420427

421428
_assert_baseline_compatible(baseline, benchmark_results)
422429

@@ -478,7 +485,9 @@ def test_no_recall_regression(self, request, benchmark_results):
478485
current_recall = benchmark_results.get("recall", {}).get("recall_at_5")
479486

480487
if baseline_recall is None or current_recall is None:
481-
pytest.skip("Recall data not yet available — run recall test first")
488+
_missing_required_input(
489+
"Recall measurement data missing — the recall test did not run"
490+
)
482491

483492
_assert_baseline_compatible(baseline, benchmark_results)
484493

0 commit comments

Comments
 (0)