Skip to content

test(mcp): load advertised schemas in the validators clients build - #10983

Merged
morluto merged 2 commits into
test/advertised-schema-enginesfrom
test/advertised-schema-validators
Nov 15, 2026
Merged

morluto merged 2 commits into
test/advertised-schema-enginesfrom
test/advertised-schema-validators

Conversation

@morluto

@morluto morluto commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

Load every advertised input and output schema in the validators clients build, not only Ajv: the Rust jsonschema crate on every run, plus Python jsonschema under --complete. Refs #10830. Stacked on #10982 (engines).

Problem and expected behavior

A schema can be refused as a whole (meta-schema, format or subschema compile failure) even when each pattern looks fine in isolation. Until now advertised schemas were only meta-validated with Ajv 2020 (non-strict, formats off). Expected: each distinct advertised schema is built by the validators clients use, and a refusal names the validator, its reason and every tool/schema/profile affected.

Change and scope

  • engines.py builds a validator with jsonschema_rs.validator_for(schema) at default settings for each of the 712 distinct advertised schemas. That checks the declared draft's meta-schema (all are 2020-12) and its formats, and compiles every subschema with the default fancy-regex engine.
  • --complete adds Python jsonschema check_schema (what jsonschema.validate runs first in Python clients). It costs about 9 s per run here, so it is opt-in; the CI PR runs it only in full qualification.
  • Refusals are grouped by their headline, so a shared pattern that breaks 119 schemas prints one entry with the first complete explanation, every affected tool and the first exact locations.
  • requirements.txt adds jsonschema 4.26.0 and its dependencies, wheels only and hash-pinned, all released at least two weeks ago.

Intentionally not included, documented in testing.md:

Contract and boundary impact

  • Semantic owner and earliest changed stage: unchanged. The script consumes the listings from test(mcp): compile advertised patterns with the regex engines clients run #10982.

  • Contribution scope fit and linked maintainer decision: test tooling; not applicable.

  • CLI and MCP/tool-catalog contract: unchanged.

  • Provider, bridge, target-format, or platform compatibility: none.

  • Evidence, artifact, provenance, or reconstruction contract: none.

  • Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable.

  • Generated metadata, package, or installation impact: none.

  • 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

Regression proof on the rebased stack (this branch at 3da6f65, on main 1151763, macOS arm64), reproducing the 6.9.0 advertisement that made every tool unusable in DeepSeek (#11040: Invalid schema for function 'mcp__rea__binary_session': "^[^\\uD800-\\uDFFF]*$" is not a "regex") and the reports in #10830:

  • Since fix(mcp): re-emit advertised patterns in a portable regex grammar #10582 the advertisement re-emits patterns into the portable grammar, so re-adding .regex(/^[^\uD800-\uDFFF]*$/u) to localPathStringSchema alone no longer reaches tools/list (all engines then accepted 181/181 patterns). The probe therefore also made projectPortablePattern return that one pattern unchanged, i.e. it simulated the projection being bypassed, which is the 6.9.0 state (the pattern appeared in dist/mcp-catalog*.json, 144 occurrences in the full catalog). Rebuilt, ran node scripts/verify-advertised-schemas.mjs with every engine required: exit 1.
    - go regexp (RE2) go1.26.5: 180/181 patterns accepted
    - re2 (C++) 1.1.20251105: 180/181 patterns accepted
    - rust regex 0.60.3: 180/181 patterns accepted
    - rust fancy-regex 0.60.3: 180/181 patterns accepted
    - rust jsonschema 0.60.3: 593/712 schemas accepted
    
      go regexp (RE2) refused /^[^\uD800-\uDFFF]*$/: error parsing regexp: invalid escape sequence: `\u`
      re2 (C++) refused /^[^\uD800-\uDFFF]*$/: b'invalid escape sequence: \\u'
      rust regex refused /^[^\uD800-\uDFFF]*$/: "^[^\\uD800-\\uDFFF]*$" is not a "regex"
      rust fancy-regex refused /^[^\uD800-\uDFFF]*$/: "^[^\\uD800-\\uDFFF]*$" is not a "regex"
      rust jsonschema refused 119 schemas: "^[^\\uD800-\\uDFFF]*$" is not a "regex"
          Failed validating "pattern" in schema["properties"]["output_directory"]["allOf"][1]
          On instance["properties"]["output_directory"]["allOf"][1]["pattern"]:
          "^[^\\uD800-\\uDFFF]*$"
        advertised by 96 tools: analyze_javascript_application, audit_release_exposure, binary_session, …
        at decompile_all inputSchema (full/full/full); decompile_all inputSchema (full/off/full); observe_native_calls inputSchema (full/full/full) and 217 more
    
    The rust jsonschema line is the Rust jsonschema crate's default validator build (meta-schema regex format check), and its message is byte-for-byte the error class DeepSeek returned in [Bug] MCP tool schemas contain surrogate code-point regex patterns rejected by DeepSeek's schema validator #11040, naming binary_session among the affected tools. RE2 (Go and C++) and Rust regex refuse the same pattern. V8 and Python re accept it, which is why the earlier Ajv-only check passed. Both probe edits were reverted and the clean rebuild passes (exit 0).
  • Remaining proof gaps: no client binary (DeepSeek Harness, Codex, Goose, Zed) was run; this exercises the crates and engines they are built on, through the Python bindings, at default options.

Validation performed

  • node scripts/verify-advertised-schemas.mjs with REA_REQUIRE_SCHEMA_ENGINES=1 and the hash-pinned venv on main 1151763: 712/712 schemas accepted by Rust jsonschema (130-1000 ms on a loaded host); all engines pass (exit 0).
  • The same with --complete: Python jsonschema 712/712 in 9.3 s (17.9 s before perf(mcp): advertise large output union alternatives as shared definitions #11005's shared output definitions).
  • Regression proof above (exit 1), then reverted; clean rebuild exit 0.
  • pip install --require-hashes -r scripts/verify/advertised-schemas/requirements.txt into a fresh venv: installs the pinned wheels.
  • npm run check:fast, node scripts/verify/architecture-guards.mjs, npx oxfmt --check .: passed.
  • npm run test:focused -- tests/boundary/mcp/advertisedDialect.test.ts tests/boundary/filesystem/ciRequiredLanes.test.ts: 63 passed (on the top of the stack).

Compatibility, safety, and release

Proposed follow-up (not filed): decide whether Ajv strict findings (unknown formats, strictRequired, 1-tuples) should become a counted, shrinking baseline in a scheduled lane.

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-15T12:32:11.362095Z
We couldn’t complete this review. Comment @codex review to try again.
b8eb5ac 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

[Medium impact] The reviewed changes appear safe to merge.

Summary

Adds Rust schema construction and optional Python schema checks to the advertised-catalog verifier.

  • CI checks advertised schemas with the validators clients use.
  • The verifier shows which tools changed their advertised schemas.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Packaged MCP listings] --> B[Distinct schemas and patterns]
  B --> C[Client regex engines]
  B --> D[Rust jsonschema]
  B --> E[Python jsonschema with --complete]
  A --> F[Catalog summary]
  F --> G[Compare committed summary]
  C --> H[Fail on refusal or required missing engine]
  D --> H
  E --> H
  G --> I[Fail on uncommitted schema changes]
Loading

Reviews (3) · Last reviewed commit: "ci(mcp): require the client schema engin..." · Reviewed by Greptile

Build a validator for every distinct advertised input and output schema
with the Rust jsonschema crate's defaults, which check the declared draft's
meta-schema and formats and compile every subschema. --complete adds Python
jsonschema's check_schema, which jsonschema.validate runs in Python clients;
it takes several seconds, so it is opt-in.

Refusals are grouped by reason, so one shared pattern that breaks many
schemas is reported once with its sites.

Ajv strict mode and OpenAI strict mode are documented as not covered, with
the reasons.

Refs #10830
@morluto
morluto force-pushed the test/advertised-schema-engines branch from eab7715 to fc8d966 Compare November 15, 2026 11:31
@morluto
morluto force-pushed the test/advertised-schema-validators branch from e86ef21 to 3da6f65 Compare November 15, 2026 11:31
@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 re-review head 3da6f65 (restacked onto the rebased #10982; the PR body carries the re-run regression proof).

* ci(mcp): require the client schema engines on every code change

Run scripts/verify-advertised-schemas.mjs at the end of the build job, after
its artifacts upload, with REA_REQUIRE_SCHEMA_ENGINES=1 so a missing engine
fails rather than passes. Go is the runner's toolchain; the Python engines
install into a virtual environment cached by the requirements file's digest
and interpreter version. Full qualification adds --complete.

Refs #10830

* test(ci): require the client schema engine step in code builds

* test(mcp): record a reviewable summary of the advertised catalog (#10985)

* test(mcp): record a reviewable summary of the advertised catalog

Commit scripts/verify/advertised-schemas/summary.json: each advertised
pattern with the tool schemas that carry it, and a digest of every tool's
schema per input or output profile. The advertised schema check compares it
with the packaged listings it already makes and fails on any difference,
printing lines such as '119 tool schemas gained pattern /.../', so a change
that reaches many tools at once is visible in review.
--update-summary regenerates it.

Refs #10830

* docs(release): check the packed catalog with client engines before publishing (#10986)

* docs(release): check the packed catalog with client engines before publishing

Add a pre-publish step to the release guide: install the packed candidate
into an empty prefix and run verify-advertised-schemas.mjs against it with
--package-root, requiring the RE2 (Go regexp and C++ RE2) and Rust (regex,
fancy-regex and jsonschema) engines. CI checks each commit's build; this
covers the archive that will be published.

Refs #10830

* docs(release): check the exact qualified archive and clean up afterwards
@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 761c2b1 into test/advertised-schema-engines Nov 15, 2026
1 check passed
@morluto
morluto deleted the test/advertised-schema-validators branch November 15, 2026 12:32
morluto added a commit that referenced this pull request Nov 15, 2026
…10983)

* test(mcp): load advertised schemas in the validators clients build

Build a validator for every distinct advertised input and output schema
with the Rust jsonschema crate's defaults, which check the declared draft's
meta-schema and formats and compile every subschema. --complete adds Python
jsonschema's check_schema, which jsonschema.validate runs in Python clients;
it takes several seconds, so it is opt-in.

Refusals are grouped by reason, so one shared pattern that breaks many
schemas is reported once with its sites.

Ajv strict mode and OpenAI strict mode are documented as not covered, with
the reasons.

Refs #10830

* ci(mcp): require the client schema engines on every code change (#10984)

* ci(mcp): require the client schema engines on every code change

Run scripts/verify-advertised-schemas.mjs at the end of the build job, after
its artifacts upload, with REA_REQUIRE_SCHEMA_ENGINES=1 so a missing engine
fails rather than passes. Go is the runner's toolchain; the Python engines
install into a virtual environment cached by the requirements file's digest
and interpreter version. Full qualification adds --complete.

Refs #10830

* test(ci): require the client schema engine step in code builds

* test(mcp): record a reviewable summary of the advertised catalog (#10985)

* test(mcp): record a reviewable summary of the advertised catalog

Commit scripts/verify/advertised-schemas/summary.json: each advertised
pattern with the tool schemas that carry it, and a digest of every tool's
schema per input or output profile. The advertised schema check compares it
with the packaged listings it already makes and fails on any difference,
printing lines such as '119 tool schemas gained pattern /.../', so a change
that reaches many tools at once is visible in review.
--update-summary regenerates it.

Refs #10830

* docs(release): check the packed catalog with client engines before publishing (#10986)

* docs(release): check the packed catalog with client engines before publishing

Add a pre-publish step to the release guide: install the packed candidate
into an empty prefix and run verify-advertised-schemas.mjs against it with
--package-root, requiring the RE2 (Go regexp and C++ RE2) and Rust (regex,
fancy-regex and jsonschema) engines. CI checks each commit's build; this
covers the archive that will be published.

Refs #10830

* docs(release): check the exact qualified archive and clean up afterwards
morluto added a commit that referenced this pull request Nov 15, 2026
… run (#10982)

* test(mcp): compile advertised patterns with the regex engines clients run

List the built package's tools over stdio in every input, output and
catalog profile and compile each distinct advertised regular expression
with V8 (plain, u, v), Go regexp (RE2), C++ RE2, Python re, and Rust regex
and fancy-regex through the Rust jsonschema crate. A refusal names the
engine, its error, and each tool, schema path and profile.

The Python engines are pinned, hash-checked wheels; Go is the host
toolchain with GOTOOLCHAIN=local. A missing engine is reported as not
verified, and REA_REQUIRE_SCHEMA_ENGINES=1 makes it a failure.

The pattern owner now also reports patternProperties keys, which clients
compile as well.

Refs #10830

* test(mcp): run schema engine helpers and listings under the process owner

* test(mcp): load advertised schemas in the validators clients build (#10983)

* test(mcp): load advertised schemas in the validators clients build

Build a validator for every distinct advertised input and output schema
with the Rust jsonschema crate's defaults, which check the declared draft's
meta-schema and formats and compile every subschema. --complete adds Python
jsonschema's check_schema, which jsonschema.validate runs in Python clients;
it takes several seconds, so it is opt-in.

Refusals are grouped by reason, so one shared pattern that breaks many
schemas is reported once with its sites.

Ajv strict mode and OpenAI strict mode are documented as not covered, with
the reasons.

Refs #10830

* ci(mcp): require the client schema engines on every code change (#10984)

* ci(mcp): require the client schema engines on every code change

Run scripts/verify-advertised-schemas.mjs at the end of the build job, after
its artifacts upload, with REA_REQUIRE_SCHEMA_ENGINES=1 so a missing engine
fails rather than passes. Go is the runner's toolchain; the Python engines
install into a virtual environment cached by the requirements file's digest
and interpreter version. Full qualification adds --complete.

Refs #10830

* test(ci): require the client schema engine step in code builds

* test(mcp): record a reviewable summary of the advertised catalog (#10985)

* test(mcp): record a reviewable summary of the advertised catalog

Commit scripts/verify/advertised-schemas/summary.json: each advertised
pattern with the tool schemas that carry it, and a digest of every tool's
schema per input or output profile. The advertised schema check compares it
with the packaged listings it already makes and fails on any difference,
printing lines such as '119 tool schemas gained pattern /.../', so a change
that reaches many tools at once is visible in review.
--update-summary regenerates it.

Refs #10830

* docs(release): check the packed catalog with client engines before publishing (#10986)

* docs(release): check the packed catalog with client engines before publishing

Add a pre-publish step to the release guide: install the packed candidate
into an empty prefix and run verify-advertised-schemas.mjs against it with
--package-root, requiring the RE2 (Go regexp and C++ RE2) and Rust (regex,
fancy-regex and jsonschema) engines. CI checks each commit's build; this
covers the archive that will be published.

Refs #10830

* docs(release): check the exact qualified archive and clean up afterwards

* test(mcp): regenerate the advertised catalog summary from current main
@morluto morluto added the area: mcp MCP server, transport, and tool registration label Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: mcp MCP server, transport, and tool registration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant