fix: make validator diagnostics self-sufficient (backlog batch)#13
Merged
Conversation
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>
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.
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
oneOfbranch selection consistent.All changes are message/code-level: no conformance outcome changes (47/47 pass) and no machine-contract change (only messages and
provisionalcodes;outputVersion, envelope, and exit classes untouched). No new dependencies;go.moduntouched.Changes
JPS-STRUCTURE-ENUMlists 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 itsCONDITION-ARITY/ESCALATION-TRIGGERSvariants) states the required minimum and the actual count.JPS-CARRIER-INVALID-JSONreports line, column, and byte offset and preserves the decoder's own (sanitized) reason — e.g. a missing comma now givesInput is not valid JSON at line 3, column 3 (byte offset 13): invalid character '"' after object key:value pair.instead of "incomplete JSON object".oneOf: a bad or ambiguous conditionopnow reports one consistentJPS-STRUCTURE-CONDITION-SHAPEat the condition (listing the valid ops) instead of three different codes/locations, and a validopis no longer spuriously flagged — a losing branch's bareop-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
TestConditionDiagnosticsExcludeIrrelevantOneOfBranchesguard and the nested-operand test still pass.Known follow-up (batch-3, not in this PR):
JPS-STRUCTURE-EXCEPTION-SHAPEis generic and, for a forbidden operand, anchors at the parent rather than the offending member — a distinct, more-involved area (the exceptionif/then/noteffect schema). Plus minor polish (decimal-operand message symmetry for numbers, usage-error punctuation, the "Core extension slot" wording).🤖 Generated with Claude Code