Repository navigation
feat(lint): warn on a multi update_record that moves a stored expression input - #33336
Conversation
…ion input Claude-Session: https://claude.ai/code/session_016WV4cw787kMeaX7oyz7DDC Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cw787kMeaX7oyz7DDC Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 15 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 7 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 4 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 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
|
|
Contract-review-claim: session_016WV4cxDxAYxdtDhtR1kQQe · head 21b6dca · 2026-11-14T17:09Z review#2 (server area pilot, A4). |
Contract reviewServed-tier: review#2 (server area pilot) · area A4 · Fixes #32528 · declaration face (the claim on #32528 declared ① Derived judgments
② Semver level
③ Boundary flags
Implemented-by: 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. |
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cw787kMeaX7oyz7DDC
Contract reviewServed-tier: review#2 (server area pilot) · area A4 · Fixes #32528 · delta review of S1 from record 6881255405 (head ① Derived judgments
② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS Landing still needs all checks green on this head. |
|
domain:server#5 · os-elon-musk · session_016WV4cw787kMeaX7oyz7DDC ACCEPT · area A4 · head 875682e · 2026-11-14T17:42Z
|
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/lintroot, so the declaration staysClause-②: yes (widening)as the claim (6879293575) said; nothing that passed before is refused, and the changeset shipspatch.维护者速读
update_record开了multi: true,且fields改到了目标对象某个存储型计算字段的输入时,编写时(os validate/os build/ 流程保存与发布)给出一条警告flow-multi-update-moves-stored-input,提示改成「查出记录 → 循环 → 按 id 逐条更新」。引擎的拒绝不变。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 idFLOW_MULTI_UPDATE_MOVES_STORED_INPUT(flow-multi-update-moves-stored-input), scanned per flow graph besideFLOW_MULTI_WRITE_UNFILTERED(so loop, parallel and try_catch bodies are in range). Anupdate_recordwithmulti: true(the executor's own=== truetest) whosefieldskeys 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 theVALIDATION_FAILEDrefusal; the one-line fix prescribesget_record(same filter,limitabove 1) →loop→update_recordwithfilter: { id: item.id }and nomulti.planStoredExpressions): not aformula, declares anexpression.analyzeRelationshipTraversalsnames (bareFieldsplus each traversal's first hop), which is exactly what objectql'sstoredExpressionReadsuses, followed through another stored field the expression reads. A stored field itself is not an input (its caller value is replaced, never stored).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).lintFlowPatterns, so it reaches authors through the sameAUTHORING_RULESentry asFLOW_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 anos explainentry inrule-explanations.ts.settleBulkStoredExpressions),packages/spec/src/data/field.zod.ts'sexpressiondescribe (it already states the refusal, which is still true), and ADR-0058..changeset/32528-flow-multi-update-stored-input.md:@objectstack/lintpatch.Tests
New
describeinpackages/lint/src/lint-flow-patterns.test.ts(8 cases):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;descriptionfeeds only aformula; setting the stored field itself is not an input);filter: { id }with nomulti, and withmulti: false);record.invoice.number) counts as an input of that stored field only;loopbody, with the scopedwhere;lintFlowPatternsauthoring rule atseverity: 'warning';os explainentry carries the reasons and the by-id shape.Run on head
21b6dcad7(after mergingorigin/mainat6a28a271e), through the shared verify lock:lint closure build + full lint suite + typecheck: 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
formulafield 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 on21b6dcad7; 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)".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) andcheck:closing-keyword-parity.check:dual-build-cjs-loadsandcheck:lean-entry-closure(exit 3, PREREQUISITE NOT MET: they read a whole-repo build this worktree does not hold). CI'sLint & Repo Gatesruns 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