Skip to content

fix(objectql)!: a multi-row insert reads a parent's formula fields over the roll-ups its rows move; fold follow-ups - #35773

Merged
objectstack-fleet[bot] merged 10 commits into
mainfrom
claude/issue-34821-rollup-fold-followups
Nov 20, 2026
Merged

objectstack-fleet[bot] merged 10 commits into
mainfrom
claude/issue-34821-rollup-fold-followups

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Tesla · project thread
Fixes #34821
Clause-②: no (narrowing)
Metadata-protocol: none
Skills-docs: none — measured with git grep over skills/ on origin/main: no skills page teaches how a child rule or requiredWhen reading a parent field calculated from a roll-up judges in a multi-row insert or its preview (the objectstack-formula bulk-write table covers only previous per row); fields.mdx carries the behaviour.

维护者速读

  • 用户能看到什么变化:一次导入或批量新建多条明细时(含导入前的预校验),校验规则若读取上级记录里基于汇总字段算出的公式(如「剩余预算」),现在逐条累计判断,与一条条新建的结果一致;批量更新不动汇总相关字段时直接读已存值。
  • 为什么做:这是汇总字段批量一致性系列的收尾,替用汇总公式做额度、上限校验的应用补齐批量新建这一路。
  • 出错会怎样:这是一次收紧:批量新建明细时,原来一次放行、逐条新建本会被拒的超额批次,现在整批拒绝且一条不写,预校验同样提示,且预校验对用户无权查看的上级字段始终按空值判断;用这类规则的应用会看到导入失败,改动可直接撤回,不涉及数据迁移。
  • 要你做什么:这是申报的收紧,按 chore(governance): the guard scripts join the governed register, .claude/** lands by declared rule-change, a declared narrowing waits for the maintainer #35610 需要你在 GitHub 上点一次 Approve;之后席位自主落地。另请知悉:用户可见的上级计算列仍以系统身份计算,若要更严需另行裁决(见席位记录)。
  • 席位意见:通过,没有必改项(席位记录见本 PR 评论)。

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 requiredWhen on parent, reads a parent formula or 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 against remaining = budget - total with budget 100 were all admitted in one call. TO: the third is refused with VALIDATION_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/main ca4ec2a2f1:

  • Premise check (the card's own, run first). Three lines of 40 under a budget of 100, a rule record.amount > record.bud.remaining (remaining a formula budget - total) and the same over a stored computed headroom: one by one the third insert is refused; on main the three in one call were all admitted. Item 1 is live.
  • Item 1, insert arm, write and preview. createBatchSummaryAccumulator gains setDependents / 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 same loadSummaryFoldDependents the predicate update's fold uses (exported from engine-update.ts; it now also exposes the stored parent as dependents.stored, the base a roll-up is moved from when the reader's row was not handed it). accept tells dependents.advance the 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, validate with mode: 'insert'), whose host in engine.ts now carries facade, getSchema, resolveFormulaPermissions, resolveFormulaRelated and formulaOptionLabels (claim amendment 7032214252).
  • Item 2, relation screen. The insert accumulator screens with filterReadsThroughReference instead of filterNamesDottedPath, so a filter in the nested one-level form is left unaccumulated, as the predicate update leaves it.
  • Item 3 (N3). summaryPatchCanMove: a roll-up whose foreign key, source field (not a count'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.
  • Patch round 3 (L2 record 7034146638).
    • M1: summaryPatchCanMove reads a filter's { $field } comparand and an addDays: { $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 $field that 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.
    • M2: the multi-row insert preview moves and computes the batch's roll-ups only onto the master-detail header columns the read door served the caller. resolvePreviewParents (engine-master-detail-related.ts) now also returns servedColumns, the columns it kept per header; overlayRow takes them as visible. A withheld calculated column reads null at 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.
    • S1: content/docs/data-modeling/fields.mdx updated 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).
    • Nits: N1 (the admitted direction), N2 (mixed moved and stored inputs) and N4 (how the 34465 note's aggregate and stored-value sentences read beside this one) are one clause each in the 34821 note. N3 is not taken: it is a cost nit, bounded by the batch, with no prose to fix.
  • Item 4 (N4). Each stand-down (filter reading through a reference or refused by the walker, a value that is not a number, a min / max past the exclusion budget) reaches a SummaryFoldStandDownSink; the engine logs one debug line Roll-up left unfolded in a predicate update: its rules read the stored value with object, parentObject, field, reason.

Tests

  • summary-rollup.test.ts, new top-level describes [#34821] … (the shared makeDriver harness lives there): one-by-one reference and multi-row insert for a formula, a stored computed field, a field-level parent. 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, advance per admitted row, summaryPatchCanMove cases, each stand-down reason from the loader and the fold.
  • Patch round 3: unit { $field } / addDays cases 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's checkOp resolves a { $field } target against the row. M2 personas on the bud header through a field-level read rule shaped like the security middleware's hide mask, read by a requiredWhen on parent.remaining: carol, not served remaining, gets [valid, valid, valid] under budgets 100 and 1000, with a served-reader CONTROL [valid, valid, invalid] that the write refuses too; erin, not served total, gets [valid, invalid] as the system preview does; dave, not served budget, gets the moved headroom and [valid, valid, invalid].
  • One existing assertion moved legitimately: [#34465] … the subject reads its bases before the write counted 5 aggregates; under an amount patch primaries (count filtered on is_primary) and line_count (a count) cannot move, so 3 now. The comment there says why.

Acceptance notes

  • The pending changeset .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.
  • N3 residual, by design: one by one, a non-moving update still recomputes the parent after row 0, so rows after the first read the freshly aggregated value; with a stale stored roll-up neither the fold nor this short-circuit matches every row. With a current stored value (the normal state) the short-circuit matches at every row and also matches a column-scaled avg / sum, which the fold did not.
  • A descriptor the insert accumulator drops mid-batch (a non-number value) keeps whatever an earlier advance carried into the parent image for its calculated fields; it moves nothing further.
  • Surface extension this round: engine-master-detail-related.ts (resolvePreviewParents returns servedColumns) 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.ts changes only the private resolvePreviewParents return type, on the same line, and stays at 6853 lines. content/docs/data-modeling/fields.mdx is S1 of the round.
  • M2 measurement: a record.REF.FIELD rule reads the related binding, a system read on main already (the L2 record says so too), so the persona pins read the header through parent. in a requiredWhen. A persona not served a column that an unguarded parent. predicate reads is refused at row 0 as unevaluable, and nothing after it moves, so the pins guard with != null.
  • Pins live in the two existing files instead of a new file named for the card: AGENTS.md (ruling record 6583487846) puts a new pin for a component with a shared harness file into that file as a top-level 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 34821 shows every [#34821] case green; on origin/main the multi-row insert cases fail with expected the write to be refused and the preview case answers [true, true, true].

Read first: packages/objectql/src/summary-batch-accumulation.ts (movedOf / patchRow with visible, addFieldReferents / filterFieldNames, accept), packages/objectql/src/engine-update.ts attachInsertSummaryDependents (the readParents gate both doors share) and its two call sites in engine-insert.ts / engine-validate.ts, and the summaryPatchCanMove filter with the stand-down sink in engine-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 from src, no build in the path), mutation through scripts/ablation-replace.mjs (anchor 1 to 0, blob moved, restored to HEAD).

  • A1 drop setDependents in engine-insert.ts: 4 failed / 147 (formula, stored, header, high-water multi-row insert cases).
  • A2 drop dependents.advance in accept: 2 failed / 149 (advance unit pin, high-water engine pin).
  • A3 screen back to filterNamesDottedPath: 1 failed / 150 (nested-form screen pin).
  • A4 drop the summaryPatchCanMove filter: 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.
  • A5 drop the debug line: 1 failed / 150 (N4 trace pin).
  • A6 (head e4710f1) skip the preview's 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.
  • A1b (head e4710f1) skip the write's attachInsertSummaryDependents: 5 failed / 153 (the four write pins and the preview pin, whose write leg refuses no longer).
  • A7 (head 3b3cd84) delete if (!addFieldReferents(value, into)) return undefined; in filterFieldNames, run with -t field: 2 failed (the { $field } unit case, the predicate-update engine pin); the CONTROL stays green.
  • A8 (head c2a5fd1) hand overlayRow undefined instead of servedColumns[i] in engine-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.
  • A9 (head c2a5fd1) drop && (!visible || visible.has(desc.summaryField)) from movedOf's carried, 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) and check:test-typecheck is OK.
  • Full dogfood battery on the final head 5d69a32: 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/verify and others), so it counts for nothing; the closure build was added to the command.
  • Derived gate families (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/main exit 1 is the foreign-note refusal, by design. check:skill-examples and check:dual-build-cjs-loads exited 3 (prerequisites: unbuilt workspace dist/) and exit 0 on a re-run once the packages were built. --ran reconciliation: 102 derived, 102 run, 0 NOT-MEASURED, exit 0.
  • Lint · scoped · query-options erasure was red in CI at c2a5fd1: the M2 pin's findOne options carried as any, test sites 236 to 237. 5d69a32 drops the cast, because the options are on contract. pnpm check:query-options-erasure is green locally ("test surface: 236 site(s) … at the ceiling") and the CI lane is green at 5d69a32.
  • overlap-check before each push: exit 1 only for chore: version packages #35129 (the release PR "chore: version packages"), which conflicts in .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 in engine.ts onto one line.
  • Full dogfood battery on the final head 90eaeed: 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.
  • Derived gate families at 90eaeed (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's dist/ and this worktree built only the dogfood closure) and check:type-check-debt (its --re-measure closure build never got a turn on the shared verify lock). Both run in CI. --ran reconciliation exit 0.
  • check:facade-delegation-only was red at ee75c6e (engine.ts 6858 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).
  • eslint over the seven changed source and test files: exit 0.
  • Head 6169c1e adds only the DELIBERATE CORRECTION to the 34465 changeset (prose, no code), so the dogfood battery and the package test readings stay at 90eaeed. Changeset gates at 6169c1e: check-empty-changeset --base origin/main exit 1 (the foreign-note refusal, by design), its --self-test exit 0, check-adr-0087-registration --base origin/main exit 0 and --self-test exit 0, check-changeset-no-major exit 0, check:changeset-gate-self-tests exit 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:

(a bulk create does not yet for a rule reading a parent field calculated from one: its accumulator moves the summary key alone, #34821)

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. The check-empty-changeset red (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

…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>
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/objectql, touching 48 documentable anchor(s).

22 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json 170ca481f0aeec14ca06d74ec3d57c654997e698.

⛔ 7 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 5 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 21 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 170ca481f0aeec14ca06d74ec3d57c654997e698 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 995ed89ea7c47b5c61a411f1347da9c03d31b5fb — the merge of head 6de555d92e7bd3446cefd60d95144da1c7d93917 into base 170ca481f0aeec14ca06d74ec3d57c654997e698, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# 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

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 170ca481f0aeec14ca06d74ec3d57c654997e698 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@github-actions github-actions Bot added documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 20, 2026
…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>
@objectstack-fleet objectstack-fleet Bot changed the title fix(objectql): a multi-row insert reads a parent's formula fields over the roll-ups its rows move; fold follow-ups fix(objectql)!: a multi-row insert reads a parent's formula fields over the roll-ups its rows move; fold follow-ups Nov 20, 2026
…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>
@objectstack-fleet objectstack-fleet Bot added the needs:contract-review Marker only — PR awaits its at-tier Contract review PASS; no check reads it, the record decides label Nov 20, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7

Check Changeset red at 6169c1ed8d · 2026-11-20T08:09Z

The only error is the DELIBERATE CORRECTION class on .changeset/34465-predicate-update-parent-summary-rule.md (job 136165292257: "exists on the merge base and was not added by this PR"). It is by design. This PR makes that note's parenthetical "(a bulk create does not yet … #34821)" false, so it drops it. The drop is declared in the PR body's ## DELIBERATE CORRECTION section, per claim amendment 2 on #34821. The gate stays red for this class either way. The seat confirms the correction with the same-head CONTRACT_REVIEW_TIER record this PR already owes for (narrowing), which is running now. Check Changeset is not a required context.

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.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 6169c1ed8dbba450fb81429e6dc520bb422de872
Local-runs: none
Scope: packages/objectql/src/engine-insert.ts, packages/objectql/src/engine-update.ts, packages/objectql/src/engine-validate.ts, packages/objectql/src/engine.ts, packages/objectql/src/summary-batch-accumulation.ts, packages/objectql/src/summary-batch-accumulation.test.ts, packages/objectql/src/summary-rollup.test.ts, .changeset/34821-rollup-fold-followups.md, .changeset/34465-predicate-update-parent-summary-rule.md + packages/objectql/src/having-filter.ts, packages/objectql/src/no-operator-object-door.ts, packages/objectql/src/summary-aggregate.ts, packages/objectql/src/engine-master-detail-related.ts, packages/objectql/src/engine-references-and-master-detail.ts, packages/objectql/src/declared-fields.ts, packages/objectql/src/index.ts, packages/objectql/src/core.ts, packages/objectql/package.json, packages/spec/src/data/field.zod.ts, packages/spec/src/data/filter.zod.ts, content/docs/data-modeling/fields.mdx (cited code and published text at this head, read, not reviewed)
Security-touching: yes

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 0e2de25149; the check-runs on the head and the log of Check Changeset job 136165292257; PR #34709's at-tier record 6943284591. Everything below is a reading of the tree at the head; nothing was built or run.

① Derived judgments

Gate 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: .changeset/34465-predicate-update-parent-summary-rule.md exists on the merge base and was not added by this PR, the DELIBERATE CORRECTION foreign-note refusal, as declared. The same run's ADR-0087 registration step lists .changeset/34821-rollup-fold-followups.md [BREAKING+bang+clause-②-narrowing] not-required (no-migration-prescription). The test and type-check verdicts for this head do not exist yet; this record does not stand in for them.

What moves, read in the code:

  • Insert door, write (engine-insert.ts) and preview (engine-validate.ts, mode insert, more than one row). Refused at head, admitted on main: a multi-row insert where some row after the first fails a rule (a validation rule one hop through a reference, or a field-level requiredWhen on parent) that reads a parent formula or stored computed field calculated from a count / sum / min / max roll-up the earlier admitted rows of the same batch move. Is that exactly what one-by-one refuses? For that shape, yes as far as the code reads: the delta is the admitted rows only (accept runs after the rules and the reference check), the first row reads the stored parent, and the calculated fields are computed by the same loadSummaryFoldDependents passes the predicate door uses (stored fields twice over the write image, then formulas in the read plan's order), with one image per parent carried through advance. The opposite direction exists too (a row main refused against the stored calculated value is admitted when earlier rows move it away from the rule's line), as one by one does; the 34821 note names only the refused direction (N1).
  • Not exact, and outside the narrowing: an avg roll-up and a roll-up dropped mid-batch are not moved, so a calculated field over one of them keeps a stored or half-moved input (N2). A roll-up whose filter is in the nested form is now left out of the insert accumulation; on main the walker answered "no match" for that form on every new row, so the roll-up read the stored value there too and no verdict moves.
  • Predicate-update door, N3: a roll-up the patch "cannot move" is no longer folded, so its rules read the stored value at every row. This is an accept-set change in BOTH directions against main, and it is declared only as value-neutral. It is value-neutral only when summaryPatchCanMove is right about "cannot move". It is not: see M1. Where it is right, the remaining difference from main is the stale-stored / column-scale case the card asked for.
  • Preview: the multi-row insert preview now computes parent calculated fields from a SYSTEM read of the parent rows, also for the master-detail header whose columns the preview withholds per caller. See M2.
  • Public surface: no schema key, error code or package-entry export moves. attachInsertSummaryDependents, loadSummaryFoldDependents (newly exported from engine-update.ts), summaryPatchCanMove, SummaryFoldStandDown, SummaryFoldStandDownSink and the two new BatchSummaryAccumulator members are module exports of internal files; neither src/index.ts nor src/core.ts (the two exports entries of packages/objectql/package.json) re-exports them. ValidateHost gains five members, internal. Right.

② Semver level

  • @objectstack/objectql: patch with a ! title, BREAKING banner, FROM / TO and the caller's fix: the right level for a non-protocol narrowing, as on PR fix(objectql)!: a predicate update judges each matched row against the parent roll-ups the rows before it move #34709.
  • Clause-②: no (narrowing): present on the PR body and the changeset, and the right arm for the insert door: no published schema or governed path moves, and an insert main admitted is refused. It does not cover M1, which moves the predicate door the other way with no declaration.
  • Metadata-protocol: none: right. Nothing an author can write is added, removed or re-read at authoring.
  • ADR-0087 not-required (no-migration-prescription): right. No key, export of a package entry, stored row or authored value changes shape; there is nothing a migration could rewrite. The marker's sentence "the value a predicate update's rule reads for a roll-up its patch cannot move" inherits M1's wording problem, not a disposition problem.

③ Boundary flags

  • Deviation, pins in the two shared harness files and not a file named for the card: accepted by claim amendment 7032214252. Answered.
  • Deviation, file-surface stop then extension to engine-validate.ts and the validate host in engine.ts: authorised by 7032214252; the host hunk in engine.ts is the five delegating members only. Answered.
  • Deviation, origin/main merged in and a killed local run: no reading from the killed run is cited; the head's check-runs are the verdict. Answered.
  • Deviation, the five host members on one line for the facade line ceiling: cosmetic. Answered.
  • Deviation, discarded ablation spellings: not evidence on this head. Answered.
  • Deviation, pushed with overlap-check exit 1 against the release PR chore: version packages #35129: the 34465 note is still on main at the read, so the correction still has a pending note to correct. If the release consumes it first, this hunk conflicts and the correction moves to the released CHANGELOG. For the seat. Answered.
  • Acceptance note, N3 residual with a stale stored roll-up: accepted as the card's own ask; it holds only where the patch truly cannot move the roll-up (M1).
  • Acceptance note, a descriptor dropped mid-batch keeps what advance carried: read and confirmed; the rule reading the roll-up itself goes back to the stored value while a calculated field keeps the half-moved image. N2.
  • open_questions: none open; both of round one were answered by 7032214252.
  • SQL push-down (Prime Directive 5): no finding. The parent read is one find by id $in per parent object, chunked at SUMMARY_GROUPED_AGGREGATE_CHUNK, bounded by the distinct parents the batch's rows name, made once per batch and never per row. It is gated twice: attachInsertSummaryDependents returns before any read unless a rule of the batch binds a related row or header of that parent, and loadSummaryFoldDependents skips an object none of whose stored or formula plans reads an accumulated roll-up (the CONTROL pin counts zero parent reads). The read is the whole row, unprojected: the stored pass needs the write image and the formula pass its inputs, and no SQL expression can evaluate the formula plan. The gate is "a rule reads that parent", not "a rule reads a calculated field of it", so a rule reading only parent.name on a parent that has such a field pays the one read (N3). N3 of the card removes aggregates; it adds no statement.
  • Transactions and concurrency: every new read happens before the batch writes, through the engine facade with the caller's context spread under isSystem: true, the same context shape the predicate door's dependents use, so the tenant scope is kept. Not traced into a driver. Concurrency stays unguaranteed per ruling 6377847361.

④ Design judgment

The 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 written, reused); a binding projected to the calculated field alone (the roll-up is moved from dependents.stored); a parent created in the same batch (only a self-referential object can do it; the related read finds no row, nothing is overlaid, unchanged from main and outside this diff). Those hold. Two things do not.

M1 (must-fix) — summaryPatchCanMove misses a filter field, so N3 un-folds a roll-up the patch does move, and the predicate door loses batch-equals-one-by-one where main holds it. filterFieldNames collects only the KEYS of the filter. summaryOperations.filter is the canonical FilterConditionSchema, which admits a { $field: 'other' } comparand and an addDays: { $field: 'n' } offset (filter.zod.ts), and the fold's own walker resolves both against the row (compareWithReference, having-filter.ts). Take late_count, a count with filter { closed_at: { $gt: { $field: 'due_on' } } }, a rule reading record.project.late_count, and a predicate update { due_on: … } matching two rows. The named set is { closed_at }, the patch writes none of fk / source / closed_at, so summaryPatchCanMove answers false and the descriptor never reaches the fold. On main it is folded exactly (filterReadsThroughReference does not screen it, the base is a database aggregate, and contributionOf sees each row enter or leave the filter). At head every row reads the stored value: the update admits what consecutive by-id updates refuse, the bypass #34465 closed under ruling 6928862195 (B), reopened for this shape. It is an undeclared move in the widening direction on a PR declared narrowing; no pin covers it (the summaryPatchCanMove cases name keys only); and it makes two published sentences false at this head: the 34821 note's "writes no … filter field of a roll-up" (the code's test is narrower than the sentence), and the 34465 note's "each matched row judges the summary as the rows judged before it leave it". The second is the note this PR rewrites, so the DELIBERATE CORRECTION cannot be confirmed on this head: the dropped parenthetical is rightly dropped, but another sentence of the same note stops being true here. Fix: collect the $field referents (the comparand and a nested addDays) into the named set, or answer "can move" for any condition holding one, and pin it beside the existing cases.

M2 (must-fix) — The preview now judges on header values the caller was not served. resolvePreviewParents keeps a header column only where the read door served this caller that very value and materialises every other declared field as null, with the stated line "the verdict never depends on a header value the caller could not have read in full" (engine-master-detail-related.ts). patchRow writes a computed dependent wherever field in row, and on a materialised header every declared field is in the row. loadSummaryFoldDependents computes from a SYSTEM read of the whole parent. So for a caller who can read the header but not budget or remaining, the first row of a multi-row preview reads remaining as null and every row after the first admitted one reads budget - (moved total) computed from the stored budget. The preview is inconsistent with itself across rows, and its verdict now depends on a withheld column, with caller-chosen amounts in the earlier rows to steer it. The write judges stored values by design, so the bit is not new to the platform, but the preview's per-column rule is its own and this hunk breaks it without saying so; no pin holds a withheld column. The related-binding path is a SYSTEM read on main already and is not affected. Fix in the preview door: do not lay a computed dependent (nor move a roll-up from the stored base) onto a header column the caller was not served, and pin a masked-column case; or put the question to the maintainer as a ruling before it lands.

S1 (should-fix) — content/docs/data-modeling/fields.mdx is not in the diff and is stale on both doors at this head. The bulk-create paragraph still lists "a summary whose filter reads a dotted path" alone (the nested form now stands down too) and says nothing of calculated parent fields, which now hold; the predicate-update paragraph still says "Three cases keep reading the stored value" and "for every summary function", with no word of a roll-up the patch cannot move. PR #34709 carried the same paragraphs with its change.

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 (avg, a roll-up dropped mid-batch, a filter through a reference) is now computed over a mix of moved and stored inputs, and a roll-up dropped mid-batch leaves its half-moved value in the carried image while the roll-up itself reads stored again. The note says "computed again over the moved roll-ups" and names neither.

N3 (nit) — The parent read is gated on "a rule reads that parent", not on "reads a calculated field of it", and foldedSummaries is handed the rows the door already refused as well, so it can read a few parents no judged row needs. Bounded by the batch; cost only.

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 logger.debug per roll-up stood down per update, carrying object and field names and a reason from a closed set, no row value or id.

Implemented-by: claude/issue-34821-rollup-fold-followups
Reviewed-by: session_01L9qibwJEh7hMPPvagWM1g7

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>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibyQBB3KuDoNobNq9LH

Seat check

L1: ACCEPT (L1-a, for area d7-B) at head 5d69a3251f5b34b96546b3d6b264585dbc096795, read 2026-11-20T10:03Z. This is the first L1 on this PR.

  • One record is owed before landing, with no new head: the Skills-docs: line (below).
  • One L2 is owed: CONTRACT_REVIEW_TIER on this head. The change is declared narrowing, so the L2 covers the whole non-prose diff and confirms the DELIBERATE CORRECTION. d7-B reports the same reviewer's delta L2 is running, after FAIL 7034146638. This ACCEPT does not replace it.

Owed before landing: the Skills-docs: line

A ! / (narrowing) PR carries a Skills-docs: line, and the body has none. git grep over skills/ finds no sentence about a multi-row write, or a predicate update, judging a rule over a roll-up or a parent field calculated from one. So the line is Skills-docs: none — nothing under skills/ covers how a batch insert or predicate update judges a rule over a roll-up or a calculated parent field, or whatever reason d7-B measures. This is a body edit, with no new head and no delta L1.

Declarations

  • Clause-②: no (narrowing) holds, and ! is on the title and the subject.
  • The rest of the breaking record is there:
    • the ADR-0087 marker not-required (no-migration-prescription);
    • the BREAKING banner;
    • FROM / TO, with the concrete 3 × 40 against 100 case;
    • the fix line;
    • the full dogfood battery pinned to 5d69a325: 482 files passed and 3 skipped; 4094 tests passed, 68 skipped, 0 failed.
    • check-adr-0087-registration reads it as BREAKING+bang+clause-②-narrowing.

DELIBERATE CORRECTION: .changeset/34465-predicate-update-parent-summary-rule.md

The correction is true. This PR's accumulator calls dependents.advance and computes the parent's calculated fields over movedOf in patchRow, so the bulk create no longer "moves the summary key alone". The note is pending: it is still in .changeset/ and compiles into the same release, and Check Changeset is red only on it (both failing runs are that job).

The diff changes code, so per landing-operations.md the confirming record is the same-head at-tier L2 PASS, which must name this sentence. My ACCEPT does not confirm it on its own.

The 34465 note's aggregate sentence. It says "one grouped aggregate per summary a rule reads". The 34821 note now qualifies it ("hold for the roll-ups the patch can move; one it cannot move is neither aggregated nor folded") rather than rewriting it. I accept that (the L2's N4). It is accurate read with the later note, and it keeps the correction to the one false parenthetical. ⛔ Nothing touches Version Packages #35129.

Code (L1 read)

  • summaryPatchCanMove. A roll-up is movable when the patch writes its FK, its sourceField (not for count), or any field its filter names.
    • The filter names come from keys and from { $field } referents at any depth, so an addDays operand holding a $field is found by recursion.
    • An unreadable operator answers "can move", the conservative direction.
  • movedOf / patchRow.
    • The stored image comes from dependents.stored when the reader was not handed the roll-up.
    • Calculated fields are written only onto columns that were served (served(field)).
    • In preview, servedColumns[i] comes from the master-detail reader's kept columns, and a null entry becomes an empty set, so a withheld column reads null (M2).
  • Nested-form filters ({ account: { status } }) are now left out by filterReadsThroughReference, as the dotted form was.
  • Stand-down sink. It reports one debug line per unfolded roll-up, with the reasons filter, not_a_number and exclusion_budget, as the changeset says.
  • Ablations A7–A9 red the new pins (7036621555).

Prose, sentence by sentence

  • 34821 changeset.
    • FROM and TO match attachInsertSummaryDependents and the preview path.
    • "carrying the parent's stored image from row to row" matches advance.
    • "judges a master-detail header column the caller is not served as empty at every row" matches M2.
    • "Only a batch with a rule reading that parent pays one read of its parent rows" matches stored.
    • The both-ways and mixed-input bullets (N1, N2) are true by the fold.
    • The nested-form sentence and the predicate-update paragraph match summaryPatchCanMove and the stand-down reasons.
  • fields.mdx. The calculated-field paragraph, the nested-form exception, the preview exception and the "Four cases" list (the new "a summary the patch cannot move" plus the three before) each match the code.

Nit (not owed)

fields.mdx's new case says "as a key or as a { $field } comparand". The changeset adds "or addDays offset". The code covers both through the same recursion, so the page could name the offset too.

Gates and routing

  • CI at 5d69a325: 39 success, plus the expected Check Changeset foreign-note red.
  • After the Skills-docs: line and the at-tier L2 PASS on this head (naming the 34465 sentence), the SKILL.md conditions for landing red-with-correction apply, and check-governed-merges.mjs --pr 35773 decides the route.

Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 5d69a3251f5b34b96546b3d6b264585dbc096795
Local-runs: none
Scope: packages/objectql/src/engine-insert.ts, packages/objectql/src/engine-update.ts, packages/objectql/src/engine-validate.ts, packages/objectql/src/engine.ts, packages/objectql/src/engine-master-detail-related.ts, packages/objectql/src/summary-batch-accumulation.ts, packages/objectql/src/summary-batch-accumulation.test.ts, packages/objectql/src/summary-rollup.test.ts, .changeset/34821-rollup-fold-followups.md, .changeset/34465-predicate-update-parent-summary-rule.md, content/docs/data-modeling/fields.mdx + packages/objectql/src/having-filter.ts, packages/objectql/src/engine-references-and-master-detail.ts, packages/objectql/src/declared-fields.ts, packages/objectql/src/index.ts, packages/objectql/src/core.ts, packages/spec/src/data/filter.zod.ts (cited code at this head, read, not reviewed)
Security-touching: yes

Delta review. This record judges the FAIL record 7034146638 (head 6169c1ed8d) against the new head: the diff 6169c1ed8d..5d69a3251f (3 commits, 8 files), the net diff against merge base 0e2de25149 (11 files), dev report 7036621555's claims as relayed, claim amendment 7036669716, and the check-runs on this head. The judgments of 7034146638 that this delta does not touch stand as written there. Everything below is a reading of the tree; nothing was built or run.

① Derived judgments

Gate 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: .changeset/34465-predicate-update-parent-summary-rule.md exists on the merge base and was not added by this PR, the DELIBERATE CORRECTION foreign-note refusal. The same run prints .changeset/34821-rollup-fold-followups.md [BREAKING+bang+clause-②-narrowing] not-required (no-migration-prescription) and a green level axis (clause-② no (narrowing), metadata-protocol none, no entry above patch). Test Core, Build Core, the Type Check lanes and the Lint lanes are success on this head.

What moves in the delta:

  • Predicate-update door: filterFieldNames now adds, for every field key, the fields its value reads as a { $field } referent at any depth (addFieldReferents: the comparand, an addDays: { $field } offset, a referent inside a list), and answers "cannot read" (taken to move) when a $field names no field by a non-empty string. So a patch writing only such a referent sends the roll-up to the fold again, as on main. The un-folded set is now: no foreign key, no source field of a non-count, no filter key, no filter referent. For that set every matched row's contribution is unchanged by the patch, so only the stale-stored / column-scale difference the card asked for remains.
  • Insert preview: resolvePreviewParents returns servedColumns[i], the keys it kept for parents[i] (the columns the read door served this caller that very value); validate hands it to overlayRow as visible, an empty set when absent. patchRow writes a moved roll-up or a computed dependent only onto a column that is in the row AND in visible. The write's overlayRow call passes no visible and is unchanged.
  • Public surface: nothing new reaches a package exports entry. servedColumns is on a private engine method and an internal module; overlayRow's third parameter is optional on an internal interface.
  • Accept set against main: unchanged in kind from 7034146638. The insert narrowing stands; the delta removes the undeclared widening on the predicate door and narrows what the preview may answer from.

② Semver level

Unchanged and still right: @objectstack/objectql: patch, ! title, BREAKING banner with FROM / TO, Clause-②: no (narrowing) on the PR body and the changeset, Metadata-protocol: none, ADR-0087 not-required (no-migration-prescription). The PR stays a narrowing: the only inserts newly refused are the multi-row ones one-by-one refuses for a rule reading a parent field calculated from an accumulated roll-up, and the note now also names the admitted direction. No delta hunk adds a key, an entry export or a stored value.

③ Boundary flags

  • Surface extension to engine-master-detail-related.ts and fields.mdx: declared in claim amendment 7036669716. The engine.ts hunk is the return type of one private delegating method. Answered.
  • N3 of 7034146638 (the parent-read gate over-reads a little) not taken: accepted, it is cost only and bounded by the batch.
  • Head c2a5fd1204 to 5d69a3251f: one test hunk typing a findOne options object. Read; no behaviour.
  • SQL push-down: the delta adds no statement. servedColumns is built from the two header reads resolvePreviewParents already makes; addFieldReferents is a walk over the declared filter. No finding.
  • For the Tier H approver, not a finding: the preview's rule now holds per COLUMN. A calculated header column the caller IS served (remaining) is still computed, for the rows after the first, under SYSTEM from inputs the caller may not be served (budget, or the roll-up itself, which is then moved from the stored value). That is what the read door serves this caller for the same column once the earlier rows are written, the first row already reads a served value that is a function of the same inputs, and the test names it (persona dave). If the maintainer wants the stricter line (a served calculated column over a withheld input reads as served at every row), that is a ruling, not this card.

④ Design judgment

M1 of 7034146638 — closed. Read in summary-batch-accumulation.ts: summaryPatchCanMove on { closed_at: { $gt: { $field: 'due_on' } } } with a patch { due_on } now names { closed_at, due_on } and answers true; the nested addDays: { $field } and a malformed referent are covered. Pins: the unit case with its CONTROL ({ other: 1 } answers false for both shapes), and the engine describe with a one-by-one reference, the predicate update refused at the second row with nothing written, and a stale-stored CONTROL showing a non-moving patch still reads the stored count. The 34821 note and fields.mdx now say "a field the filter reads (as a key, or as a { $field } comparand or addDays offset)", which is what the code tests.

M2 of 7034146638 — closed. Tried against it by reading:

  • A withheld calculated column: served(field) is false, nothing is written onto it, it stays the materialised null at row 0 and at every later row. No row-0 against later-row asymmetry (persona carol, two budgets, same verdicts).
  • A withheld roll-up: not carried from the row's null but moved from the stored parent, and never written onto the header; it feeds only the served calculated columns (persona erin). The roll-up's own key stays null at every row.
  • A header the caller cannot read: parents[i] is null, overlayRow returns it untouched, and servedColumns[i] is null; the two are null together by construction, and ?? new Set() fails closed if they ever were not.
  • previousParent is not overlaid; the related binding is the SYSTEM read main already makes behind the write-gate probe. No other path lays a SYSTEM-computed value onto a per-caller row.
    The remaining dependency (a served calculated column over withheld inputs) is the note in ③.

S1 of 7034146638 — closed. fields.mdx names, on the bulk-create door, calculated parent fields, the nested filter form, the mixed moved / stored case and the preview's withheld-column rule; on the predicate door, "Four cases", the first being a summary the patch cannot move.

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. .changeset/34465-predicate-update-parent-summary-rule.md is unchanged since 6169c1ed8d and is still pending on main. The one change against the merge base is the dropped parenthetical "(a bulk create does not yet for a rule reading a parent field calculated from one: its accumulator moves the summary key alone, #34821)", which this PR makes false: the insert accumulator and the preview now compute a parent's calculated fields over the moved roll-ups. The sentence left, "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", is true at this head. With M1 closed, "each matched row judges the summary as the rows judged before it leave it" holds for every roll-up the patch can move, and the 34821 note in the same release states the scope for one it cannot. Nothing else in that note is made false by this PR.

No must-fix, no should-fix.

N1 (nit) — fields.mdx, predicate door: the first of the "Four cases" lists a { $field } comparand but not the addDays offset the changeset and the code also count. One word.

Implemented-by: claude/issue-34821-rollup-fold-followups
Reviewed-by: session_01L9qibwJEh7hMPPvagWM1g7

VERDICT: PASS

@objectstack-fleet objectstack-fleet Bot removed the needs:contract-review Marker only — PR awaits its at-tier Contract review PASS; no check reads it, the record decides label Nov 20, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibvvVzM5KhCWkT5f45c

维护者速读

  • 用户能看到什么变化:导入或批量新建多条明细时(包括导入前的预校验),如果校验规则读取了上级记录里由汇总字段算出的公式(例如"剩余预算"),现在会逐条累计来判断,结果和一条一条新建一致。原来一次放行的超额批次,现在整批拒绝,一条都不写。预校验也不再泄露用户无权查看的上级字段。
  • 为什么做:这是汇总字段批量一致性系列的收尾,补齐了批量新建这一路,给用汇总公式做额度或上限校验的应用用。
  • 出错会怎样:这是一次申报的收紧(BREAKING):用这类规则的应用会看到超额的导入失败。改动可以直接撤回,不涉及数据迁移。
  • 要你做什么:按 chore(governance): the guard scripts join the governed register, .claude/** lands by declared rule-change, a declared narrowing waits for the maintainer #35610,需要你在 GitHub 上点一次 Approve,之后席位自主落地。另有一点供你知悉:用户能看到的上级"计算列",仍会用他看不到的输入、以系统身份算出来;这和读接口在前面几行写完后的返回一致。如果要更严,需要你另外裁决,本 PR 不改。
  • 席位意见:通过,没有必改项。L2 第一次不通过(M1、M2、S1),修好后复审已通过。

席位核对

Seat 7: hand-off for the maintainer's approval · head 5d69a3251f5b34b96546b3d6b264585dbc096795 · Fixes #34821 · K=20 against main · not governed (0 of 11 paths) · declared narrowing (Clause-②: no (narrowing)), so PR #35610's queue leg needs an authorized APPROVED review · +877/−48 · 2026-11-20T10:06Z

  • Shape.

    • Source: packages/objectql.
      • engine-insert.ts and engine-validate.ts call one new door, attachInsertSummaryDependents (in engine-update.ts), so the write and its preview compute a parent's roll-up-derived fields the same way.
      • summary-batch-accumulation.ts gains foldedSummaries / setDependents and a visible column set on overlayRow, so the preview header shows only the columns the caller was served.
      • The predicate update folds only roll-ups the patch can move (summaryPatchCanMove). A roll-up left unfolded is logged at debug level.
    • Tests: +546 lines across two pin files.
    • Docs: fields.mdx.
    • Changesets: one new changeset, plus a DELIBERATE CORRECTION of the pending .changeset/34465 note.

    The seat read the source diff itself.

  • Gates. Check-runs at this head: 40 success; the only red is Check Changeset ×2, the expected foreign-note refusal for the declared 34465 correction, explained in the body and in the L2 record. Check Changeset is not among main's required status checks. Dogfood battery at this head: 482 files, 4,094 tests, 0 failed.

  • Reviews.

    • L1: ACCEPT 7036710654 at this head.
    • L2 at CONTRACT_REVIEW_TIER: FAIL 7034146638 at 6169c1ed8d (M1 the $field comparand in summaryPatchCanMove, M2 preview header masking, S1 fields.mdx).
    • The same reviewer's delta PASS 7036724880 names this head (Head-sha: 5d69a32…, tier evidence posted). It also confirms the 34465 correction.
  • Accepted deviations / out of scope.

    • A calculated header column the caller is served is still computed under SYSTEM from inputs the caller may not be served. This matches the read door, and the dave persona pins it. A stricter line is a maintainer ruling and is not in this PR.
    • One new L2 nit (fields.mdx, addDays) is not owed.
    • Version PR chore: version packages #35129 conflicts on the 34465 note; ⛔ nobody touches it.
  • Landing. Held for the authorized APPROVED review (os-zhuang requested). Per the maintainer's standing word (2026-11-20T09:19Z), the area thread arms auto-merge after approval. A later main merge needs a same-head carry of the L2 record.

@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 20, 2026
@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 20, 2026 10:09
…llup-fold-followups

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibwJEh7hMPPvagWM1g7
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7

Regen-provenance: 7036724880 · 5d69a3251f5b34b96546b3d6b264585dbc096795 → 6de555d92e7bd3446cefd60d95144da1c7d93917 · git diff <merge-base> <head> | git patch-id --stable → (empty difference)

Head move at 2026-11-20T22:18Z: a merge-forward of main only. 6de555d92e is one merge commit, with parents 5d69a3251f and the current main. It resolved no conflict. The branch had fallen 61 first-parent commits behind, past the K ≥ 15 line in seat record 7036795550.

The PR's own net diff has the same patch-id on both heads: 85c01344d9568743b4f133d412828020f71330ae. So L1 ACCEPT 7036710654 and Fable delta L2 PASS 7036724880 carry to 6de555d92e. CI on this head is pending.

Check Changeset stays red by design. This PR deliberately corrects the unreleased .changeset/34465-predicate-update-parent-summary-rule.md (see DELIBERATE CORRECTION in the body; claim amendment 7033859376), and the gate's own rule (#18375) is to leave it red with the confirmation written. It is not a required check. Landing still waits on the Tier H APPROVED review.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7

Landing: PR #35773 (#34821) at 6de555d92e7bd3446cefd60d95144da1c7d93917, 2026-11-20T22:24Z

Arming auto-merge (queue).

@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 20, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 20, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 6de555d92e7bd3446cefd60d95144da1c7d93917
Local-runs: none
Scope: packages/objectql/src/engine-insert.ts, packages/objectql/src/engine-update.ts, packages/objectql/src/engine-validate.ts, packages/objectql/src/engine.ts, packages/objectql/src/engine-master-detail-related.ts, packages/objectql/src/summary-batch-accumulation.ts, packages/objectql/src/summary-batch-accumulation.test.ts, packages/objectql/src/summary-rollup.test.ts, .changeset/34821-rollup-fold-followups.md, .changeset/34465-predicate-update-parent-summary-rule.md, content/docs/data-modeling/fields.mdx + packages/objectql/src/having-filter.ts, packages/objectql/src/fixed-read-leaf-seam.ts, packages/objectql/src/filter-comparand-shape.ts, packages/objectql/src/engine-security-resolvers.ts, packages/objectql/src/engine-find.ts, packages/objectql/src/engine-count-aggregate.ts, packages/objectql/src/engine-top-level.ts, packages/objectql/src/validation/unit-code-membership.ts, packages/objectql/src/index.ts, packages/spec/src/data/filter.zod.ts, packages/spec/src/data/field.zod.ts, packages/formula/src/formula-return.ts, scripts/facade-delegation-registry.json (cited code and what main brought beside it, at this head, read, not reviewed)
Security-touching: yes

Delta review of a merge-forward. The previous at-tier record is PASS 7036724880 at 5d69a3251f; before it, FAIL 7034146638 at 6169c1ed8d. This record judges whether their findings hold at 6de555d92e. Inputs read: card #34821, its body and all 11 comments (claim 7031250136, dev reports 7032185057, 7033828561, 7033989513, 7036621555, claim amendments 7032214252, 7033859376, 7036669716); PR #35773, its body, its 11 files, all 8 comments (records 7034146638 and 7036724880, L1 7036710654, seat record 7036795550, 7051986368, 7052084305), review 6000183158; the net diff against 170ca481f0; the 55 check-runs on the head and the log of Check Changeset job 136605036638. Git objects were fetched and diffed; nothing was checked out, built or run. Judgments of the two earlier records that this delta does not touch stand as written there.

① Derived judgments

The head move, verified here and not taken from 7051986368:

  • 6de555d92e is one merge commit. Its parents are 5d69a3251f5b34b96546b3d6b264585dbc096795 and 170ca481f0aeec14ca06d74ec3d57c654997e698 (main then; 61 first-parent commits past the old merge base 0e2de25149).
  • git diff 0e2de25149 5d69a3251f | git patch-id --stable and git diff 170ca481f0 6de555d92e | git patch-id --stable both give 85c01344d9568743b4f133d412828020f71330ae. The PR's net diff is the same 11 files, +877 / -48.
  • The merge resolved nothing by hand: git show --cc and git show --remerge-diff of the merge commit are both empty.

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 Lint & Repo Gates included), Dogfood Regression Gate and Governed Surface Queue Guard are success. The failure is Check Changeset. Its log fails on one line: .changeset/34465-predicate-update-parent-summary-rule.md exists on the merge base and was not added by this PR, the DELIBERATE CORRECTION foreign-note refusal. The same run prints .changeset/34821-rollup-fold-followups.md [BREAKING+bang+clause-②-narrowing] not-required (no-migration-prescription) and a green level axis (clause-② no (narrowing), metadata-protocol none, no entry above patch).

What main brought into the files this PR touches or calls into, read hunk by hunk (0e2de25149..170ca481f0):

  • engine-insert.ts (+21): the ADR-0158 unit-code check. One readOrganizationUnits before the validation loop and assertUnitCodes per row. At this head the per-row check sits before the rules and before batchSummaries?.accept(rows[i]), inside the same try. A row it refuses lands in rowErrors and is never accepted, so it moves no roll-up and advances no parent image: the same treatment the earlier records judged for a row refused by a rule or by the reference check. attachInsertSummaryDependents still runs after the pre-loop refusals and skips them through rowErrors.
  • engine-validate.ts (+16 / -1): the same check in the preview's per-row try, and isUnitCodeRefusal in its catch. A refused row returns its finding before batchSummaries?.accept(row). Preview and write still agree on which rows count.
  • engine-update.ts (+41 / -1): the unit check on the by-id and predicate paths, and the ADR-0155 fixed-read leaf seam at the predicate update's entry (passFixedReadLeaves, before the prior-row read). Neither hunk is in or beside the fold: summaryPatchCanMove, the stand-down sink, loadSummaryFoldDependents and attachInsertSummaryDependents are byte-for-byte what 7036724880 read.
  • engine.ts (+13 / -12): a docblock re-wrap, facade and logger on the count host, two getters on other hosts. The validate host and resolvePreviewParents are untouched by main. The file is 6854 lines at this head against maxLines: 6854 in scripts/facade-delegation-registry.json; the gate is green on this head (N2).
  • engine-master-detail-related.ts, summary-batch-accumulation.ts, summary-batch-accumulation.test.ts, summary-rollup.test.ts, having-filter.ts, summary-aggregate.ts: not changed by main.
  • The reads the PR adds go through facade.find with { id: { $in } } under isSystem: true. main wrapped find, findOne and count in atFixedReadLeafDoor and added passFixedReadLeaves at the executor boundary. Both act only on a branded fixed-read leaf (sites.length === 0 returns), and nothing on main writes one yet, so the parent read is unchanged.
  • filter.zod.ts (+17 / -9): a jsdoc paragraph on the nested relation form. No comparand shape is added, so the set addFieldReferents must cover ($field, addDays: { $field }) is the set M1 was closed against.
  • field.zod.ts and packages/formula/src/formula-return.ts: units of measure, and authoring-time returnType inference. Neither is on the path that computes a parent's calculated field at write time.
  • fields.mdx: main rewrote the read-only paragraph near line 398. The PR's hunks are at 468 and 505 and read the same in context.

Accept set against main: unchanged in kind from 7036724880. The only new refusals on main near these doors (a unit code that is no member) refuse before the rules on both the batch and the one-by-one path, so batch-equals-one-by-one is not moved by them.

main has moved again since (cf2e321bf7). None of the 11 paths, nor scripts/facade-delegation-registry.json, is in 170ca481f0..cf2e321bf7.

② Semver level

Unchanged and still right: @objectstack/objectql: patch, ! title, BREAKING banner with FROM / TO and the caller's fix, Clause-②: no (narrowing) on the PR body and the changeset, Metadata-protocol: none, ADR-0087 not-required (no-migration-prescription). main added exports to packages/objectql/src/index.ts (the unit-code backfill); none of this PR's module exports reaches a package entry, as before. Nothing main brought turns the insert narrowing into a wider or a different move.

③ Boundary flags

  • Every deviation and open_questions entry answered in 7034146638 and 7036724880 stays answered; the delta adds none. Dev report 7036621555 has no open question.
  • The merge-forward itself: no conflict, no hand resolution, same patch-id. Answered above.
  • Release PR chore: version packages #35129 against the 34465 note: the note is still pending on main at cf2e321bf7, with the blob the PR's diff is taken against (bf088393fd). The correction still has a pending note to correct.
  • SQL push-down (Prime Directive 5): no finding. The delta adds no statement to this PR. The parent read is still one find by id $in per parent object, chunked at SUMMARY_GROUPED_AGGREGATE_CHUNK, once per batch, gated on a rule of the batch reading that parent and on a calculated field reading an accumulated roll-up. The whole row is read because the stored pass needs the write image and no SQL expression evaluates the formula plan: the reason 7034146638 gave, and it holds. main's own new read on these doors (readOrganizationUnits) is main's, outside this diff.
  • For the Tier H approver, carried from 7036724880 and unchanged: a calculated header column the caller IS served is computed under SYSTEM from inputs the caller may not be served (persona dave). The maintainer's speed-read on the PR names it, and review 6000183158 approves this head.

④ Design judgment

Each finding of the earlier records, read again in the tree at 6de555d92e:

  • M1 of 7034146638 (a { $field } comparand missed by summaryPatchCanMove): still closed. filterFieldNames calls addFieldReferents on every field key's value; a $field that names no field by a non-empty string answers "can move". having-filter.ts, the walker the fold shares, is unchanged by main, and the filter schema admits no new field-reading comparand.
  • M2 of 7034146638 (the preview judging on header columns the caller was not served): still closed. resolvePreviewParents returns servedColumns; validate hands overlayRow servedColumns[i] ?? new Set(); patchRow writes a moved roll-up or a computed dependent only onto a column that is in the row and in visible; movedOf moves a withheld roll-up from the stored parent, never from the empty column. main touched none of these lines.
  • S1 of 7034146638: still closed. Both fields.mdx paragraphs read as 7036724880 found them.
  • N1, N2, N4 of 7034146638: taken in the 34821 note, unchanged. N3: not taken, accepted as cost only.
  • The narrowing against the published rule (batch equals one-by-one, ruling 6377847361 C; 6928862195 B for the predicate door): holds. Tried against what main brought: a row refused by the new unit check mid-batch (not accepted, on either door); a predicate update carrying a fixed-read leaf (refused at the executor's entry, before the fold reads anything); a unit-code field as a roll-up's source (a summary takes no unitConfig, and the accumulator drops a value that is not a number, as before). None moves a verdict the earlier records gave.

DELIBERATE CORRECTION: confirmed on this head. .changeset/34465-predicate-update-parent-summary-rule.md differs from main by the one dropped parenthetical, "(a bulk create does not yet for a rule reading a parent field calculated from one: its accumulator moves the summary key alone, #34821)", which this PR makes false: the insert accumulator and its preview now compute a parent's calculated fields over the moved roll-ups. The sentence left, "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", is true at this head. "each matched row judges the summary as the rows judged before it leave it" holds for every roll-up the patch can move, and the 34821 note in the same release states the scope for one it cannot. Nothing main brought makes another sentence of that note false.

No must-fix, no should-fix.

N1 (nit) — carried from 7036724880, the tree being the same: fields.mdx, predicate door, the first of the "Four cases" lists a { $field } comparand but not the addDays offset the changeset and the code also count. One word.

N2 (nit) — The PR body says engine.ts "stays at 6853 lines". After the merge it is 6854, exactly the ceiling (maxLines: 6854). The gate is green on this head and the tree is right; the sentence is stale, and the file has no line to spare for whatever lands next.

Implemented-by: claude/issue-34821-rollup-fold-followups
Reviewed-by: session_01L9qibwJEh7hMPPvagWM1g7

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7

Re-arm · 2026-11-20T23:09Z · head 6de555d92e7bd3446cefd60d95144da1c7d93917

The merge group was refused at 2026-11-20T23:03Z by the Governed Surface Queue Guard's narrowing leg: no ## Contract review record named the current head. That record half is now met by the same-head CONTRACT_REVIEW_TIER record 7052838777: **VERDICT: PASS**, no must-fix and no should-fix, nits N1 and N2. The human half still stands: os-zhuang APPROVED this head, review 6000183158. The head has not moved. Auto-merge is re-armed.

@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 20, 2026
Merged via the queue into main with commit d17adf5 Nov 20, 2026
54 of 55 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-34821-rollup-fold-followups branch November 20, 2026 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue size/l tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

3 participants