Repository navigation
feat(rules): add a one-way aggregate rule - #55
Merged
Merged
Conversation
This was referenced Oct 20, 2026
Mearman
force-pushed
the
feat/aggregates
branch
from
October 20, 2026 23:11
5d55bae to
a0aadde
Compare
Mearman
force-pushed
the
feat/multi-path-rules
branch
2 times, most recently
from
October 21, 2026 00:09
5757339 to
7ee9125
Compare
Mearman
force-pushed
the
feat/aggregates
branch
2 times, most recently
from
October 21, 2026 04:50
2bd4798 to
9cf94df
Compare
Mearman
force-pushed
the
feat/multi-path-rules
branch
from
October 21, 2026 04:50
7ee9125 to
d992670
Compare
An aggregate rule writes the count, sum, minimum or maximum of the elements a wildcard path reaches in the input document, in the direction it names. Its to path keeps fewer wildcards than from, and the matches are grouped by their indexes at the kept wildcards; groups are enumerated from the arrays, so an empty group counts and sums to 0, while min and max of an empty group throw. validateCrosswalk checks the wildcard counts and that the arrays to keeps pair with the source arrays the two-way rules use. A decode-direction one-way write, default or aggregate, is now compared with the source-side from paths rather than the target-side to paths, since that is the document it writes into.
Adds aggregate to the one-way table, notes that assertRoundTrip leaves out a decode-direction aggregate's path, and drops aggregates from "Not in this version".
Mearman
force-pushed
the
feat/aggregates
branch
from
October 21, 2026 07:03
9cf94df to
4cbd748
Compare
Mearman
marked this pull request as ready for review
October 21, 2026 07:16
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 security review couldn’t start because the paying account has exhausted its Codex allowance and has insufficient available credits. The payer can check their balance and add credits in the Codex usage dashboard, then try again. If you do not manage the paying account, contact this repository's admins. |
|
🎉 This PR is included in version 0.7.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.
Adds a one-way
aggregaterule:count,sum,minormaxof the elements a wildcard path reaches, written attowhen running the direction it names.{ op: "aggregate", fn: "sum", from: "orders[].lines[].qty", to: "sales[].units", direction: "encode" }writes one total per order:tokeeps fewer wildcards thanfrom, and the matches are grouped by their indexes at the kept wildcards. Groups are enumerated from the arrays themselves, so an order with no lines gets 0 rather than no field.minandmaxof an empty group throw, a non-numeric value undersum,minormaxthrows, and so does a sum that overflows.validateCrosswalkrequires more wildcards infromthan intoand checks that an encode-direction aggregate's kept arrays pair with the same source arrays the two-way rules use (the reverse pairing for a decode-direction one). It also now compares a decode-direction one-way write (a default or an aggregate) with the source-sidefrompaths instead of the target-sidetopaths: a decode default named like a two-waytowas rejected, and one named like a two-wayfrom, which really does collide, was let through. The duplicate-from message reads "use" instead of "read" because a decode-direction write is now among the paths it compares.Stacked on #54. The new tests were checked to discriminate by dropping empty groups, filing decode writes on the target side, removing the wildcard and pairing checks, and writing only the first group.
pnpm run prepublishOnlypasses locally.Fixes #38