Repository navigation
test(mcp): fix three MCP boundary suites on native Windows - #2312
Merged
Merged
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
3 tasks done
8 tasks done
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
Five tests in three MCP boundary suites fail on native Windows because of POSIX assumptions in the tests themselves; the product behaves correctly. No issue is linked: I found them while running the MCP boundary project on Windows for #2148, and the fix touches only these test files, like #2113.
Problem and expected behavior
Smallest trigger, on Windows:
npx vitest run tests/boundary/mcp/dylibResolutionMcp.test.ts tests/boundary/mcp/electronMcp.test.ts tests/boundary/mcp/toolErrorSchemaDelivery.test.tsgives 5 failed and 18 passed on0043d9b13. Expected: each test reaches its assertions and passes, or is skipped where its mechanism does not exist on Windows.dylibResolutionMcp› keeps a permission denied while canonicalizing the opened bundleexpected undefined to be truechmod(parent, 0o000)does not deny access on WindowsdylibResolutionMcp› reports caller-selected roots that cannot be traced as invalid inputEPERM: operation not permitted, symlink 'C:\bin\ls' -> '<tmp>\…\Contents\MacOS\outside'electronMcp› exposes endpoint-scoped Electron discovery and inspection as Evidencefile_path: "C:\\…\\index.html"does not match/\/index\.html$/u/electronMcp› runs active Electron scenarios with selected paths and inferred working directoryENOENT: no such file or directory, symlink '<tmp>\rea-electron-active-mcp-…' -> '<tmp>\C:\…\rea-electron-active-mcp-…-alias'root.split("/")returns the whole path, so the alias path is doubledtoolErrorSchemaDelivery› delivers typed tool failures without violating the advertised success schema over stdioexpected '{"error":{"code":"target_unavailable"…' to contain 'C:\…\not-present.bin'JSON.stringify(...), where backslashes are escapedChange and scope
dylibResolutionMcp.test.ts:chmod-based permission test is skipped on Windows with the condition otherchmodtests already use:it.skipIf(process.platform === "win32" || process.getuid?.() === 0)./bin/lssymlink. The three other roots now also run on Windows; the symlink and its case are added where the platform is not Windows.electronMcp.test.ts:file_pathpatterns accept either separator (/[\\/]index\.html$/u, and the same forapp.jsandworker.js).basename(root), and the alias is a junction on Windows, which needs no symlink privilege. It stays adirsymlink elsewhere.toolErrorSchemaDelivery.test.ts: the diagnostic is searched for the JSON-encoded path,JSON.stringify(missing).slice(1, -1). On POSIX this is the same string as before.No product code changes. On Linux and macOS every changed line behaves as before:
[\\/]matches/,basenamereturns the last/segment, the symlink type and the outside-root case are unchanged, and JSON encoding leaves a temporary path with no backslashes or quotes as it is.Contribution scope: not applicable (test-only fix within existing boundaries).
Contract and boundary impact
docs/public/product-catalog.json), package, or installation impact: none.Evidence and regression coverage
chmoddenial) and the outside-root case of another does not run; everything else now runs there.0043d9b13the command above gives 5 failed, 18 passed on Windows; the errors are in the table.Validation performed
Windows 11 26H2 x64, non-elevated, Node 22.22.3, with a locally built Windows native addon in
native/windows/build(the JavaScript analysis tests inelectronMcpneed the Windows native controls).npx vitest run tests/boundary/mcp/dylibResolutionMcp.test.ts tests/boundary/mcp/electronMcp.test.ts tests/boundary/mcp/toolErrorSchemaDelivery.test.tson0043d9b13: 5 failed, 18 passed.npx vitest run --project mcp-boundarywith this change: 98 files passed, 6 skipped; 420 tests passed, 13 skipped, 0 failed.npm run check:fast: passed.npx oxfmt --checkon the three files: passed.Compatibility, safety, and release
Before merge
type(scope): outcome.