Skip to content

perf(tests): give the remaining MCP test clients the shared schema validation - #11025

Merged
morluto merged 1 commit into
perf/mcp-boundary-shared-validationfrom
perf/remaining-test-clients-shared-validation
Nov 15, 2026
Merged

morluto merged 1 commit into
perf/mcp-boundary-shared-validationfrom
perf/remaining-test-clients-shared-validation

Conversation

@morluto

@morluto morluto commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

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-validation baseline 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.ts checks the SDK default validator itself.
  • tests/boundary/process/nativeValueVerifierComparison.test.ts builds its client in a generated child script that imports compiled dist/ 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

  • Each new Client(info) in the 40 files now passes { jsonSchemaValidator: createMcpSchemaValidation() }. The rewrite was mechanical and parenthesis-aware, followed by oxfmt.
  • In cliStartupImports.test.ts, the import was placed at the top of the test module rather than inside a generated script string.
  • The guard's owner list gains the child-script test, with a comment explaining why. The baseline key is gone.

Not included: .mjs verifier scripts, which are outside the guard's tests/**/*.ts scope.

Contract and boundary impact

  • Semantic owner and earliest changed stage: tests/fixtures/mcpSchemaValidation.ts; test clients consume it.
  • Contribution scope fit and linked maintainer decision: not applicable (test infrastructure).
  • CLI and MCP/tool-catalog contract: none.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details: not applicable.
  • Generated metadata, package, or installation impact: none.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: test clients only. No assertions changed.
  • After this change, the 41 baseline files ran together in 177 s wall and 249 s user CPU, peaking at 3.5 GiB family RSS with a largest process of 918 MiB. These files run in forked projects, so per-file savings are smaller than in perf(tests): give MCP boundary test clients the shared schema validation #11022. I did not run a before measurement for this set.
  • The first run showed that the mechanical rewrite had also edited the client inside 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:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

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.ts passed 2/2.
  • node scripts/verify/architecture-guards.mjs: passed, with the baseline empty.
  • npm run check:fast: passed.
  • npx oxfmt --check on 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's refuseOpenProject helper with the shared validator; docs/development/testing.md now says when a fixture needs clear().

  • 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:check passed.
  • node scripts/verify/architecture-guards.mjs --shrink-baselines (no change) and npm run check:fast passed; npx oxfmt --check on the changed files passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: macOS only.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: none.

Author readiness

Human owner:

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-15T14:51:41.214600Z
We couldn’t complete this review. Comment @codex review to try again.
a56beea New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: apex

[Low impact] The PR appears safe to merge; no new actionable issues remain.

Summary

Moves the remaining 40 MCP test files to createMcpSchemaValidation() and removes their default-validator baseline.

  • Remaining MCP test clients compile output schemas only when needed.

Reviews (2) · Last reviewed commit: "perf(tests): give the remaining MCP test..." · Reviewed by Greptile

@morluto
morluto force-pushed the perf/mcp-boundary-shared-validation branch from 27fd9af to 2b83410 Compare November 15, 2026 10:29
@morluto
morluto force-pushed the perf/remaining-test-clients-shared-validation branch from c4b5516 to 185d4a7 Compare November 15, 2026 10:30
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@morluto
morluto force-pushed the perf/mcp-boundary-shared-validation branch from 2b83410 to f551d72 Compare November 15, 2026 14:07
@morluto
morluto force-pushed the perf/remaining-test-clients-shared-validation branch from 185d4a7 to 56a5881 Compare November 15, 2026 14:07
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@morluto
morluto force-pushed the perf/mcp-boundary-shared-validation branch from f551d72 to ffad7e5 Compare November 15, 2026 14:25
@morluto
morluto force-pushed the perf/remaining-test-clients-shared-validation branch from 56a5881 to e991df2 Compare November 15, 2026 14:26
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@morluto

morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

@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.

@morluto
morluto force-pushed the perf/mcp-boundary-shared-validation branch from ffad7e5 to b3d0639 Compare November 15, 2026 14:51
@morluto
morluto force-pushed the perf/remaining-test-clients-shared-validation branch from e991df2 to a56beea Compare November 15, 2026 14:51
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@morluto
morluto merged commit 58c3bd5 into perf/mcp-boundary-shared-validation Nov 15, 2026
@morluto
morluto deleted the perf/remaining-test-clients-shared-validation branch November 15, 2026 14:52
morluto added a commit that referenced this pull request Nov 15, 2026
…ion (#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)
morluto added a commit that referenced this pull request Nov 16, 2026
…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.
@morluto morluto added area: tests Test suite and verification performance Performance regressions, scaling limits, and bounded-resource work labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: tests Test suite and verification performance Performance regressions, scaling limits, and bounded-resource work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant