Repository navigation
fix(core): Change Owner answers a hand-away its read-back cannot see as moved, and asks for the provisioned queue column - #38023
Conversation
…e answers as moved The engine refuses a missing row itself, before the write, and documents a null read-back after a by-id update as a write that landed and moved the row out of the caller's scope. Change Owner read that null as not found: the single door answered 404 and told nobody, the bulk door listed the row as failed, and a cascaded child counted as refused. The write's answer is no longer read for existence; the test doubles now throw RECORD_NOT_FOUND for a missing row, as the engine does. Claude-Session: https://claude.ai/code/session_011y7As8fiqghPfkY5FTbE3X Co-Authored-By: Claude <noreply@anthropic.com>
… column, as the engine does The queue-target check looked for a field named queue in the definition. The injection registers queue wherever it registers owner_id, external objects included, where no column backs it, so an external object with an owner got a queue write instead of the 400; and list-shaped fields were refused with an untrue sentence. The check is now the engine's provenance test, resolveInjectedColumnProvenance(def, 'queue') === 'injected-provisioned', which reads both fields shapes. Claude-Session: https://claude.ai/code/session_011y7As8fiqghPfkY5FTbE3X Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011y7As8fiqghPfkY5FTbE3X Co-Authored-By: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
What this run could not see
Coarse fallback — 40 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 795bf365de7be3d30d104dd76492ddb23bbc8a85 && git checkout 795bf365de7be3d30d104dd76492ddb23bbc8a85
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin bfc0dd054ba4e05ba35cc3f77d8260c0e144f2bd c5f810a35edca48944a82980657c06bab19e144f && git checkout -B drift-repro bfc0dd054ba4e05ba35cc3f77d8260c0e144f2bd && git merge --no-ff c5f810a35edca48944a82980657c06bab19e144f
node scripts/docs-audit/affected-docs.mjs --json bfc0dd054ba4e05ba35cc3f77d8260c0e144f2bd
|
|
repo:objectstack#7 · os-alice · session_011y7As8fiqghPfkY5FTbE3X L1 review — ACCEPT · head c5f810aRead against GitHub and origin/main, not against the dev report's own words.
Premise, re-read on main: the by-id update throws #36262: Flags from l1-face, both accepted:
Changeset read sentence by sentence against the diff: both bullets match the code. The sentence "A field the author declared and named In-place adjacent fix: the same null → 404 check in Ablations reported: restoring each removed branch turns its pins red (single path 3, bulk 2, queue test 4). Out of scope: the remote driver's answer to a queue write was not traced. Dropped: after this fix the write no longer reaches it. State: ACCEPT → ready + auto-merge. |
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 46041141973 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
|
repo:objectstack#7 · os-alice · session_011y7As8fiqghPfkY5FTbE3X Queue kick — re-enqueue once · head c5f810aThe merge-group run 46041141973 (triage comment 7224862963) failed on This PR is not the cause:
Re-enqueued once on the same head. If the same signature kicks this PR again, the seat stops re-enqueuing and re-diagnoses. |
Fixes #36258
Fixes #36262
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
Two cards, one file (
packages/core/src/security/change-record-owner.ts), one commit each.#36258: a null read-back is a landed write.
writeOwnerno longer hands back the engine's answer, and the single, bulk and cascade-child call sites no longer turn anull/undefined/0answer into404 RECORD_NOT_FOUND. Measured onorigin/mainbefore collapsing the three (base4af32b99):recordNotFoundErroritself when the row is not there (engine-update.ts, the not-found gate,if (!priorRecord) throw recordNotFoundError(...)), so a call that returns has written;nullis the post-write read-back of a row the write moved out of the caller's scope. The engine's comment above that gate names this case as a write that landed;undefinedis what a driver returns when it answersupdatewith nothing. That still comes after the pre-write existence gate, so the row was written;0is the predicate (multi) branch's row count. This module never takes that branch: every write is addressed{ where: { id } }, whichassertEngineUpdateDispatchin the test doubles holds to the by-id dispatch.None of the three is a not-found signal, so none is read as one.
RECORD_NOT_FOUNDfor an unreachable row still comes from the engine's own pre-write throw, and the route answers it as before. The cascade site (runCascade, a child row's owner write) had the same three-value check. It falls under the bounded in-place exemption: same defect class, the same mechanical edit, a file this claim holds, and the same test file. Its pin is the cascade case below.previousOwnersis read before the parent's write, so a moved parent whose read-back isnullstill cascades.#36262: the queue target asks for the provisioned queue column.
offeredDefinitiondropshasOwnProperty(fields, 'queue')for a localcarriesQueueColumn(def)=resolveInjectedColumnProvenance(def, 'queue') === 'injected-provisioned', the engine's own test (assignment-rules.ts).@objectstack/coredoes not depend on@objectstack/objectql, which depends on core, so the predicate is spelled over the spec-level resolver@objectstack/spec/dataexports, not imported from the engine. The resolver reads bothfieldsshapes.Tests
At head
c5f810a3:packages/core/src/security/change-record-owner.test.ts: the double now throwsrecordNotFoundErrorfor a missing row, as the engine does, and aleavesScopeoption makes a landed write read backnull. New pins:notified: trueand the emit called; bulkupdated: 1, failed: 0, failures: []; a queue target with anullread-back; a cascade from a moved parent whose child read-backs arenulltoo,updated: 2, failed: 0.404 RECORD_NOT_FOUND, single refused and bulk listing it.queueis refused400 VALIDATION_ERROR(message first sentence asserted), single and bulk, with no update call; the same object still takes a person target; list-shapedfieldswith the platform's queue column are admitted; control: a local object is admitted whether its document lists the column or the injection adds it; an author-declared field namedqueueis refused.QUEUE_FIELD_DEF, not a hand-written{ type: 'text', system: true }. The old "no queue column" case moved frommemo(a local owner-bearing object, which the injection gives a queue column) to the external object.packages/rest/src/change-owner-routes.test.ts: the same double change (throws for a missing row), the spec'sQUEUE_FIELD_DEFonlead, and one HTTP pin: both doors answer200, single withnotified: trueand bulk withupdated: 1, failed: 0, for writes whose read-back isnull.Test runs at c5f810a
pnpm --filter @objectstack/core test(lock VERDICT batch, part exit echoedCORE_EXIT=0): Test Files 158 passed (158), Tests 3802 passed (3802).pnpm --filter @objectstack/rest test(REST_EXIT=0): Test Files 432 passed (432), Tests 8973 passed, 351 skipped (9324).pnpm --filter @objectstack/core typecheck && pnpm --filter @objectstack/rest typecheck: VERDICT command-exit 0.turbo run build --filter='@objectstack/rest^...', 31/31 tasks), and core was rebuilt after the second commit, before the REST suite read itsdist/.Ablations (each through
scripts/ablation-replace.mjs: anchor hit 1 → 0, restore blob == HEAD,git diff HEADempty). The core test imports the source directly, so nodist/is involved:written === null || undefined || 0→ throw made 3 pins red: single, queue target, cascade.l1).hasOwnProperty(fields, 'queue')test made 4 pins red: the federated pin, the list-shaped pin, the control (itsmemoarm) and the author-declared pin.Acceptance notes
queue(any definition other than the platform's own) now refuses a queue target with the 400. Before, it was admitted. This is whatresolveInjectedColumnProvenanceanswers ('author') and what the engine's assignment rules already do (they route nothing on such an object). The ownership-queue write gate in plugin-security checks for the key in the written row, not the schema, so it would still have judged such a write. Pinned so the choice is visible.memo(owner_id only, no queue in its document) is now admitted for a queue target. In production the registered document always carries the injected column on such an object, so the old "no queue column" fixture described a state that registration never leaves.change-owner-routes.test.tsunderpackages/core/src/security/. It lives atpackages/rest/src/change-owner-routes.test.ts, and that is the file this PR edits. The card's "the test doubles throwRECORD_NOT_FOUND" names it, and itsleadfixture had to carry the real queue column once change owner: the queue-target check looks for a field named queue instead of a provisioned queue column, so an external object gets a queue write instead of the 400 #36262 landed.Verification
Gates at c5f810a
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 65 commands for this diff at c5f810a. Each was run locally with its exit code captured before any pipe;--ranreconciled them as "65 derived famil(ies) accounted for, 63 run, 2 NOT-MEASURED (2 DERIVED from a recorded exit 3)".check:engine-double-contract,check:nul-bytes,check:cross-package-test-inputs,check:test-source-alias,check:error-status-conformance,check:type-check-coverage,check:type-check-debt,check:published-filesandcheck:issue-citations.check-plugin-teardown-shape.mjs --self-test, reason: shallow clone cannot reach its pinned positive-control commit.check:dual-build-cjs-loads, reason: PREREQUISITE NOT MET, it reads every package'sdist/and only the rest closure was built. CI runs both.check-platform-checklist.mjs --changed-fromis not owed.Read first (risk order):
packages/core/src/security/change-record-owner.ts,writeOwnerand its three call sites. The risk is reading a real not-found as moved; the engine's pre-write throw is the guard.packages/core/src/security/change-record-owner.ts,carriesQueueColumn. The risk is the author-declaredqueuearm (see Acceptance notes).packages/core/src/security/change-record-owner.test.ts,fakeEngine'supdate: the double now throws where the engine throws.Two-minute check:
pnpm --filter @objectstack/core exec vitest run --maxWorkers=2 src/security/change-record-owner.test.ts -t 'read-back|36262'should report 10 passed and the rest skipped.Generated by Claude Code