feat(schema): reject prefix-overlapping field paths (#194)#195
Merged
Conversation
Fixes #194. Adds a cross-field lint at ImportSchema time: no field path may be a strict prefix of another field path (e.g. "payments" alongside "payments.fee"). Such schemas cannot be presented as a tree without ambiguity — the same node would be both a typed leaf and a parent containing other leaves. Tooling that consumes the schema as a tree (UI, code generators, doc generators, future CEL `self` binding) all hit the same conflict. Independent of CEL, but required for the `self` tree shape per the discovery brief in .agents/context/cel-validation.md. Algorithm: sort paths, walk adjacent pairs, fail if A + "." prefixes B. Sorted-pair adjacency is sufficient — if A is a strict prefix of any path B, no other path C can sort between them without also being prefixed by A. ~40us at 1000 fields (see bench). Existing fixtures verified clean (no prefix-overlap violations). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.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.
Closes #194.
Summary
Test plan