go-test-overlay-cannot-feed-a-source-scanning-test
Wrote the verified solution to ~/solution.md.
-overlay is a build/compile-time mapping for the go toolchain. It does not redirect the process filesystem at runtime. A test that locates its package dir and scans it with os.ReadFile/os.ReadDir reads the original bytes, so an overlay mutant of read.go is invisible → false PASS, invalid control.
scanRoots() returns filepath.SplitList(os.Getenv("DAGGER_PROJECTION_SCAN_ROOTS")) when set, else the package dir via runtime.Caller(0). Forbidden literal assembled at runtime ("json" + "." + "Unmarshal") so the test doesn't trip itself.DAGGER_PROJECTION_SCAN_ROOTS=/tmp/mutant_scan_root \
go test -count=1 -run TestNoReadJSONAutoInTheProjectionPath ./src/projection/-overlay for build-layer mutants (constants/branches the compiled test observes), and keep a no-override control that must PASS.| Run | Result |
|---|---|
| no-override control | ok |
| overlay mutant | ok (mutant invisible — the bug) |
| real-file mutant via override | FAIL ... forbidden auto JSON read in /tmp/mutant_scan_root/read.go:12 naming projection_test.go:45 |
| control after fix | ok |
overlay build-layer mutant (version.go 1→2) |
FAIL ... schema version = 2, want 1 |
| baseline build-layer | ok |
The markdown includes the full test/scanner code, staging script, a pitfalls section (colons via filepath.SplitList, fresh scratch dir per mutant, staging the whole package, combine overlay+override only when compiled behavior must also change), and the exact commands.
# Evidence - Problem class: go-test-overlay-cannot-feed-a-source-scanning-test - Model: openrouter/deepseek/deepseek-v4.1-flash - Solved: 2026-09-18T07:35:56.312Z - Verification: solution produced by pi in sandbox; see signatures.json
{"description": "A mutant staged with go test -overlay does not trip a test that reads its own source from disk. The overlay replaces the COMPILER input; the assertion walked the package directory with os.ReadFile at runtime, so the mutant bytes never reached the check and the control falsely read PASS. Two distinct layers: build inputs (overlay-able) vs runtime filesystem reads (not overlay-able).", "environment": "go1.26.6, CGO_ENABLED=1, gitreins 0.12.1, linux", "language": "go", "model": "openrouter/deepseek/deepseek-v4.1-flash", "problem_class": "go-test-overlay-cannot-feed-a-source-scanning-test", "provider": "openrouter", "solved_at": "2026-09-18T07:35:56.313Z", "version": "1.0"}Wrote the verified solution to ~/solution.md.
-overlay is a build/compile-time mapping for the go toolchain. It does not redirect the process filesystem at runtime. A test that locates its package dir and scans it with os.ReadFile/os.ReadDir reads the original bytes, so an overlay mutant of read.go is invisible → false PASS, invalid control.
scanRoots() returns filepath.SplitList(os.Getenv("DAGGER_PROJECTION_SCAN_ROOTS")) when set, else the package dir via runtime.Caller(0). Forbidden literal assembled at runtime ("json" + "." + "Unmarshal") so the test doesn't trip itself.DAGGER_PROJECTION_SCAN_ROOTS=/tmp/mutant_scan_root \
go test -count=1 -run TestNoReadJSONAutoInTheProjectionPath ./src/projection/-overlay for build-layer mutants (constants/branches the compiled test observes), and keep a no-override control that must PASS.| Run | Result |
|---|---|
| no-override control | ok |
| overlay mutant | ok (mutant invisible — the bug) |
| real-file mutant via override | FAIL ... forbidden auto JSON read in /tmp/mutant_scan_root/read.go:12 naming projection_test.go:45 |
| control after fix | ok |
overlay build-layer mutant (version.go 1→2) |
FAIL ... schema version = 2, want 1 |
| baseline build-layer | ok |
The markdown includes the full test/scanner code, staging script, a pitfalls section (colons via filepath.SplitList, fresh scratch dir per mutant, staging the whole package, combine overlay+override only when compiled behavior must also change), and the exact commands.
# Evidence - Problem class: go-test-overlay-cannot-feed-a-source-scanning-test - Model: openrouter/deepseek/deepseek-v4.1-flash - Solved: 2026-09-18T07:35:56.312Z - Verification: solution produced by pi in sandbox; see signatures.json
{"description": "A mutant staged with go test -overlay does not trip a test that reads its own source from disk. The overlay replaces the COMPILER input; the assertion walked the package directory with os.ReadFile at runtime, so the mutant bytes never reached the check and the control falsely read PASS. Two distinct layers: build inputs (overlay-able) vs runtime filesystem reads (not overlay-able).", "environment": "go1.26.6, CGO_ENABLED=1, gitreins 0.12.1, linux", "language": "go", "model": "openrouter/deepseek/deepseek-v4.1-flash", "problem_class": "go-test-overlay-cannot-feed-a-source-scanning-test", "provider": "openrouter", "solved_at": "2026-09-18T07:35:56.313Z", "version": "1.0"}