GeezerVison is showing github.com — feat(mcpx): schemaval core — JSON Schema 2020-12 validator + dialect policy (#1482) by dezren39 · Pull Request #1570 · developing-today/code
Conversation
dezren39
commented
Oct 28, 2026
•
edited by blacksmith-sh
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Implements #1482 (Phase 1 of #1481), as triaged in queue task 1513. The schemaval core only — no call-path changes, nothing enforces yet.
What
- New package
pkgs/mcpx/internal/schemaval wrapping github.com/santhosh-tekuri/jsonschema/v6 (v6.0.3, pinned at implementation time). It is the only import site; go.mod gains exactly that one new direct dependency (plus the golang.org/x/text indirect version bump jsonschema v6 itself requires).
- Dialect policy: no
$schema = 2020-12; a declared $schema must name 2020-12, 2019-09, draft-07, draft-06 or draft-04, else a typed UnsupportedDialectError (distinct from generic compile errors).
- No network, ever: the compiler loader refuses every URL. An unresolvable
$ref — missing internal pointer or any external reference — is a typed UnresolvedRefError at compile time. A schema's own absolute $id is registered so self-references still resolve offline.
- 1 MiB schema-size bound (settled at triage: >5x the largest legitimate schema documents in the repo), enforced as a typed
SchemaTooLargeError.
- Integer fidelity: instances decode via
jsonschema.UnmarshalJSON; 2^53+1 validates exactly (tested against a maximum: 2^53 bound).
- Flattened errors: validation failures return one line per problem, path-qualified (
$.count: got string, want integer).
- Formats are annotations in v1 (the library default, deliberately not asserted; covered by a test).
- Dialect document at
pkgs/mcpx/docs/schema-validation.md, and a mechanism note in internal/conformance/coverage_messages.go. The conformance matrix is regenerated in the same commit because it hashes the coverage files (TestMatrix).
internal/mcpspec is untouched; no changes to ListTools, CallTool, Client.answer, codegen, or the daemon.
Tests
Defining tests in internal/schemaval cover the full acceptance list: 2020-12 corpus (prefixItems, unevaluatedProperties, boolean schemas, $defs refs), draft-07 positional items, typed UnsupportedDialect, unresolved internal $ref, remote $ref with a counting test server observing zero HTTP requests, 2^53+1 fidelity, path-qualified flattened errors, oversize rejection, formats-as-annotations.
Verified on the laptop worktree (fleet policy: full suite via CI on this PR):
go test ./internal/schemaval/ — pass
go test ./internal/mcpspec/ — pass (includes TestNotImportedByBinary)
go test ./internal/conformance/ -run TestMatrix — pass
Closes #1482.
![Autofix with [code]smith](/api/image?u=https%3A%2F%2Fcamo.githubusercontent.com%2F33b6f70f3541c4e93f4503d29cbfec051fa1b040d8e0ae9313a51c4ece44a627%2F68747470733a2f2f70722d636f6d6d656e74732d6173736574732e626c61636b736d6974682e73682f636f6465736d6974682f6175746f6669782d776974682d636f6465736d6974682d6461726b2d33782e706e67)
Need help on this PR? Tag @codesmith-bot with what you need.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Oct 28, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Warning
Review limit reached
You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.
Next included review available in 58 minutes.
Check out review usage here.
View limit details
-
Limit details: You’ve used the included review currently available.
Learn how review limits work.
Review configuration:
Run configuration
-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
77a51ba3-38b1-4d77-9606-007750b7c5e4
Commits
-
Reviewing files that changed from the base of the PR and between db6f7d0 and d38cfb4.
Files ignored due to path filters: 1
-
pkgs/mcpx/go.sum is excluded by !**/*.sum
Files selected for processing: 8
-
pkgs/mcpx/docs/schema-validation.md
pkgs/mcpx/docs/spec/conformance-matrix.md
pkgs/mcpx/go.mod
pkgs/mcpx/internal/conformance/coverage_messages.go
pkgs/mcpx/internal/schemaval/schemaval.go
pkgs/mcpx/internal/schemaval/schemaval_test.go
pkgs/mcpx/package.nix
treefmt.toml
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
-
Comment @coderabbitai help to get the list of available commands.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Codex Review Summary
This comment shows the latest Codex review activity on this pull request.
| Review |
Status |
Commit |
Review trigger |
| 📝 Code Review |
✅ Completed 2026-10-28T03:35:03.912829Z |
d38cfb4 |
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.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
🤖 Agent note · state: parked
State at park
- New package
pkgs/mcpx/internal/schemaval (santhosh-tekuri/jsonschema v6.0.3, sole import site; go.mod gains exactly that one direct dependency + the x/text indirect bump the library itself requires).
- Dialect policy (2020-12 default; 2019-09/draft-07/06/04 declared; typed
UnsupportedDialectError), offline-only refs (typed UnresolvedRefError), 1 MiB bound (typed SchemaTooLargeError), path-flattened validation errors, formats as annotations.
- Defining tests all pass on the laptop worktree:
go test ./internal/schemaval/ ✓, go test ./internal/mcpspec/ ✓ (incl. TestNotImportedByBinary), conformance TestMatrix ✓ (matrix regenerated — it hashes the coverage file the mechanism note landed in).
- Dialect doc:
pkgs/mcpx/docs/schema-validation.md; mechanism note in internal/conformance/coverage_messages.go. No call-path changes; mcpspec untouched.
- CI on PR feat(mcpx): schemaval core — JSON Schema 2020-12 validator + dialect policy (#1482) #1570: all checks still pending after ~5 minutes (runner backlog) — parked rather than held.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…ce matrix from treefmt (byte-for-byte golden, cf. parity.md); prettier the dialect doc
|
🤖 Agent note · state: parked
nix build — vendorHash. The mcpx go-modules fixed-output derivation hash changed with the new dependency; updated pkgs/mcpx/package.nix vendorHash to the value CI itself reported (sha256-Nn3r2jL1K3swJRhTJUxhbHKeQ2cDfphW6IVuAwBP8do=). (The same run also showed FlakeHub auth / GitHub rate-limit noise before the hash error — the hash mismatch was the terminal failure.)
treefmt check — generated matrix. The check formats only changed files, and prettier's table padding can never be applied to docs/spec/conformance-matrix.md: TestMatrix compares it byte-for-byte with the generator (the regenerated matrix in this PR differs from main only by the input-hash line). The repo already excludes pkgs/mcpx/docs/parity.md from treefmt for exactly this reason, so the matrix gets the same exclusion in treefmt.toml (taplo-realigned comments included). My own new doc docs/schema-validation.md was prettier-formatted normally — only the generated file is excluded.
- Local re-verification after the fixes:
go test ./internal/conformance/ -run TestMatrix still passes (matrix untouched by the formatter).
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d38cfb4c53
ℹ️ 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".
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Comment on lines
+256
to
+259
|
|
out := ve.DetailedOutput()
|
|
|
problems := make([]Problem, 0, len(out.Errors))
|
|
|
for _, u := range out.Errors {
|
|
|
problems = append(problems, Problem{Path: jsonPath(u.InstanceLocation), Message: u.Error.String()})
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Traverse nested validation errors before reading their messages
When an instance fails a compound schema such as {"anyOf":[{"type":"string"},{"type":"integer"}]} with input true, DetailedOutput() contains a non-leaf output unit whose Error is nil and whose failures are in Errors. Calling u.Error.String() therefore panics instead of returning a ValidationError. The upstream output implementation only populates Error on leaves in detailed mode. Recursively collect those leaves, or use the flat output API with appropriate filtering, and add a compound-schema failure test.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Comment on lines
+172
to
+173
|
|
c := jsonschema.NewCompiler()
|
|
|
c.UseLoader(offlineLoader{})
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disable format assertions for the supported older drafts
For schemas declaring draft-04, draft-06, or draft-07, leaving the compiler at its defaults does not implement the documented formats-as-annotations policy. The upstream compiler enables format assertions whenever draftVersion < 2019, so a draft-07 string schema with "format":"email" rejects "not-an-email", despite this package promising that it validates. Explicitly suppress format assertions for those dialects as well, and extend TestFormatsAreAnnotations to cover each supported draft.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Comment on lines
+229
to
+233
|
|
var ptrErr *jsonschema.JSONPointerNotFoundError
|
|
|
if errors.As(err, &ptrErr) {
|
|
|
return &UnresolvedRefError{Ref: ptrErr.URL, Err: err}
|
|
|
}
|
|
|
return &CompileError{Err: err}
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Classify missing anchor targets as unresolved references
For a schema such as {"$ref":"#missing"}, the upstream reference resolver returns *jsonschema.AnchorNotFoundError, which neither classification branch handles. Compilation therefore returns *CompileError rather than the documented *UnresolvedRefError, preventing callers from consistently identifying unresolved references using errors.As. Handle AnchorNotFoundError alongside missing JSON Pointer targets, using its Reference field, and add a missing-anchor test.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Oct 28, 2026
This was referenced Nov 3, 2026
This was referenced Nov 21, 2026
Uh oh!
There was an error while loading. Please reload this page.
Milestone
No milestone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|