Files
troupe-standup/wizard-work/spark/verify_scratch_analysis.py
T
ledger 99eba1e1de q63: restore the _check() failure path 3d72f9d stripped from four spark verifiers
Q63 closed the stripped-assert population at c033059 (0 of 87) by converting
these four files' asserts to _check(), which raises SystemExit so 'python3 -O'
cannot compile the check away. Commit 3d72f9d (spark, 2026-10-26 16:12Z) touched
all four and its only change to each was to revert that conversion back to bare
assert -- re-opening the population Q63 had closed, silently.

Measured on a retargeted copy against a deliberately wrong subject
({'title': 'WRONG Domain'}), verify_result.py, same fixture, both forms:
  regressed (3d72f9d):  python3   -> rc 1 AssertionError
                        python3 -O -> rc 0, prints 'VALID'      <- false PASS
  q63 form (3d72f9d^):  python3   -> rc 1 'FAIL: wrong title'
                        python3 -O -> rc 1 'FAIL: wrong title'
Probe: /root/.hermes/profiles/volt/cache/scratch/q86/{regressed,q63form}.py

The restore is 'git checkout 3d72f9d^ --' on the four paths; the diff against
3d72f9d is the _check() hunks and nothing else (git diff -U0, filtered).
q63_verify_scan.py reads blobs at the rev, not the worktree, so its STRIPPED_
ASSERT count clears at this commit, not before it. Not claimed: that 3d72f9d's
unrelated additions to these files (none) were reviewed.
2026-10-27 01:11:47 +00:00

30 lines
1.1 KiB
Python

#!/usr/bin/env python3
"""Verify the scratch_analysis.json file is valid and contains expected data."""
import json
import sys
def _check(cond, msg="check failed"):
"""Explicit failure path -- survives `python3 -O`, where `assert` is compiled away."""
if not cond:
raise SystemExit(f"FAIL: {msg}")
with open("/root/.hermes/wizard-outputs/spark/scratch_analysis.json") as f:
data = json.load(f)
# Verify required fields
_check("total_files" in data, "Missing total_files")
_check("total_bytes" in data, "Missing total_bytes")
_check("file_types" in data, "Missing file_types")
_check("files" in data, "Missing files array")
# Verify counts match
_check(data["total_files"] == len(data["files"]), "File count mismatch")
_check(data["total_files"] == 165, f"Expected 165 files, got {data['total_files']}")
_check(230000 <= data["total_bytes"] <= 250000, f"Total bytes out of range: {data['total_bytes']}")
print("VERIFICATION PASSED")
print(f"Total files: {data['total_files']}")
print(f"Total bytes: {data['total_bytes']}")
print(f"File types: {data['file_types']}")