test(mcp): add cross-generator field-stripping contract tests - #2010
Merged
dyoshikawa merged 2 commits intoJun 23, 2026
Conversation
Harden the MCP export paths universally (#1659): a parameterized contract test asserts that every non-codex MCP generator strips the rulesync-source-only fields (targets, description, exposed) and the codex-only envVars field from its emitted config, plus a dedicated Cursor source-preservation test verifying the fields survive in the rulesync source but are stripped at emit. Codex is the deliberate exception (it reads envVars directly). Test-only; no production changes — all 28 non-codex generators already strip correctly via RulesyncMcp.getMcpServers(). Closes #1659 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Fix the critical review finding: the test called fromRulesyncMcp without mocking process.cwd()/getHomeDirectory(), so read-or-initialize generators wrote real files into the repo root (.config/, .rovodev/, etc.) and failed CI's git-diff checks. Use setupTestDirectory + mock process.cwd() (project scope) and getHomeDirectory() (global scope) so all writes are isolated and cleaned up. Also add a symmetric description key-name probe (review finding #5). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Owner
Author
|
Thanks — merging. Adds cross-generator MCP field-stripping contract tests (parametric non-codex leak contract + Cursor source-preservation), closing #1659. |
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.
Summary
Adds the cross-generator MCP contract tests requested in #1659, hardening the MCP export paths universally.
RulesyncMcp.getMcpServers()omits the rulesync-source-only fields (targets,description,exposed) plus the codex-onlyenvVarsfield, and every non-codex tool MCP generator builds its output fromgetMcpServers(). These tests pin that contract so a future generator that bypasses the canonical stripping is caught.Changes
it.each(toolMcpFactories)(excludingcodexcli) builds aRulesyncMcpwhose server carriestargets/description/exposed/envVarsand asserts none of those field names or canary values leak into the emittedgetFileContent()— format-agnostic, covering all 28 non-codex generators (global-only tools like augmentcode are driven in global mode).Codex is the deliberate exception (it reads
envVarsdirectly to emit[mcp_servers.<name>.env]).Verification
pnpm cicheckpasses; the new file adds 29 passing tests. Test-only — no production changes were needed (all generators already strip correctly).Closes #1659