Skip to content

feat(lint): warn on a multi update_record that moves a stored expression input - #33336

Merged
objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/area-A4-32528
Nov 14, 2026
Merged

objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/area-A4-32528

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Elon · project thread
Fixes #32528

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

The maintainer's ruling on this card (recorded in 6879501332, option B: 「B 保留拒绝,编辑时提示」) keeps the engine refusal and adds an authoring warning instead of per-row compute. That still widens the public surface: a new advisory on the authoring doors and its rule id exported from the @objectstack/lint root, so the declaration stays Clause-②: yes (widening) as the claim (6879293575) said; nothing that passed before is refused, and the changeset ships patch.

维护者速读

  • 改了什么: 流程里 update_record 开了 multi: true,且 fields 改到了目标对象某个存储型计算字段的输入时,编写时(os validate / os build / 流程保存与发布)给出一条警告 flow-multi-update-moves-stored-input,提示改成「查出记录 → 循环 → 按 id 逐条更新」。引擎的拒绝不变。
  • 为什么改: 维护者裁决选 B:批量条件更新不拆成逐行写(ADR-0058 附录 II D3 不动),所以各行算出的值不同时引擎会整笔拒绝;以前作者要到流程跑起来才知道,现在保存时就知道,并拿到正确写法。
  • 风险与回滚: 只加一条警告,不拒收任何东西,不改引擎行为;误报最多是一条多余的警告。回滚 = revert 本 PR。
  • 先看: packages/lint/src/lint-flow-patterns.ts(storedInputsByObject 如何认定「输入」:直接读、经引用字段读、经另一存储字段传递读)· packages/lint/src/lint-flow-patterns.test.ts(新 describe 的三个主用例)· packages/lint/src/rule-explanations.ts(os explain 文案)。
  • 两分钟验证: pnpm --filter @objectstack/lint exec vitest run src/lint-flow-patterns.test.ts -t "stored expression input",预期 8 个用例全绿。
  • 需要你做的: 无,席位落地。

What changes

  • packages/lint/src/lint-flow-patterns.ts: new rule id FLOW_MULTI_UPDATE_MOVES_STORED_INPUT (flow-multi-update-moves-stored-input), scanned per flow graph beside FLOW_MULTI_WRITE_UNFILTERED (so loop, parallel and try_catch bodies are in range). An update_record with multi: true (the executor's own === true test) whose fields keys include an input of a stored computed field of its target object gets a warning naming the inputs it sets, the stored fields they move, and the VALIDATION_FAILED refusal; the one-line fix prescribes get_record (same filter, limit above 1) → loop → update_record with filter: { id: item.id } and no multi.
    • Stored computed field = the engine's own test (planStoredExpressions): not a formula, declares an expression.
    • Inputs = the reads analyzeRelationshipTraversals names (bareFields plus each traversal's first hop), which is exactly what objectql's storedExpressionReads uses, followed through another stored field the expression reads. A stored field itself is not an input (its caller value is replaced, never stored).
    • Objects are read as served (objectsAsServed), so a field an object extension adds counts. A target object the stack does not carry, a non-CEL dialect and a source that does not parse are not judged (silent).
  • Wiring: the rule lives inside lintFlowPatterns, so it reaches authors through the same AUTHORING_RULES entry as FLOW_MULTI_WRITE_UNFILTERED (os validate, os build, the flow save and publish doors, as an advisory). The id is exported from the root barrel (src/index.ts) and has an os explain entry in rule-explanations.ts.
  • Unchanged on purpose: the engine refusal (settleBulkStoredExpressions), packages/spec/src/data/field.zod.ts's expression describe (it already states the refusal, which is still true), and ADR-0058.
  • .changeset/32528-flow-multi-update-stored-input.md: @objectstack/lint patch.

Tests

New describe in packages/lint/src/lint-flow-patterns.test.ts (8 cases):

  • warns on a multi update that sets an input (quantity), naming the direct reader and the stored field that reads it transitively, as a warning, with a one-line hint of at most 200 characters;
  • silent on a multi update that touches no input (description feeds only a formula; setting the stored field itself is not an input);
  • silent on a single-record update (filter: { id } with no multi, and with multi: false);
  • a reference field read through (record.invoice.number) counts as an input of that stored field only;
  • not judged for an object the stack does not carry; a field an object extension adds counts;
  • judged inside a loop body, with the scoped where;
  • reaches authors through the lintFlowPatterns authoring rule at severity: 'warning';
  • the os explain entry carries the reasons and the by-id shape.

Run on head 21b6dcad7 (after merging origin/main at 6a28a271e), through the shared verify lock:

lint closure build + full lint suite + typecheck: VERDICT command-exit 0
pnpm --workspace-concurrency=2 --filter '@objectstack/lint^...' build && pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2 && pnpm --filter @objectstack/lint typecheck
 Test Files  208 passed (208)
      Tests  8889 passed | 5 skipped (8894)
check:test-typecheck: OK — @objectstack/lint's test layer compiles under packages/lint/tsconfig.test.json; 2 file(s) / 6 error(s) / 2 pinned signature(s) held in test-typecheck-debt.json
os-verify-lock: VERDICT command-exit 0

The same suite and typecheck were also green on the pre-merge head 46838fc4 (8873 passed, 5 skipped; both exits 0).

Acceptance notes

  • Per the ruling, no ablation: this adds a rule; no previously tested behaviour changed.
  • The rule cannot know whether a run's rows compute one value or several, so it warns whenever the patch moves an input. A patch that sets every input of the expression to literals computes one value and is stored by the engine; the warning still fires there, which is why it is a warning and not a gate.
  • Inputs through a formula field that a stored expression reads are not followed (silent rather than claiming an input the engine might not recompute through).

Verification

Derived gate families: 66 derived, 64 exit 0, 2 NOT MEASURED

node scripts/pm/dispatch-gates.mjs --commands (no paths; change set from the merge base, 5 paths) derived 66 families on 21b6dcad7; all 66 were run locally and reconciled with --ran (each line carrying its exit code): "66 derived famil(ies) accounted for — 64 run, 2 NOT-MEASURED (2 DERIVED from a recorded exit 3)".

  • exit 0: 64 families, including check:nul-bytes, check:doc-authoring, check:issue-citations, check:published-files, check:dts-closure, check:test-source-alias, check:cross-package-test-inputs, check:type-check-coverage, check:type-check-debt, check:undeclared-dep-imports, the changeset gates (check-empty-changeset, check-changeset-no-major, check-adr-0087-registration) and check:closing-keyword-parity.
  • NOT MEASURED: check:dual-build-cjs-loads and check:lean-entry-closure (exit 3, PREREQUISITE NOT MET: they read a whole-repo build this worktree does not hold). CI's Lint & Repo Gates runs both on a full build.

No ablation: this PR adds a rule and changes no previously tested behaviour.

🤖 Generated with Claude Code

https://claude.ai/code/session_016WV4cw787kMeaX7oyz7DDC

@github-actions github-actions Bot added size/m 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 14, 2026
@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

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

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

  • content/docs/ai/connect-mcp.mdx (via update_record (literal, a string literal in scanBulkUpdatesMovingStoredInputs))
  • content/docs/api/index.mdx (via update_record (literal, a string literal in scanBulkUpdatesMovingStoredInputs))
  • content/docs/automation/approvals.mdx (via update_record (literal, a string literal in scanBulkUpdatesMovingStoredInputs))
  • content/docs/automation/flows.mdx (via update_record (literal, a string literal in scanBulkUpdatesMovingStoredInputs))
  • content/docs/automation/hook-bodies.mdx (via update_record (literal, a string literal in scanBulkUpdatesMovingStoredInputs))
  • content/docs/automation/hooks.mdx (via update_record (literal, a string literal in scanBulkUpdatesMovingStoredInputs))
  • content/docs/automation/workflows.mdx (via update_record (literal, a string literal in scanBulkUpdatesMovingStoredInputs))
  • content/docs/concepts/architecture.mdx (via update_record (literal, a string literal in scanBulkUpdatesMovingStoredInputs))
  • content/docs/deployment/cli.mdx (via update_record (literal, a string literal in scanBulkUpdatesMovingStoredInputs))
  • content/docs/getting-started/build-with-claude-code.mdx (via update_record (literal, a string literal in scanBulkUpdatesMovingStoredInputs))
  • content/docs/getting-started/common-patterns.mdx (via update_record (literal, a string literal in scanBulkUpdatesMovingStoredInputs))
  • content/docs/kernel/contracts/data-engine.mdx (via update_record (literal, a string literal in scanBulkUpdatesMovingStoredInputs))
  • content/docs/kernel/runtime-services/examples.mdx (via update_record (literal, a string literal in scanBulkUpdatesMovingStoredInputs))
  • content/docs/permissions/system-context.mdx (via update_record (literal, a string literal in scanBulkUpdatesMovingStoredInputs))
  • content/docs/protocol/objectql/security.mdx (via update_record (literal, a string literal in scanBulkUpdatesMovingStoredInputs))

⛔ 7 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v16.mdx (via update_record (literal, a string literal in scanBulkUpdatesMovingStoredInputs))
  • content/docs/releases/v17/17-0.mdx (via update_record (literal, a string literal in scanBulkUpdatesMovingStoredInputs))
  • content/docs/releases/v17/17-2.mdx (via update_record (literal, a string literal in scanBulkUpdatesMovingStoredInputs))
  • content/docs/releases/v17/17-5.mdx (via update_record (literal, a string literal in scanBulkUpdatesMovingStoredInputs))
  • content/docs/releases/v17/17-6.mdx (via update_record (literal, a string literal in scanBulkUpdatesMovingStoredInputs))
  • content/docs/releases/v17/17-7.mdx (via update_record (literal, a string literal in scanBulkUpdatesMovingStoredInputs))
  • content/docs/releases/v18/18-0.mdx (via update_record (literal, a string literal in scanBulkUpdatesMovingStoredInputs))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 1 changed file(s) yielded no anchor (packages/lint/src/index.ts) — pages documenting those are invisible to this run
  • 3 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 4 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 82838e83adc6f464d2baef055ff7eed6338243f9 → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json 82838e83adc6f464d2baef055ff7eed6338243f9

⚠️ 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 82838e83adc6f464d2baef055ff7eed6338243f9 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · os-elon-musk · session_016WV4cw787kMeaX7oyz7DDC

Request: review · area A4 · head 21b6dca

Fixes #32528 (maintainer ruling B) · Clause-② no · Metadata-protocol none · 5 files, +333/−1, packages/lint only · NOT governed.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Contract-review-claim: session_016WV4cxDxAYxdtDhtR1kQQe · head 21b6dca · 2026-11-14T17:09Z

review#2 (server area pilot, A4).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 21b6dcad721bcda4b1adb193db10a1387efd666c
Local-runs: none

review#2 (server area pilot) · area A4 · Fixes #32528 · declaration face (the claim on #32528 declared Clause-②: yes (widening), and the diff adds an export to the package root).

① Derived judgments

  • Matches the maintainer ruling on engine: a predicate update that moves a stored expression's input is refused when the computed value differs per row, instead of computing each row (#32443 follow-up) #32528 (comment 6879501332, option B): the engine refusal (settleBulkStoredExpressions) and ADR-0058 Addendum II D3 are untouched; the change is one authoring warning that prescribes get_record → loop → update_record by id.
  • "Stored computed field" agrees with the engine's own test: isStored = not formula and declares expression, the same as planStoredExpressions (packages/objectql/src/engine-top-level.ts).
  • "Input" agrees with the engine's reader: bareFields plus each traversal's first hop from analyzeRelationshipTraversals, the same set storedExpressionReads builds; following stored→stored reads matches storedExpressionsReading's closure. A stored field set in the patch is not an input, which matches the engine replacing caller values for plan entries.
  • multi is read with the executor's own cfg.multi === true (crud-nodes.ts update_record), and fields is the executor's one write-map key.
  • Objects are read through objectsAsServed, so extension fields count; unknown targets, non-CEL dialects and unparseable sources are silent. Fine for an advisory.
  • Severity is warning (no gate), reached through the existing lintFlowPatterns authoring rule; nothing that built, validated, saved or published before is refused.
  • Tests pin the main shapes (direct input, transitive stored reader, reference hop, extension field, loop body, single-record silence, authoring-rule severity, os explain).

② Semver level

@objectstack/lint patch is right (no Metadata-protocol kind; a widening ships patch). The declaration line is not:

③ Boundary flags

  • None on security or data: read-only lint, no engine change.
  • N1 (nit) storedInputsByObject(stack) parses every stored expression of every object on each lintFlowPatterns call, also on stacks with no multi update (the flow save/publish doors run it on the served snapshot). Building it lazily on the first multi: true update would cost nothing on the common path.
  • N2 (nit) The prescribed shape caps the sweep at get_record's limit, where the multi update had no such cap. "limit above 1" reads as "any number over 1"; the os explain paragraph could say "a limit that covers the rows the filter matches", so a sweep does not silently stop short.

Implemented-by: claude/area-A4-32528
Reviewed-by: session_016WV4cxDxAYxdtDhtR1kQQe

VERDICT: FAIL

One should-fix (S1, two declaration lines); the nits are optional. Delta review of S1 is mine; a change limited to the PR body and the changeset is a short read.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 875682eeb8b5bf5c1021f9df6e83d173ae4162b5
Local-runs: none

review#2 (server area pilot) · area A4 · Fixes #32528 · delta review of S1 from record 6881255405 (head 21b6dcad).

① Derived judgments

  • 21b6dcad..875682ee is one commit touching only .changeset/32528-flow-multi-update-stored-input.md (one line); the PR body was edited to match. No code, test or docs file moved, so ① from the previous record stands unchanged.

② Semver level

③ Boundary flags

  • None. N1 (lazy index build) and N2 (limit covering the matched rows in os explain) were nits, declined by the area; accepted as deviations, no card owed.

Implemented-by: claude/area-A4-32528
Reviewed-by: session_016WV4cxDxAYxdtDhtR1kQQe

VERDICT: PASS

Landing still needs all checks green on this head.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · os-elon-musk · session_016WV4cw787kMeaX7oyz7DDC

ACCEPT · area A4 · head 875682e · 2026-11-14T17:42Z

  • Review: PASS by review#2 (record 6881284152, delta of S1 from 6881255405) at this head; nits N1/N2 declined, accepted by the reviewer.
  • check-governed-merges --pr 33336: NOT governed, 334 changed lines.
  • Checks green at this head (the cancelled PR-body guards run was superseded by the green one after the body edit).
  • Ready + auto-merge under the maintainer's 15:21Z go for area A4.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 14, 2026 17:43
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 14, 2026
Merged via the queue into main with commit df67557 Nov 14, 2026
70 of 71 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/area-A4-32528 branch November 14, 2026 18:18
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/m 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