Skip to content

fix(objectql)!: a roll-up summary field is read-only on create too, and a create seeds it as for an empty child list - #35089

Merged
objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/issue-34672-summary-insert-readonly
Nov 18, 2026
Merged

objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/issue-34672-summary-insert-readonly

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Yibo Wang · project thread

Fixes #34672

Clause-②: no (narrowing)
Metadata-protocol: none
Skills-docs: none — skills/** teaches no starting value for a summary field (its only summary-write text, skills/objectstack-data/rules/relationships.md, is about the backfill); content/docs/data-modeling/fields.mdx now states the create side

维护者速读

  • 改了什么:汇总字段(Field.summary)在新建时也一律只读,不管作者有没有写 readonly: true。普通用户的 POST、批量/复合新建、导入(insert,以及 upsert 新建的那些行)、MCP create_record、非系统身份的流程新建,送来的汇总初值都被丢掉,在 droppedFields 里报 readonly,该列按「没有子记录」起步(count/sum 为 0,min/max/avg 为空);开了 strictReadonlyWrites 则整笔拒收。顺带修好:写了 readonly: true 的汇总字段,新建时若带了值,过去会落成 null,现在落 0。
  • 为什么改:fix(objectql)!: a roll-up summary field is read-only on update whether or not it declares readonly: true #34752 只锁了更新;新建时普通用户仍可手填一个汇总初值,存下来被下游读,直到下一次子记录变动才被重算覆盖。spec 早已写明 summary 属于「never client-written」的计算类型(COMPUTED_VALUE_TYPES)。席位按路线 A 裁定(认领修正 6963962011)。
  • 风险与回滚:收窄(BREAKING):今天给汇总字段带初值的非系统新建会被丢值或被拒。系统身份(isSystem)照写:种子数据、包安装、历史导入(treatAsHistorical 只许系统身份)都不受影响。Console 新建表单本来就不发汇总字段(见 Acceptance notes)。回滚即撤回本 PR,无数据迁移。
  • 先看:packages/objectql/src/engine-top-level.ts(insertStaticReadonlySubject 与新的 withSummaryRollUpsReadonly)、packages/objectql/src/engine-insert.ts(staticReadonlyCreateStrip 里的重新播种那 4 行)、packages/objectql/src/engine-summary-update-lock.test.ts(新建一侧的 describe)。
  • 两分钟验证:pnpm --filter @objectstack/objectql exec vitest run --maxWorkers=2 src/engine-summary-update-lock.test.ts,预期全过;新建一侧那组里「a person's create (REST POST)」断言两列都是 0、droppedFields 点名两个字段。
  • 需要你做的:无。check-governed-merges 判定非受管;L1 与席位的收窄契约复审通过后由区落地。

What changes

A roll-up summary field is read-only on create too, whether or not the author declared readonly: true, and a create that had its value taken starts the column at the empty-child-list seed.

  • packages/objectql/src/engine-top-level.ts
    • insertStaticReadonlySubject(schema, wallJudgesOrganization) is the one schema view the three create-side static readonly passes read: the pre-hook withhold (what beforeInsert is shown), the post-hook strip in engine-insert.ts (what is stored) and the insert-mode preview in engine-validate.ts. It now reads every roll-up as readonly: true before staticReadonlyInsertSubject judges the schema, so that function's exclusions (a sys_ object, a platform-internal managedBy bucket) hold for roll-ups too. isSystem runs none of these passes and keeps its value.
    • New private helper withSummaryRollUpsReadonly(schema): the one spelling of the roll-up lock, read by both the insert view and updateStaticReadonlySubject (the update half, fix(objectql)!: a roll-up summary field is read-only on update whether or not it declares readonly: true #34752, now reads it instead of its own loop; no update answer changes).
    • summaryFieldsLockedOnUpdate is renamed summaryFieldsLockedOnWrite (it now answers both verbs). It is a module export of engine-top-level.ts, not a package export: packages/objectql/dist/index.d.ts names neither spelling.
  • packages/objectql/src/engine-insert.ts: staticReadonlyCreateStrip re-runs initializeSummaryFields over the stripped row after its re-default and copies the seed back for the TAKEN keys only. Without it the strip re-ran applyFieldDefaults alone, so a taken roll-up landed null while the write succeeded: the state the summary seed exists to rule out. That already happened before this PR for a roll-up declared readonly: true (route condition 1); it is fixed here for both.
  • packages/objectql/src/validation/rule-validator.ts: the summary note on RUNTIME_OWNED_FIELD_TYPES (the rule-validator 里 RUNTIME_OWNED_FIELD_TYPES 的排除理由对 summary 是错的:summary 是「存储列」不是「读时计算」 #6014 note) is rewritten. It keeps "do not add summary to this set" and says why the type rides the static readonly strip instead (the isSystem-only exemption, and the re-seed); it retires "supplying an initial value is a SUPPORTED authoring path" for an ordinary caller, per the route ruling.
  • content/docs/data-modeling/fields.mdx: the summary paragraph now covers create and update.
  • .changeset/34672-summary-readonly-on-create.md: patch on @objectstack/objectql, BREAKING, the migration line for REST, import and MCP clients, ADR-0087 not-required (no-migration-prescription).
  • .changeset/34672-summary-readonly-on-update.md: DELIBERATE CORRECTION, see Acceptance notes.

No new drop reason, no spec key: reason readonly, as on update.

Tests

  • packages/objectql/src/engine-summary-update-lock.test.ts, new describe "a roll-up summary is read-only on create" (14 cases), real ObjectQL and a recording driver, order_total a sum roll-up without readonly beside order_total_ro declared readonly: true, written as a signed-in person unless stated:
    • baseline: a create naming neither stores 0 and 0, reports nothing;
    • the REST POST shape: both values dropped and reported in one event, both columns 0, the rest stored, the returned row 0;
    • condition 1: the declared readonly: true roll-up alone lands 0, not null (the driver's create payload is asserted);
    • a null starting value is taken the same way and lands 0;
    • a batch (array) create and insertMany (the import commit; the row that sent a value carries droppedFields, the other none);
    • strictReadonlyWrites: refused (code ERR_READONLY_FIELD_REJECTED, fields, drops, operation: 'insert'), nothing written;
    • the insert-mode preview reports the same drop;
    • a beforeInsert hook is shown the seed, not the caller's value;
    • children already stored before the parent: the create lands 0, not the typed value; the next child write recomputes to the true sum;
    • isSystem keeps 90 and 90 (seed loads, package installs, historical imports);
    • preserveAudit without isSystem is no exemption;
    • a max roll-up (no empty-set value) is dropped and stays empty;
    • a sys_ object stays outside the create lock.
  • packages/rest/src/import-summary-update-lock-34672.test.ts, new describe (3 cases), real ObjectQL + protocol + SQLite :memory: over the HTTP routes as a signed-in person, reading the physical row: POST /api/v1/data/:object (201, droppedFields names both, both columns 0); import writeMode: 'insert' dry run and commit (row 1 carries droppedFields, stored 0); import writeMode: 'upsert' (drops on the updated row and on the created row; a created row whose children were already stored lands 0, and the next child POST recomputes to 51).
  • Changed pins, each forced by the narrowing and each now stating the new expectation (route condition 4; no pin deleted):
    1. engine-summary-update-lock.test.ts "INSERT is not narrowed: a caller's initial value is kept" → "INSERT is narrowed too: a person's starting value is dropped, reported, and the column seeded 0".
    2. summary-rollup.test.ts "never overwrites a value the author supplied on insert" → "never overwrites a value a system writer supplied on insert (seed data, a historical import)": the same assertion, now written with isSystem: true, the only writer that may still supply one; beside it a new case, "an ordinary caller's value on insert is dropped, and the seed fills the column" (0 and 0).
    3. summary-rollup.test.ts "seeds every row of a batch insert, and only the unsupplied ones" → the same assertions with a system writer.
      4.–7. engine-blank-typed-value-door.test.ts, the four insert cases ("" one row, " " one row, array + insertMany, "a valid value on every typed column … (the roll-up's is dropped)"): every other typed column still reaches the driver as null / unchanged, and no f_summary is sent on create, as it already was not on update (the shared expectTypedNull now says so for both verbs).
    4. packages/rest/src/rest-data-blank-typed-value.test.ts: the fixture seed helper writes as the system principal (that is the writer that may still set f_summary: 7); "a valid value on every typed column" now expects droppedFields naming f_summary and the column null (this fixture's roll-up declares no summaryOperations, so there is no seed).

Ablation (node scripts/ablation-replace.mjs, each leg restored to the HEAD blob with git diff HEAD empty; the objectql suites import the engine from source, so no build sits between the edit and the run):

  • The lock, engine-top-level.ts staticReadonlyInsertSubject(withSummaryRollUpsReadonly(schema) as any) → staticReadonlyInsertSubject(schema as any) (anchor x1 → x0, blob 853f70980a4d → 4c1dc5b1d8f4): Tests 16 failed | 91 passed (107). Red: the flipped insert pin, 10 of the 14 create cases, the ordinary-caller summary-rollup case and the 4 blank-door insert cases. Green, as predicted: the baseline, the declared readonly: true case (the declared flag is taken without the lock), isSystem, sys_, every update case and the system-writer summary-rollup cases.
  • The re-seed, engine-insert.ts if (stripped[k] == null && reseeded[k] !== undefined) stripped[k] = reseeded[k]; → void reseeded[k]; (blob 0b8e11afbbae → 3c2e0b671768): Tests 10 failed | 97 passed (107). Red includes condition 1's pin ("the declared readonly: true roll-up alone lands 0, not null"); green: the baseline, isSystem, the max case, sys_, strict, preview and every update case.

Acceptance notes

  • Console create form (route condition 2), measured on this head: the Console does NOT send a summary field on create. ObjectForm builds its create payload with formWritePayload (ui/packages/plugin-form/src/writePayload.ts), whose first step is sanitizeFormData; ModalForm and DrawerForm call sanitizeFormData directly; the master-detail batch sanitizes child rows the same way. sanitizeFormData drops every field whose type is in COMPUTED_FIELD_TYPES (ui/packages/plugin-form/src/sanitize.ts, summary a member) whenever the object schema is supplied, and ObjectForm renders a summary control disabled. Existing pins: ui/packages/plugin-form/src/sanitize.test.ts "drops computed / read-only field types when a schema is provided" (task_count: { type: 'summary' } dropped) and ui/packages/plugin-form/src/masterDetailTx.test.ts "buildMasterDetailBatch strips computed/server-managed child fields" (a child summary dropped from the create op); both run on this head, Test Files 2 passed (2), Tests 21 passed (21). The import mapping also offers no summary target (ui/packages/app-shell/src/views/importTargetFields.ts, COMPUTED_TYPES). One edge, harmless after this PR: a form built only from inline customFields sanitizes with no schema, so a summary there would not be filtered client-side; the engine now drops and reports it. No ui/ change.
  • DELIBERATE CORRECTION of an unreleased changeset, .changeset/34672-summary-readonly-on-update.md (fix(objectql)!: a roll-up summary field is read-only on update whether or not it declares readonly: true #34752's, not yet consumed by a release), two sentences, because they state the create-side answer this PR reverses:
    • was "An import with writeMode: 'upsert' drops the value on the rows it updates and keeps it on the rows it creates." now "An import with writeMode: 'upsert' drops the value on the rows it updates; the rows it creates are covered by the create-side entry (34672-summary-readonly-on-create)."
    • was "Not changed: a create keeps a value sent for a summary field as its starting value, …" now "Not changed by this entry: the create side, which the create-side entry (34672-summary-readonly-on-create) narrows in the same release; seed data and a historical import, which write as the system principal, still carry a pre-computed total on create."
      The dispatch order for this round names both changesets in the file surface.
  • node scripts/pm/overlap-check.mjs reports one overlap, with chore: version packages #33849 (chore: version packages) on that same changeset: the Version Packages PR deletes the file it consumes and this PR edits it. It is regenerated from main, so it is no queue; every other candidate (fix(objectql)!: a required field hidden by its own visibleWhen is required only when shown #34978, fix(audit): a search the server widens never names a column the caller may not query #34817, fix(objectql)!: a predicate update judges each matched row against the parent roll-ups the rows before it move #34709) and origin/main merge cleanly.
  • The rename summaryFieldsLockedOnUpdate → summaryFieldsLockedOnWrite has no caller outside packages/objectql/src (git grep), and node scripts/check-platform-checklist.mjs --changed-from origin/main reports 0 lost.
  • Started from the lost round's pushed head 4f08aded (Resume-from); the work was reviewed against route A and its five conditions and found complete; this round added a merge of main and the verification below. The (wip) subject on 5430eb9a is left in history, not rewritten.

Verification

Final head b2f55b4eb7e8e029c1df489121a97f18c7814370: a merge of main (eb7b09d4d2, 9 first-parent commits, none in packages/objectql) over the lost round's head 4f08aded, no conflict. Every reading below ran on this head.

Full dogfood battery
  • On b2f55b4eb7e8e029c1df489121a97f18c7814370, under one os-verify-lock.sh hold (VERDICT command-exit 0, held 45m22s): pnpm --workspace-concurrency=2 --filter '@objectstack/dogfood^...' build && pnpm --filter @objectstack/dogfood test (no shard, no path): Test Files 479 passed | 3 skipped (482), Tests 4072 passed | 68 skipped (4140). No failure.
Local runs
  • Under one lock hold: pnpm --filter @objectstack/objectql typecheck exit 0, pnpm --filter @objectstack/rest typecheck exit 0 (both tsc --noEmit && pnpm check:test-typecheck), pnpm --filter @objectstack/objectql test exit 0 (Test Files 610 passed (610), Tests 13739 passed (13739)), pnpm --filter @objectstack/rest test exit 0 (Test Files 418 passed (418), Tests 8610 passed | 350 skipped (8960)). Built first: pnpm --workspace-concurrency=2 --filter '@objectstack/rest...' build, VERDICT command-exit 0.
  • The card's pins: pnpm --filter @objectstack/objectql exec vitest run --maxWorkers=2 src/engine-summary-update-lock.test.ts src/summary-rollup.test.ts src/engine-blank-typed-value-door.test.ts (Tests 107 passed (107)) and pnpm --filter @objectstack/rest exec vitest run --maxWorkers=2 src/import-summary-update-lock-34672.test.ts src/rest-data-blank-typed-value.test.ts (Tests 13 passed (13)), VERDICT command-exit 0.
  • Console pins, from ui/: pnpm exec vitest run --maxWorkers=2 packages/plugin-form/src/sanitize.test.ts packages/plugin-form/src/masterDetailTx.test.ts, Test Files 2 passed (2), Tests 21 passed (21).
  • node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack: 101 derived commands, each recorded as CMD :: exit N; --ran reconciliation: "101 derived, 100 run, 1 NOT-MEASURED, 0 UNRUN". 99 exit 0. node scripts/check-empty-changeset.mjs --base origin/main exit 1, the DELIBERATE CORRECTION above (red by design until the seat's record). pnpm check:type-check-debt exit 3 twice, NOT MEASURED, reason: its closure build queues for the verify lock, held first by this PR's battery and then by a sibling's dogfood run (queue timeout 540s); its coverage half printed OK — 128/131 workspace packages type-checked; CI's run is the reading.
  • node scripts/check-platform-checklist.mjs --changed-from origin/main: exit 0, 0 lost.
  • node scripts/pm/overlap-check.mjs --branch=HEAD: VERDICT overlap exit 1, only chore: version packages #33849 (Version Packages) on the corrected changeset, see Acceptance notes; origin/main eb7b09d4d2, fix(objectql)!: a required field hidden by its own visibleWhen is required only when shown #34978, fix(audit): a search the server widens never names a column the caller may not query #34817 and fix(objectql)!: a predicate update judges each matched row against the parent roll-ups the rows before it move #34709 merge cleanly.
  • The full repo farm (pnpm lint, test:repo, the other packages): CI.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WGufzfr1xZSFZzCR8HnqXX

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

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

10 anchor(s) derived from 1 changed package(s); no hand-written page names any of them. ⚠️ 1 changed file(s) yielded no anchor (packages/objectql/src/validation/rule-validator.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

What this run could not see
  • 1 changed file(s) yielded no anchor (packages/objectql/src/validation/rule-validator.ts) — pages documenting those are invisible to this run
  • 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 301b7c11c5f24a52db706f9016155293c066756d → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 8600f655b8b7a319c81129e750648c76b6decb66 — the merge of head b2f55b4eb7e8e029c1df489121a97f18c7814370 into base 301b7c11c5f24a52db706f9016155293c066756d, 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 8600f655b8b7a319c81129e750648c76b6decb66 && git checkout 8600f655b8b7a319c81129e750648c76b6decb66
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 301b7c11c5f24a52db706f9016155293c066756d b2f55b4eb7e8e029c1df489121a97f18c7814370 && git checkout -B drift-repro 301b7c11c5f24a52db706f9016155293c066756d && git merge --no-ff b2f55b4eb7e8e029c1df489121a97f18c7814370

node scripts/docs-audit/affected-docs.mjs --json 301b7c11c5f24a52db706f9016155293c066756d

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

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

席位核对

L1 review · REWORK (paper only; the code is accepted) · Head-sha: b2f55b4eb7e8e029c1df489121a97f18c7814370 · card #34672 (insert half, narrowing) · read 2026-11-18T02:26Z

This is a full review: there is no earlier L1 record. I read the whole diff from merge-base eb7b09d4 (11 files, +450 / -103), plus:

  • claim 6962699354;
  • premise reading 6963917179;
  • amendment 6963962011 (route A, conditions 1–5);
  • dev report 6967101808.

The history has 3 commits and 2 pure main merges, and nothing was rewritten.

The lock (engine-top-level.ts).

  • withSummaryRollUpsReadonly is now the single way the roll-up lock is spelled, and both static-readonly views read it.
  • Create side. insertStaticReadonlySubject applies it before staticReadonlyInsertSubject judges the schema, so the sys_ and managedBy exclusions still hold. The pre-hook withhold and the post-hook strip read the same subject, so beforeInsert is never handed a value that will not be stored.
  • Update side. updateStaticReadonlySubject reads the same helper, so it answers as before.
  • Exemption. isSystem runs none of these passes: seed loads, installs, historical imports and the recompute keep their value. The rename summaryFieldsLockedOnUpdate → summaryFieldsLockedOnWrite has no caller outside objectql/src.

The seed (engine-insert.ts, condition 1).

  • staticReadonlyCreateStrip re-runs initializeSummaryFields over the stripped row and copies the result back for taken keys that are still null. The column then starts at 0 for count/sum and stays empty for min/max/avg, the same as a create that never named the field. The readonly: true → null defect is gone.
  • The re-seed sits inside the branch that runs only after the re-default's permission resolution succeeded. On failure the row comes back as it arrived, as before.

Condition 2 (Console). The Console sends no summary value on create: sanitizeFormData drops COMPUTED_FIELD_TYPES, and its two existing pins pass. The schemaless customFields edge is now dropped by the engine.

Condition 4 (pins).

  • Each forced edit states its new expectation. Two examples: the batch seed case and the "author supplied" case now write as isSystem, with a new ordinary-caller case that drops the value and seeds the column; the REST blank-typed cases expect droppedFields: [{ … fields: ['f_summary'], reason: 'readonly' }].
  • 14 engine pins cover the REST shape, batch, strict refusal, readonly: true, the isSystem exemption and preserveAudit with no exemption. There are 3 REST import pins.
  • The body reports two ablations: lock off turns 16 red and re-seed off turns 10 red, with the references staying green. I did not re-run them.
  • fields.mdx describes both verbs.

Paper.

  • Changeset levels. fix(objectql)! is a patch, with Clause-②: no (narrowing), Metadata-protocol: none and ADR-0087 not-required. Check Changeset's LEVEL AXIS and the ADR-0087 step pass at this head.
  • Migration line (condition 3). It names REST, import and MCP, with isSystem as the server-side route.
  • Battery (condition 5). It ran on this exact head, b2f55b4e: 4072/68, VERDICT 0.
  • Governance. Not governed.

Gates at this head (latest attempt per check): 1 failed (Check Changeset), 15 success, 15 skipped, 21 still running. Check Changeset is red only on the foreign-changeset rule (#17712) for .changeset/34672-summary-readonly-on-update.md, the declared DELIBERATE CORRECTION; every other axis in that job is green. The correction is the right class. #34752's pending note says "a create keeps a value sent for a summary field", and this PR makes that false, so restoring it would ship a false sentence. Both rewritten sentences are quoted in the body. Per the gate's own text, the seat confirms it by its record.

Should-fix (blocks; paper only)

Owed, for the seat:

  1. The narrowing contract review, at tier.
  2. Your record confirming the DELIBERATE CORRECTION of fix(objectql)!: a roll-up summary field is read-only on update whether or not it declares readonly: true #34752's update note. Check Changeset stays red until then.

This comment readies, queues and arms nothing.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Contract-review-claim: session_01WGufzgh1zkZzDXL36ckWAG · head b2f55b4eb7e8e029c1df489121a97f18c7814370 · 2026-11-18T02:28Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

席位核对

L1 same-head review · ACCEPT · Head-sha: b2f55b4eb7e8e029c1df489121a97f18c7814370 · card #34672 (insert half, narrowing) · read 2026-11-18T02:28Z

This follows L1 6967162172 (REWORK, paper only) at the same head. The code is unchanged.

  • S1 is closed. Claim amendment 6967174314 on objectql: a Field.summary roll-up without readonly: true accepts a person's write — REST PATCH and import store the typed value until the next recompute #34672 adds packages/rest/src/import-summary-update-lock-34672.test.ts and .changeset/34672-summary-readonly-on-update.md to the surface, and gives the reason for each. All 11 files of the diff now lie inside the claim as amended.
  • This L1 also accepts the DELIBERATE CORRECTION. It applies to .changeset/34672-summary-readonly-on-update.md, and both rewritten sentences are quoted in the PR body. The gate's text names the dispatching seat's record as the confirmation, so the seat's ACCEPT or contract-review PASS is the record that counts. This L1 is not.
  • Gates at this head (latest attempt per check): 1 failed (Check Changeset), 23 success, 15 skipped, 14 still running.

No new findings.

Owed, for the seat:

  1. The narrowing contract review, at tier.
  2. Its record confirming the DELIBERATE CORRECTION. Check Changeset stays red until then.

This comment readies, queues and arms nothing.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: b2f55b4eb7e8e029c1df489121a97f18c7814370
Local-runs: none
Scope: packages/objectql/src/engine-top-level.ts, packages/objectql/src/engine-insert.ts, packages/objectql/src/validation/rule-validator.ts, packages/objectql/src/engine-summary-update-lock.test.ts, packages/objectql/src/summary-rollup.test.ts, packages/objectql/src/engine-blank-typed-value-door.test.ts, packages/rest/src/import-summary-update-lock-34672.test.ts, packages/rest/src/rest-data-blank-typed-value.test.ts + read, not reviewed: packages/spec/src/data/field-value.zod.ts, packages/spec/src/data/field.zod.ts, packages/spec/src/kernel/execution-context.zod.ts, packages/objectql/src/engine-summaries-and-expansion.ts, packages/objectql/src/engine-validate.ts, packages/rest/src/import-prepare.ts, packages/rest/src/form-routes.ts, packages/core/src/utils/import-runner.ts, packages/metadata-protocol/src/seed-loader.ts, packages/metadata-protocol/src/protocol-data-writes.ts, packages/mcp/src/stdio-data-bridge.ts, packages/mcp/src/mcp-http-tools.ts, packages/runtime/src/domains/mcp.ts, packages/services/service-automation/src/builtin/crud-nodes.ts, packages/lint/src/validate-readonly-flow-writes.ts; the two changesets and content/docs/data-modeling/fields.mdx read only for the migration line and the deliberate correction
Security-touching: yes

PR #35089 (card #34672, insert half, route A). Net diff read as eb7b09d4d2..b2f55b4eb7 (the head is a merge of main at eb7b09d4d2): 11 files, +450 / -103, the same list GitHub serves for the PR. Inputs: the card body and all 17 comments, the PR body, file list and comments, the check-runs on the head (read 2026-11-18T02:35Z), the npm registry metadata of @objectstack/objectql.

① Derived judgments

Accept-set changes the diff implies, each read in the code at the head:

  1. A non-system create no longer stores a caller's value for a roll-up summary field: right. insertStaticReadonlySubject (engine-top-level.ts) now judges withSummaryRollUpsReadonly(schema), so every type === 'summary' field reads as readonly: true for the three create-side static passes that share that one view: the pre-hook withhold (withholdInsertReadonlyFromHooks), the post-hook strip (engine-insert.ts, staticReadonlyCreateStrip) and the insert-mode preview (engine-validate.ts). All three sit behind !context?.isSystem. Every create door ends in engine.insert (insertMany is insert with __partialRowErrors), so no door is left on the old answer.
  2. The taken column starts at the empty-child-list seed: right. staticReadonlyCreateStrip re-runs initializeSummaryFields over the stripped row after the re-default and copies back only taken keys that are still null. initializeSummaryFields seeds 0 for count / sum and nothing for min / max / avg, and never overwrites a non-null value, so a non-summary taken key and a taken key with its own defaultValue are untouched. The seed is an in-memory fill, no query.
  3. The declared readonly: true roll-up no longer lands null on such a create (route condition 1): right. Same four lines; pinned by "the declared readonly: true roll-up alone lands 0, not null", which asserts the driver's create payload.
  4. isSystem is the only exemption: right. Seed loads, package installs and @objectstack/verify fixtures write under SEED_WRITE_EXECUTION_CONTEXT (isSystem: true); treatAsHistorical is refused for every non-system caller at the import doors (importControlOptOutRefusal, import-prepare.ts:431-437), so a historical import is a system write. preserveAudit without isSystem gets nothing, as for every other read-only column on create (the 2026-08-08 ruling in rule-validator.ts), and is pinned.
  5. sys_ objects and the platform-internal managedBy buckets stay outside the create lock: right as declared. The flag is added before staticReadonlyInsertSubject judges the schema, so its two object-level exclusions hold. This leaves the create side narrower than the update half (which locks every object); the changeset says so, and no platform object declares a summary field at this head.
  6. The update half answers as before: right. updateStaticReadonlySubject reads the same helper; the result is the schema with the same fields flagged, organization_id removed under the same condition.
  7. Public surface: none moved. summaryFieldsLockedOnUpdate becomes summaryFieldsLockedOnWrite; it is a module export of engine-top-level.ts with no reference outside packages/objectql/src and none in src/index.ts. No spec file, baseline, drop reason or error code changes.

What an existing caller sees, door by door (drop unless stated; refusal only under the in-process strictReadonlyWrites option, which no REST, MCP, import or flow door passes):

Door Before At this head Told?
REST POST /api/v1/data/:object stored as sent dropped; 0 for count/sum, empty for min/max/avg droppedFields, reason readonly (pinned over HTTP + SQLite)
REST batch / createMany / composite stored as sent same the same createData / insertMany report (read, not pinned for a summary)
Import insert, and the rows an upsert creates stored as sent same per-row droppedFields, dry run and commit (pinned)
MCP create_record, HTTP transport stored as sent same the protocol's create answer carries droppedFields (read, not pinned)
MCP create_record, stdio bridge stored as sent same not told: see N1
Flow create_record, not run as system stored as sent same droppedFields and a warning on the node output
Flow create_record, runAs: 'system' stored stored n/a
Public form submit (anonymous) stored as sent same not told: the answer is the id only (see N2)
A hook's or other server code's insert without isSystem stored as sent same server WARN, onFieldsDropped if passed
Seed loads, package installs, historical imports, the recompute stored stored n/a
insert-mode preview (validate) no drop reported reports the drop pinned

Forced pin edits, each read against its old text: none is weakened to green.

  • engine-summary-update-lock.test.ts: "INSERT is not narrowed" is inverted, same payload, now asserting the report and the stored 0.
  • summary-rollup.test.ts: the two "author supplied" cases keep their assertions under isSystem: true, and a new ordinary-caller case asserts the opposite (0 and 0), so both sides of the boundary are pinned where one was.
  • engine-blank-typed-value-door.test.ts: the insert cases now assert f_summary is absent from the driver payload, a stricter statement than the old null; every other typed column keeps its assertion.
  • rest-data-blank-typed-value.test.ts: the fixture seed moves to isSystem (the one writer that may set it), and the valid-value case asserts droppedFields and a null column, with the reason stated (that fixture's roll-up declares no summaryOperations, so nothing seeds it).
  • New: 14 engine cases and 3 REST cases, covering both seed families, batch, insertMany, strict refusal, preview, the hook view, children stored before the parent, isSystem, preserveAudit, sys_.

Gate verdicts on the head at 02:35Z: 26 success, 15 skipped, 1 failure, 11 with no conclusion yet. The failure is Check Changeset, and its log shows one red step only, the foreign-changeset rule on .changeset/34672-summary-readonly-on-update.md; the same job prints the level axis, the ADR-0087 registration and the no-major check green. Test Core (1/10) to (10/10) and Type Check · workspace were still running: this record does not answer them, and the landing reads their conclusions. Dogfood Regression Gate, Build Core, Type Check · source gates, Type Check · debt ledger, the lint families and Governed Surface Queue Guard are green.

② Semver level

patch on @objectstack/objectql, fix(objectql)! with a BREAKING banner: matches what the diff publishes. One package's behaviour changes, no schema key, accepted metadata value, export or baseline moves, and the Check Changeset level axis reads it so on this head ("a non-protocol change at patch, its BREAKING banner and ADR-0087 disposition untouched by the level").

Clause-②: no (narrowing). Right: a create that stored a caller's value now drops it, nothing is widened.
Metadata-protocol: none. Right: nothing an author writes in metadata is accepted, refused or read differently; the same line was judged right for the update half.
ADR-0087 not-required (no-migration-prescription): right, nothing stored is rewritten and the fix is one sentence, which the body carries.

The migration line is present and names REST, import and MCP clients and the isSystem route for server code. It is accurate for what the engine does; its "reported in droppedFields" is not true of one MCP transport (N1), and the door list omits two doors that are narrowed too (N2).

③ Boundary flags

  • open_questions: none in report 6967101808.
  • SQL push-down: no new id materialisation, read or in-app join. The re-seed is initializeSummaryFields, a pure fill over the row in hand.
  • Flag, check-empty-changeset red by design: answered, see the confirmation line under ④.
  • Flag, check:type-check-debt NOT MEASURED locally: answered by CI, Type Check · debt ledger is success on this head.
  • Flag, overlap with chore: version packages #33849 (Version Packages) on the corrected changeset: accepted, that PR is regenerated from main. One consequence the seat should hold: the corrected note says the create side is narrowed "in the same release". That is true only if this PR lands before a release consumes the update note. If a release is cut first, the edit to that file has nothing to apply to and the create changeset stands alone, which it can.
  • Flag, deviations (battery run before pr_create; the local merge message amended before its first push; the (wip) subject left in history): no contract effect.
  • Flag, out-of-scope note (a Console form built only from inline customFields sanitizes without a schema): harmless as the dev says, the engine now drops and reports it. Not reviewed: no ui/ path is in the diff.
  • Flag, file surface: the two paths L1 found outside the amended claim are inside it since amendment 6967174314.
  • Flag, the ruling of record: amendment 6963962011 records route A as the seat's ruling, relayed, where the seat's earlier note 6949162788 said the insert half needed a maintainer ruling. ④ below finds the narrowing enforces what the spec already states, which is the ground the amendment gives. This record is not a maintainer ruling and does not stand in for one; whether the seat's word is enough for this route is the seat's to cite, not escalated here.
  • Security-touching: yes is meant. The changed hunks extend the server-enforced static readonly write lock, which content/docs/protocol/objectql/security.mdx and the authz conformance matrix (readonly-static-write) class as security enforcement, and they restate its isSystem exemption. Nothing here is an undisclosed mechanism: the card is public and describes it.

④ Design judgment

The narrowing makes the spec's own statement real; it takes no declared capability away. On main the published spec lists summary in COMPUTED_VALUE_TYPES, "Server-computed types: never client-written" (field-value.zod.ts), and FieldSchema.summaryOperations says the engine recomputes the value. No ADR and no spec text declares a starting value. What said otherwise was a code comment (the #6014 note in rule-validator.ts), a descriptive "Unchanged ... stored as sent" line in older changelogs, and the fields.mdx sentence #34752 added on 2026-11-17, which has not shipped in a release. The two uses the note protected, seed data and historical imports, write as the system principal and keep their value. The only caller left on the old answer was the card's own actor.

Dropped, not refused, is the card's answer. The card's Expected reads "the write is dropped and reported in droppedFields, as already happens for formula and readonly fields"; route A adds the seed. The diff does exactly that, through the existing strip, with reason readonly and no new code path for reporting.

Tried to break it, in the code:

  • A second view that could disagree: there is none. The withhold, the strip and the preview read insertStaticReadonlySubject; a hook is shown the seed and the stored row carries the seed (pinned).
  • The rule-validator 里 RUNTIME_OWNED_FIELD_TYPES 的排除理由对 summary 是错的:summary 是「存储列」不是「读时计算」 #6014 hazard (a strip that leaves null behind a successful write): closed by the re-seed, and the ablation in the PR body turns the pin red without it.
  • The re-seed overwriting something it should not: it writes only taken keys that are null after the re-default, so a field defaultValue and a hook's own write (kept by hookWrittenKeys) survive.
  • A failed permission resolution in the re-default returns the row as it arrived, caller's value included, but with error set: insert throws or culls that row and validate throws, so that row is never stored.
  • A historical import losing its totals: not reachable, treatAsHistorical is system-only at both import doors.
  • A restore from the recycle bin re-creating a row with its totals: not a create (ADR-0148 D2), it does not pass this strip.
  • A parent created after its children: it starts at 0, not the true sum, until the next child write. That is the answer any create that names no roll-up already gets, and the changeset says the column "starts as if no value had been sent". Not a regression of this diff.

The rewritten #6014 note agrees with the code it describes: summary stays out of RUNTIME_OWNED_FIELD_TYPES, for the two reasons it gives (that strip honours preserveAudit, and it runs after the seed pass).

No must-fix, no should-fix.

Nits (none affects the engine's answer or the contract; each is prose or a follow-up outside this diff):

  • N1 (nit) — The changeset's migration line and fields.mdx say an MCP create reports the drop in droppedFields. The stdio bridge (packages/mcp/src/stdio-data-bridge.ts, create) calls engine.insert with no onFieldsDropped and answers { ...data, ...written }, so on that transport the caller is not told, and where the write result omits the key (a min / max / avg roll-up on a driver that returns the row it was handed) the answer can echo the caller's value. This predates the PR and is the same for every readonly column and for the update half; the PR widens how often it is met. Fix on the prose faces (say "on the HTTP transport"), or leave it and file a follow-up card for the bridge.
  • N2 (nit) — The changeset's door list omits two doors that are narrowed with the rest: the public form submit (packages/rest/src/form-routes.ts, anonymous, the answer is the id only, so the drop is not shown to the submitter) and a caller's overrides on clone (packages/metadata-protocol/src/protocol-data-crud.ts, which reports the drop through the same listener as a create). Both end in the engine's insert. Prose only.
  • N3 (nit) — Follow-up, outside this diff: packages/lint/src/validate-readonly-flow-writes.ts knows only a declared readonly: true, so a user-run flow whose create_record or update_record sets a roll-up gets no lint finding although the engine now drops the value on both verbs; and the static readonly section of content/docs/protocol/objectql/security.mdx does not name the implicit roll-up lock. Both gaps date from the update half.

Deliberate correction confirmed: .changeset/34672-summary-readonly-on-update.md (the pending note of #34752). It is unpublished: the file on main is still blob c33d0f79e0, added by a825152ea7 on 2026-11-17, and the newest @objectstack/objectql on npm is 18.5.0, published 2026-11-15; packages/objectql/CHANGELOG.md at this head carries no entry for it. The PR body declares the correction, names the note and quotes both rewritten sentences. Judged sentence by sentence at this head:

  • Old: "An import with writeMode: 'upsert' drops the value on the rows it updates and keeps it on the rows it creates." False at this head: the created row's value is dropped and reported (pinned by the upsert case in import-summary-update-lock-34672.test.ts).
  • New: "An import with writeMode: 'upsert' drops the value on the rows it updates; the rows it creates are covered by the create-side entry (34672-summary-readonly-on-create)." True.
  • Old: "Not changed: a create keeps a value sent for a summary field as its starting value, so seed data and a historical import may still carry a pre-computed total; the next child write replaces it with the computed one." False at this head for every non-system create.
  • New: "Not changed by this entry: the create side, which the create-side entry (34672-summary-readonly-on-create) narrows in the same release; seed data and a historical import, which write as the system principal, still carry a pre-computed total on create." True, with "in the same release" holding as long as this PR lands before a release consumes the note (③).
    Restoring the base text would put two false sentences into the next release note. The rest of that file is unchanged.

Implemented-by: claude/issue-34672-summary-insert-readonly
Reviewed-by: session_01WGufzgh1zkZzDXL36ckWAG

VERDICT: PASS

@objectstack-fleet

objectstack-fleet Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Hand-off · PR #35089 · card #34672 (insert half) · 2026-11-18T03:22Z

Seat 3 is handing over to the next PM. Everything needed is on GitHub; nothing lives in a thread or a scratchpad.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Maintainer ruling · 2026-11-18T03:22Z: route A is approved for the insert half of #34672. Roll-up summary values sent on create are dropped, the same as on update. Asked by seat 3; Yibo Wang answered 「A」 at 2026-11-18 03:21Z.

This settles the hold that seat note 6949162788 placed. The seat's at-tier L2 PASS at b2f55b4, which carries the deliberate-correction confirmation, stands. #35089 now lands through the normal flow.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Landing · PR #35089 (card #34672, insert half) · head b2f55b4eb7 · 2026-11-18T03:24Z

  • Ruling: the maintainer approved route A for the insert half, ruling 6968044993. That lifts the hold named in hand-off 6968036744.
  • Records at this head: L1 same-head ACCEPT 6967193871 (after the paper-only REWORK 6967162172), and the seat's narrowing L2 PASS 6967339515, which confirms the deliberate changeset correction.
  • Narrowing ((narrowing) arm): the full dogfood battery is green on this exact head, sha-first os-dev-report 6967101808 on objectql: a Field.summary roll-up without readonly: true accepts a person's write — REST PATCH and import store the typed value until the next recompute #34672.
  • check-governed-merges.mjs --pr 35089: NOT governed, 0 of 11 paths, +450 / -103. CI at b2f55b4e: 39 success, 15 skipped, 1 failure, Check Changeset (PR Automation). That check is not required (ruleset 12119582) and is red on the confirmed correction.
  • This stroke marks the PR ready and arms auto-merge. Follow-up nits N1, N2 and N3 are filed to triage once it merges.

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

2 participants