Skip to content

fix(objectql)!: a predicate update judges each matched row against the parent roll-ups the rows before it move - #34709

Merged
objectstack-fleet[bot] merged 13 commits into
mainfrom
claude/project-thread-tbysd1
Nov 18, 2026
Merged

objectstack-fleet[bot] merged 13 commits into
mainfrom
claude/project-thread-tbysd1

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

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' } } 读关联记录时,与点路径写法一样不叠加、读存值。
  • 为什么改:裁决 6377847361(C,插入)和 6928862195(B,updateMany)已定「批量等于逐条」,谓词更新是剩下唯一不守它的批量门;席位在卡上按路线 A 裁定(6938087434)。
  • 风险与回滚:收窄(BREAKING):今天能整批写进去的某些谓词更新会被整批拒收(只影响有规则读父汇总的子对象,hotcrm 与示例应用里没找到)。也有反方向:前面的行把汇总往放行方向推时,main 会拒的更新现在会放行,和逐条一致。没有这类规则、或只匹配一行时,零额外开销。三种情形读存值(下面单列一节)。回滚即撤回本 PR,无数据迁移。
  • 先看: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 on main before 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 leaves primaries at 2.

  • packages/objectql/src/summary-batch-accumulation.ts
    • loadPredicateUpdateSummaryBases(engine, descriptors, matched, ctx) reads, per summary a rule reads and per chunk of parents, one grouped aggregate (groupBy the FK, ROLLUP_AGGREGATE_OPTION on 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. avg reads 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 exposes overlay(binding) and overlayRow(object, header), the same two shapes as the insert arm, plus advance(i). The summary filter is evaluated on each row state by the in-memory aggregation's own walker.
    • The fold also patches the parent's fields that are calculated from a folded roll-up: a formula, or a stored computed field (an expression on 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, where remaining = budget - spent). setDependents hands the fold what computes them, and foldedSummaries() 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. loadSummaryFoldDependents handles the calculated fields the way a by-id update's rule reads the parent, that is, as SYSTEM (resolvePredicateRelated reads 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:
    1. The stored computed fields, as the recompute's write computes them: over the write's image, the stored row with the folded roll-ups and no formula fields. A stored field that reads a formula therefore computes null here, 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 its beforeUpdate hooks, 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, headroom over 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's advance tells 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).
    2. The formulas, as the next read computes them: over that row, with the stored row's values of the formulas the plan does not hold put back on it, and with the option labels the SYSTEM read uses. A formula outside the plan reads no folded roll-up, so it does not move while the update is judged, and the SYSTEM read of the stored parent already computed it. A planned formula reading one (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.ts and engine.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 like summaryForeignKeyColumns. 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 — patch on @objectstack/objectql, BREAKING, FROM → TO and the one-line fix, ADR-0087 not-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-level describe (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 filtered count, a count, 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.
    • The one-by-one reference answer.
    • A predicate update refused as one by one refuses its second row (VALIDATION_FAILED / 400, nothing written) for the filtered count, sum, avg (a row outside the match included) and min (a matched row holding the extreme takes it with it).
    • A reparent: three lines moving under a header of one land under 1, 2, then 3, and the third needs note. A reparent under the line: all admitted.
    • A predicate update matching one row reads the stored value.
    • A rule reading a FORMULA (remaining) and one reading a STORED computed field (headroom) calculated from the total roll-up: the one-by-one reference, the predicate update refusing the second row, and under the line admitted.
    • The other direction: a row main refused (it read the stored total, 120) is admitted, because the row before it lowers the total to 70, as one by one admits it.
    • S2, each with its one-by-one reference: a formula reading a lookup hop and the roll-up (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 stays null on every write, because a write's image carries no formula, so the rule admits both rows, and the predicate update admits both.
    • L1 M1, with its one-by-one reference: a formula over the roll-up that also reads a formula reading no roll-up (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.
    • L2 delta S3, with its one-by-one reference: a stored computed field declared before the stored computed field it reads (head_gap = record.headroom). One by one it tracks headroom on every write (20, then -10) and the second update is refused; the predicate update is refused the same way.
    • L2 delta S4, over three rows, each with its one-by-one reference: a high-water mark (peak is the larger of record.peak and record.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_x reads chain_y, chain_y reads chain_z, chain_z reads record.total; the third line reads 150 and is refused, where a restart reads 120). The predicate update is refused the same way in both.
    • L2 delta M2, in its own top-level describe (the fake driver declares readableIdsLeaf and resolves the composed semi-join leaf): a min roll-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.
    • CONTROL: an object whose rule reads no roll-up makes no aggregate read before its write, and admits as before.
    • The subject reads one grouped aggregate per roll-up a rule reads, before the write.
    • The file's fake driver learned $null: the engine widens a $nin to $or [x $null, x $nin], and the fake answered true for any unknown operator.
  • packages/objectql/src/summary-batch-accumulation.test.ts covers 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 on main, so the blobs below are that commit's engine-update.ts): the summaryFold?.advance(i); line in the engine-update.ts validation loop was deleted (anchor x1 → x0, blob 72635fb6ff22 → 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).

  • Red, as predicted: the filtered count, sum, avg, min and the reparent refusal.
  • Green, as predicted: one-by-one, single match, under the line, CONTROL, bases-read, and every unit pin.
  • Restore: blob 72635fb6ff22 == HEAD, git diff HEAD empty.

Second ablation, for the calculated fields (at 06427b07): const computed = dependents?.(object, parentId, moved); was replaced with const computed = undefined as …; (anchor x1 → x0, blob 2e7d129120ed → 7e274c71df8f). Result: Tests 3 failed | 105 passed (108).

  • Red, as predicted: the dependents unit pin, and the FORMULA and STORED computed refusals.
  • Green, as predicted: the one-by-one formula reference, under the line, the other direction, and every earlier pin.
  • Restore: blob 2e7d129120ed == HEAD, git diff HEAD empty.

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.
  • The line removing the formula fields from the write's image deleted: red is the stored-reads-formula pin only.

Fifth ablation, for L1 M1 (at 9e5bae05): the line putting the unplanned formulas back before the formula pass was deleted (anchor x1 → x0, blob 726b7cceae20 → 93453eaaab6f). Run with -t 34465 on summary-rollup.test.ts: Tests 1 failed | 21 passed | 72 skipped (94).

  • Red, as predicted: the M1 predicate-update refusal only (the update admits both rows).
  • Green, as predicted: the M1 one-by-one reference, its under-the-line control, and every earlier pin.
  • Restore: blob 726b7cceae20 == HEAD, git diff HEAD empty.

Sixth and seventh ablations, for L2 delta M2 and S3 (at c14d8dd9), one mutation each, run over both files (Tests … (120)), restored blob == HEAD and git diff HEAD empty each:

  • M2: if (filterReadsThroughReference(desc.filter)) continue; → if (filterNamesDottedPath(desc.filter)) continue; in the loader (blob 260317ab8f34 → 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.
  • S3: the overlay's pass bound 2 → 1 (one stored pass) (blob 90d4a727eaf5 → d741636a9bb9): Tests 1 failed | 119 passed. Red, as predicted: the S3 predicate-update refusal only. Green: the S3 one-by-one reference, slack, headroom and every earlier pin.

Eighth ablation, for L2 delta S4 (at d19c04bb): the fold's advance stopped telling the dependents (if (!dependents?.advance || !states) return; → return;, blob 5078351317da → 2f02052470ed): Tests 3 failed | 122 passed (125), restored blob 5078351317da == HEAD and git diff HEAD empty.

  • Red, as predicted: the fold unit pin for the parents advanced, and the S4 high-water-mark and chain predicate-update refusals (each an "expected the write to be refused": the update admits).
  • Green, as predicted: both S4 one-by-one references, S3's 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 null after 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.

  1. A summary filter that 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.
  2. A value that is not a finite number, in any matched row or any parent's base. This covers a sum / min / max / avg over 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.
  3. A min / max when 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 for min / max leaves the matched rows out with id $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 / avg have 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, in summary-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

Verification

All readings are on the final head d19c04bb (d19c04bb49e278843e9aceaacea198b9961440ae: S4 and N7 over c14d8dd9). origin/main was not merged again: overlap-check against origin/main db1a05cd and the PRs sharing files (#34978, #34817, #34799) reads VERDICT clean exit 0.

Full dogfood battery
  • bash scripts/pm/os-verify-lock.sh -c "pnpm --filter '@objectstack/dogfood^...' build && pnpm --filter @objectstack/dogfood test" on d19c04bb (no shard, no path): Test Files 479 passed | 3 skipped (482), Tests 4072 passed | 68 skipped (4140), VERDICT command-exit 0. No failure.
  • The earlier batteries on 9e5bae05 and c14d8dd9 (same counts, VERDICT 0) no longer count for this head.
Local runs
  • pnpm --filter @objectstack/objectql exec vitest run --maxWorkers=2 on d19c04bb: Test Files 607 passed (607), Tests 13700 passed (13700).
  • src/summary-rollup.test.ts + src/summary-batch-accumulation.test.ts on d19c04bb: Tests 125 passed (125).
  • pnpm --filter @objectstack/objectql typecheck: exit 0 (check:test-typecheck OK), on 52e46807, the same commit before a one-string amend of a test rule's CEL condition (a null guard) that made it d19c04bb.
  • node scripts/check-nul-bytes.mjs: exit 0. overlap-check: VERDICT clean exit 0 (above).
  • The full derived gate sweep was run on 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.
  • PR check-runs on d19c04bb: 55 completed, 40 success, 15 skipped, none failed.
  • pnpm lint and the rest of the farm: CI.

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic. (packages/spec not touched)
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint is CI's run (not run locally).
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: its generated artifacts are regenerated and committed. (not touched)
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

Generated by Claude Code

…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>
@github-actions github-actions Bot added size/l 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 17, 2026
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

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

7 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/automation/webhooks.mdx (via realtimeService (literal, a string literal in update))
  • content/docs/concepts/architecture.mdx (via getSchema (literal, a string literal in loadSummaryFoldDependents; a string literal in update))
  • content/docs/kernel/contracts/data-engine.mdx (via buildDriverOptions (literal, a string literal in update))
  • content/docs/kernel/runtime-services/examples.mdx (via buildHookApi (literal, a string literal in update))
  • content/docs/permissions/system-context.mdx (via assertReferencesResolve (literal, a string literal in update), buildDriverOptions (literal, a string literal in update), buildSession (literal, a string literal in update), encryptSecretFields (literal, a string literal in update))
  • content/docs/permissions/tenant-audit-census.mdx (via buildDriverOptions (literal, a string literal in update))
  • content/docs/protocol/kernel/realtime-protocol.mdx (via publishDataEvent (literal, a string literal in update))
What this run could not see
  • 1 anchor(s) matched too much of the corpus to be a work list: ObjectQL (symbol, 81 pages)
  • 10 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 db1a05cdaeec179bdf327c1e357ac7bbc6b678b9 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 944d1c0d4a46d57eca57ec634ef0b5e0072e875f — the merge of head d19c04bb49e278843e9aceaacea198b9961440ae into base db1a05cdaeec179bdf327c1e357ac7bbc6b678b9, 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 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

⚠️ 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 db1a05cdaeec179bdf327c1e357ac7bbc6b678b9 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmSLi1reMd27fT62jJ3

Final head · PR #34709 · 2026-11-17T08:40Z

Final head for L1 and L2: 13741cb992acd5ce1d3734c29870982ee3a1bf7a (main merged). Check-runs on this head: 53, of which 38 success and 15 skipped, none pending, none red.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

l2-review#4 · os-steve · session_01ADHkmP44onN8RMzsPMqjRq

Contract-review-claim: session_01ADHkmP44onN8RMzsPMqjRq · head 13741cb · 2026-11-17T08:41Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmTHGRTjPqZAcBuo9WH

席位核对

L1 first review · ACCEPT · head 13741cb992acd5ce1d3734c29870982ee3a1bf7a (final head 6943079743) · card #34465 · read 2026-11-17T08:43Z

Checklist (read on GitHub at this head, not from the report)

  • Shape: draft, base main, attribution lines first, then Fixes #34465, the only closing-keyword hit in the body. Route A as ruled on the card (6938087434, inheriting 6377847361 C and 6928862195 B). Title carries !.

  • Declarations: Clause-②: no (narrowing), Metadata-protocol: none in the body and the changeset. Narrowing confirmed from the diff: a predicate update that one-by-one updates would refuse a row of is now refused whole (VALIDATION_FAILED), and no key or export moves. @objectstack/objectql patch with **BREAKING**, FROM → TO, the one-line fix, and ADR-0087 not-required (no-migration-prescription).

  • File surface: 8 files from get_files. engine-summaries-and-expansion.ts and engine.ts were added by the area (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).

  • Mechanism, read in the source:

    • Loader: loadPredicateUpdateSummaryBases sends one grouped aggregate per read roll-up and chunk of parents, under { ...context, isSystem: true } like the recompute. The parents are those the matched rows name before or after the patch, packed to ≤ SUMMARY_GROUPED_AGGREGATE_CHUNK parent ids and, for min / max, ≤ 5,000 excluded ids per statement. count / sum / avg bases hold the matched rows as stored (avg reads sum plus a non-null count). min / max bases leave them out with id $nin. The where matches the recompute's (fkField $in and the roll-up filter), and the aggregate rides ROLLUP_AGGREGATE_OPTION on fkField as aggregateSummaryValues does. A dotted-path filter, a non-numeric answer, or an exclusion past the budget drops that roll-up from folding, so it reads the stored value as on main.
    • Fold: createPredicateUpdateSummaryFold keeps a per-parent bag. count / sum / avg start empty over a base that already holds the matched rows. min / max start with every matched row's stored value, over a base that excludes them. advance(i) takes row i's stored contribution out and puts its patched one in. Before row k is judged, rows 0..k−1 stand patched and rows k..n−1 stored, which is what the k-th consecutive by-id update reads. A reparent leaves one parent's bag and joins another's. The empty-set values follow summaryEmptySetValue. A filter the in-memory walker refuses, or a non-finite source value in any matched row, drops that roll-up.
    • Wiring (engine-update.ts): only when rulesNeedRows, more than one row matched, and summaryDescriptorsReadByRules(object) (the cached feat(objectql): a bulk update recomputes its parents' roll-up summaries once, at the end of the batch #34439 analysis, classes (i) and (ii)) is non-empty. priorRows come from driver.find(object, ast, …) with no field projection, then rowsWithDeclaredColumnsOnly, so the FK, source and filter fields the fold reads are present. The related binding, the header and the previous header are overlaid. The loop still judges every row before the one updateMany.
  • Tests and controls: 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 group, memory driver, real recompute) covers:

    • the one-by-one reference;
    • refusals for filtered count, sum, avg (a non-matched child included) and min (a matched row holding the extreme), each VALIDATION_FAILED / 400 with nothing written;
    • a three-line reparent refused on the third, and a reparent under the threshold admitted;
    • a single match reading the stored value;
    • CONTROL: no rule reads a roll-up ⇒ no aggregate read and admitted as before;
    • one grouped aggregate per read roll-up.

    summary-batch-accumulation.test.ts pins the fold and the loader, including the three left-out cases. The fake driver learning $null is named. Ablation (advance(i) deleted) turned 5 of 102 red, as predicted, and was restored to the HEAD blob.

  • Prose checked against the code: the changeset FROM / TO / "Not moved" and the new fields.mdx paragraph, including the three stored-value exceptions and "a rule of the parent itself judges the summary once, after the write". All match the loader's and the fold's stand-downs.

  • Gates at this head: check-runs on 13741cb9…: 53 runs, 38 success, 15 skipped, 0 failed. Lint & Repo Gates, TypeScript Type Check, Check Changeset and Dogfood Regression Gate are success. The full dogfood battery is pinned to this head in report 6942048229 (13741cb99, 478 passed | 3 skipped files, 4055 passed | 68 skipped tests, VERDICT command-exit 0). git merge-tree --write-tree against today's origin/main dc66d330 is clean, and against feat(objectql): refuse a nested-relation condition and a lookup dimension up front on a driver without the readableIdsLeaf capability #34565's head 779d1aa3 it is clean per the body.

Before landing (body only, no head move)

  • The Skills-docs: reason cites the wrong file. The verdict none is true: nothing under skills/** teaches how a rule reads a parent summary during a predicate update. But the per-row hook semantics of a multi: true write are taught in skills/objectstack-data/references/data-hooks.md (lines 181 and 195), not in objectstack-formula/SKILL.md, which has no multi: true text. Please correct the parenthetical.

Residuals (code-read, no change asked)

  • The fold derives its base from the children, while row 0 of a one-by-one run reads the stored summary. Where a stored roll-up is stale, the first matched row can read a different, more correct, value than one-by-one would.
  • sum / avg fold in JS floating point; a threshold sitting exactly on a decimal boundary could differ from the database's decimal arithmetic.

Owed after this

  • L2: owed, CONTRACT_REVIEW_TIER (declared narrowing; scope is the diff outside the prose faces).
  • Landing tier: narrowing, handed to the seat for Tier H (seat rule of 2026-11-17 04:14Z). check-governed-merges.mjs --pr 34709 read here: 0 of 8 paths governed, +722 / −7. No non-test packages/spec/src.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

l2-review#4 · os-steve · session_01ADHkmP44onN8RMzsPMqjRq

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 13741cb992acd5ce1d3734c29870982ee3a1bf7a
Local-runs: none
Scope: packages/objectql/src/engine-summaries-and-expansion.ts, packages/objectql/src/engine-update.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 + packages/objectql/src/summary-aggregate.ts, packages/objectql/src/summary-rule-reads.ts, packages/objectql/src/engine-master-detail-related.ts, packages/objectql/src/having-filter.ts, packages/drivers/driver-sql/src/sql-driver-filter-helpers.ts, content/docs/data-modeling/fields.mdx on main (cited code and published text, read, not reviewed)

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 judgments

Gate 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:

  • Door: only the predicate branch of UpdateFacet.update (update(object, patch, { where, multi: true }) and what reaches it, a flow update_record step with multi: true). By-id update, updateManyData / batchData, the insert doors, hooks and flow-step reads, and the recompute after the write are untouched.
  • Trigger: rulesNeedRows, more than one matched row, and summaryDescriptorsReadByRules(object) non-empty. A single matched row, or an object no rule reads a roll-up of, runs main's path with no extra statement. Right.
  • Stored parent summary values: none differ from main. The recompute after updateMany is not in the diff. What moves is the value a rule reads while row k is judged: count, sum, avg read base (every child as stored, one grouped aggregate) plus the in-memory delta of rows 0..k-1; min, max read base (children outside the matched ids) joined with the matched rows in their current state. On main every row read the stored value. Right, and it is what ruling 6938087434 asks.
  • Accepted on main, refused at head (VALIDATION_FAILED, nothing written): a predicate update where some row k after the first fails its rule against the roll-up as rows 0..k-1 leave it, for a filtered or plain count, sum, avg, min, max, a reparent included, read one hop through a reference (class i) or by requiredWhen on parent (class ii). Right.
  • Refused on main, accepted at head: the opposite direction exists and no prose face names it. When earlier matched rows move the roll-up away from the rule's line (rule record.kind == 'big' and parent total over 100; stored total 110; a small row of 80 judged first, patch sets amount 10), main refused the later row against 110, head judges it against 40 and admits, as one-by-one in that order does. Right by the ruling; the declaration narrowing is still the correct arm, since the breaking direction is the one a consumer must be told. See N1.
  • Row 0 no longer reads the stored summary but the base aggregated from the children. Equal when the stored roll-up is current; where it is stale, or where JS arithmetic differs from the stored column (an avg or sum stored at a column scale), row 0 can answer differently than a by-id update. Residual, see N3.
  • Order: rows are judged in the order the matched-row read returns them, with no declared order. For a rule that is not monotone in the roll-up the verdict depends on that order; one-by-one has the same property, under the caller's order. Right, not stated anywhere; no finding.
  • Public surface: no schema key, no export of the package index, no error code. MIN_MAX_EXCLUDED_ID_BUDGET, loadPredicateUpdateSummaryBases, createPredicateUpdateSummaryFold are module exports of an internal file; summaryDescriptorsReadByRules is private on ObjectQL. Right.
  • Loader against the recompute it must agree with (aggregateSummaryValues): same fkField $in plus filter where, same groupBy, same ROLLUP_AGGREGATE_OPTION, same { ...context, isSystem: true } context shape. avg is read as sum and a count under sourceField $ne null, which driver-sql lowers to IS NOT NULL. Right.
  • Fold: advance(i) removes row i's stored contribution and adds its patched one, per descriptor and per parent; the min/max bag is a multiset so an extreme can leave. Empty-set values follow summaryEmptySetValue. Matched rows come from the driver read through formatOutput, which presents declared booleans and numerics as JS values on every dialect, so a decimal column is a number in the matched rows. Right.

② Semver level

@objectstack/objectql: patch, title with !, BREAKING banner, FROM and TO, the one-line fix: right under AGENTS.md (a non-protocol change, widening or breaking, ships patch and keeps its banner and ADR-0087 disposition; Metadata-protocol: none takes patch).

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.

Metadata-protocol: none: accepted. Nothing an author can write is added, removed or re-read at authoring; the engine now honours an unchanged rule on one more door.

ADR-0087 not-required (no-migration-prescription): honest. No key, export, stored row or authored value changes shape, so there is nothing for a migration to rewrite.

③ Boundary flags

  • Deviation 1 (two files added to the surface): authorised by the claim amendment 6938143680. Answered.
  • Deviation 2 (the fake driver in summary-rollup.test.ts learned $null): test-only, and needed, since the fake answered true for an unknown operator and would have hidden the $nin exclusion. Answered.
  • Deviation 3 (ablation blobs name the commit before the restart): the ablation is not evidence on this head; the anchor line summaryFold?.advance(i); is present once at the head and the head's check-runs are the gate verdict. Answered.
  • open_questions (route to the L2 seat): answered by this record.
  • Out-of-scope findings (class iii, the bulk readonlyWhen strip): the ruling places both out of scope, and fields.mdx states class iii. Answered.
  • SQL push-down (Prime Directive 5): no finding. Every base is a grouped aggregate in the database, chunked at 500 parents. No new row or id read: the matched rows are the read main already makes whenever rulesNeedRows. The in-memory part folds states that are not written yet, which no SQL aggregate can see. The id $nin list for min / max is built from those rows, with the reason given in the docblock (an extreme cannot be subtracted).
  • Concurrency and atomicity: the base read, the judgement, the one updateMany and the recompute run in the same operation context as on main; the recompute placement is unchanged. Two concurrent predicate updates each read their base before the other writes and can both admit, exactly as both read the stored value on main: no new wrong state, and ruling 6377847361 leaves concurrency unguaranteed. All-or-nothing holds: every row is judged before the one statement.
  • Escalated to the Tier H approver: the ruling's letter says exact "for count, sum, min, max and avg alike" and carves nothing out. The PR ships three declared stored-value exceptions (④). Two are the published limits of the insert door of the same family; the third is new. The approver accepts them with the landing or cards a follow-up; this record does not accept them on the ruling owner's behalf.

④ Design judgment

The narrowing makes the spec's own refusal real: fields.mdx on main already publishes batch-equals-one-by-one for the bulk create and bulk update doors, and the rule an author declares is unchanged. No declared capability is taken away at the consumer. The three declared exceptions, read in the code:

  • Dotted-path filter: loadPredicateUpdateSummaryBases skips the descriptor before any statement (filterNamesDottedPath). A filter the in-memory walker throws on drops the descriptor in the fold. Result in both cases: no overlay, the rule reads the stored value as on main. No refusal, no recompute, no log.
  • Non-number: a base answer that is not a finite number (a numeric string is parsed and accepted, so the PR body's "decimal the driver returns as a string" is narrower in the code than in the body), or a matched row whose source value is not a JS number, drops the whole descriptor for every parent of the update. In practice this is min / max over a date or text field. Stored value as on main, silently.
  • More than 5,000 matched rows under one parent for min / max: fits = false drops the whole descriptor, for every parent of the update, not only the large one. Stored value as on main, silently. The threshold is the exported, documented constant MIN_MAX_EXCLUDED_ID_BUDGET, stated as 5,000 in the changeset and in fields.mdx; it is not configurable.

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 summaryFieldsReadByRules test, which is closed over computed fields: a rule reading record.project.remaining, where remaining is a formula or stored computed field over the roll-up, counts as reading the roll-up (summary-rule-reads.ts, and fields.mdx on main says so for the bulk update door). summaryDescriptorsReadByRules therefore returns that descriptor and the base aggregates are paid, but patchRow overwrites only desc.summaryField, and only when that key is in the bound row; the related row is projected to the columns the rule names (resolveOneHopRelated), so the computed field keeps the value calculated from the stored roll-up. Such a rule is judged as on main: the predicate update admits what one-by-one refuses, the silent bypass the ruling closes. The PR body's "every other roll-up a rule reads is still folded" is false for it, and the new fields.mdx paragraph ("equals one-by-one updates too") follows a paragraph telling the reader that a computed field over a summary reads the summary. No test pins the case. Fix either way: recompute the dependent computed fields on the overlaid row, or name the case beside the other three in the changeset and fields.mdx (and skip the base read for it).

N1 (nit) — The changeset and fields.mdx describe only the refused direction. A predicate update main refused can now be admitted (①). One clause on the prose faces.

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 avg / sum can make such an update answer differently than its by-id form. Follow-up card, not this head.

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: claude/project-thread-tbysd1
Reviewed-by: session_01ADHkmP44onN8RMzsPMqjRq

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>
…ated fields over

Claude-Session: https://claude.ai/code/session_01ADHkmPgdzD1Rp6LuxSPNpk
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmSLi1reMd27fT62jJ3

Final head · PR #34709 · 2026-11-17T11:40Z

Final head for the L1 and L2 deltas: 18f3774a7b4016f5bd2ffdc761de6d6d4f1494d7, over 13741cb9 (L1 6943145716, L2 6943284591). Check-runs on this head: 57, of which 40 success and 17 skipped, none pending, none red.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

l2-review#4 · os-steve · session_01ADHkmP44onN8RMzsPMqjRq

Contract-review-claim: session_01ADHkmP44onN8RMzsPMqjRq · head 18f3774 · 2026-11-17T11:41Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmTHGRTjPqZAcBuo9WH

席位核对

L1 delta · ACCEPT · head 18f3774a7b4016f5bd2ffdc761de6d6d4f1494d7 over 13741cb9 (my L1 6943145716; final head 6947008048) · card #34465 · read 2026-11-17T11:42Z

Delta (PR's own files; main moved none of them between the two merge bases)

Six files, +211/−17.

L2 S1, fixed by recomputing. loadSummaryFoldDependents in engine-update.ts runs only when a fold exists. For each parent object the fold moves, it does the following.

In summary-batch-accumulation.ts:

  • patchRow now collects every folded value of the object's parent, not only the summary keys present in the bound row.
  • It hands those values to the dependents callback, and patches only the fields the bound row carries, so the projection the rule asked for is unchanged.
  • An object with no such field reads nothing extra.

There is no new exception. The PR body no longer claims "every other roll-up a rule reads is still folded" without this case.

Tests. summary-rollup.test.ts adds:

  • the one-by-one reference for a formula over the roll-up;
  • a refusal for the formula case;
  • a refusal for the stored computed field case;
  • an under-the-line admit;
  • the reverse direction (N1): a row main refused, admitted when the row before it moves the total under the cap.

summary-batch-accumulation.test.ts pins the callback. The ablation turned 3 cases red, and the code was restored.

N1. The changeset now says the answer moves both ways and gives an example. fields.mdx states the rule as "read it as the matched rows judged before leave it", which covers both directions by construction. I accept that as answering N1 on that face.

N2. The three stand-downs are now written out for every parent the update reads that summary for. They include a filter the in-memory walker refuses. This matches the loader.

The as any → typed write is the query-options-erasure gate's ask and changes no behaviour.

Re-read at this head

Before landing (body only, no head move)

  • The Skills-docs: reason regressed. The body's line 8 cites objectstack-formula SKILL.md again. o2-E corrected that at 08:44Z to skills/objectstack-data/references/data-hooks.md (lines 181 and 195), and the developer's body update overwrote it. The verdict none still holds. Please restore the correct citation and read the body back.

Owed after this

  • L2: the delta at this head (CONTRACT_REVIEW_TIER, the declared narrowing).
  • Landing tier: narrowing, handed to the seat for Tier H.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

l2-review#4 · os-steve · session_01ADHkmP44onN8RMzsPMqjRq

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 18f3774a7b4016f5bd2ffdc761de6d6d4f1494d7
Local-runs: none
Scope: packages/objectql/src/engine-summaries-and-expansion.ts, packages/objectql/src/engine-update.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/34465-predicate-update-parent-summary-rule.md, content/docs/data-modeling/fields.mdx (the prose the delta rewrote, read against the code), packages/objectql/src/engine-top-level.ts, packages/objectql/src/engine-master-detail-related.ts, packages/objectql/src/engine-security-resolvers.ts, packages/objectql/src/engine-readable-ids-permission-formula.ts, packages/objectql/src/engine-find.ts, packages/objectql/src/summary-aggregate.ts, packages/objectql/src/summary-rule-reads.ts (cited code, read, not reviewed)
Security-touching: yes

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 13741cb992acd5ce1d3734c29870982ee3a1bf7a, S1 open, N1 to N4). Inputs read: that record, the lane's final-head note 6947008048, the L1 delta 6947051355, the PR body at this head, card #34465 with all 8 comments (route ruling 6938087434, dev reports 6942048229 and 6946193985), the two delta diffs, whole files at the head, and the 57 check-runs on the head.

① Derived judgments

Gate 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: 06427b074 (parent 13741cb99, six files, +211 / -17) and 18f3774a7 (parent f63c9e3ea, one line: the as any on the parents read is removed, no behaviour). The merge f63c9e3ea (parents 06427b074 and main at dc66d3308) changed none of the PR's eight files: the diff 06427b074..f63c9e3ea over those paths is empty. What main brought is not reviewed. Main has moved again since (the head is not merged with it); GitHub reports the PR mergeable.

What moves in the delta, read in the code:

  • createPredicateUpdateSummaryFold.patchRow now collects every folded roll-up value of the parent (whether or not the bound row carries that key), patches the roll-up keys the row carries, hands the collected values to a dependents callback, and patches the returned fields the row carries. A field the binding or header does not carry is never added. Right: the projection the rule asked for is unchanged.
  • loadSummaryFoldDependents (engine-update.ts) runs once, before the per-row loop, only when a fold exists. Per parent object the fold moves: plan = storedExpressionsReading([...planStoredExpressions(schema), ...planFormulaProjection(schema, undefined).plan], foldedFields); empty plan or no parent id reads nothing; otherwise the parents are read by id in chunks of 500 through the engine find under { ...context, isSystem: true }, and the plan's permission map, one-hop related rows and option labels are resolved once over those rows. The callback evaluates applyFormulaPlan over { ...stored, ...moved }, synchronously, with no statement.
  • Once per parent, not per child: confirmed. The read sits outside the row loop; each overlay is an in-memory evaluation of the filtered plan.
  • A parent with no field calculated from a folded roll-up: plan.length === 0, no read. An object no rule reads a roll-up of, or a single matched row: no fold, so the function is never called. Cost unchanged for both. Right.
  • Same plan: the entries are built by the read path's own builders (formulaPlanEntry), the reader set is closed transitively, and formulas keep the order orderFormulaPlan gives them, so a formula reading another formula built on the roll-up is evaluated after it. A formula the plan does not hold (it reads no folded roll-up) is taken from the stored row, where the system find already computed it, which is what the rule's own read would hold. Right for formula over formula, and for a formula over a stored computed field (stored entries come first). Not right for a stored computed field over a formula built on the roll-up: see S2, second point.
  • Same inputs: the stored row is the system read's row, which is the authority the rule's own related read uses (resolveOneHopRelated, authority predicate, reads the named columns as system). Right.
  • Same context: no. See S2.
  • Which calls answer differently than at the reviewed head: a predicate update matching more than one row, on a child whose rule reads (one hop, or on parent in a requiredWhen) a formula or stored computed field of the parent built on a count, sum, avg, min or max roll-up of that child. At the reviewed head such a rule read the value calculated from the stored roll-up for every row; at this head row k reads it calculated over the roll-up as rows 0..k-1 leave it. Both directions follow: a row that was admitted is refused (VALIDATION_FAILED, nothing written), and a row that was refused is admitted when the earlier rows move the roll-up toward admitting it. Stored parent values still do not differ from main: the recompute after updateMany is untouched.
  • Public surface: SummaryDependents, foldedSummaries and setDependents are additions to an internal module; no schema key, package export or error code moves.

② Semver level

Unchanged from 6943284591 and still right: @objectstack/objectql: patch, title with !, BREAKING banner, FROM and TO, the one-line fix. The delta widens the set of rules the narrowing reaches (a rule reading a calculated field) and the changeset's banner now names that set.

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.

Metadata-protocol: none: accepted, nothing authorable moves.

ADR-0087 not-required (no-migration-prescription): honest, as before; the delta changes no key, export, stored row or authored value.

③ Boundary flags

  • Dev deviation (the head is not merged with the main commit that carries feat(objectql): refuse a nested-relation condition and a lookup dimension up front on a driver without the readableIdsLeaf capability #34565): the gate verdicts above are on this head; the merge is the landing seat's step. Answered.
  • Dev deviation (relay signed line on the body): no effect on the tree. Answered.
  • open_questions (route the delta to L1 and the L2 seat): answered by 6947051355 and this record.
  • Out-of-card finding (the batch-insert accumulator): confirmed from the code. createBatchSummaryAccumulator.patchRow skips a descriptor unless desc.summaryField in row and writes that key only; it has no dependents step. A rule reading a parent formula or stored computed field built on a roll-up therefore reads the value calculated from the stored roll-up for every row of a multi-row insert. Same shape as S1, on the insert door, outside this card: a finding card for the seat (the body names 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). One sentence of this PR's own changeset does claim that door: see N5.
  • L1 note (the Skills-docs: reason cites the wrong skill file again): body only, verdict none unaffected; for the lane before landing.
  • SQL push-down (Prime Directive 5): no finding. The new read is a keyed id $in read of the parents the fold moves, 500 per statement, and its rows are the input of a CEL evaluation over values that are not written yet, which no SQL expression can see; the reason is given in the function's docblock. No child id or child row is materialised by the delta, and nothing is joined in memory that a statement could join. The whole parent row is read (no projection) for every parent of the update; bounded by the number of parents, as the base aggregates are.
  • Leak check on the system read: the stored row and the scratch row never leave the callback. Only the plan's own fields are returned, and only those the bound row already carries are written. The bound row was produced by the rule's own read, which is itself a system read of exactly those columns behind the caller's read doors, so the delta puts no value in front of a rule that the rule's own read did not already put there, and nothing reaches a response or a refusal text that did not before. A parent the caller's door does not return has no bound row and is not patched. No leak found.
  • Concurrency and atomicity: unchanged from 6943284591. The parents read rides the update's own context, so its transaction handle; it happens before the one statement.
  • Escalated to the Tier H approver, carried from 6943284591: the three declared stored-value exceptions against the ruling's letter. The delta adds no exception.

④ Design judgment

S1: 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 dependents call ablated, the FORMULA refusal, the STORED refusal and the unit pin can only read the value calculated from the stored total (20) and admit, so three red is what the code predicts; the one-by-one reference, the under-the-line case and the reverse-direction case do not depend on the call. The STORED pin also asserts the stored column is unchanged after the refusal. None of the pins exercises a calculated field that reads a lookup, calls label() or can(), or a stored computed field over a formula.

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. fields.mdx covers it by its wording (the summary as the rows judged before leave it), which is true in both directions.

N2: closed

The changeset, fields.mdx and the body now say each stand-down covers that summary for every parent the update reads it for, and name the walker-refused filter. This matches the loader and the fold.

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 resolveOneHopRelated with authority predicate: a find under { ...context, isSystem: true }, so the formula's permission map, its one-hop related rows and its option labels are all resolved under that system context. A stored computed field is written by the recompute's parent update, also under the system context, with the declared option labels (declaredOptionLabels), never the reader's locale. loadSummaryFoldDependents builds systemCtx and uses it for the row read only; resolveFormulaPermissions, resolveFormulaRelated, formulaOptionLabels and applyFormulaPlan are all handed the caller's own context and the write's own permissionResolution. Consequences, each only for a calculated field built on a folded roll-up:

  • a field that also reads a lookup (record.account.credit_limit - record.total): the hop is read as the caller. A caller who may not read that related row or column gets null for the field on every matched row, row 0 included, where main, a single-row match and a by-id update all read the system value. The rule is then judged on null instead of the number.
  • a field that calls can(): answered from the caller's map where the rule's own read asks under the system context.
  • a stored computed field that calls label(): computed with the reader's locale labels where the stored value uses the declared ones.
  • plan order: the combined plan lists every stored computed field before every formula, so a stored computed field that reads a formula built on the roll-up is evaluated before that formula is recomputed and keeps the stored-roll-up value (whether the write path serves that shape at all was not confirmed here; if it does not, state it).
    The direction is safe for disclosure (the caller's context is the narrower one), but it is a new divergence from one-by-one that this delta introduces, and the docblock's "the read path's own" does not hold for the rule's read path. Fix: resolve and evaluate under the systemCtx the function already builds (and a resolution minted for it), use the declared labels for the stored entries, order stored entries after the formulas they read, and pin a field that reads a lookup; or state the caller-context choice and its effect in the docblock and the prose faces.

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: applyFormulaPlan is called with no fault sink, so a calculated field that does not evaluate in the fold reads null without a report.

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: claude/project-thread-tbysd1
Reviewed-by: session_01ADHkmP44onN8RMzsPMqjRq

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>
@os-zhuang
os-zhuang marked this pull request as ready for review November 18, 2026 01:06
@os-zhuang
os-zhuang enabled auto-merge November 18, 2026 01:06
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 18, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 44213369286 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

分类:failure —— 按下面的日志分诊。

失败的 job(日志抽取,best effort):

  • Test Core (7/10) — 失败步骤: Run this shard's tests

    @objectstack/scenarios:test:  FAIL  test/skill-evals/skill-evals.test.ts > --regrade grades an old answer only against the case that ran > the command: a reworded case keeps its record bytes and leave
      ↳ 失败原因: @objectstack/scenarios:test: Error: Test timed out in 5000ms.
    

↳ 失败原因 是判读的关键:超时(Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言(AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️ 断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError。 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

  • test/skill-evals/skill-evals.test.ts — 24h 窗口内只有本 PR 撞到过,暂不汇总(再有一个不同 PR 撞到就会自动开汇总 issue)。
  • ⚠️ 24h 评论账本没读完(超过 5 页仍未读到窗口尽头),所以上面的「不同 PR 数」是下界,不是全量。

历史信号:

  • 本 PR 过去 24h 无队列失败记录(首次)。
  • 过去 24h 队列共有 18 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzfr1xZSFZzCR8HnqXX

Hand-off · PR #34709 · card #34465 · 2026-11-18T03:26Z

Seat 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.

@github-actions

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 44229490752 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

分类:failure —— 按下面的日志分诊。

失败的 job(日志抽取,best effort):

  • Test Core (7/10) — 失败步骤: Run this shard's tests

    @objectstack/scenarios:test:  FAIL  test/skill-evals/skill-evals.test.ts > --regrade grades an old answer only against the case that ran > the command: a reworded case keeps its record bytes and leave
      ↳ 失败原因: @objectstack/scenarios:test: Error: Test timed out in 5000ms.
    

↳ 失败原因 是判读的关键:超时(Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言(AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️ 断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError。 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

  • test/skill-evals/skill-evals.test.ts — 24h 窗口内只有本 PR 撞到过,暂不汇总(再有一个不同 PR 撞到就会自动开汇总 issue)。
  • ⚠️ 24h 评论账本没读完(超过 5 页仍未读到窗口尽头),所以上面的「不同 PR 数」是下界,不是全量。

历史信号:

  • ⚠️ 本 PR 过去 24h 已在队列失败 1 次(不含本次)。 内容未变而反复失败 ⇒ 高度怀疑 flaky 测试或与同组 PR 的语义冲突,重排不解决。
  • 过去 24h 队列共有 18 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbaX2qDxUq9sF93EqqL

Queue read · PR #34709 · head d19c04bb49e · 2026-11-18T04:04Z

Both ejections (runs 44213369286 and 44229490752) are one signature, packages/qa/scenarios/test/skill-evals/skill-evals.test.ts:362 "Test timed out in 5000ms", and they are deterministic for this PR rather than chance:

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).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbaX2qDxUq9sF93EqqL

Re-queue · 2026-11-18T06:25Z. Both queue ejections (runs 44213369286 and 44229490752) had one signature, the skill-evals.test.ts:362 5 s timeout, in a package this PR does not touch (diagnosis 6968687387). That flake is fixed by #35121, merged as 815f43fa67326c4cd9e177e9a08e1aaa14804208, and its card #35110 is closed. The 18.6.0 freeze is lifted (seat comment 6970550718), and seat 1 gave the go to re-queue this PR.

Head d19c04bb49e278843e9aceaacea198b9961440ae is unchanged since L1 ACCEPT 6963396892, L2 PASS 6963489089, the seat record 6963524236 and the battery 6963351884. The maintainer's approver account readied it and queued it at 2026-11-18T01:07Z, and that human action is the record on the three exceptions. Check-runs on the head: 44 success, 21 skipped, 0 failed. mergeable_state clean. pm:awaiting-merge is removed in this stroke, and auto-merge is armed.

@objectstack-fleet objectstack-fleet Bot removed the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 18, 2026
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 18, 2026
Merged via the queue into main with commit 94a2d8b Nov 18, 2026
68 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-tbysd1 branch November 18, 2026 06:52
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 size/xl tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants