fix(statement): prefix schema errors with their JSON path - #52
Merged
Conversation
validate() returned jsonschema's bare error message, so a const mismatch read as "'claimed' was expected" with no field name. Share manifest.py's path-prefixing convention (context_report.schema_errors, one formatter both validators call) and extend it: a const failure also names the expected and offending values, and a root-level error gets a stable "(root)" prefix instead of an empty one. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
open-coder-ai-org
marked this pull request as ready for review
September 7, 2026 23:35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
statement.validate()returned jsonschema's baree.message, so aconstmismatch rendered as'claimed' was expectedwith no indication of which field failed.run/manifest.py:validate()already had the fix (
"/".join(absolute_path) + ": " + message), so this extracts thatconvention into a shared module,
context_report.schema_errors, that both validators now call —one formatter instead of two copies.
Two improvements over the manifest.py precedent, both requested by the brief:
(root)prefixinstead of an empty one (
": message").constfailure additionally names the expected and offending values on the same line, e.g.predicate/attributes/3/environmentSensitive: expected True, got False.verify.pyandcli.pyare unaffected — they only consume the returnedlist[str].Tests added to
tests/test_schema.py: aconstmismatch (cost.latency_ms'senvironmentSensitive), a nestedif/thenfailure under asubjectKindblock(
instruction-filerequiring a row'sresultto beNotApplicable), and a root-level error(deleting
_type) — each asserting the exact path-prefixed message. No golden or fixture filescaptured the old bare-message text, so nothing else needed updating;
docs/andREADME.mdonlyshow
validate()used generically (errors = validate(stmt)), never a sample error string.spec/is untouched — this is renderer-side only, per the brief.Definition of done
python -m ruff check .andpython -m ruff format --check .cleanpython -m pytest -qgreen; new checks have attack + ordinary-data testsspec/attestation/v0.1/schema.jsonis untouchedchock checkandchock sync --repo . --checkclean, if.agents/policies/changed — n/a, no.agents/policies/changesClaims
re-derivableunless it actually recomputes from the subjectplus its recorded configuration and carries an
inputHash. A row that could not bemeasured says
NotAvailable,Error, orNotApplicableand why. (unchanged by this PR)Closes open-coder-ai/org-plan#166.
🤖 Generated with Claude Code