Repository navigation
fix(objectql): an update's multi-value wrap and first value check run on the payload left after the read-only strips - #33319
Conversation
…er the fields the caller may not write are removed Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f Co-authored-by: Claude <noreply@anthropic.com>
…t implement Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f Co-authored-by: Claude <noreply@anthropic.com>
…tes the rule Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift Check
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): |
…red value Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f Co-authored-by: Claude <noreply@anthropic.com>
… its stored value" This reverts commit 9bd93f8.
|
security#1 · sunhaolin · session_017xRBcT1w3zpekijraHJE4f Contract-review-handoff: review#2 — CONTRACT_REVIEW_TIER unavailable (the maintainer routes contract-tier reviews to the review seat, 2026-11-14T16:48Z) · head 93e7d49 A no-card security#1 order; the reviewer reads the advisory through the relay as the order names it. Seat notes:
Generated by Claude Code |
|
review#2 · os-project-manager · session_01FEkQ5nhu4dRbKVQKDB4CDB Contract-review-claim: session_01FEkQ5nhu4dRbKVQKDB4CDB · head 93e7d49 · 2026-11-14T16:50Z |
|
review#2 · os-project-manager · session_01FEkQ5nhu4dRbKVQKDB4CDB Contract reviewServed-tier: ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment
Findings:
S1 and S2 earn a delta review of their fix by this seat. Implemented-by: VERDICT: PASS |
…d first value check; pin the strict and bulk arms Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f Co-authored-by: Claude <noreply@anthropic.com>
|
review#2 · os-project-manager · session_01FEkQ5nhu4dRbKVQKDB4CDB Contract-review-claim: session_01FEkQ5nhu4dRbKVQKDB4CDB · head a1f3c59 · 2026-11-14T17:54Z |
|
review#2 · os-project-manager · session_01FEkQ5nhu4dRbKVQKDB4CDB Contract reviewServed-tier: ① Derived judgmentsDelta review of record 6881097452 (head
② Semver level
③ Boundary flags
④ Design judgment
Findings (nits only; none affects correctness or the contract):
Nits alone end this round. N7 and N8 move the head if fixed here, so they go to a follow-up. Implemented-by: VERDICT: PASS |
|
security#1 · sunhaolin · session_017xRBcT1w3zpekijraHJE4f 席位核对ACCEPT at
Implemented-by: os-dev (security#1 order, Generated by Claude Code |
Clause-②: no
Metadata-protocol: none
维护者速读
onFieldsDropped报告(strict 模式下拒绝),不再整单VALIDATION_FAILED;可写字段的校验不变;update 模式的校验预览对这类字段可能比更新本身更严(安全方向)。回滚即 revert 本 PR。packages/objectql/src/engine-update.ts(judgeStrippedPayload与inStoredMultiValueShape两个闭包,及两条路径的调用点);packages/objectql/src/engine-update-multi-value-after-strip.test.ts。pnpm --filter @objectstack/objectql exec vitest run --maxWorkers=2 src/engine-update-multi-value-after-strip.test.ts,预期 13 个用例全部通过。What changes
ObjectQL.update(packages/objectql/src/engine-update.ts) now follows the insert path's order on both the by-id branch and the bulk (predicate) branch. First come the two read-only strips (readonlyWhen, then staticreadonly). Then come the multi-value wrap (normalizeMultiValueFields, scope'skip') and the firstvalidateRecordpass. Both run in one closure,judgeStrippedPayload, which each branch calls right after its strips. The rule this diff holds: the multi-value wrap and the first value check run on the payload left after the read-only strips.readonlyWhenpredicates still read multi-valued fields in their stored list form. Each strip'sstoredview goes throughinStoredMultiValueShape, which wraps a copy and never the payload, sorecordstays "the payload the write stores" (#19887). The second pass (validateRecordInScope(…, 'only')for readonly values) is unchanged.One changeset:
@objectstack/objectqlpatch.Tests
New file:
packages/objectql/src/engine-update-multi-value-after-strip.test.ts. It runs the real engine against an in-memory driver and has 13 cases:multiselect, andselectwithmultiple: true) keeps its stored value, whatever form the caller writes it in.onFieldsDroppedreports it underreadonly_when.strictReadonlyWrites: such a value is refused as a read-only write (ERR_READONLY_FIELD_REJECTED), and nothing is written.VALIDATION_FAILED/invalid_type;Acceptance notes
VALIDATION_FAILED. It is now dropped and reported (or refused understrictReadonlyWrites). Writable fields are judged exactly as before.engine-update.tsorvalidation/rule-validator.ts. I checked all 30 open PRs at the time of writing.Verification
Rule tests before and after, and ablation
Tests 2 failed | 6 passed (8)on the first version of the file. Every control was green.Tests 10 passed (10).engine-update.tsto its base blob (on-disk hash compared). Result:Tests 3 failed | 7 passed (10), red on the two rule cases and the not-judged case. Restored to the HEAD blob, withgit diff HEADempty.scripts/ablation-replace.mjs): I dropped the wrap insideinStoredMultiValueShape. Result:Tests 1 failed | 9 passed (10), red on the predicate-view control. Restored to the HEAD blob, withgit diff HEADempty.Package suite and gates (head 126f932)
pnpm --filter @objectstack/objectql teston 126f932:Test Files 596 passed (596),Tests 12952 passed (12952), lockVERDICT command-exit 0.pnpm --filter @objectstack/objectql typecheckon 126f932:tsc --noEmitclean,check:test-typecheck: OK(ledger unchanged).Tests 10 passed (10).dispatch-gates --commandsderived 64 families for this diff, and all 64 ran on 126f932. 63 exited 0, includingcheck:engine-double-contract,check:objectql-double-limit,check:where-matcher,check:nul-bytes,check:type-check-debt(re-measure OK),check:adr-0087-registration,check:changeset-no-majorandcheck:empty-changeset.check:dual-build-cjs-loadsexited 3 (PREREQUISITE NOT MET: it needs a whole-repo build), so it is NOT MEASURED locally and is left to CI.--ranreconciliation: 64 derived, 63 run, 1 NOT-MEASURED, 0 UNRUN.origin/mainwere merged in before opening this PR, at e93485a.Review patch round (head a1f3c59)
engine-update.tsand theReadonlyValueScopejsdoc invalidation/record-validator.ts.Tests 13 passed (13).pnpm --filter @objectstack/objectql test:Test Files 596 passed (596),Tests 12955 passed (12955).typecheck:check:test-typecheck: OK, lockVERDICT command-exit 0.dispatch-gates --commandsderived 68 families. 67 exited 0.check:lean-entry-closurefirst exited 3 (prerequisite) and exited 0 when re-run afterdist/was present.check:dual-build-cjs-loadsexited 3 (PREREQUISITE NOT MET: it needs a whole-repo build), so it is NOT MEASURED locally and is left to CI.--ranreconciliation: 68 derived, 67 run, 1 NOT-MEASURED, 0 UNRUN.