test: gate V1 side files and V3 legacy receipts; early output rejection
- analyze_jet_cv_continuation: samples are analyzed only if the sibling re*_s*.json receipt is the same case with run_status COMPLETE and source_recheck UNCHANGED; receipts without run_status (pre-recheck runners) are refused unless --legacy-receipts, and labelled LEGACY_NO_FINAL_SOURCE_RECHECK. Results carry receipt_gate. - V3: receipts are schema 2 and need source_recheck UNCHANGED; a missing recheck is accepted only for frozen-mode schema 1 receipts whose run_case.py hash is one of the pre-recheck runners (9805383,2cf9853, db3d098; hashes checked against git history in a test). - V1/V3 refuse --output inside the checkout before source checks or CUDA (shared source_provenance.reject_output_inside). - A failing recheck is recorded as RECHECK_FAILED (still invalid); the in-run V1 receipt write is tmp+replace. Negative host tests for each gate. No threshold, solver or evidence edits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
df0f586331
commit
36ffc8b1b2
9 files changed
+185
-33
No files matched your search
@@ -18,20 +18,28 @@ def checkout_provenance(repo):
|
||||
def final_source_check(recorded, recheck):
|
||||
"""Re-derive the source identity after a run and compare it with the recorded one.
|
||||
|
||||
Returns receipt fields: source_recheck "UNCHANGED", or "CHANGED" with source_after
|
||||
(None if the recheck itself failed) and the recheck error. Callers mark a receipt
|
||||
complete only for "UNCHANGED"; a changed source invalidates the run.
|
||||
Returns receipt fields: source_recheck "UNCHANGED"; "CHANGED" with source_after; or
|
||||
"RECHECK_FAILED" (source_after None) with the error. Callers mark a receipt complete
|
||||
only for "UNCHANGED"; anything else invalidates the run.
|
||||
"""
|
||||
try:
|
||||
after = recheck()
|
||||
except Exception as error: # a failed recheck cannot confirm the source
|
||||
return dict(source_recheck="CHANGED", source_after=None,
|
||||
except Exception as error: # a failed recheck cannot confirm the source: invalid too
|
||||
return dict(source_recheck="RECHECK_FAILED", source_after=None,
|
||||
source_recheck_error=f"{type(error).__name__}: {error}")
|
||||
if after == recorded:
|
||||
return dict(source_recheck="UNCHANGED")
|
||||
return dict(source_recheck="CHANGED", source_after=after, source_recheck_error=None)
|
||||
|
||||
|
||||
def reject_output_inside(output, repo):
|
||||
"""Refuse run outputs inside the checkout before any work: they would dirty it."""
|
||||
from pathlib import Path
|
||||
output, repo = Path(output).resolve(), Path(repo).resolve()
|
||||
if output == repo or repo in output.parents:
|
||||
raise SystemExit(f"--output must be outside the source checkout {repo}")
|
||||
|
||||
|
||||
class HistoryUnavailable(RuntimeError):
|
||||
"""The clone cannot show the recorded commit (no git, shallow clone, installed copy)."""
|
||||
|
||||
|
||||
Reference in new issue
Block a user