Repository navigation
feat(when): gate a wildcard rule per element - #53
Merged
Merged
Conversation
This was referenced Oct 20, 2026
Mearman
force-pushed
the
feat/path-grammar
branch
from
October 20, 2026 23:11
53792d5 to
3bb08df
Compare
Mearman
force-pushed
the
feat/element-when
branch
from
October 20, 2026 23:11
3c25c6c to
0d7b1c2
Compare
A when reference with wildcards now names a field of the element the rule is visiting. It is written against the rule's from side, its part through its last wildcard must be the array from iterates at that depth, and it may have fewer wildcards than the rule. While decoding, that part is rebased onto the to side's array, so the gate reads the same element in the target document. readLocus takes an element gate and drops a refused element before reading anything below it, so an element lacking the rule's path is skipped rather than absent. Collection references bind the same way. validateCrosswalk rejects a wildcard reference into another array, one with more wildcards than its rule, and any on a one-way rule.
Describes how a wildcard reference binds to the visited element, how decode rebases it onto the target array, and that an element every rule skips is a gap error; drops the item from "Not in this version".
Mearman
force-pushed
the
feat/element-when
branch
from
October 21, 2026 00:09
0d7b1c2 to
0512e9e
Compare
Mearman
marked this pull request as ready for review
October 21, 2026 04:38
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
🎉 This PR is included in version 0.5.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
Lets a rule that iterates an array be gated on a field of the element it is visiting, for example applying
items[].radiustoshapes[].ronly whereitems[].kindiscircle.A
whenreference with wildcards is written against the rule'sfromside. Its part through its last wildcard must be the arrayfromiterates at that depth (so it cannot point into an unrelated array), and it may have fewer wildcards than the rule, which gates every inner element on a field of the outer one. While decoding, that part is rebased onto thetoside's array, so the same element is read in the target document. The field below it still has to keep its name in both shapes, the same constraint every gate already has.readLocustakes the gate and drops a refused element before reading anything below it, so an element that lacks the rule's path is skipped rather than reported absent. Collection references (some,every) bind the same way. If every rule writing into an element skips it, the output array has a gap, which surfaces through the gap check added in the base PR.Stacked on #52. The new tests were checked to discriminate by reverting the reader gate, the decode rebase and each validation branch.
pnpm run prepublishOnlypasses locally.Fixes #40