Repository navigation
test(mcp): load advertised schemas in the validators clients build - #10983
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. |
[Medium impact] The reviewed changes appear safe to merge. SummaryAdds Rust schema construction and optional Python schema checks to the advertised-catalog verifier.
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]
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
eab7715 to
fc8d966
Compare
e86ef21 to
3da6f65
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
@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
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…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
… 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
Summary
Load every advertised input and output schema in the validators clients build, not only Ajv: the Rust
jsonschemacrate on every run, plus Pythonjsonschemaunder--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.pybuilds a validator withjsonschema_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 defaultfancy-regexengine.--completeadds Pythonjsonschemacheck_schema(whatjsonschema.validateruns 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.requirements.txtaddsjsonschema4.26.0 and its dependencies, wheels only and hash-pinned, all released at least two weeks ago.Intentionally not included, documented in
testing.md:strict: truetook about 10 s CPU and refused 61-64 schemas for authoring constructs: unknownformats (58-59),strictRequired(3), 1-tuples (2), and withstrictTypesalso missing types (15) and union types (11). None of these is a known client rejection; the MCP SDK runs Ajv withstrict: false. A proposed follow-up is below rather than a new counted baseline here.strict: true) requires every property to be required. REA's optional inputs do not meet that, and REA does not claim strict-mode support.advertisedDialect.ts, each citing its report: the keyword allowlist and type, enum anditemsrules (Gemini, [Bug] Gemini-backed clients reject the 6.8.0 default compact tool catalog: jsonValueSchema() emits a multi-type array alongside a sibling items: {} #7103, [Bug] Gemini-backed clients reject the whole tool catalog: advertised schemas emit non-string const values (boolean enum MUST be TYPE_STRING) #4025, [Bug] Gemini-backed clients still reject the whole tool catalog: advertised empty-string const in trace_application_feature.seed.value serializes as an empty enum member #5201), root shape (Anthropic/OpenAI, [Bug] Three MCP tool input schemas use a root anyOf and are rejected by strict function-schema clients #1052), size (Moonshot, [Bug] Moonshot clients reject every request while REA is connected: advertised tool schemas exceed the per-schema size cap (kimi-cli unusable) #1484), depth (inputSchema nesting depth exceeds 10 on 24 tools (max 19: compare_web_captures) — breaks strict-depth MCP clients #2813), and bounds (llama.cpp). No new rule was needed.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:.regex(/^[^\uD800-\uDFFF]*$/u)tolocalPathStringSchemaalone no longer reachestools/list(all engines then accepted 181/181 patterns). The probe therefore also madeprojectPortablePatternreturn that one pattern unchanged, i.e. it simulated the projection being bypassed, which is the 6.9.0 state (the pattern appeared indist/mcp-catalog*.json, 144 occurrences in the full catalog). Rebuilt, rannode scripts/verify-advertised-schemas.mjswith every engine required: exit 1.rust jsonschemaline is the Rustjsonschemacrate's default validator build (meta-schemaregexformat 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, namingbinary_sessionamong the affected tools. RE2 (Go and C++) and Rustregexrefuse the same pattern. V8 and Pythonreaccept it, which is why the earlier Ajv-only check passed. Both probe edits were reverted and the clean rebuild passes (exit 0).Validation performed
node scripts/verify-advertised-schemas.mjswithREA_REQUIRE_SCHEMA_ENGINES=1and the hash-pinned venv on main 1151763: 712/712 schemas accepted by Rustjsonschema(130-1000 ms on a loaded host); all engines pass (exit 0).--complete: Pythonjsonschema712/712 in 9.3 s (17.9 s before perf(mcp): advertise large output union alternatives as shared definitions #11005's shared output definitions).pip install --require-hashes -r scripts/verify/advertised-schemas/requirements.txtinto 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:
Before merge
type(scope): outcome.