Repository navigation
Conversation
Every kmp-mcp test that spawns the binary now goes through one helper, tests/support/isolated_home.rs, which points HOME, XDG_DATA_HOME and XDG_CONFIG_HOME at a home private to the test process under CARGO_TARGET_TMPDIR. A test that needs its own layout still sets the variables afterwards and wins. kmp-release's guide engine now sets XDG_DATA_HOME beside KMP_MCP_DATA_DIR for scratch-store runs, so `kmp-release guide assets write` no longer remembers its temp store in the real known-stores index.
…910) In-process gRPC servers kept each endpoint's agent directory and telemetry salt in the user data home, and every test endpoint is a fresh random port: each run left new agent-users/<hash>.sqlite3 and salt files beside the developer's real ones. KernelMcpServer::with_remote_state_home relocates both, and the gRPC tests use the isolated test home.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #910.
What leaked
Run on a developer machine, the
kmp-mcpandkmp-releasetest suites wrote into the real home:known-stores.jsonl: spawnedkmp-mcpbinaries remembered their temporary stores in the real$XDG_DATA_HOME/kmp/known-stores.jsonl. This is the case the issue describes.~/.claude.json,~/.claude/backupsand~/.hermes/in the home they inherited.agent-users/: in-process gRPC servers kept each endpoint's agent directory and telemetry salt under$XDG_DATA_HOME/agent-users/. Every test uses a fresh random port, so every run added new<hash>.sqlite3and.telemetry-saltfiles. On the maintainer's machine there were 162 of them, 44 from today alone.kmp-release guide assets write: setKMP_MCP_DATA_DIRbut notXDG_DATA_HOME.Fix
tests/support/isolated_home.rs, gives every spawnedkmp-mcpaHOME,XDG_DATA_HOMEandXDG_CONFIG_HOMEprivate to the test process, underCARGO_TARGET_TMPDIR. About 80 spawn sites now use it. A test that sets these variables itself still wins, because its value is applied later.KernelMcpServer::with_remote_state_homemoves a remote store's agent directory and salt. The gRPC tests use it to point at the isolated home.kmp-release: the guide engine now setsXDG_DATA_HOMEbesideKMP_MCP_DATA_DIRfor scratch-store runs. A regression test with a fake engine checks this for both the CLI path and the MCP path.Evidence
cargo test -p kmp-mcp, run withHOMEandXDG_*pointing at a fake developer home:kmp/known-stores.jsonl(temp store/tmp/.tmp…),agent-users/*.sqlite3and salts,.claude.json,.claude/backups,.hermes/kmp-mcp+kmp-release)cargo test -p kmp-mcp -p kmp-releasealso ran against the maintainer's real home: 108 suites ok, and the realknown-stores.jsonlwas byte-identical before and after. fmt, clippy-D warningsand the kmp-mcp architecture gate all pass.CI is unaffected because its home is throwaway. The dev-loop now also covers
kmp-release(499f82b on the integration branch).