Repository navigation
test(mcp): check advertised schemas against a portable dialect in every profile - #10567
Conversation
Codex Review Summary: ✅ CompletedThis 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a6e25111d9
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
[Medium impact] The reviewed changes appear safe to merge, with no new blocking issue found. SummaryAdds one owner for the advertised schema dialect, counted baselines, all-profile catalog coverage, and packaged catalog checks.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
Profiles["Input × output × catalog profiles"] --> Listed["Advertised tools"]
Listed --> Dialect["Shared dialect checks"]
Dialect --> Counts["Violation counts"]
Counts --> Baseline["Compare with profile baseline"]
Package["Packaged tools"] --> Dialect
Reviews (3) · Last reviewed commit: "fix(mcp): refuse zero-padded repeat boun..." · Reviewed by Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2af5be9733
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Summary
Adds one owner for the portable advertised schema dialect (
src/contracts/advertisedDialect.ts) and checks every schema REA can advertise against it. A catalog test liststools/listthrough the in-memory client for every input × output × catalog profile combination (2 × 3 × 2) and compares the violation counts with a counted baseline (advertisedDialectBaseline.ts). The baseline may only shrink, and any construct not listed is enforced at zero. The packaged catalog check, which runs over the packed tarball in CI, on Windows and in the release rehearsal, applies the same rules to the default profiles.Refs #10389 #7151 #10436
Problem and expected behavior
The advertised dialect was never written down. Each client rejection (
\0,\uD800, look-around,v-mode classes, arrays withoutitems, root unions, empty-string enums, size and depth) was repaired at one site, and each guard was a denylist for one construct. Most guards covered only the default profile, so the full input profile shipped look-around andv-mode failures (#10389) until a per-site fix. One refused construct can make a client reject the whole tools request, not just one tool.Expected: any new construct outside the portable dialect, in any profile, fails a test before release, and the known remainder is listed explicitly.
Change and scope
advertisedDialect.tsis a TypeScript port of the audit'spad_audit.pyallowlist. It checks:type;itemson arrays only;anyOfonly below the root, with at least two typed branches;patternrestricted to the regex grammar that compiles in V8 (plain,u,v), Pythonre, Goregexp, Rustregexandfancy-regex.Output schemas are checked against the regex grammar only, because SDK clients compile them but no model reads them.
The 13 KiB per-tool cap moves from
mcpInputSchemaProfile.tsinto the dialect owner.COMPACT_INPUT_SCHEMA_BUDGET_BYTESnow refers to it. The depth check reusesschemaDepthandCOMPACT_SCHEMA_MAX_DEPTH.verifyCompleteToolCatalog(packed tarball:verify:package,verify:package:windows, release rehearsal canary) refuses a catalog whose default-profile counts exceed the baseline.The new test runs on the curated Windows lane and is in the
packageCI scope.Superseded checks removed:
\0/\udenylists and the full-profile compile test inadvertisedPatternsVMode.test.ts(the canonical base64 semantics test stays);schemaDepthcopy incompactInputSchemaMcp.test.ts;dependentRequiredwalker;$refwalker and its unit test.$ref,$defs,dependentRequiredanddependenciesare now outside the allowlist at zero in both profiles.Baseline today, measured over every distinct listed definition:
compactinput: 18 keys. The largest are$schema(256),const(81),exclusiveMinimum(61), untyped nodes (40),\spatterns (21) and unanchored^\/prefixes (9).fullinput: 33 keys. These include unanchored (98),\d/\w/\s(30),.(5), one[^…^…]and one\x80-\xffpattern.fulloutput: 67 patterns (., shorthand classes, unanchored).compactandoffoutput: zero.The look-around and
v-mode constructs from #10389 are at zero in every profile, so they are enforced.Intentionally not included:
Contract and boundary impact
Semantic owner and earliest changed stage:
src/contracts/advertisedDialect.tsowns the dialect rules and the per-tool size cap. Its consumers aremcpInputSchemaProfile.ts, the catalog test and the packaged verifier.Contribution scope fit and linked maintainer decision: not applicable (test and verification guard; no runtime behaviour change).
CLI and MCP/tool-catalog contract: unchanged. Nothing advertised changes.
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: packaged verification now fails on a dialect regression.
Documentation or usability only; no target interaction.
Evidence and regression coverage
tests/boundary/mcp/advertisedDialect.test.ts:""/u/v;packageCatalogVerification.test.ts: the packaged check refuses a look-around pattern in an input or output schema before any tool call.src/domain/portableBundleName.tsfrom before the [Bug] Full input-schema profile advertises look-ahead and v-mode-incompatible patterns #10389 fix (b6b6800346^) makes the catalog test fail withinput pattern look-around: 6 > 0andinput pattern unanchored: 104 > 98for the full profile.Validation performed
npm run check:fast: passed.npm run test:focused -- tests/boundary/mcp/advertisedDialect.test.ts tests/boundary/mcp/advertisedPatternsVMode.test.ts tests/boundary/mcp/compactInputSchemaMcp.test.ts tests/boundary/mcp/packageCatalogVerification.test.ts tests/process-global/curatedWindowsLane.test.ts tests/boundary/filesystem/ciChangeScope.test.ts tests/boundary/filesystem/ciRequiredLanes.test.ts: 7 files and 452 tests passed.npm run docs:check: passed.npx oxfmt --checkon changed files: passed.verify:package,verify:package:windowsand the Windows lane. CI exercises them.Compatibility, safety, and release
Author readiness
Human owner:
Before merge
type(scope): outcome.