Repository navigation
Conversation
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
[Low impact] The reviewed changes appear safe to merge, with no blocking findings. SummaryMoves MCP SDK clients in 159 test files onto the existing shared, lazy schema validator. Updates the testing guide and removes the remaining default-client baseline, with two named exceptions.
Reviews (3) · Last reviewed commit: "perf(tests): give the remaining MCP test..." · Reviewed by Greptile |
82e0975 to
3d24b37
Compare
27fd9af to
2b83410
Compare
3d24b37 to
1dd25fb
Compare
2b83410 to
f551d72
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
1dd25fb to
632d2ee
Compare
f551d72 to
ffad7e5
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
ffad7e5 to
b3d0639
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
f66e2a1
into
perf/test-mcp-shared-schema-validation
…10960) * perf(tests): give MCP test clients the shared lazy schema validation The MCP SDK client compiles every listed tool's output schema on its first tool call. With the SDK's default Ajv options, REA's catalog costs gigabytes of allocation per client (inspect_analysis_view alone: 1.7 s and ~500 MiB retained), so native MCP files peaked at 1-2 GiB per worker. tests/fixtures/mcpSchemaValidation already owns lazy, reference-preserving validation. Route the native MCP, process-boundary and shared harness clients through it, share compiled validators across clients in a worker (bounded LRU keyed by schema text), and add a counted architecture guard so default-validation test clients cannot spread; the remaining copies are the baseline. * fix(guards): read call arguments past parentheses inside string literals * perf(tests): give MCP boundary test clients the shared schema validation (#11022) * perf(tests): give MCP boundary test clients the shared schema validation * perf(tests): give the remaining MCP test clients the shared schema validation (#11025) * fix(guards): read an MCP client's validator option from parsed code The default-validation counter searched each new Client(...) call's text for jsonSchemaValidator, so an inline comment, a string literal or a client name naming the option hid a default client. Parse the source with @babel/parser and count NewExpressions of Client whose object-literal arguments have no jsonSchemaValidator property; a source that does not parse counts every textual call. The guard reads raw test sources, and the generated-child-script allowlist entry, which no longer counts as a call, is removed. * fix(guards): read an MCP client's options only from a whole object-literal argument The default-validation counter skipped files without the text 'new Client(', so a comment between the tokens hid a client, and it took any depth-two key as an option, so 'enabled ? { jsonSchemaValidator } : {}' passed while its false branch uses the SDK default. The skip now only requires the name Client, and the validator counts only when it is a key of an object literal that is a whole argument; anything else counts as the default.
Summary
This PR moves the remaining MCP boundary test clients onto the shared, lazy schema validation that #10960 introduced. It changes 119 files in
tests/boundary/mcp/and shrinks thetest-mcp-client-default-validationbaseline from 161 files (282 sites) to 41 files (43 sites).outputValidatorReuse.test.tschecks the SDK default validator itself, so it becomes a named owner of the guard and keeps that validator.Stacked on #10960.
Problem and expected behavior
A test client built with the SDK default compiles the output schema of every listed tool on its first
callTool. In themcp-boundarythread workers, those compilations accumulate. Expected: each client pays only for the tools it calls, and pays once per worker.Change and scope
new Client(info)in the slice now passes{ jsonSchemaValidator: createMcpSchemaValidation() }. Where an options object already existed, the validator was added to it. The rewrite was mechanical and parenthesis-aware, followed by oxfmt.progressMcp.test.tsandelectronMcp.test.tsgain a localtestClient(name)helper, and one client's info object inadbStartMcp.test.tsis collapsed to a single line. Without these changes, three test functions would exceedmax-lines-per-function.scripts/verify/architecture-guards.mjsnamestests/boundary/mcp/outputValidatorReuse.test.tsas an owner, since it deliberately exercises the SDK default validator. The baseline was lowered with--shrink-baselines.Not included: the remaining 41 baseline files in acceptance, process-global, CLI, filesystem, providers, firmware and process tests. They follow in a further slice.
Contract and boundary impact
tests/fixtures/mcpSchemaValidation.ts(from perf(tests): give MCP test clients the shared lazy schema validation #10960); test clients consume it.Expected effects:
Evidence and regression coverage
I ran the same 119 files with
npm run test:focused, first on #10960's head and then on this branch. Both runs were on macOS, back to back on a shared host. Peak is process-family RSS sampled every 200 ms.Both runs: 117 files passed and 2 skipped, 879 tests passed and 7 skipped.
For evidence-bearing changes:
Validation performed
npm run test:focused -- <the 119 migrated tests/boundary/mcp files>: 117 files passed, 2 skipped; 879 tests passed, 7 skipped (66 s wall, 3.7 GiB peak).node scripts/verify/architecture-guards.mjs: passed.npm run check:fast: passed.npx oxfmt --checkon the changed files: passed.After rebasing onto main at 5c53bca (#10693), head f551d72: import conflicts kept both sides;
outputSchemaProfile.test.tsdrops the now-unusedadvertisedInputJsonSchemaimport.npm run test:focused -- tests/boundary/mcp/advertisedPatternsVMode.test.ts tests/boundary/mcp/batchSourcePublicationCleanup.test.ts tests/boundary/mcp/outputSchemaProfile.test.ts tests/boundary/mcp/providerSelectionMcp.test.ts tests/boundary/mcp/webModuleTraceMcp.test.ts: 5 files, 36 tests passed.node scripts/verify/architecture-guards.mjs --shrink-baselines(no change) andnpm run check:fastpassed;npx oxfmt --checkon the changed files passed.Compatibility, safety, and release
Author readiness
Human owner:
Before merge
type(scope): outcome.