Skip to content

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

Closed

Description

@os-bob

What

A Field.summary roll-up is computed by the engine from its child rows. Unless the author also adds readonly: true, a person's write to it is accepted and stored. Both PATCH /data/<obj>/:id and import writeMode: 'update' return 2xx, and the typed value stays until something triggers a recompute.

No author means a roll-up to be hand-written. The lint and validate gates do not flag a summary that lacks readonly.

Repro (app project, 18.5.0, booted via @objectstack/verify)

  • crm_quote_line_item.cb_converted_quantity = summary (sum of order quantities by source_quote_line), with no readonly.
    • A sales rep PATCHes a draft line with { cb_converted_quantity: 90 } and gets 200. The stored value is 90 while no order exists. It survives the quote's acceptance, and downstream defaults read it.
  • crm_opportunity.cb_actual_won_amount = summary over orders. A manager or admin PATCH on an open opportunity, or an import update, changes it from 619469.03 to 2.
  • The existing crm_account.cb_order_amount summary behaves the same way: a manager PATCH sets it to 55.
  • Adding readonly: true makes every one of these writes get dropped, and the roll-up still recomputes.

Expected

A summary field is engine-owned. It should be treated as read-only for every person and import write, whether or not the author spells out readonly: the write is dropped and reported in droppedFields, as already happens for formula and readonly fields. Failing that, os lint should refuse a summary that does not set readonly: true.

Consumer

An app's 「累计已转吨数」, 「实际成交额」 and customer order totals are business figures that must not be typeable. The app is adding readonly: true to each summary in the meantime. This is the declared way to mark a field read-only, not a workaround.

Activity

  1. objectstack-fleet commented on Nov 17, 2026

    @objectstack-fleet
    Contributor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Path: none

    Triage: first touch → p1 · domain:server · pm:queue · 2026-11-17T05:44Z

    ⛔ Not a claim.

  2. added
    domain:server
    pm:queue
    priority:p1
    on Nov 17, 2026
  3. objectstack-fleet commented on Nov 17, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack#2 · os-steve · session_01ADHkmSLi1reMd27fT62jJ3

    Claim · #34672 · 2026-11-17T09:14Z

    Claim: PM loop, area o2-E of seat repo:objectstack#2 (seat post #34478). A large card: the fix drops a person's or an import's write to a Field.summary roll-up that is stored today, a narrowing, so it owes the full dogfood battery and lands through the seat's Tier H path (rule card #34424, area-order 04:14Z). Built in a card thread the seat opens; the area holds the lease, sends L1 and L2. Serial: after PR #34709 (#34465, same roll-up family, engine-update.ts), before #33787's execution cards
    Session: session_01ADHkmSLi1reMd27fT62jJ3
    Thread session: the card thread the seat opens (named in a follow-up line on this card)
    Account: os-steve
    Branch: the card thread's branch (named in the follow-up line)
    Worktree: objectstack (the card thread's own container)
    Domain: domain:server
    Seat: repo:objectstack#2
    File surface: packages/objectql/src/engine-top-level.ts (the write strips: stripComputedWriteFields and the readonly strip, and their DroppedFieldsEvent report), packages/objectql/src/engine-update.ts and packages/objectql/src/engine-insert.ts (where the strips run; the summary recompute's own write, marked SUMMARY_RECOMPUTE_WRITE in engine-summaries-and-expansion.ts, must stay exempt), packages/objectql/src/readonly-strict-errors.ts (the drop reason and its phrase under strictReadonlyWrites), their tests, the field docs under content/docs/**, one changeset (stop on breach; explain in the report). A new drop reason or a new spec key is a contract change: stop and report before it
    Container & model: L, mode:thread, model: default, effort: high. Narrowing: the PR declares it and carries the full dogfood battery pinned to its head
    Clause-②: no
    Metadata-protocol: none
    Responsibility: objectstack platform: packages/objectql/src/engine-top-level.ts, the computed-field strip takes only type 'formula'; a 'summary' roll-up without readonly: true passes every person and import write to the driver, which stores the typed value until the next recompute | none: lint and validate do not flag a summary without readonly | app projects with summaries that omit readonly (the card's 18.5.0 repro: crm_quote_line_item.cb_converted_quantity, crm_opportunity.cb_actual_won_amount, crm_account.cb_order_amount)
    Pre-claim lane: repo:objectstack area o2-E — the write path in packages/objectql (domain:server); the seat routed it here
    Pre-claim deps: triage first touch 6939838658 (p1); not part of #34571 (the seat's reading). In-flight surface: PR #34709 (#34465, this area) and PR #34565 (#33876, this area) edit files on this surface; the card thread starts from main after #34709 merges and checks against #34565 with git merge-tree before its PR (54 open PRs read in this act)
    Prior rulings read: readonly,true,objectql,field,summary,roll-up,accepts,person,write,rest,patch,import (+5 more) → 332 hits; ADR-0061 D2, ADR-0078 Decision §6, ADR-0098 Decision §2, ADR-0098 Decision §4, ADR-0144 D5, ADR-0007 Decision §8, ADR-0014 Decision §2; thread: none
    Ruling-ref: none (the card's own Expected: engine-owned, dropped and reported in droppedFields like formula and readonly fields; failing that, lint refuses a summary without readonly)
    Thread-read: 6939838658
    Premise: holds (read on origin/main: stripComputedWriteFields in engine-top-level.ts filters def?.type === 'formula' only; Field.summary builds type: 'summary'; the recompute writes the parent through this.update with system context and the SUMMARY_RECOMPUTE_WRITE marker)
    Serial constraints cleared: #34709 (lands first), #34565 (merge-tree before the PR)

  4. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 17, 2026
  5. objectstack-fleet commented on Nov 17, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack#2 · os-steve · session_01ADHkmSLi1reMd27fT62jJ3

    Claim follow-up · #34672 · 2026-11-17T09:17Z

    Thread session: session_01ADHkmNeSWABJwKsumBUZq9 (the card thread the seat opened for this card; it reports to area o2-E)
    Branch: claude/project-thread-sd08sq
    The rest of claim 6943806073 stands.

  6. objectstack-fleet commented on Nov 17, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack#2 · os-steve · session_01ADHkmSLi1reMd27fT62jJ3

    Claim amendment · #34672 · 2026-11-17T09:20Z

    Route (area's decision, no contract change): a Field.summary roll-up is treated as implicitly read-only on the update side, through the static readonly strip (reason readonly, the autonumber precedent of #5503), so system writes, the recompute's own write included, stay exempt. Covers by-id and predicate updates, import writeMode: 'update' and the validate preview. An insert carrying a summary value stays as #6014 designed it; that is reported as a separate finding, not changed here.
    File surface (amended): adds one new test-only file under packages/rest/src/ (an import writeMode: 'update' through the HTTP route whose summary value is dropped and reported in that row's droppedFields, after import-row-dropped-fields-20701.test.ts).

  7. objectstack-fleet commented on Nov 17, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack#2 · os-steve · session_01ADHkmSLi1reMd27fT62jJ3

    Claim amendment · #34672 · 2026-11-17T11:07Z

    File surface (amended): adds packages/rest/src/rest-data-blank-typed-value.test.ts, a forced test change of this card's narrowing (PR #34752). That pin (#20308's SQLite twin) sends a blank to every typed column on PATCH, batch update and updateMany and asserts a stored null; a summary is now read-only on update, so its blank is dropped and the stored value stays. The three update assertions for the summary column now expect the stored value; every other column still expects null, and the insert assertions are unchanged. The PR body names it.

  8. objectstack-fleet commented on Nov 17, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack#2 · os-steve · session_01ADHkmNeSWABJwKsumBUZq9
    os-dev-report

    {
      "issue": 34672,
      "status": "done",
      "branch": "claude/project-thread-sd08sq",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/34752",
      "session": "session_01ADHkmNeSWABJwKsumBUZq9",
      "premise_still_valid": true,
      "summary": "Premise measured on origin/main: a person's PATCH and an import update (writeMode update) of a summary field without readonly: true were stored with no drop and no droppedFields entry. Fix: updateStaticReadonlySubject (packages/objectql/src/engine-top-level.ts), the one schema view every update-side static readonly pass judges, now reads every summary field as readonly: true via the new summaryFieldsLockedOnUpdate. By-id, predicate (multi), the hide pass and the update preview drop the key with reason readonly; strictReadonlyWrites refuses it (ERR_READONLY_FIELD_REJECTED); isSystem writes (recompute, backfill, enable refresh) are exempt as before. No new drop reason, no spec key; insert unchanged per the #6014 note.",
      "tests": "New: packages/objectql/src/engine-summary-update-lock.test.ts (11 cases) and packages/rest/src/import-summary-update-lock-34672.test.ts (3 cases: PATCH, import update dry run + commit, readonly: true control). Forced changes: engine-blank-typed-value-door.test.ts and rest-data-blank-typed-value.test.ts (summary blank on update is now dropped). objectql typecheck + full suite on 65f7837f: Test Files 607 passed (607), Tests 13617 passed (13617). REST pins on 76acd4f2: Test Files 3 passed (3), Tests 20 passed (20). Ablation on 7aebcc32 (summaryFieldsLockedOnUpdate(schema) -> []): Tests 6 failed | 14 passed (20), as predicted; restore blob c112f3aea19e == HEAD.",
      "gates": "dispatch-gates --commands on 76acd4f2: 100 commands, each exit 0 (check:type-check-debt first exit 3 on a lock-queue timeout, re-measured OK); --ran: 100 run, 0 NOT-MEASURED. CI on 76acd4f2: 40 check-runs success, 15 skipped, 0 failed (Test Core 10/10 + aggregate, Lint, Type Check, Check Changeset, PR-body guards).",
      "dogfood_battery": "65f7837f (main merged; final head 76acd4f2 differs only in a rest test file the dogfood package does not read) · VERDICT command-exit 0 · Test Files 478 passed | 3 skipped (481) · Tests 4055 passed | 68 skipped (4123) · no failure. Build 119/119. Same counts on a4f80eb9.",
      "mcp_calls": "9 — issue_read x2, pull_request_read x5, get_job_logs x2 (all reads)",
      "api_writes": "3 — relay pr_create (draft PR #34752), relay issue_patch (PR #34752 body), this os-dev-report comment via post-stamped; plus git pushes to claude/project-thread-sd08sq (not REST)",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "class: a · reach: POST /api/v1/data/:object (and import writeMode insert) with a value for a summary field without readonly: true stores the caller's value until the next child write recomputes it · evidence: engine-summary-update-lock.test.ts 'insert keeps a caller's initial value'; rule-validator.ts RUNTIME_OWNED_FIELD_TYPES #6014 note keeps summary out of the insert strip on purpose (seed data, historical import totals) · dedupe words: summary insert initial value readonly roll-up create",
        "carrier: PR #34752 Acceptance notes · noted, not filed (changing it overturns the #6014 design note; a seat/maintainer call)"
      ],
      "files_changed": [
        "packages/objectql/src/engine-top-level.ts",
        "packages/objectql/src/engine-summary-update-lock.test.ts (new)",
        "packages/objectql/src/engine-blank-typed-value-door.test.ts (forced)",
        "packages/rest/src/import-summary-update-lock-34672.test.ts (new, area-approved surface)",
        "packages/rest/src/rest-data-blank-typed-value.test.ts (forced, area-approved surface)",
        "content/docs/data-modeling/fields.mdx",
        ".changeset/34672-summary-readonly-on-update.md"
      ],
      "line_budget": "n/a — no skill text touched",
      "deviations": "Opened before #34709 landed, on the seat's go-ahead; merge-tree of 76acd4f2 against #34709 head 18f3774a exits 0. Final head 76acd4f2; contract review owed (Tier H, narrowing), PR stays draft until os-zhuang approves."
    }

    Stamped 2026-11-17T12:18Z.


    Generated by Claude Code

  9. objectstack-fleet commented on Nov 17, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack#2 · os-steve · session_01ADHkmQ2SN4K183oqAvUajA

    Scope note · 2026-11-17T12:31Z

    The card's Expected section reads "every write by people and imports". PR #34752 closes the update side: a summary field is read-only on every update. The insert side is left as it is by design, not by omission: a create that carries a summary value stores it until the next child change recomputes it, which #6014 kept on purpose so that seeds and historical imports can carry their initial values (the comment beside the summary handling in rule-validator.ts records why).

    The seat therefore scopes this card to the update side and keeps Fixes #34672 on PR #34752. Changing the insert side is a product-semantics change to #6014's design, not a gap in this card; if it is wanted it is a new card with its own ruling. The PR's changeset and docs state the insert behaviour, and the maintainer summary of the seat record names this scoping for the approver.

  10. objectstack-fleet commented on Nov 17, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack#2 · os-steve · session_01ADHkmSLi1reMd27fT62jJ3

    Hand-off · 2026-11-17T12:40Z · repo:objectstack#2 → repo:objectstack#3 (maintainer order 2026-11-17 12:33–12:34Z)

    • PR fix(objectql)!: a roll-up summary field is read-only on update whether or not it declares readonly: true #34752, current head 91202760fd51b93095440d60dcb68810e7a1ce83: one prose-only commit (changeset + content/docs/data-modeling/fields.mdx) over the reviewed head 76acd4f2.
    • Records on file: L1 ACCEPT 6947895896 and L2 PASS 6948085736, both on 76acd4f2; none on 91202760.
    • Open items: L2 N1 (state the update-side answers: upsert drops on updated rows and keeps on created rows; a historical import keeps the value; undoing an older import does not restore it) is answered by 91202760 and in the PR body, not re-reviewed. The insert side stays out of scope (seat ruling 6948112119, the rule-validator 里 RUNTIME_OWNED_FIELD_TYPES 的排除理由对 summary 是错的:summary 是「存储列」不是「读时计算」 #6014 design).
    • Next: awaiting approval and landing. A narrowing, so Tier H (os-zhuang) before landing; it stays a draft, not armed. CI on 91202760 was still running at hand-off. The last dogfood battery ran on 65f7837f; the new docs commit is not a base merge, so the battery gate needs a fresh run on the landing head.
    • Small-flaw rule (maintainer 12:34:45Z): when review leaves only small flaws, the PR may merge first and the flaws get their own card; a governed PR still needs os-zhuang's approval.
  11. 24 remaining items

  12. added
    pm:dispatched
    and removed
    pm:blocked
    on Nov 18, 2026
  13. objectstack-fleet commented on Nov 18, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack#1 · os-warren · session_01JQwxbaX2qDxUq9sF93EqqL

    Takeover · #34672 · PR #35089 · 2026-11-18T03:50Z

    Release: claim 6962699354 (session session_01WGufzfr1xZSFZzCR8HnqXX, account os-support-ai), handed over, not abandoned. Provenance: Warren (maintainer) to seat 3 at 03:19Z 「开发中的任务提交代码,开始写交接文件,准备交给下一个pm」「已经入队的继续跟进」 and at 03:30Z 「代码已推送,交给下一任,用信箱 交接给刚入座的 objectstack#1」, quoted in seat 3's hand-off brief on #34584 (comment 6968205670); Warren to seat 1 at 03:20Z in os-warren's fleet project 「加载最新的 pm-dispatch 技能,你接手 objectstack 全仓车道 座位1,前任已经没有token了」 (seat post #34366 comment 6968121768). Assignee os-support-ai → os-warren and lease:o3-J → lease:o1-D in this stroke.

    Claim: PM loop round 1 (area o1-D, repo:objectstack#1; takeover of open PR #35089 to follow it to MERGED and close the card out)
    Session: session_01JQwxbaX2qDxUq9sF93EqqL
    Account: os-warren
    Branch: claude/issue-34672-summary-insert-readonly (continued; no force-push)
    Domain: domain:server
    Seat: repo:objectstack#1
    File surface: unchanged, the PR's files at b2f55b4eb7e8e029c1df489121a97f18c7814370
    Container & model: no dev dispatched by this claim (landing follow-up only), effort: high
    Clause-②: no (narrowing)
    Metadata-protocol: none
    Thread-read: 6967174314
    Premise: holds — the PR at b2f55b4eb7e8e029c1df489121a97f18c7814370 carries the reviews named in the hand-off
    Pre-claim lane: the PR's paths — whole-repo lane
    Pre-claim deps: none named on the card
    Prior rulings read: maintainer ruling A 6968044993 (03:21Z)
    Serial constraints cleared: none (no code change under this claim)
    Resume-from: claude/issue-34672-summary-insert-readonly@b2f55b4eb7e8e029c1df489121a97f18c7814370

    Hand-over record: last pushed sha b2f55b4eb7e8e029c1df489121a97f18c7814370. In the merge queue since 03:25Z; the red check-empty-changeset is the deliberate correction confirmed by the seat L2 PASS at this head (brief 6968205670 §1). Merge closes the card; this seat then strips pm:dispatched and lease:o1-D.

  14. objectstack-fleet commented on Nov 18, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack#1 · os-warren · session_01JQwxbaX2qDxUq9sF93EqqL

    Close-out · #34672 · 2026-11-18T04:01Z

    Probe Reading
    PR #35089 MERGED at 2026-11-18T04:00Z through the merge queue, merge commit cc5472eb8525925916c3530dc256546991c3344b
    Card closed completed by Fixes #34672

    Delivered: the insert half (a person's initial value on a Field.summary roll-up without readonly: true is refused on create), under maintainer ruling A 6968044993. The update half landed earlier in PR #34752. Nothing remains on this card. pm:dispatched and lease:o1-D come off and the assignee is cleared in this stroke.

  15. removed
    pm:dispatched
    on Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    domain:serverpriority:p1

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions