Skip to content

fix: make validator diagnostics self-sufficient (backlog batch)#13

Merged
kikashy merged 1 commit into
mainfrom
fix/diagnostics-backlog
Jul 24, 2026
Merged

fix: make validator diagnostics self-sufficient (backlog batch)#13
kikashy merged 1 commit into
mainfrom
fix/diagnostics-backlog

Conversation

@kikashy

@kikashy kikashy commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Clears the validator-diagnostics backlog the agent-testing protocol surfaced: make each diagnostic self-sufficient — an author can act on it without opening the schema — and make the condition oneOf branch selection consistent.

All changes are message/code-level: no conformance outcome changes (47/47 pass) and no machine-contract change (only messages and provisional codes; outputVersion, envelope, and exit classes untouched). No new dependencies; go.mod untouched.

Changes

  • JPS-STRUCTURE-ENUM lists the allowed values.
  • JPS-STRUCTURE-LOCAL-ID (and sibling pattern codes: pack-version, fact-path, decimal-operand) names the offending value and gives a concrete example.
  • JPS-STRUCTURE-COLLECTION-ARITY (and its CONDITION-ARITY / ESCALATION-TRIGGERS variants) states the required minimum and the actual count.
  • JPS-CARRIER-INVALID-JSON reports line, column, and byte offset and preserves the decoder's own (sanitized) reason — e.g. a missing comma now gives Input is not valid JSON at line 3, column 3 (byte offset 13): invalid character '"' after object key:value pair. instead of "incomplete JSON object".
  • Condition oneOf: a bad or ambiguous condition op now reports one consistent JPS-STRUCTURE-CONDITION-SHAPE at the condition (listing the valid ops) instead of three different codes/locations, and a valid op is no longer spuriously flagged — a losing branch's bare op-discriminator failure is now rejected, completing the fix started in the seam work and clearing the empty-{} firehose.

Verification

Three independent no-context adversarial sweeps (~180 inputs each) found no wrong-accept, wrong-reject, mislocated path, or crash; the diagnostics above are all now rated "especially clear." Focused tests added for each; the TestConditionDiagnosticsExcludeIrrelevantOneOfBranches guard and the nested-operand test still pass.

Known follow-up (batch-3, not in this PR): JPS-STRUCTURE-EXCEPTION-SHAPE is generic and, for a forbidden operand, anchors at the parent rather than the offending member — a distinct, more-involved area (the exception if/then/not effect schema). Plus minor polish (decimal-operand message symmetry for numbers, usage-error punctuation, the "Core extension slot" wording).

🤖 Generated with Claude Code

Enrich the diagnostics an author acts on so each names its own fix without
opening the schema, and make the condition oneOf branch selection report
consistently. No conformance outcome changes (all 47 cases pass) and no
machine-contract change: messages and provisional codes only.

- ENUM lists the allowed values.
- LOCAL-ID and the sibling pattern codes (pack-version, fact-path,
  decimal-operand) name the offending value and give a concrete example instead
  of dumping the grammar regex.
- COLLECTION-ARITY, and its condition and escalation variants, states the
  required minimum and the actual count.
- CARRIER-INVALID-JSON reports the line, column, and byte offset and preserves
  the decoder's own (sanitized) reason, instead of a vague "incomplete object".
- A bad or ambiguous condition op now reports one consistent
  JPS-STRUCTURE-CONDITION-SHAPE at the condition, listing the valid ops, rather
  than three different codes and locations; and a valid op is no longer
  spuriously flagged. A losing branch's bare op-discriminator failure is now
  rejected like the grouped case, completing the oneOf fix from the seam work
  and clearing the empty-object condition firehose.

Surfaced by the agent-testing protocol and confirmed by three independent
adversarial sweeps: no document is wrongly accepted or rejected. Each change has
a focused test; the condition-diagnostic guard test and the nested-operand test
still pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Brian Jin <35789537+kikashy@users.noreply.github.com>
@kikashy
kikashy merged commit 851524b into main Jul 24, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant