Repository navigation
perf(tests): give the remaining MCP test clients the shared schema validation - #11025
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 PR appears safe to merge; no new actionable issues remain. SummaryMoves the remaining 40 MCP test files to
Reviews (2) · Last reviewed commit: "perf(tests): give the remaining MCP test..." · Reviewed by Greptile |
27fd9af to
2b83410
Compare
c4b5516 to
185d4a7
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
2b83410 to
f551d72
Compare
185d4a7 to
56a5881
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
f551d72 to
ffad7e5
Compare
56a5881 to
e991df2
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
@greptileai please review the latest commit: the branch was rebased onto main after #10693, and the findings from the earlier review are addressed in the current head. |
ffad7e5 to
b3d0639
Compare
e991df2 to
a56beea
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…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 last 40 baseline test clients onto the shared, lazy schema validation: acceptance, process-global, CLI, filesystem, providers, firmware and process tests. The
test-mcp-client-default-validationbaseline drops from 41 files to 0, so the guard now enforces zero. Two files are named owners of the guard instead:tests/boundary/mcp/outputValidatorReuse.test.tschecks the SDK default validator itself.tests/boundary/process/nativeValueVerifierComparison.test.tsbuilds its client in a generated child script that imports compileddist/modules, and that script cannot load the TypeScript fixture.Stacked on #11022.
Problem and expected behavior
Same as #10960 and #11022: a default-validation test client compiles every listed tool's output schema on its first call. Expected: no test client does this except the tests that are about the SDK default.
Change and scope
new Client(info)in the 40 files now passes{ jsonSchemaValidator: createMcpSchemaValidation() }. The rewrite was mechanical and parenthesis-aware, followed by oxfmt.cliStartupImports.test.ts, the import was placed at the top of the test module rather than inside a generated script string.Not included:
.mjsverifier scripts, which are outside the guard'stests/**/*.tsscope.Contract and boundary impact
tests/fixtures/mcpSchemaValidation.ts; test clients consume it.Expected effects:
Evidence and regression coverage
nativeValueVerifierComparison's generated child script (ReferenceError: createMcpSchemaValidation is not defined). That file is reverted and named as a guard owner. Rerun: 1 file / 2 tests passed.For evidence-bearing changes:
Validation performed
npm run test:focused -- <the 41 baseline files>: 39 passed, 1 skipped, 1 failed (nativeValueVerifierComparison, described above). After the fix,npm run test:focused -- tests/boundary/process/nativeValueVerifierComparison.test.tspassed 2/2.node scripts/verify/architecture-guards.mjs: passed, with the baseline empty.npm run check:fast: passed.npx oxfmt --checkon the changed files: passed.After rebasing onto main at 5c53bca (#10693), head 56a5881:
schemaVerifierEnvironment(removed by #10693) is no longer imported; the JEB failure test keeps main'srefuseOpenProjecthelper with the shared validator;docs/development/testing.mdnow says when a fixture needsclear().npm run test:focused -- tests/boundary/providers/jeb/failureEnvelopes.test.ts tests/acceptance/setup/launcherAliasesCli.test.ts tests/acceptance/setup/dshClientSetup.test.ts tests/acceptance/artifactExtractionSelection.test.ts tests/acceptance/harmonyArtifactJourney.test.ts: 5 files, 40 tests passed;npm run docs:checkpassed.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.