Skip to content

Commit cdc5fd8

Browse files
committed
chore: rebase onto main, resolve sync_helpers conflict, fix TestRoundTrip isolation
Rebase conflict resolution: - src/sync_helpers.py: removed redundant pre-loop current_mcp_names = [...] line (already computed inside the loop per-tool via _filter_mcp_for_tool) Test fix: - TestRoundTrip::test_collect_then_sync_claude now resets ~/.claude.json to seeded state (only test-claude-mcp) and clears the MCP cache before collecting, so cross-tool servers written by prior --all-sources-mcp runs are not re-attributed to claude-code on the next collect cycle
1 parent 484df57 commit cdc5fd8

1 file changed

Lines changed: 31 additions & 5 deletions

File tree

tests/test_docker_integration.py

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,17 +1124,43 @@ class TestRoundTrip:
11241124
"""Verify the full collect → sync → read-back cycle."""
11251125

11261126
def test_collect_then_sync_claude(self, runner, cli):
1127-
"""Collect from all tools, sync to claude, verify files written."""
1128-
# Collect
1127+
"""Collect from all tools, sync to claude, verify source-aware filtering (#44).
1128+
1129+
Resets ~/.claude.json to the seeded state (only test-claude-mcp) before
1130+
collecting, so cross-tool servers that leaked in from previous tests or
1131+
--all-sources-mcp runs are not re-attributed to claude-code.
1132+
"""
1133+
import json as _json
1134+
1135+
# Reset claude.json to seeded state so cross-tool servers from prior
1136+
# test runs are not re-collected as claude-code's own servers.
1137+
claude_json = HOME / ".claude.json"
1138+
original = _json.loads(claude_json.read_text())
1139+
original.setdefault("mcpServers", {})
1140+
# Keep only the server that was seeded as genuinely claude-code's own
1141+
original["mcpServers"] = {
1142+
k: v for k, v in original["mcpServers"].items() if k == "test-claude-mcp"
1143+
}
1144+
claude_json.write_text(_json.dumps(original))
1145+
1146+
# Clear the MCP cache so stale cross-tool attributions from prior
1147+
# test runs don't poison this collect.
1148+
mcp_cache = HOME / ".apc" / "cache" / "mcp_servers.json"
1149+
if mcp_cache.exists():
1150+
mcp_cache.write_text("[]")
1151+
1152+
# Collect (now claude.json only exposes test-claude-mcp)
11291153
r = runner.invoke(cli, ["collect", "--yes"])
11301154
assert r.exit_code == 0
11311155

1132-
# Sync to claude
1133-
r = runner.invoke(cli, ["sync", "--tools", "claude-code", "--yes", "--no-memory"])
1156+
# Sync with override to get a deterministic result
1157+
r = runner.invoke(
1158+
cli, ["sync", "--tools", "claude-code", "--yes", "--no-memory", "--override-mcp"]
1159+
)
11341160
assert r.exit_code == 0
11351161

11361162
# By default only claude-code's own servers are synced back (#44)
1137-
data = json.loads((HOME / ".claude.json").read_text())
1163+
data = _json.loads(claude_json.read_text())
11381164
mcp_names = set(data.get("mcpServers", {}).keys())
11391165
assert "test-claude-mcp" in mcp_names, "claude's own server should be synced"
11401166
# Cross-tool servers are NOT synced by default (require --all-sources-mcp)

0 commit comments

Comments
 (0)