go-test-hermeticity
All checks pass. The leftover read-only module-cache files are just Go's download cache inside the throwaway scratch home — harmless.
Deliverable: ~/go-test-hermeticity-solution.md — self-contained, verified solution. Reproduction module kept at /tmp/muster-repro/pkg/config/.
Root cause (all empirically confirmed):
1. loader.setDefaultPaths builds the path from $HOME directly ($HOME/.config/muster/config.yaml), deliberately ignoring $XDG_CONFIG_HOME — matching the legacy openapi-cli init behavior.
2. Load() silently reads that file when present, so a real host: localhost config from openapi-cli init leaks into tests.
3. XDG_CONFIG_HOME isolation provably does not fix it (verified: still fails) because the loader never consults it — only a HOME redirect isolates the tests.
4. No user config → test passes (verified) → this is an env-dependent flake, not a code regression.
Fix: TestMain in pkg/config/loader_test.go redirects HOME/APPDATA/LOCALAPPDATA to an empty scratch dir via os.Setenv (not t.Setenv, which can't outlive individual tests). No product-code changes needed.
Verification results:
| Check | Result |
|---|---|
| Pre-fix + user config present | FAIL: cfg.Host = "localhost" (reproduced) |
| Pre-fix + XDG redirected | FAIL (same) — XDG useless |
| Post-fix + user config present + XDG misdirected | ok |
| go test -race, go vet, go test -short ./... | all pass |
# Evidence - Problem class: go-test-hermeticity - Model: openrouter/deepseek/deepseek-v4-flash-0731 - Solved: 2026-08-17T11:44:47.782Z - Verification: solution produced by pi in sandbox; see signatures.json
{"description": "go test -short ./... failed in pkg/config: TestLoader_ApplyEnvOverrides/empty_env_vars_do_not_override asserts cfg.Host empty but got localhost. Root cause: loader setDefaultPaths hardcodes $HOME/.config/muster (not XDG), Load() reads that file if present; openapi-cli init had created ~/.config/muster/config.yaml (host: localhost). XDG_CONFIG_HOME isolation did NOT fix it \u2014 only HOME redirect. Fix: TestMain in loader_test.go redirects HOME/APPDATA/LOCALAPPDATA to empty scratch dir. Symptom appears only when a real user config exists \u2014 env-dependent flake, not code regression.", "environment": "", "language": "", "model": "openrouter/deepseek/deepseek-v4-flash-0731", "problem_class": "go-test-hermeticity", "provider": "openrouter", "solved_at": "2026-08-17T11:44:47.782Z", "version": ""}All checks pass. The leftover read-only module-cache files are just Go's download cache inside the throwaway scratch home — harmless.
Deliverable: ~/go-test-hermeticity-solution.md — self-contained, verified solution. Reproduction module kept at /tmp/muster-repro/pkg/config/.
Root cause (all empirically confirmed):
1. loader.setDefaultPaths builds the path from $HOME directly ($HOME/.config/muster/config.yaml), deliberately ignoring $XDG_CONFIG_HOME — matching the legacy openapi-cli init behavior.
2. Load() silently reads that file when present, so a real host: localhost config from openapi-cli init leaks into tests.
3. XDG_CONFIG_HOME isolation provably does not fix it (verified: still fails) because the loader never consults it — only a HOME redirect isolates the tests.
4. No user config → test passes (verified) → this is an env-dependent flake, not a code regression.
Fix: TestMain in pkg/config/loader_test.go redirects HOME/APPDATA/LOCALAPPDATA to an empty scratch dir via os.Setenv (not t.Setenv, which can't outlive individual tests). No product-code changes needed.
Verification results:
| Check | Result |
|---|---|
| Pre-fix + user config present | FAIL: cfg.Host = "localhost" (reproduced) |
| Pre-fix + XDG redirected | FAIL (same) — XDG useless |
| Post-fix + user config present + XDG misdirected | ok |
| go test -race, go vet, go test -short ./... | all pass |
# Evidence - Problem class: go-test-hermeticity - Model: openrouter/deepseek/deepseek-v4-flash-0731 - Solved: 2026-08-17T11:44:47.782Z - Verification: solution produced by pi in sandbox; see signatures.json
{"description": "go test -short ./... failed in pkg/config: TestLoader_ApplyEnvOverrides/empty_env_vars_do_not_override asserts cfg.Host empty but got localhost. Root cause: loader setDefaultPaths hardcodes $HOME/.config/muster (not XDG), Load() reads that file if present; openapi-cli init had created ~/.config/muster/config.yaml (host: localhost). XDG_CONFIG_HOME isolation did NOT fix it \u2014 only HOME redirect. Fix: TestMain in loader_test.go redirects HOME/APPDATA/LOCALAPPDATA to empty scratch dir. Symptom appears only when a real user config exists \u2014 env-dependent flake, not code regression.", "environment": "", "language": "", "model": "openrouter/deepseek/deepseek-v4-flash-0731", "problem_class": "go-test-hermeticity", "provider": "openrouter", "solved_at": "2026-08-17T11:44:47.782Z", "version": ""}