Repository navigation
fix(objectql)!: a multi-row insert reads a parent's formula fields over the roll-ups its rows move; fold follow-ups - #35773
Conversation
…the roll-ups its rows move; fold stand-downs traced The insert accumulator recomputes parent formula / stored computed fields built on an accumulated roll-up, and screens filters reading through a reference in the nested form. A predicate update leaves unfolded a roll-up its patch cannot move, and each fold stand-down logs one debug line. Claude-Session: https://claude.ai/code/session_01L9qibwJEh7hMPPvagWM1g7 Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibwJEh7hMPPvagWM1g7 Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 22 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 7 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 21 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 995ed89ea7c47b5c61a411f1347da9c03d31b5fb && git checkout 995ed89ea7c47b5c61a411f1347da9c03d31b5fb
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 170ca481f0aeec14ca06d74ec3d57c654997e698 6de555d92e7bd3446cefd60d95144da1c7d93917 && git checkout -B drift-repro 170ca481f0aeec14ca06d74ec3d57c654997e698 && git merge --no-ff 6de555d92e7bd3446cefd60d95144da1c7d93917
node scripts/docs-audit/affected-docs.mjs --json 170ca481f0aeec14ca06d74ec3d57c654997e698
|
…fields over the moved roll-ups The write and its preview share one door (attachInsertSummaryDependents); the validate host carries the formula services it needs. The changeset is re-declared Clause-2 no (narrowing) with its ADR-0087 disposition. Claude-Session: https://claude.ai/code/session_01L9qibwJEh7hMPPvagWM1g7 Co-authored-by: Claude <noreply@anthropic.com>
…llup-fold-followups
…'s line ceiling Claude-Session: https://claude.ai/code/session_01L9qibwJEh7hMPPvagWM1g7 Co-authored-by: Claude <noreply@anthropic.com>
…enthetical DELIBERATE CORRECTION: this branch makes a multi-row insert compute a parent field calculated from a roll-up over the moved values, so the pending note's parenthetical is false once it lands. Claude-Session: https://claude.ai/code/session_01L9qibwJEh7hMPPvagWM1g7 Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7 Check Changeset red at The only error is the DELIBERATE CORRECTION class on Release note: the bot-authored Version Packages PR #35129 deletes the same pending note, so overlap-check reports a modify/delete there. If a release consumes the 34465 note before this PR lands, the correction moves to a docs amendment of the released entry. ⛔ No seat edits #35129. |
|
repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7 Contract reviewServed-tier: Inputs read: card #34821 body and all 8 comments (claim 7031250136, dev reports 7032185057, 7033828561, 7033989513, claim amendments 7032214252 and 7033859376); rulings 6377847361 (C, on #25477) and 6928862195 (B, on #33795); PR #35773 body, its 9 files, the net diff against merge base ① Derived judgmentsGate verdicts at the read (60 check-runs on the head): 24 success, 22 skipped, 3 failure, 11 still in progress (Test Core 1/10 to 10/10 less one, Type Check workspace, Type Check consumer gates). The three failures are all Check Changeset. The log read (job 136165292257) fails on one line only: What moves, read in the code:
② Semver level
③ Boundary flags
④ Design judgmentThe insert narrowing makes the published rule real (batch equals one-by-one, ruling 6377847361 C) and takes no declared capability away. Tried against it by reading: mixed parents (deltas and images are keyed per parent object and id); a refused row mid-batch under partial mode (never accepted, moves nothing); a row whose reference check fails after the rules (not accepted); declaration order and a high-water mark (the predicate door's two-pass M1 (must-fix) — M2 (must-fix) — The preview now judges on header values the caller was not served. S1 (should-fix) — N1 (nit) — The 34821 note states only the refused direction. A multi-row insert main refused against the stored calculated value can now be admitted when earlier rows move it away from the rule's line. One clause, as the 34465 note has. N2 (nit) — A calculated field reading both an accumulated roll-up and one that stays stored ( N3 (nit) — The parent read is gated on "a rule reads that parent", not on "reads a calculated field of it", and N4 (nit) — After this PR the 34465 note's "one grouped aggregate per summary a rule reads" and "Three cases keep reading the stored value" are exact only when read with the 34821 note beside it (a roll-up the patch cannot move is neither aggregated nor folded). Both compile into one release, so a clause in either note is enough. The N4 debug line of the card is harmless: one Implemented-by: VERDICT: FAIL |
…h can move, and keep the preview's batch overlay on the header columns the caller was served
summaryPatchCanMove now reads a { $field } comparand and an addDays offset
as fields of the filter, so a predicate update writing only a comparand
still folds the roll-up. The multi-row insert preview moves and computes
the batch's roll-ups onto the master-detail header columns the read door
served the caller only. fields.mdx and the 34821 note follow both doors.
Claude-Session: https://claude.ai/code/session_01L9qibwJEh7hMPPvagWM1g7
Co-authored-by: Claude <noreply@anthropic.com>
…er-caller header columns through a parent. predicate The carol and erin personas read the header through a field-level read rule. A requiredWhen on parent. reads the header the preview binds per caller; a record.REF rule reads the related binding, a system read. Claude-Session: https://claude.ai/code/session_01L9qibwJEh7hMPPvagWM1g7 Co-authored-by: Claude <noreply@anthropic.com>
…ing them The findOne options in the carol pin carried `as any`, one more test site for the query-options erasure ratchet (236 to 237). The options are on contract, so the cast goes. Claude-Session: https://claude.ai/code/session_01L9qibwJEh7hMPPvagWM1g7 Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#7 · os-tesla · session_01L9qibyQBB3KuDoNobNq9LH Seat checkL1: ACCEPT (L1-a, for area d7-B) at head
Owed before landing: the
|
|
repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7 Contract reviewServed-tier: Delta review. This record judges the FAIL record 7034146638 (head ① Derived judgmentsGate verdicts (59 check-runs on the head, none pending): 40 success, 17 skipped, 2 failure. Both failures are Check Changeset. The log read (job 136216287457) fails on one line: What moves in the delta:
② Semver levelUnchanged and still right: ③ Boundary flags
④ Design judgmentM1 of 7034146638 — closed. Read in M2 of 7034146638 — closed. Tried against it by reading:
S1 of 7034146638 — closed. N1, N2, N4 — taken in the 34821 note (both directions; a calculated field over a moved and a stored roll-up; the 34465 note's "one grouped aggregate per summary a rule reads" and its three cases scoped to the roll-ups the patch can move). N3 — not taken, accepted above. DELIBERATE CORRECTION — confirmed on this head. No must-fix, no should-fix. N1 (nit) — Implemented-by: VERDICT: PASS |
|
repo:objectstack#7 · os-tesla · session_01L9qibvvVzM5KhCWkT5f45c 维护者速读
席位核对Seat 7: hand-off for the maintainer's approval · head
|
…llup-fold-followups Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibwJEh7hMPPvagWM1g7
|
repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7 Regen-provenance: 7036724880 · Head move at 2026-11-20T22:18Z: a merge-forward of The PR's own net diff has the same patch-id on both heads:
|
|
repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7 Landing: PR #35773 (#34821) at
|
|
repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7 Contract reviewServed-tier: Delta review of a merge-forward. The previous at-tier record is PASS 7036724880 at ① Derived judgmentsThe head move, verified here and not taken from 7051986368:
Gate verdicts (55 check-runs on this head, none pending): 39 success, 15 skipped, 1 failure. Test Core and its 10 shards, Build Core, the Type Check lanes, the Lint lanes (query-options erasure and What
Accept set against
② Semver levelUnchanged and still right: ③ Boundary flags
④ Design judgmentEach finding of the earlier records, read again in the tree at
DELIBERATE CORRECTION: confirmed on this head. No must-fix, no should-fix. N1 (nit) — carried from 7036724880, the tree being the same: N2 (nit) — The PR body says Implemented-by: VERDICT: PASS |
|
repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7 Re-arm · 2026-11-20T23:09Z · head The merge group was refused at 2026-11-20T23:03Z by the Governed Surface Queue Guard's narrowing leg: no |
Requested by Tesla · project thread
Fixes #34821
Clause-②: no (narrowing)
Metadata-protocol: none
Skills-docs: none — measured with
git grepoverskills/on origin/main: no skills page teaches how a child rule orrequiredWhenreading a parent field calculated from a roll-up judges in a multi-row insert or its preview (the objectstack-formula bulk-write table covers onlypreviousper row); fields.mdx carries the behaviour.维护者速读
.claude/**lands by declared rule-change, a declared narrowing waits for the maintainer #35610 需要你在 GitHub 上点一次 Approve;之后席位自主落地。另请知悉:用户可见的上级计算列仍以系统身份计算,若要更严需另行裁决(见席位记录)。What changes
BREAKING (Clause-②: no (narrowing), the same declaration PR #34709 made for the predicate-update door, per rulings 6377847361 C and 6928862195 B): a multi-row insert of a child whose rule, or field-level
requiredWhenonparent, reads a parentformulaor stored computed field calculated from a roll-up is now refused where one-by-one inserts refuse it; main admitted it. FROM: three lines of 40 againstremaining = budget - totalwith budget 100 were all admitted in one call. TO: the third is refused withVALIDATION_FAILED, nothing is written, and the insert preview answers that row invalid. Fix for a caller: insert the refused rows on their own, or split the batch. ADR-0087 disposition in the changeset:not-required (no-migration-prescription).Four items of the card, measured first against
origin/mainca4ec2a2f1:record.amount > record.bud.remaining(remaininga formulabudget - total) and the same over a stored computedheadroom: one by one the third insert is refused; on main the three in one call were all admitted. Item 1 is live.createBatchSummaryAccumulatorgainssetDependents/foldedSummaries. A related row or master-detail header a rule reads now carries the parent's formula and stored computed fields recomputed over the moved roll-ups, through the sameloadSummaryFoldDependentsthe predicate update's fold uses (exported fromengine-update.ts; it now also exposes the stored parent asdependents.stored, the base a roll-up is moved from when the reader's row was not handed it).accepttellsdependents.advancethe parents each admitted row names, so a self-reading stored field (a high-water mark) is carried row to row as each one-by-one recompute stores it. The parent rows are read only when a rule of the batch reads that parent (a related binding or a header). Both doors go through one helper,attachInsertSummaryDependents(engine-update.ts): the write (engine-insert.ts) and the multi-row insert preview (engine-validate.ts,validatewithmode: 'insert'), whose host inengine.tsnow carriesfacade,getSchema,resolveFormulaPermissions,resolveFormulaRelatedandformulaOptionLabels(claim amendment 7032214252).filterReadsThroughReferenceinstead offilterNamesDottedPath, so a filter in the nested one-level form is left unaccumulated, as the predicate update leaves it.summaryPatchCanMove: a roll-up whose foreign key, source field (not acount's) and filter fields the patch does not write is not handed to the fold; its rules read the stored value, as the by-id form reads it, with no aggregate read. A filter holding a condition whose fields cannot be enumerated is taken to move.summaryPatchCanMovereads a filter's{ $field }comparand and anaddDays: { $field }offset as fields of the filter (addFieldReferents), so a patch writing only a comparand ({ due_day }under{ closed_day: { $gt: { $field: 'due_day' } } }) still folds the roll-up; a$fieldthat names no field by a string is taken to move. The 34465 note's "each matched row judges the summary as the rows judged before it leave it" holds again at this head.resolvePreviewParents(engine-master-detail-related.ts) now also returnsservedColumns, the columns it kept per header;overlayRowtakes them asvisible. A withheld calculated column readsnullat every row, as at row 0. A withheld roll-up is moved from the stored value, not from the empty column, so a served calculated field over it reads as one by one serves it.content/docs/data-modeling/fields.mdxupdated for both doors (calculated parent fields on bulk create, the nested-form stand-down, the preview's per-caller columns, and the predicate update's "a summary the patch cannot move" as a fourth stored-value case).min/maxpast the exclusion budget) reaches aSummaryFoldStandDownSink; the engine logs one debug lineRoll-up left unfolded in a predicate update: its rules read the stored valuewithobject,parentObject,field,reason.Tests
summary-rollup.test.ts, new top-level describes[#34821] …(the sharedmakeDriverharness lives there): one-by-one reference and multi-row insert for a formula, a stored computed field, a field-levelparent.predicate and a high-water mark; an under-the-line control; the preview pin (three lines of 40 under 100: preview[valid, valid, invalid]and the write refused) with its under-the-line control (three of 30: all valid, write admits); a control that an insert whose rules read no parent reads no parent row; N3 stale-stored pin (by-id reference, predicate update refused at row 0, zero aggregates before the write) with a moving-patch control; N4 trace pin.summary-batch-accumulation.test.ts: nested-form screen and its operator-object control,foldedSummaries, dependents patching from the stored base,advanceper admitted row,summaryPatchCanMovecases, each stand-down reason from the loader and the fold.{ $field }/addDayscases with a control patch and a non-string referent (summary-batch-accumulation.test.ts); engine describe[#34821] a predicate update whose patch writes only a { $field } comparand …(by-id reference, the predicate update refused at its second row, and a CONTROL showing an unrelated patch still reads the stale stored count). The test driver'scheckOpresolves a{ $field }target against the row. M2 personas on thebudheader through a field-level read rule shaped like the security middleware's hide mask, read by arequiredWhenonparent.remaining: carol, not servedremaining, gets[valid, valid, valid]under budgets 100 and 1000, with a served-reader CONTROL[valid, valid, invalid]that the write refuses too; erin, not servedtotal, gets[valid, invalid]as the system preview does; dave, not servedbudget, gets the movedheadroomand[valid, valid, invalid].[#34465] … the subject reads its bases before the writecounted 5 aggregates; under anamountpatchprimaries(count filtered onis_primary) andline_count(a count) cannot move, so 3 now. The comment there says why.Acceptance notes
.changeset/34465-predicate-update-parent-summary-rule.md(unreleased) said a bulk create does not yet equal one-by-one for a rule reading a parent field calculated from a roll-up. It is edited here (claim amendment 7033859376); see DELIBERATE CORRECTION below.avg/sum, which the fold did not.advancecarried into the parent image for its calculated fields; it moves nothing further.engine-master-detail-related.ts(resolvePreviewParentsreturnsservedColumns) is outside the claimed surface. M2's fix in the preview door needs the columns that function keeps, and it is the only place that knows them.engine.tschanges only the privateresolvePreviewParentsreturn type, on the same line, and stays at 6853 lines.content/docs/data-modeling/fields.mdxis S1 of the round.record.REF.FIELDrule reads the related binding, a system read on main already (the L2 record says so too), so the persona pins read the header throughparent.in arequiredWhen. A persona not served a column that an unguardedparent.predicate reads is refused at row 0 as unevaluable, and nothing after it moves, so the pins guard with!= null.describe(accepted in claim amendment 7032214252).Verification
Two-minute check:
pnpm --filter @objectstack/objectql exec vitest run --maxWorkers=2 src/summary-rollup.test.ts -t 34821shows every[#34821]case green; onorigin/mainthe multi-row insert cases fail withexpected the write to be refusedand the preview case answers[true, true, true].Read first:
packages/objectql/src/summary-batch-accumulation.ts(movedOf/patchRowwithvisible,addFieldReferents/filterFieldNames,accept),packages/objectql/src/engine-update.tsattachInsertSummaryDependents(thereadParentsgate both doors share) and its two call sites inengine-insert.ts/engine-validate.ts, and thesummaryPatchCanMovefilter with the stand-down sink inengine-update.ts.Ablations (each at a committed head, restored blob == HEAD; A1 to A5 at ebc2b34)
Command each time:
pnpm --filter @objectstack/objectql exec vitest run --maxWorkers=2 src/summary-rollup.test.ts src/summary-batch-accumulation.test.ts(tests import the engine fromsrc, no build in the path), mutation throughscripts/ablation-replace.mjs(anchor 1 to 0, blob moved, restored to HEAD).setDependentsinengine-insert.ts: 4 failed / 147 (formula, stored, header, high-water multi-row insert cases).dependents.advanceinaccept: 2 failed / 149 (advance unit pin, high-water engine pin).filterNamesDottedPath: 1 failed / 150 (nested-form screen pin).summaryPatchCanMovefilter: 2 failed / 149 (N3 pin, the base-count pin). The first attempt passed an empty--replacement, which the tool did not run; re-run with--delete.attachInsertSummaryDependents: 1 failed / 153 (the preview pin; its under-the-line control stays green). A first spelling that made the call throw was discarded: it reds by throwing, not by the missing behaviour.attachInsertSummaryDependents: 5 failed / 153 (the four write pins and the preview pin, whose write leg refuses no longer).if (!addFieldReferents(value, into)) return undefined;infilterFieldNames, run with-t field: 2 failed (the{ $field }unit case, the predicate-update engine pin); the CONTROL stays green.overlayRowundefinedinstead ofservedColumns[i]inengine-validate.ts, run with-t preview: 2 failed / 7 (carol reads[valid, valid, invalid]under budget 100 and[valid, valid, valid]under 1000, so a withheld column decides; erin[valid, valid]); dave and the system control stay green.&& (!visible || visible.has(desc.summaryField))frommovedOf'scarried, run with-t preview: 1 failed / 7 (erin's second row reads remaining 80, moved from the empty column).Local verification at 5d69a32 (patch round 3)
pnpm --filter @objectstack/objectql typecheck && pnpm --filter @objectstack/objectql exec vitest run --maxWorkers=2(verify lock, at c2a5fd1): VERDICT command-exit 0;check:test-typecheck: OK; Test Files 620 passed (620), Tests 14018 passed (14018). 5d69a32 changes one test line (below); at 5d69a32 the two roll-up suites give 161 passed (161) andcheck:test-typecheckis OK.pnpm --workspace-concurrency=2 --filter '@objectstack/dogfood^...' build && pnpm --filter @objectstack/dogfood test(verify lock, no shard, no path): VERDICT command-exit 0; Test Files 482 passed, 3 skipped (485); Tests 4094 passed, 68 skipped (4162); no failure. A first attempt at c2a5fd1 never reached a test body: 474 files failed to resolve unbuilt workspace entries (@objectstack/verifyand others), so it counts for nothing; the closure build was added to the command.dispatch-gates.mjs --commands, 11 paths; the docs file adds the docs families): 102 derived, the same list at c2a5fd1 and 5d69a32. 99 exit 0 on the first pass.check-empty-changeset --base origin/mainexit 1 is the foreign-note refusal, by design.check:skill-examplesandcheck:dual-build-cjs-loadsexited 3 (prerequisites: unbuilt workspacedist/) and exit 0 on a re-run once the packages were built.--ranreconciliation: 102 derived, 102 run, 0 NOT-MEASURED, exit 0.Lint · scoped · query-options erasurewas red in CI at c2a5fd1: the M2 pin'sfindOneoptions carriedas any, test sites 236 to 237. 5d69a32 drops the cast, because the options are on contract.pnpm check:query-options-erasureis green locally ("test surface: 236 site(s) … at the ceiling") and the CI lane is green at 5d69a32..changeset/34465-predicate-update-parent-summary-rule.md, the note this PR corrects; every other shared PR merges cleanly.Local verification at 90eaeed (origin/main 0e2de25 merged in)
pnpm --workspace-concurrency=2 --filter '@objectstack/dogfood^...' build && pnpm --filter @objectstack/objectql typecheck && pnpm --filter @objectstack/objectql test(verify lock, at ee75c6e): VERDICT command-exit 0;check:test-typecheck: OK; Test Files 619 passed (619), Tests 14005 passed (14005). 90eaeed only re-wraps the five validate-host members inengine.tsonto one line.pnpm --filter @objectstack/objectql build && pnpm --filter @objectstack/dogfood test(verify lock, no shard, no path): VERDICT command-exit 0; Test Files 482 passed, 3 skipped (485); Tests 4094 passed, 68 skipped (4162); no failure.dispatch-gates.mjs --commands, 8 paths, 684 changed lines): 71 derived, 69 run with exit 0, 2 NOT MEASURED from a recorded exit 3:check:dual-build-cjs-loads(PREREQUISITE NOT MET, it reads every package'sdist/and this worktree built only the dogfood closure) andcheck:type-check-debt(its--re-measureclosure build never got a turn on the shared verify lock). Both run in CI.--ranreconciliation exit 0.check:facade-delegation-onlywas red at ee75c6e (engine.ts6858 lines, ceiling 6854); 90eaeed brings it to 6853, gate green.pnpm check:adr-0087-registration: green,.changeset/34821-rollup-fold-followups.md [BREAKING+bang+clause-②-narrowing] not-required (no-migration-prescription).check-empty-changeset --base origin/mainexit 1 (the foreign-note refusal, by design), its--self-testexit 0,check-adr-0087-registration --base origin/mainexit 0 and--self-testexit 0,check-changeset-no-majorexit 0,check:changeset-gate-self-testsexit 0; the prose families reading the note (check:issue-citations,check:doc-authoring,check:nul-bytes,check:closed-ceremony-text, closing-keyword parity, the docs-audit pair) exit 0.DELIBERATE CORRECTION
DELIBERATE CORRECTION:
.changeset/34465-predicate-update-parent-summary-rule.md(pending, from #34465 / PR #34709) drops one parenthetical from its BREAKING paragraph, which this PR makes false:After: the sentence reads "A bulk create and a bulk update already equal one-by-one writes for a rule reading the summary itself; this extends that to the update that selects its rows by a filter, calculated parent fields included." No other sentence of that note changed, then or in patch round 3. With M1 fixed at 3b3cd84, its sentence "each matched row judges the summary as the rows judged before it leave it" holds again for a roll-up whose filter reads a
{ $field }comparand. The words become false because this PR makes a multi-row insert (and its preview) compute a parent formula or stored computed field over the roll-ups its admitted rows move, so the accumulator no longer moves the summary key alone; both notes compile into the same release. Thecheck-empty-changesetred (the foreign-note refusal) is by design for this class; the seat confirms the correction by its same-head at-tier contract-review record (landing-operations.md), not by a maintainer wait.Generated by Claude Code