Repository navigation
fix(objectql)!: a predicate update judges each matched row against the parent roll-ups the rows before it move - #34709
Conversation
…e parent roll-ups the rows before it move A rule reading a parent roll-up (one hop through a reference, or a field-level parent. predicate) now reads, for each row a multi: true update matches, the value consecutive by-id updates would have left: a base read in the database (every child as stored for count/sum/avg, the children outside the matched set for min/max), folded in memory with the matched rows judged before it. The batch is still judged in full before its one updateMany. Claude-Session: https://claude.ai/code/session_01ADHkmPgdzD1Rp6LuxSPNpk Co-authored-by: Claude <noreply@anthropic.com>
…judged before it move Claude-Session: https://claude.ai/code/session_01ADHkmPgdzD1Rp6LuxSPNpk Co-authored-by: Claude <noreply@anthropic.com>
…-tbysd1 Claude-Session: https://claude.ai/code/session_01ADHkmPgdzD1Rp6LuxSPNpk Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 7 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
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 944d1c0d4a46d57eca57ec634ef0b5e0072e875f && git checkout 944d1c0d4a46d57eca57ec634ef0b5e0072e875f
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin db1a05cdaeec179bdf327c1e357ac7bbc6b678b9 d19c04bb49e278843e9aceaacea198b9961440ae && git checkout -B drift-repro db1a05cdaeec179bdf327c1e357ac7bbc6b678b9 && git merge --no-ff d19c04bb49e278843e9aceaacea198b9961440ae
node scripts/docs-audit/affected-docs.mjs --json db1a05cdaeec179bdf327c1e357ac7bbc6b678b9
|
|
repo:objectstack#2 · os-steve · session_01ADHkmSLi1reMd27fT62jJ3 Final head · PR #34709 · 2026-11-17T08:40Z Final head for L1 and L2:
|
|
l2-review#4 · os-steve · session_01ADHkmP44onN8RMzsPMqjRq Contract-review-claim: session_01ADHkmP44onN8RMzsPMqjRq · head 13741cb · 2026-11-17T08:41Z |
|
repo:objectstack#2 · os-steve · session_01ADHkmTHGRTjPqZAcBuo9WH 席位核对L1 first review · ACCEPT · head Checklist (read on GitHub at this head, not from the report)
Before landing (body only, no head move)
Residuals (code-read, no change asked)
Owed after this
|
|
l2-review#4 · os-steve · session_01ADHkmP44onN8RMzsPMqjRq Contract reviewServed-tier: Inputs read: card #34465 body and all 7 comments (route ruling 6938087434, claim amendment 6938143680, dev reports 6938068056 and 6942048229); PR #34709 body, its 8 files, the net diff against merge-base 4107b3e; the 53 check-runs on the head. Rulings 6377847361 and 6928862195 were read as the card's ruling and the tree quote them (they sit on other cards, outside this brief's inputs). ① Derived judgmentsGate verdicts: 53 check-runs on the head, 38 success, 15 skipped, none failed, none pending. Check Changeset, Lint and Repo Gates, TypeScript Type Check, Test Core 1/8 to 8/8, Build Core, Build Docs: success. What moves, read in the code:
② Semver level
Clause-②: no (narrowing) — present in the PR body and the changeset, and correct: no published schema or governed path moves, and a previously written update is now refused.
ADR-0087 ③ Boundary flags
④ Design judgmentThe narrowing makes the spec's own refusal real:
Each falls back per whole descriptor, never per row, so no row reads a half-folded value, and none can refuse or admit differently than main for that roll-up. All three are stated on both prose faces. The first two are the insert door's published limits; none is graded above a nit here, and the question whether the ruling admits them is escalated in ③. S1 (should-fix) — A fourth stored-value case exists and no face declares it. The ruling scopes route A by the N1 (nit) — The changeset and N2 (nit) — Prose precision on the exceptions: the non-number and 5,000-row cases stand the roll-up down for every parent of that update, not only for the parent or row that met the case, and a filter the walker refuses stands down like a dotted path. The prose faces read as per parent and name only the dotted path. N3 (nit) — The fold replaces the stored value with a base aggregated from the children even for row 0 and even when the patch touches no foreign key, source field or filter field of the roll-up. An update that cannot move the roll-up could keep main's path and its zero cost; as written, a stale stored roll-up or a column-scale difference on N4 (nit) — None of the three stand-downs leaves a trace. One debug line naming the roll-up left unfolded would make the published limit observable. Follow-up card. Implemented-by: VERDICT: PASS |
…ed from a folded roll-up again A rule reading a formula or stored computed field of the parent calculated from a roll-up (remaining = budget - spent) now reads it over the folded value, as consecutive by-id updates would. Claude-Session: https://claude.ai/code/session_01ADHkmPgdzD1Rp6LuxSPNpk Co-authored-by: Claude <noreply@anthropic.com>
…-tbysd1 Claude-Session: https://claude.ai/code/session_01ADHkmPgdzD1Rp6LuxSPNpk Co-authored-by: Claude <noreply@anthropic.com>
…ated fields over Claude-Session: https://claude.ai/code/session_01ADHkmPgdzD1Rp6LuxSPNpk Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#2 · os-steve · session_01ADHkmSLi1reMd27fT62jJ3 Final head · PR #34709 · 2026-11-17T11:40Z Final head for the L1 and L2 deltas:
|
|
l2-review#4 · os-steve · session_01ADHkmP44onN8RMzsPMqjRq Contract-review-claim: session_01ADHkmP44onN8RMzsPMqjRq · head 18f3774 · 2026-11-17T11:41Z |
|
repo:objectstack#2 · os-steve · session_01ADHkmTHGRTjPqZAcBuo9WH 席位核对L1 delta · ACCEPT · head Delta (PR's own files;
|
|
l2-review#4 · os-steve · session_01ADHkmP44onN8RMzsPMqjRq Contract reviewServed-tier: The delta adds a system-context read of parent rows and resolves a formula permission map and one-hop related rows inside a write. Delta record over 6943284591 (VERDICT PASS on ① Derived judgmentsGate verdicts: 57 check-runs on the head, all completed: 40 success, 17 skipped, none failed, none pending. Check Changeset, Lint and Repo Gates, TypeScript Type Check, Type Check workspace, Test Core 1/8 to 8/8, Build Core, Build Docs, Dogfood Regression Gate and the query-options erasure lint: success. What the PR's own commits are: What moves in the delta, read in the code:
② Semver levelUnchanged from 6943284591 and still right: Clause-②: no (narrowing) — present in the PR body and the changeset, and correct: no published schema or governed path moves, and a previously written update can be refused.
ADR-0087 ③ Boundary flags
④ Design judgmentS1: closed The remedy is the first one: recompute on the overlaid row, no new exception. The six new pins are real. Read against the code: with the N1: closed The changeset states both directions with an example, the body states it in the risk line, and a test pins the reverse direction. N2: closed The changeset, S2 (should-fix) — The recompute is not evaluated in the context either reader it stands in for uses, so it is not what a by-id update would read when the calculated field depends on the reader. A by-id update's rule reads a parent formula through
N3 (nit) — Still open, left for follow-up #34821 as ordered: the fold replaces the stored value with a base aggregated from the children even for row 0 and when the patch cannot move the roll-up. The delta extends this to the calculated fields, which are recomputed from that base for row 0 too. N4 (nit) — Still open, left for follow-up #34821: none of the three stand-downs leaves a trace. The delta adds one more silent spot: N5 (nit) — The changeset's banner sentence now lists the calculated-field rule and continues "A bulk create and a bulk update already equal one-by-one writes for such a rule". For a bulk update that holds (the roll-ups recompute after each row). For a bulk create it does not for the newly listed rule: the insert accumulator overlays the roll-up key only (③). One clause: limit that sentence to the rules reading the summary itself, or name the insert limit. Implemented-by: VERDICT: PASS |
… the by-id rule reads them SYSTEM context for the parents' read, permission map, one-hop rows and labels; stored computed fields over the write's image with declared labels, then formulas over that row. Claude-Session: https://claude.ai/code/session_01ADHkmPgdzD1Rp6LuxSPNpk Co-authored-by: Claude <noreply@anthropic.com>
…alculated parent field Claude-Session: https://claude.ai/code/session_01ADHkmPgdzD1Rp6LuxSPNpk Co-authored-by: Claude <noreply@anthropic.com>
…-tbysd1 Claude-Session: https://claude.ai/code/session_01ADHkmPgdzD1Rp6LuxSPNpk Co-authored-by: Claude <noreply@anthropic.com>
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 44213369286 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
|
repo:objectstack#3 · os-support-ai · session_01WGufzfr1xZSFZzCR8HnqXX Hand-off · PR #34709 · card #34465 · 2026-11-18T03:26ZSeat 3 is handing over to the next PM. This PR is in the merge queue, and seat 3 keeps following it to merged and then closes the card. This comment is the record if that hand-off happens first.
|
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 44229490752 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
|
repo:objectstack#1 · os-warren · session_01JQwxbaX2qDxUq9sF93EqqL Queue read · PR #34709 · head Both ejections (runs 44213369286 and 44229490752) are one signature,
A third queue run with this head would meet the same plan, so the PR is not re-queued until the test is fixed: card #35110 (self-triaged p2, blocks this PR). Once #35110 merges, this seat re-queues the unchanged head (no code change here, so the L1-e ACCEPT 6963396892, contract review 6963489089 and seat record 6963524236 still stand). |
|
repo:objectstack#1 · os-warren · session_01JQwxbaX2qDxUq9sF93EqqL Re-queue · 2026-11-18T06:25Z. Both queue ejections (runs 44213369286 and 44229490752) had one signature, the Head |
Requested by Yibo Wang · project thread
Fixes #34465
Clause-②: no (narrowing)
Metadata-protocol: none
Skills-docs: none — skills/** teaches the per-row hook semantics of a predicate (
multi: true) write (skills/objectstack-data/references/data-hooks.md, lines 181 and 195) but says nothing on how a rule reads a parent summary during one维护者速读
update(..., { where, multi: true }),flow 的 update_record 节点multi: true)时,读父记录汇总的校验规则和明细字段的parent.条件,现在每一行读到的是「前面已判过的匹配行改完之后」的汇总,和逐条 by-id 更新的结果一致。count/sum/min/max/avg 都精确,换父也算;规则读的是父记录上建在汇总上的公式或存储计算字段(如remaining = budget - spent)时,也按叠加后的汇总重算;被重算的公式若还读一个与汇总无关的公式(如room = ceiling - total,ceiling = budget + extra),后者取父记录读出的存值,和逐条一致;存储计算字段像逐条写入那样算两遍,所以先声明的字段读到后声明字段的新值;每个父记录带一份「上一行重算写下的行」往下传,所以读自身存值的字段(如历史最高值)和逆声明顺序的三级链从第三行起也和逐条一致;汇总的filter以嵌套写法{ account: { status: 'x' } }读关联记录时,与点路径写法一样不叠加、读存值。packages/objectql/src/summary-batch-accumulation.ts(末尾新增loadPredicateUpdateSummaryBases与createPredicateUpdateSummaryFold)、packages/objectql/src/engine-update.ts(谓词分支校验循环)、packages/objectql/src/summary-rollup.test.ts(末尾 objectql: a predicate update (multi: true) resolves the parent once for the matched set, so a rule reading a parent roll-up does not answer as it does one by one #34465 一组)。pnpm --filter @objectstack/objectql exec vitest run --maxWorkers=2 src/summary-rollup.test.ts src/summary-batch-accumulation.test.ts,预期全过;summary-rollup.test.ts末尾两组 objectql: a predicate update (multi: true) resolves the parent once for the matched set, so a rule reading a parent roll-up does not answer as it does one by one #34465 共 30 条、summary-batch-accumulation.test.ts三组 objectql: a predicate update (multi: true) resolves the parent once for the matched set, so a rule reading a parent roll-up does not answer as it does one by one #34465 共 9 条,两文件合计 125 条全过;各轮修复各做一次消融:去掉「未重算公式取存值」1 条变红,嵌套写法退回只认点路径 2 条变红,存储计算只算一遍 1 条变红,不再逐行传父记录映像 3 条变红。check-governed-merges判定非受管;区在 L1 ACCEPT 与席位契约复审 PASS 之后落地)。What changes
A predicate update judges every matched row before its one
updateMany, against related rows (resolvePredicateRelated) and master-detail headers (resolveMasterDetailParents) read once for the batch, and recomputes the roll-ups once after it. So every row read a parent summary as it stood before the update. Measured onmainbefore this change: with "one primary line per invoice" (record.is_primary == true && record.inv.primaries > 0), two by-id updates admit the first line and refuse the second, but one predicate update admits both and leavesprimariesat 2.packages/objectql/src/summary-batch-accumulation.tsloadPredicateUpdateSummaryBases(engine, descriptors, matched, ctx)reads, per summary a rule reads and per chunk of parents, one grouped aggregate (groupBythe FK,ROLLUP_AGGREGATE_OPTIONon the FK, a system context like the recompute). The parents are those the matched rows name, as stored or as the update leaves them.count/sum/avg: every child as stored, the matched rows included.avgreads its sum and non-null count.min/max: the children outside the matched set (id $nin), since an extreme cannot be taken back out.createPredicateUpdateSummaryFold(bases, matched, childFields)folds the matched rows in memory. Before row k, rows 0..k-1 have left their stored contribution and taken the one the update gives them. It exposesoverlay(binding)andoverlayRow(object, header), the same two shapes as the insert arm, plusadvance(i). The summaryfilteris evaluated on each row state by the in-memory aggregation's own walker.formula, or a stored computed field (anexpressionon a field that is not a formula), directly or through another such field. A rule can read one of these instead of the roll-up (record.project.remaining, whereremaining = budget - spent).setDependentshands the fold what computes them, andfoldedSummaries()says which roll-ups and parents it moves.packages/objectql/src/engine-update.ts— in the predicate branch's per-row validation loop, when a rule reads a summary of this object and more than one row matched, it builds the fold. It then judges row i against the overlaid related binding and header (and the previous header), and advances.loadSummaryFoldDependentshandles the calculated fields the way a by-id update's rule reads the parent, that is, as SYSTEM (resolvePredicateRelatedreads related values under system authority). It reads the folded parents' stored rows once, at most 500 ids per read. It resolves the plan's permission map once over those rows, with the SYSTEM context's own permission resolution, and likewise its one-hop related rows and its option labels; none of these moves while the update is judged. The plan is the parent's stored computed fields and formulas that read a folded roll-up, closed transitively (storedExpressionsReading). Each overlay then computes them in two passes, as one by one computes them:nullhere, as it does on every write. This pass uses the DECLARED option labels, and it is evaluated TWICE, because a by-id write computes the stored fields before itsbeforeUpdatehooks, moves the changed values onto the patch, and computes them again before the statement. So a stored field declared BEFORE the stored field it reads (head_gap = record.headroom,headroomover the roll-up) is written over the moved value, and the fold reads it the same way. The pass also carries ONE IMAGE PER PARENT through the update: after each matched row is judged, the fold'sadvancetells the dependents every parent that row names (as stored and as left), which writes that parent's image again from the previous image, as the recompute writes each such parent after every child update. The next row reads that image. So a stored field that reads its own stored value (a high-water mark) or a chain of stored fields declared against their reading order holds at every row what one by one holds, not only at the second row. Row 0 still reads the write's image over the stored row (N3, follow-up objectql roll-up folding follow-ups: bulk insert reads stored formula fields built on a folded roll-up; update fold on non-moving patches; trace the stand-downs #34821).room = ceiling - total,ceiling = budget + extra) therefore reads it as the by-id rule's read does.Both passes use the read path's own
applyFormulaPlan. An object whose calculated fields read no folded roll-up reads nothing more. Validation still runs on every row before the one write: all-or-nothing is unchanged.packages/objectql/src/engine-summaries-and-expansion.tsandengine.ts—summaryDescriptorsReadByRules(childObject): the child's roll-up descriptors that some rule reads, from the cached feat(objectql): a bulk update recomputes its parents' roll-up summaries once, at the end of the batch #34439 analysis (summaryFieldsReadByRules, classes (i) and (ii)). It is wired through the facet host likesummaryForeignKeyColumns. Added to the claim's file surface by the area (comment 6938143680 on objectql: a predicate update (multi: true) resolves the parent once for the matched set, so a rule reading a parent roll-up does not answer as it does one by one #34465).content/docs/data-modeling/fields.mdx— one paragraph after the bulk-update one: a predicate update equals one-by-one updates, with its limits..changeset/34465-predicate-update-parent-summary-rule.md—patchon@objectstack/objectql, BREAKING, FROM → TO and the one-line fix, ADR-0087not-required (no-migration-prescription).Why
Ruling 6377847361 (C, 「批量等于逐条,并发不保证」, inserts) and ruling record 6928862195 (B, 「被规则读到的合计不延后」, updateMany). The record's out-of-card finding named this door: "No ruling covers it". The seat ruled it the third door of the same family, route A, on the card (6938087434). The SQL stays in the database (one grouped aggregate per summary read), the hook and event shapes do not move (route B would have split the write into N by-id updates), and no function is left with a partial answer (route C).
What narrows, named in the changeset: a predicate update that one-by-one updates would refuse a row of is now refused, with
VALIDATION_FAILED/ 400, and writes nothing. Not moved: a rule that reads no summary, a predicate update matching one row, a by-id update, hooks and flow steps (they read the value from before the update, as ruling record 6928862195 states), and a rule of the parent itself (class (iii): it judges the summary once, after the write; outside this card, as the card's options analysis says).Tests
packages/objectql/src/summary-rollup.test.ts— a new top-leveldescribe(objectql: a predicate update (multi: true) resolves the parent once for the matched set, so a rule reading a parent roll-up does not answer as it does one by one #34465) on the file's memory driver, where the roll-up recompute runs for real. A child carries five roll-ups that rules read (a filteredcount, acount,sum,min,avg). Its class (i) rules read them one hop, and its class (ii)requiredWhen: 'parent.line_count >= 3'reads one on the header.VALIDATION_FAILED/ 400, nothing written) for the filteredcount,sum,avg(a row outside the match included) andmin(a matched row holding the extreme takes it with it).note. A reparent under the line: all admitted.remaining) and one reading a STORED computed field (headroom) calculated from thetotalroll-up: the one-by-one reference, the predicate update refusing the second row, and under the line admitted.cap_left = record.cap_ref.amount - record.total), updated by a caller who cannot read the lookup's object (a read-scoping middleware): one by one refuses the second update, and a predicate update by the same caller is refused the same way, because the calculated field is computed under SYSTEM. A stored computed field reading a formula (slack = record.remaining): measured one by one it staysnullon every write, because a write's image carries no formula, so the rule admits both rows, and the predicate update admits both.room = record.ceiling - record.total,ceiling = record.budget + record.extra). One by one refuses the second update. The predicate update is refused the same way, and under the line it admits both.head_gap = record.headroom). One by one it tracksheadroomon every write (20, then -10) and the second update is refused; the predicate update is refused the same way.peakis the larger ofrecord.peakandrecord.total; totals 100 → 160 → 120, so the third line reads 160 and is refused, where a restart from the stored row reads 120 and admits) and three stored fields chained against declaration order (chain_xreadschain_y,chain_yreadschain_z,chain_zreadsrecord.total; the third line reads 150 and is refused, where a restart reads 120). The predicate update is refused the same way in both.describe(the fake driver declaresreadableIdsLeafand resolves the composed semi-join leaf): aminroll-up filtered in the nested form ({ acct: { status: 'active' } }) and a patch that moves no roll-up (tag). One by one reads the stored minimum (5) and refuses the first line; the predicate update reads it too and is refused, where the fold over the children outside the match (80) would have admitted both.$null: the engine widens a$ninto$or [x $null, x $nin], and the fake answeredtruefor any unknown operator.packages/objectql/src/summary-batch-accumulation.test.tscovers the fold and the loader on their own (including the nested form left out before any statement in three shapes, with an operator-only field condition as the control, and the fold telling the dependents, after each judged row, every parent that row names with the roll-ups it leaves): count/sum/avg over a base holding the matched rows, min/max over a base leaving them out, reparent and header, the three left-out cases, and the statements the loader sends. It also checks that the fold hands the folded values to the dependents hook and patches only the calculated fields the row carries.Ablation (
node scripts/ablation-replace.mjs, one mutation, taken on the fix commit before the branch was restarted onmain, so the blobs below are that commit'sengine-update.ts): thesummaryFold?.advance(i);line in theengine-update.tsvalidation loop was deleted (anchor x1 → x0, blob72635fb6ff22→79e693a8edb8). Every row then reads the base as stored. The suites import the engine from source, so no rebuild was needed. Result:Tests 5 failed | 97 passed (102).count,sum,avg,minand the reparent refusal.72635fb6ff22== HEAD,git diff HEADempty.Second ablation, for the calculated fields (at
06427b07):const computed = dependents?.(object, parentId, moved);was replaced withconst computed = undefined as …;(anchor x1 → x0, blob2e7d129120ed→7e274c71df8f). Result:Tests 3 failed | 105 passed (108).2e7d129120ed== HEAD,git diff HEADempty.Third and fourth ablations, for S2 (at
a7affccc), one mutation each,Tests 1 failed | 111 passed (112)each, restored blob == HEAD:resolveFormulaRelated(…, systemCtx)→(…, context): red is the caller/lookup refusal only.Fifth ablation, for L1 M1 (at
9e5bae05): the line putting the unplanned formulas back before the formula pass was deleted (anchor x1 → x0, blob726b7cceae20→93453eaaab6f). Run with-t 34465onsummary-rollup.test.ts:Tests 1 failed | 21 passed | 72 skipped (94).726b7cceae20== HEAD,git diff HEADempty.Sixth and seventh ablations, for L2 delta M2 and S3 (at
c14d8dd9), one mutation each, run over both files (Tests … (120)), restored blob == HEAD andgit diff HEADempty each:if (filterReadsThroughReference(desc.filter)) continue;→if (filterNamesDottedPath(desc.filter)) continue;in the loader (blob260317ab8f34→eac8b30b74dd):Tests 2 failed | 118 passed. Red, as predicted: the loader's nested-form pin and the M2 predicate-update refusal (the update admits). Green: the M2 one-by-one reference and every earlier pin.90d4a727eaf5→d741636a9bb9):Tests 1 failed | 119 passed. Red, as predicted: the S3 predicate-update refusal only. Green: the S3 one-by-one reference,slack,headroomand every earlier pin.Eighth ablation, for L2 delta S4 (at
d19c04bb): the fold'sadvancestopped telling the dependents (if (!dependents?.advance || !states) return;→return;, blob5078351317da→2f02052470ed):Tests 3 failed | 122 passed (125), restored blob5078351317da== HEAD andgit diff HEADempty.head_gap,slack,headroom, M1, M2 and every earlier pin.On the order of the two passes: L2's S2 asked for a stored field to compute after the formula it reads. That would compute a value one by one never stores: the reference pin measures a stored computed field reading a formula as
nullafter every by-id write. So the stored pass runs first, over the image without formulas, as the write does, and the formulas after, as the read does; the fourth ablation reds that pin.Where "exact" is not reached (the three stored-value exceptions)
Route A (seat ruling on the card, 6938087434) asks each matched row to read the roll-up exactly as consecutive by-id updates would. In three cases the fold cannot say that value exactly. The roll-up then keeps reading the stored value, the value every row read before this change, rather than a guessed one. This applies to that roll-up for EVERY parent the update reads it for, not only the parent whose row or base caused it, because the case is decided once per roll-up per update. Every other roll-up a rule reads, and every parent field calculated from one, is still folded. A rule reading a dropped roll-up answers as it did before this PR, so nothing here can admit a row that main refuses.
filterthat reads through a reference, as a dotted path ({ 'account.kind': 'x' }) or in the nested form ({ account: { status: 'x' } }, the form the summary-filter lint accepts for a relation head), or one the in-memory filter walker refuses. The loader leaves such a roll-up out before any statement runs (filterReadsThroughReference). Whether a matched row counts depends on a field of ANOTHER record, reached through a reference. The matched row in memory carries the foreign key but not that record, so the in-memory walker cannot tell whether the row's old or new state passes the filter. The same limit applies on the insert arm (Declarative "at most one row per parent where X" (conditional unique) — summary-based guards miss rows in the same bulk insert #25579). A filter the walker refuses (an operator it does not evaluate) cannot be judged in memory either, so it falls back the same way. Exact would need one extra read per hop, per row.sum/min/max/avgover a date, a text, or a decimal that the driver returns as a string, either in a matched row or in the base the database answers. Folding needs arithmetic and ordering on the values. Comparing a JS string with a database decimal or date would invent an order that the database does not use. The same limit applies on the insert arm.min/maxwhen any one parent holds more than 5,000 matched rows (MIN_MAX_EXCLUDED_ID_BUDGET). An extreme cannot be taken back out of an aggregate. So the base formin/maxleaves the matched rows out withid $nin (…). Parents are packed so that one statement names at most 500 parent ids and 5,000 excluded ids, far below SQLite's 32,766 and PostgreSQL's 65,535 bound parameters. One parent whose own matched set is larger than that cannot be excluded in one statement.count/sum/avghave no such limit: their base holds the matched rows as stored, and the fold subtracts each row's old part in memory, so no id list is sent.Pinned: cases 1 (both spellings; the nested form also end to end against its one-by-one reference in
summary-rollup.test.ts) and 3, and case 2 for a base that is not a number, insummary-batch-accumulation.test.ts(loadPredicateUpdateSummaryBases: a roll-up is left out). Case 2 for a matched value that is not a number is pinned in the same file (createPredicateUpdateSummaryFold: no fold). The user-facing docs state all three (content/docs/data-modeling/fields.mdx), and so does the changeset.Acceptance notes
mainafter fix(objectql)!: a multi-row insert counts its earlier rows into the parent summary a field-level parent. predicate reads #34612 merged (b91cefa).origin/mainwas merged again before the first runs (13741cb), and again for the L2 delta (f63c9e3). Both merges were clean.engine.ts. It merged at 10:36Z as6091b645, after this head's lastmainmerge.git merge-tree --write-treeof this head againstorigin/mainwith it (48a6c3e4) is clean.min/max, also per 5,000 excluded ids), before the write.readonlyWhenbulk strip are outside this card, as the card's options analysis says.a7affccc; at18f3774athey were kept. Measured before the fix on the merged head: the new predicate-update pin was red (the update admitted both rows) while its one-by-one reference refused. Pinned with the one-by-one reference, the predicate update and an under-the-line control; ablated once (fifth ablation above).origin/mainwas merged first (05241f49, clean). The full dogfood battery was run on the final head (Verification).9e5bae05): M2, amin/maxroll-up whose filter reads a related record in the nested form slipped past the dotted-path check and the in-memory walker answered "no match" without refusing, so it was folded over the children outside the match. The loader now leaves it out before any statement (filterReadsThroughReference), so it reads the stored value as the dotted form does, and the base aggregate that objectql: refuse a cross-object where up front with INVALID_FILTER / 400 on a driver that compiles no semi-join (MongoDB, OData) — ADR-0139 capability-bit amendment #33876 refuses on a driver withoutreadableIdsLeafis never sent for it. S3, fixed rather than stated: the fold evaluates the stored plan twice, as the by-id write does. The changeset andfields.mdxname the nested form; the S3 fix keeps their existing claim true. Both pinned with a one-by-one reference and ablated once each (sixth and seventh ablations). N6 (nit) is left to the follow-up card with N3 and N4. The insert arm's own dotted-path check (createBatchSummaryAccumulator) is unchanged: there a nested-form filter contributes nothing for every new row, which leaves the stored value, the same answer as leaving it out.c14d8dd9, contract review delta 6961415010 with S4): S4 was fixed by carrying one image per parent through the fold (the review's first remedy), not by stating it: the change is small (an optionaladvanceonSummaryDependents, called by the fold'sadvance, and an image map inloadSummaryFoldDependents), the same shape as the S3 fix. N7 (nit, trivial) is folded in:filterReadsThroughReferenceasksisNoOperatorObjecttoo, so an empty object beneath a field ({ acct: {} }) is left out like the nested form. The insert arm is untouched (its limit went to objectql roll-up folding follow-ups: bulk insert reads stored formula fields built on a folded roll-up; update fold on non-moving patches; trace the stand-downs #34821, comment 6961449942). N3, N4 and N6 stay on objectql roll-up folding follow-ups: bulk insert reads stored formula fields built on a folded roll-up; update fold on non-moving patches; trace the stand-downs #34821.Verification
All readings are on the final head
d19c04bb(d19c04bb49e278843e9aceaacea198b9961440ae: S4 and N7 overc14d8dd9).origin/mainwas not merged again:overlap-checkagainstorigin/maindb1a05cdand the PRs sharing files (#34978, #34817, #34799) readsVERDICT clean exit 0.Full dogfood battery
bash scripts/pm/os-verify-lock.sh -c "pnpm --filter '@objectstack/dogfood^...' build && pnpm --filter @objectstack/dogfood test"ond19c04bb(no shard, no path):Test Files 479 passed | 3 skipped (482),Tests 4072 passed | 68 skipped (4140),VERDICT command-exit 0. No failure.9e5bae05andc14d8dd9(same counts,VERDICT 0) no longer count for this head.Local runs
pnpm --filter @objectstack/objectql exec vitest run --maxWorkers=2ond19c04bb:Test Files 607 passed (607),Tests 13700 passed (13700).src/summary-rollup.test.ts+src/summary-batch-accumulation.test.tsond19c04bb:Tests 125 passed (125).pnpm --filter @objectstack/objectql typecheck: exit 0 (check:test-typecheckOK), on52e46807, the same commit before a one-string amend of a test rule's CEL condition (a null guard) that made itd19c04bb.node scripts/check-nul-bytes.mjs: exit 0.overlap-check:VERDICT clean exit 0(above).c14d8dd9(99 families: 98 run with exit 0, 1 NOT-MEASURED,check:type-check-debt, lock queue-timeout). This round's diff moves only objectql source and its two test files, all inside the earlier sweep's paths; the families are CI's on this head.d19c04bb: 55 completed, 40 success, 15 skipped, none failed.pnpm lintand the rest of the farm: CI.Human Minimum
packages/specholds no runtime logic. (packages/specnot touched)pnpm lintis CI's run (not run locally).main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed. (not touched)content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code