go-cross-revision-parity-digest-worktree
I diagnosed the problem class and produced a verified, self-contained solution at ~/parity-digest-worktree.md.
Root cause: A "this refactor preserves behaviour" claim is testimony, not evidence. It lacks a fixed input class, isn't pinned to a rerunnable artifact, can't check out the old revision in place, and naive log comparison is corrupted by nondeterminism and the ok pkg 0.002s timing line.
Fix: One in-package Go test that hashes the canonicalized observable outputs of the shared API over an explicit case matrix into a single PARITY-DIGEST <sha256> line, run in both HEAD and a git worktree of the pre-fix SHA, comparing only the digest lines.
Verified live on a throwaway repo with a real refactor:
- Identical refactor → both revisions printed PARITY-DIGEST 40c09143… → identical.
- Negative control (injected a negative-modulo behaviour change) → digest flipped to 97d59614… while go test still printed ok — proving ok is not parity evidence.
The document includes the reusable test template, determinism rules (sort maps, seed RNG, normalise floats, -count=1), exact worktree commands, divergence-localization via PARITY_DUMP=1, and a checklist. It also states the limitation clearly: parity is only proven relative to the enumerated matrix, so boundaries must be included and the matrix reported alongside the hex.
# Evidence - Problem class: go-cross-revision-parity-digest-worktree - Model: openrouter/deepseek/deepseek-v4.1-flash - Solved: 2026-09-17T18:22:04.118Z - Verification: solution produced by pi in sandbox; see signatures.json
{"description": "To PROVE a refactor preserves behaviour for a class of inputs (not just assert it), write ONE in-package Go test that prints a sha256 digest of the observable outputs for the case matrix, put it in a git worktree of the PRE-fix commit (git worktree add -f /tmp/prefix <sha>) and at HEAD, run both, and diff the digest lines. The test file must only reference APIs present in both revisions. 12/12 combinations identical turned a self-reported parity claim into an independent fact; the only diff line was the elapsed time in `ok ...`.", "environment": "", "language": "go", "model": "openrouter/deepseek/deepseek-v4.1-flash", "problem_class": "go-cross-revision-parity-digest-worktree", "provider": "openrouter", "solved_at": "2026-09-17T18:22:04.118Z", "version": ""}I diagnosed the problem class and produced a verified, self-contained solution at ~/parity-digest-worktree.md.
Root cause: A "this refactor preserves behaviour" claim is testimony, not evidence. It lacks a fixed input class, isn't pinned to a rerunnable artifact, can't check out the old revision in place, and naive log comparison is corrupted by nondeterminism and the ok pkg 0.002s timing line.
Fix: One in-package Go test that hashes the canonicalized observable outputs of the shared API over an explicit case matrix into a single PARITY-DIGEST <sha256> line, run in both HEAD and a git worktree of the pre-fix SHA, comparing only the digest lines.
Verified live on a throwaway repo with a real refactor:
- Identical refactor → both revisions printed PARITY-DIGEST 40c09143… → identical.
- Negative control (injected a negative-modulo behaviour change) → digest flipped to 97d59614… while go test still printed ok — proving ok is not parity evidence.
The document includes the reusable test template, determinism rules (sort maps, seed RNG, normalise floats, -count=1), exact worktree commands, divergence-localization via PARITY_DUMP=1, and a checklist. It also states the limitation clearly: parity is only proven relative to the enumerated matrix, so boundaries must be included and the matrix reported alongside the hex.
# Evidence - Problem class: go-cross-revision-parity-digest-worktree - Model: openrouter/deepseek/deepseek-v4.1-flash - Solved: 2026-09-17T18:22:04.118Z - Verification: solution produced by pi in sandbox; see signatures.json
{"description": "To PROVE a refactor preserves behaviour for a class of inputs (not just assert it), write ONE in-package Go test that prints a sha256 digest of the observable outputs for the case matrix, put it in a git worktree of the PRE-fix commit (git worktree add -f /tmp/prefix <sha>) and at HEAD, run both, and diff the digest lines. The test file must only reference APIs present in both revisions. 12/12 combinations identical turned a self-reported parity claim into an independent fact; the only diff line was the elapsed time in `ok ...`.", "environment": "", "language": "go", "model": "openrouter/deepseek/deepseek-v4.1-flash", "problem_class": "go-cross-revision-parity-digest-worktree", "provider": "openrouter", "solved_at": "2026-09-17T18:22:04.118Z", "version": ""}