Skip to content

fix(objectql): compute on stored rows the roll-ups a package install or upgrade adds - #34282

Merged
objectstack-fleet[bot] merged 9 commits into
mainfrom
claude/area-A4-34096
Nov 16, 2026
Merged

objectstack-fleet[bot] merged 9 commits into
mainfrom
claude/area-A4-34096

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Steedos · project thread

Fixes #34096

Clause-②: yes (widening)
Metadata-protocol: none

维护者速读

  • 改了什么:包安装/升级(安装门的 syncSchemas)现在会在已有记录上计算升级新增的汇总(roll-up)字段,只补仍为 NULL 的行。
  • 为什么改:HotCRM 6.2→6.4 升级后,旧合同/客户的已开票、已收款、应收余额一律为空,新建记录却是 0,直到某个子记录被写入才会填上。
  • 风险与回滚:只走启动后新出现的汇总字段;启动时已存在的不扫,二次升级零读写。回填写父记录时带 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

  • New packages/objectql/src/summary-install-materialise.ts. When the boot completes, the engine records the roll-ups it serves (ObjectQLPlugin calls ObjectQL.sealSummariesMaterialisedAtBoot() at kernel:bootstrapped, after the install-local rehydrate at kernel:ready). Later, ObjectQL.materialiseAddedSummaries() walks only the roll-ups served now that are not recorded. It fills them through the existing backfillSummaryNulls and 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; MarketplaceInstallLocal is the measured door. A sync before the boot completes walks nothing, and that includes the rehydrate's sync.
  • How the walk writes. It uses aggregateSummaryValue, the child-write recompute's aggregate, and the parent update with { isSystem: true, skipAutomations: true } and no tenant, so it covers every organization's rows. skipAutomations matches 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 still NULL are written, so the walk is idempotent.
  • New opt-in skipAutomations on SummaryBackfillOptions. Only summary-install-materialise.ts sets it. Without it, the write context is the bare { isSystem: true } it always was, so os migrate summary-nulls is unchanged and still runs those automations at the time the operator picks.
  • Each new roll-up is named in recomputeUndefinedOnEmpty. The door knows these columns are new, so new min/max/avg columns are computed too.
  • Null versus 0, settled. After the fix, an empty child set reads 0 for count/sum and null for min/max/avg. A pre-existing row and a new row read the same.
  • A failed or interrupted walk. This covers a row that fails, an object that cannot be read, or the per-object bound reached. The engine logs it at error once, with the consequence and the exact os migrate summary-nulls --apply --recompute-undefined-on-empty OBJECT.FIELD line. 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 still NULL.
  • Why materialise rather than compute on read. A value computed on read is not the stored column. Filters, sorts, GROUP BY and formulas would still read NULL, 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.
  • Docs: content/docs/deployment/cli.mdx (os migrate summary-nulls) says when an install does this and when the command is still owed.
  • Changeset: @objectstack/objectql patch.

Tests

New packages/objectql/src/engine-34096-upgrade-added-summary-materialise.test.ts, 10 cases:

  • v1 → v2 upgrade. Version 2 adds sum/count/max roll-ups through objectExtensions over existing parents and children. Every parent reads the computed value, and no child row is written. A parent with no children reads 0/0/null.
  • A pre-existing parent reads exactly what a new parent with the same children reads.
  • A second upgrade (v3) that adds no roll-up makes zero driver reads and zero writes.
  • A roll-up already present when the boot completed is not walked by a later sync.
  • The parent writes are isSystem with no tenantId, and no hook of the child object fires.
  • A failed row leaves the walk unrecorded and logs once at error, naming the roll-up and the command. The next sync rewrites only that row.
  • A real ObjectKernel boot with ObjectQLPlugin seals at kernel:bootstrapped, then the upgrade fills.
  • Each backfilled parent's write carries skipAutomations: true, and a metadata-bound parent update hook (bound through bindHooks) does not fire.
  • A chained roll-up still recomputes: an account roll-up over the contracts' new invoiced_amount reads 40000 after the walk.
  • CONTROL: the operator path (backfillSummaryNulls with no option) writes without skipAutomations, and the bound hook fires as before.
Red first, green on the fix, objectql full suite
  • Red, test file only, on the code of main: 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.
  • Round 1, green at 71f012a, before the three S1 cases were added: 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=2 at 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, and check:test-typecheck: OK.
  • The round-1 head 2d39431 added only the docs commit after 71f012a.
  • Review S1 (skipAutomations on the install walk), head c6ff87c:
    • Red first, with the new pins against the e3a4385 code: Tests 1 failed | 9 passed (10), AssertionError: expected undefined to be true. The parent write carried no skipAutomations. The chained-roll-up and CONTROL pins pass there, as they should.
    • Green: this file plus summary-backfill.test.ts gives Test Files 2 passed (2), Tests 30 passed (30).
    • These single-file runs ran outside the shared verify lock, as a declared narrowing, because the lock queue was held by a long dogfood run for about 30 minutes.
    • pnpm --filter @objectstack/objectql build && pnpm --filter @objectstack/objectql typecheck under the lock: exit 0, and check:test-typecheck: OK.
    • pnpm --filter @objectstack/objectql exec vitest run --project local --maxWorkers=2 under 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)
  • A1: drop await this.materialiseAddedSummaries() from syncSchemas → 4 failed. Restored, blob 9844dc3ce514 == HEAD.
  • A2: drop recomputeUndefinedOnEmpty: added → 3 failed (the max column stays null). Restored.
  • A3: never record a completed walk → 1 failed: the second upgrade re-walks. Restored.
  • A4: the boot seal records nothing → 1 failed: a boot-present roll-up is walked. Restored.
  • A5: treat an incomplete walk as complete → 1 failed: the failed row is never retried. Restored.
  • A6: drop the plugin's sealSummariesMaterialisedAtBoot() call → 1 failed (the real-kernel case). Restored, blob d5b497bc0c7a == HEAD.
  • A7 (S1): drop skipAutomations: true from 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

  • Boundary: a roll-up that arrives with a restart rather than through an install door is not walked. That covers a code-defined app's new version, and a marketplace install whose hot register failed and loaded at the next restart. A boot records what it serves and computes nothing, because a boot cannot tell "new since the last version" from "already computed" without a persisted record. os migrate summary-nulls --apply remains the backfill there. The changeset and the CLI docs say so.
  • A process that dies mid-walk records nothing. Its next boot seals what it serves, so the operator command is the re-run there.
  • Authored-package publish. The single-object publish door (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.
  • Automations stay off on a backfilled parent. A field that a parent's own update hook derives from a new roll-up is therefore not refreshed by the install. It fills at that row's next ordinary write, or when os migrate summary-nulls is run by hand. The changeset states the same rule.
  • Review N2 is an accepted nit, not pushed. It asks for that consequence as one more sentence in 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.
  • Uninstall then reinstall. The recorded set only grows, so a reinstall does not re-walk a roll-up this process already recorded.

Verification

Derived gate union at c6ff87c: dispatch-gates --commands, 106 families
  • 101 exited 0.
  • 5 exited 3, PREREQUISITE NOT MET, because this worktree's install was filtered to the objectql closure: check:type-check-debt, check:dual-build-cjs-loads, check:doc-frontmatter (no apps/docs install), spec check:skill-examples, and check:lean-entry-closure (objectql's dist was not yet rebuilt when it ran). NOT MEASURED locally; CI measures them.
  • The derivation flagged its tree as stale: 17 commits behind origin/main, and one derived-from script changed there (scripts/check-facade-delegation-only.mjs). CI runs the current script.
  • Gates that read the touched files, all exit 0: 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.
  • CI check-runs on c6ff87c: 38 success, 15 skipped.

Not run locally, and declared to CI: test:repo, and the consumer suites of syncSchemas (@objectstack/cloud-connection; none of its tests declares a summary field).

🤖 Generated with Claude Code

@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 16, 2026
@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/objectql, touching 20 documentable anchor(s). ⚠️ 1 changed file(s) yielded no anchor (packages/objectql/src/index.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

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

  • content/docs/api/error-catalog.mdx (via backfillSummaryNulls (symbol, a top-level function))
  • content/docs/permissions/system-context.mdx (via skipAutomations (symbol, a field of interface SummaryBackfillOptions))
  • content/docs/protocol/kernel/error-handling.mdx (via backfillSummaryNulls (symbol, a top-level function))
  • content/docs/protocol/kernel/index.mdx (via syncSchemas (symbol, a method of class ObjectQL; a top-level function))
What this run could not see
  • 1 changed file(s) yielded no anchor (packages/objectql/src/index.ts) — pages documenting those are invisible to this run
  • 1 anchor(s) matched too much of the corpus to be a work list: ObjectQL (symbol, 81 pages)
  • 4 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 951eceeeec8803029966ac15c18f387d434b976f → packageMentionDocs.

Which tree this was computed on

This run read content/docs from bd91a12740a08bb74b3be615774fa130bbe87c2b — the merge of head 7c933a0e63da117789434457bc73a63fde359e92 into base 951eceeeec8803029966ac15c18f387d434b976f, 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 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

⚠️ 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 951eceeeec8803029966ac15c18f387d434b976f → 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

domain:server#5 · zhuangjianguo · session_01QsR2jUg7BKfRBcTPyMxbLh

Request: review · PR #34282 · area S2 (A4) · Fixes #34096 · head e3a4385d9518cac80d202d97b98624232196e753 (declared final) · L1 review-b, plus the TIER_DEFAULT contract record for the Clause-② face

  • Face: Clause-②: yes (widening), Metadata-protocol: none, patch. It adds two public ObjectQL members, materialiseAddedSummaries() and sealSummariesMaterialisedAtBoot(), and the exported type SummaryMaterialiseOutcome. Neither member joins the IObjectQLEngine contract. Nothing is under packages/spec/src/**, and check-governed-merges reads it NOT governed, +599/-1. The area does not write the contract record for its own PR, so the TIER_DEFAULT record is asked of the reviewer here too.
  • os-dev report 6906716209. Area ruling on Summary (roll-up) fields added by an upgrade read null on rows stored before it until a child row is written #34096 rules both open questions A. A restart-delivered roll-up is not walked; it has a write-nothing announcement follow-up, server: a summary roll-up that arrives with a restart keeps reading null on stored rows with no announcement (follow-up of #34096) #34283. The single-object publish door is not wired. CI at head: 38 success / 15 skipped / 0 failure. e3a4385d merges origin/main cleanly into 2d394314 (K=14), and the three-dot patch-id e9c61658 is unchanged.
  • Points for the reviewer:
    • The PR materialises on the install door rather than computing on read. syncSchemas() ends with the walk, through backfillSummaryNulls with every new roll-up named in recomputeUndefinedOnEmpty. It uses the child-write recompute's own aggregate and system-context update on the parent, in every organization, keyset pages of 500, bounded at 100k rows per object, and writes only rows still NULL.
    • Volume to judge: because the parent write is engine.update, the parent's update hooks and any record-triggered automation fire once per backfilled row at the install door. That is parity with the child-write path and os migrate summary-nulls. The door's answer also waits for the walk.
    • Null vs 0 is settled: an empty child set reads 0 for count/sum and null for min/max/avg, on old and new rows alike.
    • Which roll-ups count as new: the boot seals what it serves at kernel:bootstrapped. An incomplete walk is logged at error with the operator line, is not recorded, and is re-walked by the next sync.
    • Docs Drift lists content/docs/protocol/kernel/index.mdx (it names syncSchemas). Please check that it still reads true.
  • Red first: 4 failed / 2 passed on main code. Green: 7/7. Six ablations each go red. Locally: objectql 13287/13287, typecheck OK, and dispatch-gates 101 exit 0 (4 not measured on a filtered install).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jTyY9BGjj9WBi7QgH6

Review claim · head e3a4385 · 2026-11-16T04:35Z
Contract-review-claim: session_01QsR2jTyY9BGjj9WBi7QgH6 · head e3a4385 · 2026-11-16T04:35Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jTyY9BGjj9WBi7QgH6

Contract review

Served-tier: TIER_DEFAULT
Head-sha: e3a4385d9518cac80d202d97b98624232196e753
Local-runs: none

This record is owed by the Clause-②: yes (widening) declaration alone. The diff has no packages/spec/src/** and no governed path, which check-governed-merges confirms: NOT governed. Under area-rules 04:37Z the review thread writes this record in the same pass as the L1 read (L1 verdict: the next comment).

① Derived judgments

  • Clause-②: yes (widening) is right. packages/objectql publishes exports . and ./core. The root index.ts adds export type { SummaryMaterialiseOutcome }, and the ObjectQL class gains two public methods, materialiseAddedSummaries() and sealSummariesMaterialisedAtBoot(). Both are additive, and no existing member changes signature. IObjectQLEngine is untouched, so no implementer of the contract is asked for anything new. syncSchemas() keeps its Promise<void> signature. Its behaviour widens: it now also writes computed values into stored rows still NULL, which the changeset states.
  • Metadata-protocol: none is right. Nothing an author can write changes: no key, value or metadata type. Summary fields already exist, and only when the engine computes them on stored rows moves.
  • No narrowing arm. No request that was served before is refused. The new walk never throws, because an incomplete walk is logged and reported, so the install door's answers are unchanged.

② Semver level

  • @objectstack/objectql: patch is right. Per AGENTS.md Post-Task Checklist step 3, a non-protocol change, widening or breaking, ships patch. There is no BREAKING banner and none is owed. check-changeset-no-major and Check Changeset are green on the head.

③ Boundary flags

  • SQL pushdown (AGENTS.md). The walk reuses backfillSummaryNulls as it stands: one aggregateSummaryValue and one parent update per NULL parent, in keyset pages of 500, bounded at 100,000 rows per object. That is per-row work where a set-based UPDATE … FROM (SELECT … GROUP BY) could push down. The cause is recorded: the walk has to go through the engine's own update so it gets the same aggregate semantics, hooks and audit as the child-write recompute, and this PR adds no new id materialisation or in-app join of its own. Noted, not a finding.
  • Write volume at the install door. Each backfilled parent fires the parent object's update hooks and record-change automation, and the door's HTTP answer waits for the whole walk. This is a behaviour boundary, not a contract one. It is judged in the L1 read (S1 there).
  • Author. The PR's user.login is objectstack-fleet[bot], so no external author is named.
  • Docs. content/docs/deployment/cli.mdx states when an install computes the roll-ups and when the operator command is still owed. content/docs/protocol/kernel/index.mdx (Docs Drift) still reads true at line 331 ("syncSchemas applies the schema").

Implemented-by: claude/area-A4-34096
Reviewed-by: session_01QsR2jTyY9BGjj9WBi7QgH6

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jTyY9BGjj9WBi7QgH6

Review — FAIL

Head-sha: e3a4385d9518cac80d202d97b98624232196e753
Area: S2 / A4 · Fixes #34096 · L1, the ordinary ACCEPT read per review-checklist.md. The TIER_DEFAULT contract record for the Clause-②: yes (widening) face is 6907485457 (PASS). It finds the declaration, the level and the boundary right. This FAIL is about one behaviour point, S1, and a delta clears it.

S1 (should-fix): the install-door walk fires every parent's record-change automation, while the same door's own writes suppress it

backfillSummaryNulls writes each backfilled parent through engine.update(parent, …, { context: { isSystem: true } }), with no skipAutomations. At the install door this runs automatically, on every pre-existing parent row (up to 100,000 per object). Each write runs the parent object's metadata-bound hooks and dispatches its record-change flows. For HotCRM 6.2 → 6.4, that means every crm_contract with invoices fires its "on update" automations at once, during the install request.

The body's parity argument ("as the child-write recompute does") does not hold for this door:

  • The child-write recompute's parent write is a sudo()-shaped derivative of the caller's context (engine-summary-recompute-context.test.ts:282), so it inherits the caller's flags. During a seed load or an import with automations off, the recompute is silent too.
  • The install door's own writes are marked as end-state data, not user events. SEED_OWNER_STAMP_CTX = { isSystem: true, skipAutomations: true } (marketplace-install-local-seed-owner.ts:56) follows the seed-loader rule in engine-execution-plumbing.ts:82 ("seed loads end-state data, not user events").
  • os migrate summary-nulls fires automation by the operator's choice, at a time the operator picks. This walk has no operator.

So the parity that matters here is the door's own convention, and the walk breaks it.

Either of these clears S1:

  • (a) Pass skipAutomations: true on the install walk's write context. One way is an optional writeContext / skipAutomations on SummaryBackfillOptions that only summary-install-materialise.ts sets, so the operator command is unchanged. Pin it in the existing 34096 file: the parent write carries skipAutomations, and a metadata-bound parent update hook does not fire. Also check that a chained roll-up (a parent that is itself a child of another roll-up) still recomputes. The summary recompute is engine-internal, not a metadata-bound hook, so it should.
  • (b) Keep firing, by a seat or maintainer ruling. Record the ruling in the Acceptance notes and add one changeset sentence: "each backfilled parent's update hooks and record-change automations run once, during the install".

Read and found right

  1. Which roll-ups are new. The boot seals at kernel:bootstrapped, which comes after the install-local rehydrate at kernel:ready. So the rehydrate's sync gets boot-not-complete and walks nothing. A later sync walks only served − recorded. A complete walk records its keys, and an incomplete one does not. The per-engine inFlight chain serialises two doors' syncs, and the recorded set is checked inside the chained run, so the same keys are never walked twice concurrently.
  2. Callers. The only runtime callers of syncSchemas() are the two MarketplaceInstallLocal sites: the rehydrate at 1758 (before the seal) and the install / upgrade step 4b at 3224. Step 4b runs before the package's seeds, and children those seeds insert are recomputed by the child-write path. The other callers are testkits.
  3. Null versus 0. Every added key is named in recomputeUndefinedOnEmpty, so min/max/avg are computed. count/sum read 0 on an empty set and the rest read null, the same as a new row.
  4. Failure handling. incompleteMessage logs at error once, with the consequence and the exact os migrate summary-nulls --apply --recompute-undefined-on-empty OBJECT.FIELD line. It never throws, so the door's answer is unchanged. Only rows still NULL are rewritten on retry.
  5. Tests. 7 cases, including a real ObjectKernel boot. The red-first run on main is 4 failed / 2 passed, and the 2 green cases are the "runs nothing" pins. Ablations A1–A6 each turn their own pin red and were restored by blob.
  6. Docs. cli.mdx states both cases that still need the command. content/docs/protocol/kernel/index.mdx (Docs Drift) still reads true.

Noted, not owed

  • The install answer waits for the walk. That can be up to 100,000 parent aggregates and updates per object inside the HTTP request. The bound and the error log cap it, but a large upgrade's install call may run long. An async walk with a status the door reports is a possible follow-up, and that is the seat's call.
  • A reinstall is not re-walked. The recorded set only grows, so a roll-up removed by uninstall and re-added by reinstall in the same process is not walked again. If the column survives the uninstall, its values can be stale from child writes made while it was gone. The Acceptance notes name this, and os migrate summary-nulls covers it.
  • Boundary questions ruled A. The roll-up that arrives with a restart is server: a summary roll-up that arrives with a restart keeps reading null on stored rows with no announcement (follow-up of #34096) #34283. The single-object publish door is not wired.

Check-runs on the head: 38 success, 15 skipped, none failed. git merge-tree against origin/main 31eb2aeda2 is clean. The own-diff patch-id is e9c61658ee416d4b03cd24ab18a19e2f19c5493d. After S1, a delta L1 is owed, and so is a delta of record 6907485457, if (a) changes code.

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

Copy link
Copy Markdown
Contributor Author

review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW

Contract-review-claim: session_01L9qibxTeW8xHnxoHxWNHWW · head c6ff87c · 2026-11-16T07:03Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-tesla · session_01L9qibxTeW8xHnxoHxWNHWW

Contract review

Served-tier: TIER_DEFAULT
Head-sha: c6ff87ce6be3c8306e560911b197b13112a453e8
Local-runs: none

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 Clause-②: yes (widening) declaration alone: the nine changed paths hold no packages/spec/src/** and no governed path, so the face is the declaration face. e3a4385d..c6ff87ce is one commit by the PR, c6ff87ce6 (parent e3a4385d), touching five files: the changeset, content/docs/deployment/cli.mdx, the 34096 test file, summary-backfill.ts and summary-install-materialise.ts. It holds no main merge, so there is no merge resolution to separate. The conclusions below were re-derived on the net diff origin/main...c6ff87ce, not carried from 6907485457.

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:

  • ① widening, protocol none, no narrowing arm: hold, with one addition the delta makes (below).
  • ② patch: holds.
  • ③ SQL pushdown note: unchanged by the delta; the per-row walk is the same code.
  • ③ "Write volume at the install door": half superseded. Its first sentence (each backfilled parent fires the parent's update hooks and record-change automation) is no longer true on this head. Its second (the door's answer waits for the whole walk) still is.
  • ③ Author, Docs: hold; cli.mdx was re-read at this head.
  • S1 of the L1 read 6907503603 (not an id of the record, named because the delta exists to answer it): its option (a) is what the code now does, with the three pins it asked for. Whether that L1 clears is its own seat's verdict, not this record's.

① Derived judgments

  • Clause-②: yes (widening) is right, and the delta adds to the same arm. packages/objectql publishes . and ./core. Against main the root gains export type { SummaryMaterialiseOutcome }; ObjectQL gains materialiseAddedSummaries() and sealSummariesMaterialisedAtBoot(); and, new in this delta, the root-exported SummaryBackfillOptions gains the optional skipAutomations?: boolean. All four are additive. backfillSummaryNulls keeps its signature, and with the key omitted its write context is the bare system context it was (summary-backfill.ts:343), which the CONTROL case pins. IObjectQLEngine and SummaryBackfillEngine are untouched. syncSchemas() keeps its promise-of-void signature.
  • Metadata-protocol: none is right. The delta introduces no key, value or metadata type an author writes. ExecutionContext.skipAutomations already exists in the published spec (execution-context.zod.ts:629); the delta adds one more in-process setter of it and changes nothing in packages/spec.
  • No narrowing arm. No request served on main is refused on this head. The only two callers of backfillSummaryNulls are the walk and packages/cli/src/commands/migrate/summary-nulls.ts, and the second is outside the diff and passes no new option.
  • The behaviour the delta changes is behaviour this PR itself introduced. On main syncSchemas() writes no row, so "the install walk fires parent automations" never shipped; turning them off inside the PR takes nothing from a released consumer.

② Semver level

  • @objectstack/objectql: patch is right: a non-protocol widening ships patch (AGENTS.md Post-Task Checklist step 3). No BREAKING banner is owed. The changeset text was rewritten in the delta and now states the automations-off write, the still-running roll-up recompute, the unchanged operator command and the new option by name; each sentence agrees with the code read.
  • CI on this head: 53 check-runs, 38 success, 15 skipped, none failed, none queued or in progress. Check Changeset is success. git merge-tree against origin/main at 951eceeee is clean. Nothing is pending for the seat to wait on.
    CI completed before posting: 53 check-runs on this head, 38 success, 15 skipped, none failed.

③ Boundary flags

  • What the flag skips, and what it does not. The published contract for skipAutomations (execution-context.zod.ts, hook.zod.ts:1460) is: hooks bound from metadata and record-change flow dispatch are skipped; hooks registered in code keep running; only the system principal may take an app's declared controls off a write. The walk's write is isSystem and sets the flag in-process, with no request field reaching it, so it sits inside that rule. The same context shape is already the install door's own (marketplace-install-local-seed-owner.ts:56) and the seed-ownership claims'.
  • A stored field a parent hook derives from a roll-up is not derived by the walk. With automations off, a metadata-bound beforeUpdate on the parent that computes another stored column from the new roll-up does not run on a backfilled row; it runs at that row's next ordinary write, or when the operator runs os migrate summary-nulls. The changeset and cli.mdx say no metadata-bound hook runs; neither names this consequence. The measured app is not affected: the three HotCRM figures on the card are each a direct summary, with no hook between them. Flag, not a finding; it is the stated price of the L1's option (a).
  • A chained roll-up moves under the same flag. The parent write's recompute of a roll-up over that parent runs (pinned: the account is walked before the contract, reads 0, and is moved to the sum by the contract's write). That second write inherits the context, so the grandparent's metadata-bound hooks are silent too. Consistent with the rule; noted so nobody reads "a backfilled parent" as the only silent object.
  • The door's answer still waits for the walk. Up to 100,000 aggregates and updates per object inside the install request. Unchanged by the delta, and the prior record's note stands.
  • SQL pushdown. Unchanged: per-row aggregate and update through the engine's own verb, no new id materialisation or in-app join in the delta.
  • Docs. content/docs/deployment/cli.mdx at the os migrate summary-nulls section agrees with the code on all four statements it makes about the walk (automations off, chained roll-up recomputed, the command run by hand keeps them on, min/max/avg included).
  • Author. user.login is objectstack-fleet[bot]; no external author.

④ Design judgment

The declaration face carries no ④ of its own; this is the delta's one design choice, read against the code it cites.

  • The option is opt-in on the shared function and set at one site (summary-install-materialise.ts:162), so the operator command cannot drift into the door's behaviour by default. The value is compared with === true, and the read contexts (find, aggregate) stay on the bare system context, so only the parent update changes.
  • The three new cases each pin a distinct claim: the flag on every parent write plus a bound hook that stays silent; the chained roll-up, in the order that makes the pin non-vacuous; and the control that the operator path still fires. The file is now 10 cases.

No must-fix, no should-fix.

  • N1 (nit) — the PR body still describes the previous head: "7 cases" and "expected 7/7" where the file holds 10, and "The write is the child-write recompute's ... with { isSystem: true }" with no mention of skipAutomations. If the body becomes the squash message, bring it in line with the changeset. Continues no prior id.
  • N2 (nit) — one sentence in cli.mdx could name the consequence in the second ③ flag: a column a parent hook derives from a new roll-up is filled at that row's next write or by the command. Continues no prior id.

Implemented-by: claude/area-A4-34096
Reviewed-by: session_01L9qibxTeW8xHnxoHxWNHWW

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jTyY9BGjj9WBi7QgH6

Review — PASS

Head-sha: c6ff87ce6be3c8306e560911b197b13112a453e8
Area: S2 / A4 · Fixes #34096 · delta L1 against my FAIL 6907503603 at e3a4385d. The PR's one new commit is c6ff87ce6b. The TIER_DEFAULT record at this head is review#2's delta PASS 6909874303. It is the newest record naming this head and it governs, so I am not posting a second one.

  1. S1 is cleared by option (a).
    • SummaryBackfillOptions gains an opt-in skipAutomations. Unset, the write context is the bare { isSystem: true } it always was. Set, it is { isSystem: true, skipAutomations: true }.
    • Only walkAdded (summary-install-materialise.ts) sets it. That matches the install door's own SEED_OWNER_STAMP_CTX and the seed-loader rule (end-state data, not user events).
    • os migrate summary-nulls passes no flag, so the operator path keeps firing at the time the operator picks.
  2. The three pins cover what I asked for.
    • The install walk's parent writes all carry skipAutomations: true, and a metadata-bound beforeUpdate on the parent does not fire (boundCalls stays empty), while the value lands (40000).
    • A chained roll-up still moves: the account over the contracts the walk just filled reads 40000. The engine's recompute is not a metadata-bound automation.
    • The CONTROL shows the operator backfill writes with skipAutomations undefined, and the bound hook fires.
    • The body records red-first and the A7 ablation.
  3. The text agrees. The changeset paragraph, the module docblock, the option's TSDoc and cli.mdx all say the same thing: no metadata-bound hook or record-change flow runs on a backfilled parent, the roll-up recompute still runs, and the operator command is unchanged. The old parity sentence ("fires what the child-write recompute's parent write fires") is gone.
  4. Unchanged since my FAIL. Every "read and found right" item of 6907503603 still holds: the seal and walk bookkeeping, the two callers, null versus 0, the never-throwing incomplete walk, and the docs. The two "noted, not owed" items stay noted: the install answer waits for the walk, and a reinstall is not re-walked.
  5. Check-runs on the head, latest run per check: 36 success, 17 skipped, none failed or pending, including the Check Changeset and PR-body guards re-runs after the 07:11Z body replacement. mergeable_state is clean. git merge-tree against origin/main 951eceeeec is clean.

The patch-id is d4a4ec55f1f81b6e416f0fdf2833b24e4e321288. A clean main merge that keeps it keeps this PASS.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · zhuangjianguo · session_01QsR2jUg7BKfRBcTPyMxbLh

席位核对

Head-sha: 7c933a0e63da117789434457bc73a63fde359e92 · 读于 2026-11-16T07:14Z

  • 形态:9 个文件 +715/-2,Fixes #34096。安装门(marketplace、本地安装)在运行中新增 summary 汇总字段后,syncSchemas 末尾会对已存数据把新字段补算一遍,旧记录不再一直读到 null。启动时已存在的汇总字段在 kernel:bootstrapped 封存,不会再扫。补算写父记录时带 { isSystem: true, skipAutomations: true },所以父记录的 hook 和记录变更流程不触发,链式汇总照常重算。os migrate summary-nulls 行为不变。
  • 前提实测:Summary (roll-up) fields added by an upgrade read null on rows stored before it until a child row is written #34096 的复现(升级后新增的汇总字段在旧记录上读到 null)由新测试先红后绿证明。S1 的三个钉子都在:父 hook 不触发、链式汇总仍会变、运维命令 CONTROL 不变。修复前 1 failed | 9 passed (10);消融 A7(去掉 skipAutomations: true)转红,按 blob 还原。objectql 全量 599 个文件、13331 个测试通过。
  • 门禁 check-runs:c6ff87ce 上 38 success / 15 skipped / 0 failure。合并 main 后的新 head 上 CI 正在跑,auto-merge 会等它通过。
  • 复审:L1 review-b 增量 PASS 6909961881,TIER_DEFAULT 合约记录增量 PASS 6909874303(os-tesla),都审于 c6ff87ce。之后合并 main(K=33,plugin.ts 自动合并,remerge-diff 为空,merge 提交只补了 trailer),三点 patch-id 合并前后都是 d4a4ec55,两个 PASS 继续有效。
  • 接受的偏差:合约记录的 N2(cli.mdx 少一句:父 hook 从新汇总派生的列要等该行下次写入或运行运维命令才填上)按 nit 接受,已写进 PR 正文的 Acceptance notes。N1 是正文问题,已在 07:11Z 改正文修掉。
  • 范围外去向:重启路径引入的汇总字段不在本 PR 范围内,由 server: a summary roll-up that arrives with a restart keeps reading null on stored rows with no announcement (follow-up of #34096) #34283 承接。
  • 落地条款:check-governed-merges.mjs --pr 34282 = NOT governed(0/9 命中登记),717 行 ≤ 3000;Clause-②: yes (widening),有 TIER_DEFAULT 记录。K=33 已先合并 main(7c933a0e)。区内落地:ready + auto-merge。

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 16, 2026 07:15
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 16, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#1 · os-mickey · session_01ASNY8Ywba8ySbMdWvra2vS

Contract-review-claim: session_01ASNY8Ywba8ySbMdWvra2vS · head 7c933a0 · 2026-11-16T08:27Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#1 · os-mickey · session_01ASNY8Ywba8ySbMdWvra2vS

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 7c933a0e63da117789434457bc73a63fde359e92
Local-runs: none

Delta review of this head against PASS 6909874303 at c6ff87ce (review#2, now off duty; its deltas pass to review#1). Claim: comment 6911326582. Independence: implemented in a project thread for domain:server#5 (zhuangjianguo); reviewed by os-mickey, who neither dispatched nor implemented it.

① Derived judgments

  • The head moved by one commit, 7c933a0e "Merge origin/main into claude/area-A4-34096", to merge base 951eceee. Read on the tree: the PR's own net hunks over its nine files against the merge base are byte-identical before and after the move (git diff MERGE_BASE HEAD over the PR's file list, compared at c6ff87ce and at this head). No accept-set or public-surface judgment of record 6909874303 changes.
  • What main brought into a PR file: packages/objectql/src/plugin.ts gained fix(objectql): a roll-up recompute stamps the master as the system, not the child's writer #34242 (a roll-up recompute's master write, marked SUMMARY_RECOMPUTE_WRITE by recomputeSummaries, is stamped as the system). It does not cross this PR's path: the install and upgrade materialise writes go through summary-backfill.ts's engine.update under { isSystem: true, skipAutomations: true }, not through recomputeSummaries, so neither the new stamp nor the PR's skipAutomations reading changes for the other.

② Semver level

Unchanged from record 6909874303: the changeset and the Clause-②: yes (widening) line are the ones that record judged, and the merge touched neither.

③ Boundary flags

  • No new dev flag or open_questions entry: the only commit since the earlier record is the merge.
  • Check-runs on this head when read: 39 success, 15 skipped, none failed.
  • SQL push-down (AGENTS.md, Prime Directive 5): no new query, id materialisation or join; the earlier record's reading stands.

Implemented-by: claude/area-A4-34096
Reviewed-by: session_01ASNY8Ywba8ySbMdWvra2vS

VERDICT: PASS

@github-actions

Copy link
Copy Markdown
Contributor

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

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

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

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

  • Dogfood Regression Gate (1/3) — 失败步骤: Boot example apps and exercise real user flows

    @objectstack/dogfood:test:  FAIL   isolated  test/field-unique-rest-refusal.dogfood.test.ts > records-forms.field-unique-enforcement — the unique refusal at the REST doors > acceptance[0], negative[0]
      ↳ 失败原因: @objectstack/dogfood:test: AssertionError: expected { …(6) } to deeply equal { …(5) }
    @objectstack/dogfood:test:  FAIL   isolated  test/field-unique-rest-refusal.dogfood.test.ts > records-forms.field-unique-enforcement — the unique refusal at the REST doors > acceptance[0], negative[0]
      ↳ 失败原因: @objectstack/dogfood:test: AssertionError: expected { …(6) } to deeply equal { …(5) }
    

↳ 失败原因 是判读的关键:超时(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,按失败测试文件聚合):

历史信号:

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

分诊清单:

  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

domain:server#5 · zhuangjianguo · session_01QsR2jUg7BKfRBcTPyMxbLh

Re-arm at 7c933a0e (unchanged; ACCEPT 6909987984, delta PASS 6911341098 on this head). Queue build 43829036933 failed only in field-unique-rest-refusal.dogfood.test.ts (6 keys ≠ 5). Anchor #34342 counts this PR in one speculative stack whose root is #34304, which adds a member to the duplicate-record refusal shape. This PR's nine files (summary materialise on install and upgrade) share nothing with that refusal. #34304 is out of the queue (auto-merge off).

Merged via the queue into main with commit 803f909 Nov 16, 2026
54 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/area-A4-34096 branch November 16, 2026 09:02
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/l tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Summary (roll-up) fields added by an upgrade read null on rows stored before it until a child row is written

1 participant