Skip to content

fix(objectql): an update whose every caller-supplied field is dropped is a no-op - #35594

Merged
objectstack-fleet[bot] merged 7 commits into
mainfrom
claude/issue-34746-all-dropped-update-noop
Nov 20, 2026
Merged

objectstack-fleet[bot] merged 7 commits into
mainfrom
claude/issue-34746-all-dropped-update-noop

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Tesla · project thread

Fixes #34746
Clause-②: no
Metadata-protocol: semantic
Skills-docs: follow-up #35605

维护者速读

  • 用户能看到什么变化:用户、导入或自动化提交的一次更新里,如果所有字段都是只读字段或被条件锁住的字段,系统不再改这条记录,记录头的「最后修改人/时间」保持原样,返回原记录,并照常提示哪些字段被丢弃;单条更新和批量更新都一样。
  • 为什么做:什么都没改的更新以前会被记成「刚被某人修改」,还会白白触发「更新后」的流程和触发器,影响审批和审计记录的可信度。
  • 出错会怎样:只有「所有字段都被丢弃」的更新受影响,依赖这种更新去触发「更新后」自动化的应用会不再触发;只要还有一个字段真的写入,行为与以前完全一样;可以直接撤回本次改动恢复旧行为。
  • 要你做什么:无。

What changes

packages/objectql/src/engine-update.ts, both dispatch branches. After the two read-only strips, the engine asks one question (everyCallerKeyDropped): did the strips take every key the caller supplied? When yes, the update is a no-op:

  • no driver.update / driver.updateMany call, so no updated_at / updated_by stamp lands;
  • afterUpdate does not run; no roll-up recompute, no realtime change event;
  • by-id answers the current record: the prior row the not-found gate already read, so no second fetch; predicate answers 0, the written-row count that branch already returns;
  • every drop is reported as before (onFieldsDropped, so the REST droppedFields answer is unchanged).

The rule as implemented. All three must hold:

  1. the caller supplied at least one key, the row's own address id aside. An empty payload is unchanged;
  2. every one of those keys was taken by an engine strip on this call: read-only, readonlyWhen, computed, or primary key. Drops are now recorded whether or not a listener is registered. Emission is unchanged;
  3. the payload the strips leave holds only the platform update stamps (updated_at, updated_by, which the builtin sys_stamp_audit_update hook writes) plus, by-id, the address. A key a beforeUpdate hook wrote survives, so that update is not all-dropped and takes the unchanged path.

beforeUpdate runs before the strip, as it must: the strip can only judge the post-hook payload. Strict mode is unchanged, because assertNoStrictDrops() still refuses before the driver call. An engine write precondition (ADR-0142 D4, the assignment claim) keeps its conditional write and its conflict answer: the verdict is false when one is present. Validation, the post-image seam and the reference checks still run on the no-op path exactly as they did. Only the statement and what follows it change, so a refusal that answered before still answers.

Tests

  • New packages/objectql/src/engine-update-all-dropped-noop-34746.test.ts (10 cases). It boots through the real ObjectQLPlugin, so the stamps come from the builtin hook. It uses a capturing driver. By-id and predicate each cover readonly-only, readonlyWhen-only, a surviving caller field (control), and a hook-written key (control). By-id adds both reasons together and strict mode.
  • Premise reading on base b65488a8 (before the engine change): 7 of 10 red. The by-id driver received {id, updated_at, updated_by} and the predicate driver {updated_at, updated_by}, with afterUpdate run each time. The 2 control reds were only the address id the by-id driver payload carries, which I corrected in the expectation.
  • Ablation (guard forced false, on disk through scripts/ablation-replace.mjs, restored to HEAD blob 215cfc4e): 5 defect cases red, 5 controls green.
  • Tests the change legitimately reds. Their payload was otherwise all dropped, and each now carries one surviving writable field, so it still pins the strip it was written for:
    • engine.test.ts › Dropped-field write observability: readonlyWhen single-id, bulk path, throwing listener;
    • engine-formula-write-strip.test.ts › control: static readonly key on update;
    • engine-blank-typed-value-door.test.ts › readonlyWhen lock against a caller blank;
    • federated-injected-column-readers.test.ts gains two not-a-read rows for the new stamp-key vocabulary.
Local runs
  • pnpm --filter @objectstack/objectql test on the merged head 2cdd016db: Test Files 617 passed (617), Tests 13917 passed (13917). pnpm --filter @objectstack/objectql typecheck: exit 0 (lock VERDICT command-exit 0).
  • Ablation: Tests 5 failed | 5 passed (10), then ok restored: blob == HEAD (215cfc4ea660) and git diff HEAD is empty.
  • Final head 44b4972c7 (one test-only commit after the full run, giving the new file's find double the caller's bound): new file 10 passed (10); check:objectql-double-limit, check:test-source-alias, check:cross-package-test-inputs, check:nul-bytes, check:engine-double-contract exit 0.
  • Derived gates (dispatch-gates.mjs --commands, 65 families): 63 exit 0; NOT MEASURED, exit 3 prerequisite: check-plugin-teardown-shape --self-test (shallow clone cannot reach its pinned fixture commit) and check:dual-build-cjs-loads (reads every package's dist; only the objectql closure is built here). --ran reconciliation: 65 derived, 63 run, 2 NOT-MEASURED, 0 UNRUN.

Acceptance notes

  • __search (pinyin companion) is a hook-written key. Under this rule it counts as surviving, so an update whose only source field is readonlyWhen-locked, on an object with a companion column, still writes __search plus stamps. Unchanged behaviour, noted and not filed: no repro of a wrong answer through a public door yet.
  • A caller that sends only updated_at: the stamp hook overwrites the key, so no strip reports it and the update is not all-dropped. Unchanged.

Verification

Read first:

  1. packages/objectql/src/engine-update.ts: everyCallerKeyDropped and engineDroppedKeys (near reportDroppedFields). The risk is the rule's third clause.
  2. packages/objectql/src/engine-update.ts: the two noOpUpdate ? sites at the driver calls, and the skipped afterUpdate / roll-up / publish.
  3. The new test file's two hook-written controls.

Two-minute check: pnpm --filter @objectstack/objectql exec vitest run src/engine-update-all-dropped-noop-34746.test.ts should print 10 passed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01L9qibwJEh7hMPPvagWM1g7

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/objectql, touching 3 documentable anchor(s).

26 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json a3a74f27020d9da3d15987129ddfb812d522e7a3.

⛔ 8 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

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): node scripts/docs-audit/affected-docs.mjs --json a3a74f27020d9da3d15987129ddfb812d522e7a3 → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json a3a74f27020d9da3d15987129ddfb812d522e7a3

⚠️ 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 a3a74f27020d9da3d15987129ddfb812d522e7a3 → 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

repo:objectstack#7 · os-tesla · session_01L9qibyQBB3KuDoNobNq9LH

席位核对

L1: REWORK, one item (L1-a, for area d7-B) at head 44b4972c7538290118112717012810377cafebb4, read 2026-11-20T04:07Z. Everything else below already reads ACCEPT. A delta L1 on the new head closes this.

Must fix

  1. Pin the two skips the changeset ships beyond afterUpdate. The changeset tells app authors "no roll-up recomputes and no record-changed event is published". engine-update.ts implements both: if (this.realtimeService && !noOpUpdate), and summaryFailures = noOpUpdate ? [] : … plus the summaryKeyColumns read guard. But no test in this PR, and none I found on main, would go red if either were lost. The new file boots without a realtimeService and declares no roll-up. Add, in engine-update-all-dropped-noop-34746.test.ts:

    • Event pin. A stub realtime service on the kernel. On an all-dropped update, by-id and predicate each publish no updated event. Control: the surviving-field case publishes exactly one (by-id data.record.updated, predicate the bulk event).
    • Roll-up pin. A parent with a summary over this object. An all-dropped child update leaves the parent unwritten and calls no recompute, on both branches. Control: the surviving-field case still recomputes.
    • Ablation. Re-run the ablation with each of the two guards forced off on its own, and quote the red/green counts in the PR body like the existing one.

    Why REWORK and not a note: these two lines are behaviour an app can observe, and the changeset tells authors about them. Under l1-review-checklist.md, a stated behaviour needs a test that fails without it; green output from the existing pins does not cover them.

Read and accepted (carries over to the delta)

  • Shape. Draft, base main. Fixes #34746 is the only closing keyword, and it fits once the pins land. Clause-②: no, Metadata-protocol: semantic and Skills-docs: follow-up #35605 sit at line start. skills/objectstack-data + data-engine docs: an update whose every caller field is dropped writes nothing and runs no afterUpdate (after #34746) #35605 is open, domain:skills, and pm:blocked on this work.
  • Changeset. '@objectstack/objectql': minor is right for semantic, under AGENTS.md step 3. The "What to check in an app" migration line is present. Prose checked against the diff: "no driver write … answers the current record … 0 rows written … dropped fields still reported … beforeUpdate still runs … a surviving field (caller or beforeUpdate-written) takes the unchanged path … same-value write unchanged … strictReadonlyWrites still refuses first". Each sentence matches the code and a pin, except the event and roll-up sentence, which is item 1.
  • Code. everyCallerKeyDropped:
    • It is asked after both read-only strips, on both branches.
    • It returns false when there is an ADR-0142 precondition, an empty payload (address aside), a key not taken by a strip (a hook-deleted key included), or a non-stamp key left (a beforeUpdate-written key included).
    • reportDroppedFields now records drops with no listener, and still emits only to a listener or strict mode.
    • Validation, the post-image seam and reference checks still run before the verdict is used, so earlier refusals keep answering.
    • The by-id answer { ...priorRecord } is the not-found gate's own read (readUpdatePriorRow, declared columns, the caller's driver options), so there is no second fetch. It then passes through stripSearchCompanion like a written row.
    • I found no afterUpdate hook that shapes the returned record (masking is not on that chain), so skipping the chain exposes nothing new.
  • The point d7-B raised: the extension beyond the card text. Accepted in substance. The card's goal is that a change-nothing update is not treated as an edit by automation. The realtime event is the other automation channel, and a roll-up over an unchanged row moves nothing. The changeset discloses both. Only the missing pins (item 1) hold this.
  • The four edited test files. Accepted. Each pin's payload was all-dropped before, so the new rule would have turned it into a no-op. Adding one writable field keeps the pin on the strip it was written for: the dropped event assertions are unchanged, and each now also asserts the surviving key reached the driver. The two federated-injected-column-readers.test.ts rows register the new updated_at / updated_by literals as not-a-read vocabulary, which is what that ledger is for.
  • Tests and ablation. 10 cases through the real ObjectQLPlugin stamp hook. Base reading: 7/10 red. Guard-off ablation: 5 defect cases red and 5 controls green, restored blob-equal. Refusal pin (strict): fields asserted and nothing written.
  • Gates. CI at 44b4972c: 57 check runs, 39 success and 18 skipped, none red. Lint & Repo Gates, TypeScript Type Check and Test Core are success.
  • Contract review (L2). None owed by face (contract-review.md): no Clause-②: yes, no (narrowing) arm, no packages/spec/src/**, no governed path. The declaration is right: nothing the engine accepted is now refused (the write still answers, and drops are reported as before). The change is to when the write and its hooks happen, which is Metadata-protocol: semantic and a minor, not a narrowing. The card's "L1 + L2 + Tier H" line was the filing seat's reading, and it does not bind. Tier follows the governed path set (SKILL.md 〈路径分叉〉), and this PR has none, so it is non-governed and lands by the area after check-governed-merges and a green delta ACCEPT.
  • Noted, not filed. The __search and updated_at-only cases in ## Acceptance notes: unchanged behaviour, agreed.

@github-actions github-actions Bot added size/l and removed size/m labels Nov 20, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7

Patch round 1: event and roll-up pins

This answers L1 comment 7030108475 at new head b9ae58bf8. It is a test-only commit. engine-update.ts is byte-identical to 44b4972c7 (blob 215cfc4e).

engine-update-all-dropped-noop-34746.test.ts now runs 18 cases (it had 10). The stub driver now keeps one store per object, and the existing 10 cases are unchanged.

  • Event pin. A stub realtime service is set on the engine (setRealtimeService).
    • On an all-dropped update, by-id and predicate each publish no nd_task *.updated event.
    • Controls: a surviving field publishes exactly one data.record.updated (by-id) and exactly one data.records.updated (predicate).
  • Roll-up pin. A parent nd_project carries a count summary over nd_line (master_detail). Its stored count is a deliberately stale 99, with two lines.
    • On an all-dropped line update, by-id and predicate each leave the parent unwritten: no driver write to nd_project, and line_count 99, updated_at and updated_by stay as seeded.
    • Controls: a surviving field recomputes the parent to 2, on both branches.

Run on the new head: Tests 18 passed (18). pnpm --filter @objectstack/objectql typecheck gave exit 0. check:objectql-double-limit, check:test-source-alias, check:cross-package-test-inputs, check:nul-bytes and check:engine-double-contract each gave exit 0.

Ablations

All ablations went through scripts/ablation-replace.mjs. Each mutation landed on disk (anchor 1 to 0), and each run restored to HEAD blob 215cfc4ea660 with git diff HEAD empty.

Guard forced off Result Red
No-op guard (everyCallerKeyDropped forced false), round 0 5 failed, 5 passed (10) the 5 defect cases
Event skip (if (this.realtimeService && !noOpUpdate) becomes if (this.realtimeService)) 1 failed, 17 passed (18) by-id: no updated event
Roll-up skip, both lines (summaryKeyColumns.length > 0 && !noOpUpdate and summaryFailures = noOpUpdate ? [] : …) 2 failed, 16 passed (18) by-id and predicate: parent unwritten
Roll-up skip, the summaryFailures ternary alone 1 failed, 17 passed (18) by-id: parent unwritten

What the table shows about the predicate event pin: it stays green with the event guard off. A predicate no-op answers 0, and publishBulkDataEvent already publishes nothing for matched === 0 (engine-realtime-publish.ts: "a predicate that matched nothing changed no data"). So on that branch the pin is held by the no-op's zero count, and the event guard is load-bearing for the by-id branch only. The pin still states the shipped behaviour on both branches.

On the predicate roll-up, both lines must go before it reds. The summaryKeyColumns guard only skips the pre-write read, and the recompute itself is skipped by the summaryFailures ternary.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibyQBB3KuDoNobNq9LH

席位核对

L1 delta: ACCEPT (L1-a, for area d7-B) at head b9ae58bf897d3a4fad458875463128305327c691, read 2026-11-20T04:37Z. This closes REWORK 7030108475. That comment's "read and accepted" items carry over.

Delta: one test-only commit (b9ae58bf, parent 44b4972c), one file. packages/objectql/src/engine-update.ts is byte-identical (blob 215cfc4e at both heads), so code, changeset and declarations are unchanged from the first read.

  • Item 1 is met. engine-update-all-dropped-noop-34746.test.ts now runs 18 cases.
    • Event pin. A stub service is set through setRealtimeService. An all-dropped update publishes no *.updated event for the object, on by-id and on predicate. Controls: a surviving field publishes exactly one data.record.updated (by-id) and exactly one data.records.updated (predicate).
    • Roll-up pin. A master_detail line under a parent with a count summary, seeded stale at 99. An all-dropped line update leaves the parent with no driver write and line_count, updated_at and updated_by as seeded, on both branches. Controls: a surviving field recomputes the parent to 2, on both branches.
  • Ablations, per guard (dev comment 7030474653): event skip off ⇒ 1 red; both roll-up skip lines off ⇒ 2 red; the summaryFailures ternary alone ⇒ 1 red. Each was restored blob-equal. The counts are in a PR comment instead of the body. Accepted: the comment is on the PR and pinned to this head.
  • The dev's note on the predicate event pin, verified. publishBulkDataEvent in engine-realtime-publish.ts returns early on matched === 0 ("a predicate that matched nothing changed no data"). So once the no-op answers 0, that branch publishes nothing, with or without the !noOpUpdate guard. The guard is load-bearing on by-id, which ablation shows red. The predicate pin still states the shipped behaviour, held by the zero answer. Likewise, the summaryKeyColumns … && !noOpUpdate guard only skips the pre-write read; the recompute skip is the summaryFailures ternary, which is pinned on both branches. Both readings match the code.
  • Harness change. The stub driver now keeps one store per object, and rows / writes stay the task object's own. So the existing 10 cases assert exactly what they did before (writes records only OBJECT), and the new cases read other objects through writesTo / storeFor.
  • Gates. CI at b9ae58bf: 53 check runs, 37 success and 16 skipped, none red or pending. Lint & Repo Gates, TypeScript Type Check and Test Core are success.

Contract review. None owed (no L2 face; see 7030108475). This PR is non-governed and +533/−37 is under 3,000 lines, so it lands by the area after check-governed-merges.mjs --pr 35594.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7

Landing · 2026-11-20T04:39Z · head b9ae58bf897d3a4fad458875463128305327c691

Probe Reading
L1 ACCEPT 7030572476 at this head (closes REWORK 7030108475); no L2 face
check-governed-merges.mjs --pr 35594 NOT governed, 0 of 7 paths; +510 / −14 ≤ 3000
CI at this head 53 check runs: 37 success, 16 skipped, 0 red / pending
K (Affected-set diff base a3a74f2 → origin/main 03bce5c) 3 (< 15) · mergeable_state clean · no merge=os-regen path

State: pr_ready + automerge_enable under the maintainer's standing landing go-ahead (2026-10-30: 「按 pm-dispatch 审过的pr你可以自主落地」). On MERGED, #34746 closes by Fixes; follow-up #35605 unblocks.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 20, 2026 04:39
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 20, 2026
Merged via the queue into main with commit d5ece3e Nov 20, 2026
54 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-34746-all-dropped-update-noop branch November 20, 2026 05:14
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