feat(intent): rollup op: latest - keep a parent field equal to the newest child's value - #6350
Merged
Merged
Conversation
…west child's value Adds a third rollup aggregation alongside count/sum: op: latest copies the `of` value of the child row with the greatest `by` date/timestamp onto the parent `field`. The recurring "keep the parent's rate equal to its latest child rate" shape (e.g. Currency.rate <- newest CurrencyRate.rate) that the DSL could not express before (only count/sum). - RollupIntent gains `by` (the child date/timestamp ordering field). - Parser: op: latest requires `of` + `by`, `by` must be date/timestamp, and the parent field type must match `of`. - Generator emits create/update/delete handlers (a new/edited/removed child row can change which row is latest or its value). - renderRollupAggregate's latest branch tracks the max-`by` row type-agnostically (`var` + Objects.equals), copies its `of` onto the parent field with the usual change-guard; an empty child set resets the parent field to null. Unit: GlueRollupLatestTest (create/update/delete handlers + of/by/field mapping); full engine-intent suite green. Runtime proof is the KeyFolders currencies adoption (Currency.rate maintained from CurrencyRate), verified on regeneration. Co-Authored-By: Claude Fable 5 <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.
Adds a third rollup aggregation alongside
count/sum.op: latestcopies theofvalue of the child row with the greatestbydate/timestamp onto the parentfield— the recurring "parent's headline value = its newest child's value" shape the DSL couldn't express (only count/sum).RollupIntent.by= the child date/timestamp ordering field.latestrequiresof+by;bymust be date/timestamp; the parentfieldtype must matchof.renderRollupAggregatelatest branch tracks the max-byrow type-agnostically (var+Objects.equals), copies itsofwith the usual change-guard; empty child set → parent field null.Motivation: surfaced by a KeyFolders currencies review —
Currency.ratewas a dead field (nothing maintained it) because the DSL had no copy-latest-child-to-parent primitive.Test:
GlueRollupLatestTest(handlers + of/by/field mapping); full engine-intent suite green. Runtime proof is the currencies adoption (verified on regeneration there).🤖 Generated with Claude Code