Repository navigation
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
Conversation
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzfr1xZSFZzCR8HnqXX
…ced pins Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzfr1xZSFZzCR8HnqXX
…date note's create sentence Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzfr1xZSFZzCR8HnqXX
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzfr1xZSFZzCR8HnqXX
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzfr1xZSFZzCR8HnqXX
📓 Docs Drift Check10 anchor(s) derived from 1 changed package(s); no hand-written page names any of them. What this run could not see
Coarse fallback — 21 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 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 |
|
repo:objectstack#3 · os-support-ai · session_01WGufzi8zDwpH6wX7ZPUcHR 席位核对L1 review · REWORK (paper only; the code is accepted) · Head-sha: This is a full review: there is no earlier L1 record. I read the whole diff from merge-base
The history has 3 commits and 2 pure main merges, and nothing was rewritten. The lock (
The seed (
Condition 2 (Console). The Console sends no summary value on create: Condition 4 (pins).
Paper.
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 Should-fix (blocks; paper only)
Owed, for the seat:
This comment readies, queues and arms nothing. |
|
repo:objectstack#3 · os-support-ai · session_01WGufzgh1zkZzDXL36ckWAG Contract-review-claim: session_01WGufzgh1zkZzDXL36ckWAG · head |
|
repo:objectstack#3 · os-support-ai · session_01WGufzi8zDwpH6wX7ZPUcHR 席位核对L1 same-head review · ACCEPT · Head-sha: This follows L1 6967162172 (REWORK, paper only) at the same head. The code is unchanged.
No new findings. Owed, for the seat:
This comment readies, queues and arms nothing. |
|
repo:objectstack#3 · os-support-ai · session_01WGufzgh1zkZzDXL36ckWAG Contract reviewServed-tier: PR #35089 (card #34672, insert half, route A). Net diff read as ① Derived judgmentsAccept-set changes the diff implies, each read in the code at the head:
What an existing caller sees, door by door (drop unless stated; refusal only under the in-process
Forced pin edits, each read against its old text: none is weakened to green.
Gate verdicts on the head at 02:35Z: 26 success, 15 skipped, 1 failure, 11 with no conclusion yet. The failure is ② Semver level
Clause-②: no (narrowing). Right: a create that stored a caller's value now drops it, nothing is widened. The migration line is present and names REST, import and MCP clients and the ③ Boundary flags
④ Design judgmentThe narrowing makes the spec's own statement real; it takes no declared capability away. On Dropped, not refused, is the card's answer. The card's Expected reads "the write is dropped and reported in Tried to break it, in the code:
The rewritten #6014 note agrees with the code it describes: 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):
Deliberate correction confirmed:
Implemented-by: VERDICT: PASS |
|
repo:objectstack#3 · os-support-ai · session_01WGufzfr1xZSFZzCR8HnqXX Hand-off · PR #35089 · card #34672 (insert half) · 2026-11-18T03:22ZSeat 3 is handing over to the next PM. Everything needed is on GitHub; nothing lives in a thread or a scratchpad.
|
|
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. |
|
repo:objectstack#3 · os-support-ai · session_01WGufzfr1xZSFZzCR8HnqXX Landing · PR #35089 (card #34672, insert half) · head
|
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.mdxnow states the create side维护者速读
Field.summary)在新建时也一律只读,不管作者有没有写readonly: true。普通用户的POST、批量/复合新建、导入(insert,以及upsert新建的那些行)、MCPcreate_record、非系统身份的流程新建,送来的汇总初值都被丢掉,在droppedFields里报readonly,该列按「没有子记录」起步(count/sum为 0,min/max/avg为空);开了strictReadonlyWrites则整笔拒收。顺带修好:写了readonly: true的汇总字段,新建时若带了值,过去会落成null,现在落 0。summary属于「never client-written」的计算类型(COMPUTED_VALUE_TYPES)。席位按路线 A 裁定(认领修正 6963962011)。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
summaryfield is read-only on create too, whether or not the author declaredreadonly: true, and a create that had its value taken starts the column at the empty-child-list seed.packages/objectql/src/engine-top-level.tsinsertStaticReadonlySubject(schema, wallJudgesOrganization)is the one schema view the three create-side staticreadonlypasses read: the pre-hook withhold (whatbeforeInsertis shown), the post-hook strip inengine-insert.ts(what is stored) and theinsert-mode preview inengine-validate.ts. It now reads every roll-up asreadonly: truebeforestaticReadonlyInsertSubjectjudges the schema, so that function's exclusions (asys_object, a platform-internalmanagedBybucket) hold for roll-ups too.isSystemruns none of these passes and keeps its value.withSummaryRollUpsReadonly(schema): the one spelling of the roll-up lock, read by both the insert view andupdateStaticReadonlySubject(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).summaryFieldsLockedOnUpdateis renamedsummaryFieldsLockedOnWrite(it now answers both verbs). It is a module export ofengine-top-level.ts, not a package export:packages/objectql/dist/index.d.tsnames neither spelling.packages/objectql/src/engine-insert.ts:staticReadonlyCreateStripre-runsinitializeSummaryFieldsover the stripped row after its re-default and copies the seed back for the TAKEN keys only. Without it the strip re-ranapplyFieldDefaultsalone, so a taken roll-up landednullwhile the write succeeded: the state the summary seed exists to rule out. That already happened before this PR for a roll-up declaredreadonly: true(route condition 1); it is fixed here for both.packages/objectql/src/validation/rule-validator.ts: thesummarynote onRUNTIME_OWNED_FIELD_TYPES(the rule-validator 里 RUNTIME_OWNED_FIELD_TYPES 的排除理由对 summary 是错的:summary 是「存储列」不是「读时计算」 #6014 note) is rewritten. It keeps "do not addsummaryto this set" and says why the type rides the staticreadonlystrip instead (theisSystem-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:patchon@objectstack/objectql, BREAKING, the migration line for REST, import and MCP clients, ADR-0087not-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), realObjectQLand a recording driver,order_totalasumroll-up withoutreadonlybesideorder_total_rodeclaredreadonly: true, written as a signed-in person unless stated:0and0, reports nothing;0, the rest stored, the returned row0;readonly: trueroll-up alone lands0, notnull(the driver's create payload is asserted);nullstarting value is taken the same way and lands0;insertMany(the import commit; the row that sent a value carriesdroppedFields, the other none);strictReadonlyWrites: refused (codeERR_READONLY_FIELD_REJECTED,fields,drops,operation: 'insert'), nothing written;insert-mode preview reports the same drop;beforeInserthook is shown the seed, not the caller's value;0, not the typed value; the next child write recomputes to the true sum;isSystemkeeps90and90(seed loads, package installs, historical imports);preserveAuditwithoutisSystemis no exemption;maxroll-up (no empty-set value) is dropped and stays empty;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,droppedFieldsnames both, both columns0); importwriteMode: 'insert'dry run and commit (row 1 carriesdroppedFields, stored0); importwriteMode: 'upsert'(drops on the updated row and on the created row; a created row whose children were already stored lands0, and the next childPOSTrecomputes to51).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".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 withisSystem: 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" (0and0).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 asnull/ unchanged, and nof_summaryis sent on create, as it already was not on update (the sharedexpectTypedNullnow says so for both verbs).packages/rest/src/rest-data-blank-typed-value.test.ts: the fixtureseedhelper writes as the system principal (that is the writer that may still setf_summary: 7); "a valid value on every typed column" now expectsdroppedFieldsnamingf_summaryand the columnnull(this fixture's roll-up declares nosummaryOperations, so there is no seed).Ablation (
node scripts/ablation-replace.mjs, each leg restored to the HEAD blob withgit diff HEADempty; the objectql suites import the engine from source, so no build sits between the edit and the run):engine-top-level.tsstaticReadonlyInsertSubject(withSummaryRollUpsReadonly(schema) as any)→staticReadonlyInsertSubject(schema as any)(anchor x1 → x0, blob853f70980a4d→4c1dc5b1d8f4):Tests 16 failed | 91 passed (107). Red: the flipped insert pin, 10 of the 14 create cases, the ordinary-callersummary-rollupcase and the 4 blank-door insert cases. Green, as predicted: the baseline, the declaredreadonly: truecase (the declared flag is taken without the lock),isSystem,sys_, every update case and the system-writersummary-rollupcases.engine-insert.tsif (stripped[k] == null && reseeded[k] !== undefined) stripped[k] = reseeded[k];→void reseeded[k];(blob0b8e11afbbae→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, themaxcase,sys_, strict, preview and every update case.Acceptance notes
ObjectFormbuilds its create payload withformWritePayload(ui/packages/plugin-form/src/writePayload.ts), whose first step issanitizeFormData;ModalFormandDrawerFormcallsanitizeFormDatadirectly; the master-detail batch sanitizes child rows the same way.sanitizeFormDatadrops every field whose type is inCOMPUTED_FIELD_TYPES(ui/packages/plugin-form/src/sanitize.ts,summarya member) whenever the object schema is supplied, andObjectFormrenders 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) andui/packages/plugin-form/src/masterDetailTx.test.ts"buildMasterDetailBatch strips computed/server-managed child fields" (a childsummarydropped 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 inlinecustomFieldssanitizes with no schema, so a summary there would not be filtered client-side; the engine now drops and reports it. Noui/change..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:writeMode: 'upsert'drops the value on the rows it updates and keeps it on the rows it creates." now "An import withwriteMode: '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)."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.mjsreports 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 frommain, 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) andorigin/mainmerge cleanly.summaryFieldsLockedOnUpdate→summaryFieldsLockedOnWritehas no caller outsidepackages/objectql/src(git grep), andnode scripts/check-platform-checklist.mjs --changed-from origin/mainreports0 lost.4f08aded(Resume-from); the work was reviewed against route A and its five conditions and found complete; this round added a merge ofmainand the verification below. The(wip)subject on5430eb9ais left in history, not rewritten.Verification
Final head
b2f55b4eb7e8e029c1df489121a97f18c7814370: a merge ofmain(eb7b09d4d2, 9 first-parent commits, none inpackages/objectql) over the lost round's head4f08aded, no conflict. Every reading below ran on this head.Full dogfood battery
b2f55b4eb7e8e029c1df489121a97f18c7814370, under oneos-verify-lock.shhold (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
pnpm --filter @objectstack/objectql typecheckexit 0,pnpm --filter @objectstack/rest typecheckexit 0 (bothtsc --noEmit && pnpm check:test-typecheck),pnpm --filter @objectstack/objectql testexit 0 (Test Files 610 passed (610),Tests 13739 passed (13739)),pnpm --filter @objectstack/rest testexit 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.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)) andpnpm --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.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 asCMD :: exit N;--ranreconciliation: "101 derived, 100 run, 1 NOT-MEASURED, 0 UNRUN". 99 exit 0.node scripts/check-empty-changeset.mjs --base origin/mainexit 1, the DELIBERATE CORRECTION above (red by design until the seat's record).pnpm check:type-check-debtexit 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 printedOK — 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/maineb7b09d4d2, 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.pnpm lint,test:repo, the other packages): CI.🤖 Generated with Claude Code
https://claude.ai/code/session_01WGufzfr1xZSFZzCR8HnqXX