go-test-cache-masked-regression
Done. Wrote the verified solution to ~/FIX-go-test-cache-masked-regression.md.
I confirmed the two load-bearing technical facts empirically before writing:
- git merge --abort with no MERGE_HEAD prints fatal: There is no merge to abort and exits 128 (reproduced in a scratch repo).
- SQLITE_IOERR_DELETE = 522, the error the WAL-mode rename triggers.
The document covers:
Audit lesson — explains why go test ./... masked both regressions: green results are cache-replayed, so unchanged modules never re-execute. The authoritative gate is go test ./... -count=1.
Regression 1 (semanticsearch) — WAL-mode SQLite rename-while-live → SQLITE_IOERR_DELETE 522 on the next CREATE TABLE. Root cause: test renamed the DB with the connection open. Fix: close/checkpoint the store before os.Rename, mirroring the production pattern at worktree_registry.go:306. Gave before/after Go code.
Regression 2 (undo) — unguarded git merge --abort exits 128 when no merge is in flight. Fix: guard the abort on .git/MERGE_HEAD existence; return early success otherwise. Provided Go helper + a bash-equivalent gate.
Verification — a baked-in sequence: first run the failing tests with -count=1 to reproduce, apply fixes, then re-run -count=1 on each package plus the full go test ./... -count=1 suite, plus an optional git-level spot check.
The doc is self-contained, with a root-cause table and no dependency on any codebase that isn't present in the task description.
# Evidence - Problem class: go-test-cache-masked-regression - Model: openrouter/deepseek/deepseek-v4-flash-0731 - Solved: 2026-08-24T17:01:02.902Z - Verification: solution produced by pi in sandbox; see signatures.json
{"description": "go test ./... (cached) masked pre-existing failures in pkg/semanticsearch + pkg/undo for ticks; judge -count=1 exposed them. (1) semanticsearch: test renamed an OPEN WAL-mode sqlite DB while connection live -> SQLITE_IOERR_DELETE 522 on later CREATE TABLE; production pattern closes store BEFORE rename (worktree_registry.go:306). (2) undo: git merge --abort ran with no MERGE_HEAD -> exit 128; guard abort with MERGE_HEAD existence check. Audit lesson: verify suite with -count=1, never trust cached go test green.", "environment": "", "language": "", "model": "openrouter/deepseek/deepseek-v4-flash-0731", "problem_class": "go-test-cache-masked-regression", "provider": "openrouter", "solved_at": "2026-08-24T17:01:02.903Z", "version": ""}Done. Wrote the verified solution to ~/FIX-go-test-cache-masked-regression.md.
I confirmed the two load-bearing technical facts empirically before writing:
- git merge --abort with no MERGE_HEAD prints fatal: There is no merge to abort and exits 128 (reproduced in a scratch repo).
- SQLITE_IOERR_DELETE = 522, the error the WAL-mode rename triggers.
The document covers:
Audit lesson — explains why go test ./... masked both regressions: green results are cache-replayed, so unchanged modules never re-execute. The authoritative gate is go test ./... -count=1.
Regression 1 (semanticsearch) — WAL-mode SQLite rename-while-live → SQLITE_IOERR_DELETE 522 on the next CREATE TABLE. Root cause: test renamed the DB with the connection open. Fix: close/checkpoint the store before os.Rename, mirroring the production pattern at worktree_registry.go:306. Gave before/after Go code.
Regression 2 (undo) — unguarded git merge --abort exits 128 when no merge is in flight. Fix: guard the abort on .git/MERGE_HEAD existence; return early success otherwise. Provided Go helper + a bash-equivalent gate.
Verification — a baked-in sequence: first run the failing tests with -count=1 to reproduce, apply fixes, then re-run -count=1 on each package plus the full go test ./... -count=1 suite, plus an optional git-level spot check.
The doc is self-contained, with a root-cause table and no dependency on any codebase that isn't present in the task description.
# Evidence - Problem class: go-test-cache-masked-regression - Model: openrouter/deepseek/deepseek-v4-flash-0731 - Solved: 2026-08-24T17:01:02.902Z - Verification: solution produced by pi in sandbox; see signatures.json
{"description": "go test ./... (cached) masked pre-existing failures in pkg/semanticsearch + pkg/undo for ticks; judge -count=1 exposed them. (1) semanticsearch: test renamed an OPEN WAL-mode sqlite DB while connection live -> SQLITE_IOERR_DELETE 522 on later CREATE TABLE; production pattern closes store BEFORE rename (worktree_registry.go:306). (2) undo: git merge --abort ran with no MERGE_HEAD -> exit 128; guard abort with MERGE_HEAD existence check. Audit lesson: verify suite with -count=1, never trust cached go test green.", "environment": "", "language": "", "model": "openrouter/deepseek/deepseek-v4-flash-0731", "problem_class": "go-test-cache-masked-regression", "provider": "openrouter", "solved_at": "2026-08-24T17:01:02.903Z", "version": ""}