Repository navigation
Description
Relocated from dezren39/darwin-nix#259 on 2026-10-28 (placement audit): mcpx's single source lives in developing-today/code (pkgs/mcpx); re-home tracked at #309. Original body below; issue references inside it are historical (dezren39/nix numbering).
Repro
On pristine origin/main 408bc2b, with a real ~/.config/mcpx/config.json present and TMPDIR pointing under $HOME (my case: TMPDIR on a btrfs volume at ~/tmp because /tmp is a 512M tmpfs):
cd pkgs/mcpx
TMPDIR=$HOME/tmp go test ./internal/daemon/
5 failures, e.g.:
--- FAIL: TestResolveNamesTheDaemonKeyedToTheNearestConfig (0.00s)
routes_resolve_test.go:55: configHash = "70618a007427", want "ffec5674504f"
--- FAIL: TestResolveOverHTTPAnswersForTheAskingDaemonItself (0.00s)
routes_resolve_test.go:199: sources = [.../003/.mcpx.json /home/hatch/.config/mcpx/config.json], want [.../003/.mcpx.json]
--- FAIL: TestResolveForADirectoryWithNoConfigNamesTheDefaultDaemon (0.00s)
routes_resolve_test.go:227: configHash = "dc56d4a7680a", want empty: nothing contributed
Root cause
Same class as #196/#221 (fixed there for internal/config): SearchPathFrom checks $dir/.config/mcpx/config.json at every ancestor level during the upward walk. The test's isolate() set HOME/XDG_CONFIG_HOME to a t.TempDir, but the temp tree itself lived under the real $HOME, so the walk passed through the real home directory and picked up the developer's own config — changing the daemon key in FingerprintConfig and breaking socket resolution (the leaked hash dc56d4a7680a is the same default-daemon hash from #196).
Two Go gotchas made the obvious fix wrong:
testing.TempDirreadsGOTMPDIR, notTMPDIR(go1.26testing/testing.go:1460), and caches one parent dir per test — settingTMPDIRafter the firstt.TempDirhas no effect.- So the fake home itself must be created outside the real $HOME tree.
Fix
In PR #221 (commit 995fb9a on branch mcpx-test-home-isolation): isolate() now creates the fake home with os.MkdirTemp("/tmp", ...) and points GOTMPDIR+TMPDIR+HOME at it before any t.TempDir call. Full internal/daemon package green with the fix; the 5 failures reproduce on pristine 408bc2b.
Acceptance criteria
-
go test ./internal/daemon/passes with TMPDIR under the real $HOME and a real~/.config/mcpx/config.jsonpresent. - The daemon tests are hermetic: config discovery in tests cannot read the operator's real config (test-scoped HOME or config-dir override).
- No production behavior changes beyond what test hermeticity requires.
Activity
developing-today commentedon Oct 28, 2026
CODE-884
dezren39 commentedon Oct 28, 2026
History carried over from dezren39/darwin-nix#259 (verbatim, oldest first):
@dezren39 · 2026-10-15T09:23:28Z
Verified fixed on current origin/main (
fe3038f).Reproduced the exact issue preconditions: real
~/.config/mcpx/config.jsonpresent,TMPDIR=/home/hatch/tmp(under the real $HOME),GOTMPDIRunset, thengo test -count=1 ./internal/daemon/inpkgs/mcpx— 30/30 PASS, no failures.The fix is the
isolate()rework from PR #221 (commit995fb9a, merged 2026-09-30 as0e38804): the fake home is created withos.MkdirTemp("/tmp", ...)(outside the real $HOME tree) withGOTMPDIR+TMPDIR+HOMEpointed at it before anyt.TempDircall, so the upward config walk can never leak the developers own config.No further work needed from this side; closing is yours to call.
@dezren39 · 2026-10-27T15:35:09Z
Intake review
Fleet monitor intake pass, 2026-10-27 (repo-fleet-monitor).
Related: the 2026-09-30 mcpx conformance set — parent analysis #252, siblings #253, #254, #255, #256, #257, #258, #259 (filed together from
docs/spec/conformance-matrix.mdin dezren39/nix). Treat the set as one body of work; do not re-file per-gap issues.Notes: Unlike the rest of the set this one is reproduced on pristine main (408bc2b) with an exact repro and 5 named failures — the config walk leaking the real
~/.config/mcpx/config.jsoninto daemon tests. Priority normal and effort m (monitor judgment): it poisons the test signal for every other mcpx change, including the rest of this set.Risks: A test-only fix that masks a real config-precedence bug — the repro test (
TestResolveNamesTheDaemonKeyedToTheNearestConfig) suggests nearest-config resolution is the mechanism, so verify the production precedence is intended before walling it off in tests.Suggested approach: reproduce first, then decide whether the leak is a test-isolation gap or a genuine resolution bug; fix at that layer.
dezren39 commentedon Oct 29, 2026
🤖 Agent note · done
Triage verdict (task 2859, 2026-10-29): already fixed on current main — closing
The fix this issue asks for is already present in developing-today/code. Verified read-only against current main today:
pkgs/mcpx/internal/daemon/routes_resolve_test.go,isolate()(lines 28–50):os.MkdirTemp("/tmp", "mcpx-test-home-")— outside the real $HOME tree, exactly the PR feat(id): add bounded pure Roc JSON library #221 approach this issue prescribes;HOME,XDG_CONFIG_HOME,GOTMPDIRandTMPDIRall pointed at the fake home insideisolate(), before anyt.TempDircall in the tests that use it;filepath.EvalSymlinksso path comparisons also hold on macOS (/tmp → /private/tmp).That matches the carried-over verification in this issue's own history (dezren39, 2026-10-15: exact repro preconditions — real ~/.config/mcpx/config.json present, TMPDIR under the real $HOME —
go test -count=1 ./internal/daemon/30/30 PASS on the nix tree's main at fe3038f, fix = PR #221 commit 995fb9a, merged 2026-09-30 as 0e38804). The re-home carried both the fix and that verification into this repo; the acceptance criteria (daemon tests pass with TMPDIR under real $HOME; tests hermetic; no production behavior change) are met by test-only code already on main.Dedupe pass: searches for "mcpx daemon tests HOME config walk hermetic" and the conformance-set siblings return no other code issue covering this subject — #1988 (mcpx Go tests fail on macOS) is a different failure set (internal/config path tests), not this one. No follow-up packet enqueued: there is nothing left to implement.
Closing as completed (already fixed upstream, inherited via the #309 re-home).