Repository navigation
fix(objectql): compute on stored rows the roll-ups a package install or upgrade adds - #34282
Conversation
…lue on pre-upgrade rows Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUg7BKfRBcTPyMxbLh
…or upgrade adds Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUg7BKfRBcTPyMxbLh
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUg7BKfRBcTPyMxbLh
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUg7BKfRBcTPyMxbLh
…ummary-nulls is still owed Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUg7BKfRBcTPyMxbLh
📓 Docs Drift CheckThis PR changes 1 package(s): 4 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 bd91a12740a08bb74b3be615774fa130bbe87c2b && git checkout bd91a12740a08bb74b3be615774fa130bbe87c2b
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 951eceeeec8803029966ac15c18f387d434b976f 7c933a0e63da117789434457bc73a63fde359e92 && git checkout -B drift-repro 951eceeeec8803029966ac15c18f387d434b976f && git merge --no-ff 7c933a0e63da117789434457bc73a63fde359e92
node scripts/docs-audit/affected-docs.mjs --json 951eceeeec8803029966ac15c18f387d434b976f
|
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUg7BKfRBcTPyMxbLh
|
domain:server#5 · zhuangjianguo · session_01QsR2jUg7BKfRBcTPyMxbLh Request: review · PR #34282 · area S2 (A4) · Fixes #34096 · head
|
|
domain:server#5 · zhuangjianguo · session_01QsR2jTyY9BGjj9WBi7QgH6 Contract reviewServed-tier: This record is owed by the ① Derived judgments
② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS |
|
domain:server#5 · zhuangjianguo · session_01QsR2jTyY9BGjj9WBi7QgH6 Review — FAILHead-sha: S1 (should-fix): the install-door walk fires every parent's record-change automation, while the same door's own writes suppress it
The body's parity argument ("as the child-write recompute does") does not hold for this door:
So the parity that matters here is the door's own convention, and the walk breaks it. Either of these clears S1:
Read and found right
Noted, not owed
Check-runs on the head: 38 success, 15 skipped, none failed. |
…tions off The parent write carries skipAutomations, as the install door's own seed writes do, through a new opt-in skipAutomations option on backfillSummaryNulls; os migrate summary-nulls is unchanged. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUg7BKfRBcTPyMxbLh
|
review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW Contract-review-claim: session_01L9qibxTeW8xHnxoHxWNHWW · head c6ff87c · 2026-11-16T07:03Z |
|
review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW Contract reviewServed-tier: Read at 2026-11-16T07:08Z. Delta review of this head against PASS 6907485457 at e3a4385 (by the lane's own reviewer); claim: comment 6909795221; no lane request (owed per check-owed-reviews). Independence: implemented in a project thread for domain:server#5 (zhuangjianguo); reviewed by os-tesla, who neither dispatched nor implemented it. The record is owed by the Prior ids. Record 6907485457 grades no finding (no M, S or N id), so there is no id to continue. Its unnumbered points, each re-read on this head:
① Derived judgments
② Semver level
③ Boundary flags
④ Design judgmentThe declaration face carries no ④ of its own; this is the delta's one design choice, read against the code it cites.
No must-fix, no should-fix.
Implemented-by: VERDICT: PASS |
|
domain:server#5 · zhuangjianguo · session_01QsR2jTyY9BGjj9WBi7QgH6 Review — PASSHead-sha:
The patch-id is |
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jUg7BKfRBcTPyMxbLh
|
domain:server#5 · zhuangjianguo · session_01QsR2jUg7BKfRBcTPyMxbLh 席位核对Head-sha:
|
|
review#1 · os-mickey · session_01ASNY8Ywba8ySbMdWvra2vS Contract-review-claim: session_01ASNY8Ywba8ySbMdWvra2vS · head 7c933a0 · 2026-11-16T08:27Z |
|
review#1 · os-mickey · session_01ASNY8Ywba8ySbMdWvra2vS Contract reviewServed-tier: Delta review of this head against PASS 6909874303 at ① Derived judgments
② Semver levelUnchanged from record 6909874303: the changeset and the ③ Boundary flags
Implemented-by: VERDICT: PASS |
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 43829036933 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
|
domain:server#5 · zhuangjianguo · session_01QsR2jUg7BKfRBcTPyMxbLh Re-arm at |
Requested by Steedos · project thread
Fixes #34096
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
syncSchemas)现在会在已有记录上计算升级新增的汇总(roll-up)字段,只补仍为 NULL 的行。skipAutomations,与安装门自己的种子写入一致,不触发父对象的元数据钩子和记录变更流程,但上一层汇总照常重算。失败按 error 记日志并在下次安装时重试。回滚即回退本 PR,已写入的值本就是引擎自己会写的值。packages/objectql/src/summary-install-materialise.ts(新增字段判定与失败处理)、engine-compatibility-api.ts的syncSchemas末尾、plugin.ts的kernel:bootstrapped封存。pnpm --filter @objectstack/objectql exec vitest run --project local src/engine-34096-upgrade-added-summary-materialise.test.ts,预期 10/10 通过。os migrate summary-nulls补"这一边界可接受。What changes
packages/objectql/src/summary-install-materialise.ts. When the boot completes, the engine records the roll-ups it serves (ObjectQLPlugincallsObjectQL.sealSummariesMaterialisedAtBoot()atkernel:bootstrapped, after the install-local rehydrate atkernel:ready). Later,ObjectQL.materialiseAddedSummaries()walks only the roll-ups served now that are not recorded. It fills them through the existingbackfillSummaryNullsand records them once the walk is complete.ObjectQL.syncSchemas()runs it last. That is the sync every runtime install door asks for after its hot register;MarketplaceInstallLocalis the measured door. A sync before the boot completes walks nothing, and that includes the rehydrate's sync.aggregateSummaryValue, the child-write recompute's aggregate, and the parentupdatewith{ isSystem: true, skipAutomations: true }and no tenant, so it covers every organization's rows.skipAutomationsmatches the install door's own seed writes (SEED_OWNER_STAMP_CTX, the seed-loader rule: end-state data, not user events), so no metadata-bound hook or record-change flow runs on a backfilled parent. The engine's roll-up recompute is not an automation and still runs, so a roll-up over a backfilled parent moves too. The walk writes no child row. Pages are keyset pages of 500, bounded per object at 100,000. Only rows stillNULLare written, so the walk is idempotent.skipAutomationsonSummaryBackfillOptions. Onlysummary-install-materialise.tssets it. Without it, the write context is the bare{ isSystem: true }it always was, soos migrate summary-nullsis unchanged and still runs those automations at the time the operator picks.recomputeUndefinedOnEmpty. The door knows these columns are new, so newmin/max/avgcolumns are computed too.0forcount/sumandnullformin/max/avg. A pre-existing row and a new row read the same.erroronce, with the consequence and the exactos migrate summary-nulls --apply --recompute-undefined-on-empty OBJECT.FIELDline. It does not record those roll-ups, so the next install's sync in the same process walks them again and fills only what is stillNULL.GROUP BYand formulas would still readNULL, and every list read would pay an aggregate per row. The install door is the one moment that knows the column is new and has just created it.content/docs/deployment/cli.mdx(os migrate summary-nulls) says when an install does this and when the command is still owed.@objectstack/objectqlpatch.Tests
New
packages/objectql/src/engine-34096-upgrade-added-summary-materialise.test.ts, 10 cases:sum/count/maxroll-ups throughobjectExtensionsover existing parents and children. Every parent reads the computed value, and no child row is written. A parent with no children reads0/0/null.isSystemwith notenantId, and no hook of the child object fires.error, naming the roll-up and the command. The next sync rewrites only that row.ObjectKernelboot withObjectQLPluginseals atkernel:bootstrapped, then the upgrade fills.skipAutomations: true, and a metadata-bound parent update hook (bound throughbindHooks) does not fire.invoiced_amountreads 40000 after the walk.backfillSummaryNullswith no option) writes withoutskipAutomations, and the bound hook fires as before.Red first, green on the fix, objectql full suite
Tests 4 failed | 2 passed (6),AssertionError: expected null to be 700. The two that pass there are the "runs nothing" pins, which nothing on main can violate.Test Files 1 passed (1),Tests 7 passed (7). The file now holds 10 cases; see the S1 lines below.pnpm --filter @objectstack/objectql exec vitest run --project local --maxWorkers=2at 71f012a:Test Files 599 passed (599),Tests 13287 passed (13287),VERDICT command-exit 0.pnpm --filter @objectstack/objectql build && pnpm --filter @objectstack/objectql typecheck: exit 0, andcheck:test-typecheck: OK.Tests 1 failed | 9 passed (10),AssertionError: expected undefined to be true. The parent write carried noskipAutomations. The chained-roll-up and CONTROL pins pass there, as they should.summary-backfill.test.tsgivesTest Files 2 passed (2),Tests 30 passed (30).pnpm --filter @objectstack/objectql build && pnpm --filter @objectstack/objectql typecheckunder the lock: exit 0, andcheck:test-typecheck: OK.pnpm --filter @objectstack/objectql exec vitest run --project local --maxWorkers=2under the lock at c6ff87c:Test Files 599 passed (599),Tests 13331 passed (13331),VERDICT command-exit 0.Ablations (each mutated through scripts/ablation-replace.mjs, restored with git checkout HEAD and checked by blob hash)
await this.materialiseAddedSummaries()fromsyncSchemas→ 4 failed. Restored, blob 9844dc3ce514 == HEAD.recomputeUndefinedOnEmpty: added→ 3 failed (themaxcolumn stays null). Restored.sealSummariesMaterialisedAtBoot()call → 1 failed (the real-kernel case). Restored, blob d5b497bc0c7a == HEAD.skipAutomations: truefrom the install walk → 1 failed (the skipAutomations / bound-hook pin). Restored, blob a3b846744f16 == HEAD.The subject resolves to
src/through relative imports, so no dist preflight applies.Acceptance notes
os migrate summary-nulls --applyremains the backfill there. The changeset and the CLI docs say so.syncObjectSchema,protocol.installPackage) is not wired. A batch publish can sync a parent before its new child table exists, and the walk would then log a false failure. Left for a decision, not guessed.os migrate summary-nullsis run by hand. The changeset states the same rule.cli.mdx. The head c6ff87c is green and holds a PASS record, and the note above and the changeset already carry the rule, so a docs-only push would only restart review.Verification
Derived gate union at c6ff87c: dispatch-gates --commands, 106 families
check:type-check-debt,check:dual-build-cjs-loads,check:doc-frontmatter(noapps/docsinstall),spec check:skill-examples, andcheck:lean-entry-closure(objectql's dist was not yet rebuilt when it ran). NOT MEASURED locally; CI measures them.scripts/check-facade-delegation-only.mjs). CI runs the current script.check:test-source-alias,check:facade-delegation-only,check:durability-log-level,check:system-context-census,check:dts-closure,check:doc-authoring,check:nul-bytes,check:changeset-no-major,check:adr-0087-registration.Not run locally, and declared to CI:
test:repo, and the consumer suites ofsyncSchemas(@objectstack/cloud-connection; none of its tests declares a summary field).🤖 Generated with Claude Code