Skip to content

fix(core): Change Owner answers a hand-away its read-back cannot see as moved, and asks for the provisioned queue column - #38023

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-36258-change-owner-readback-queue
Nov 27, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-36258-change-owner-readback-queue

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

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. writeOwner no longer hands back the engine's answer, and the single, bulk and cascade-child call sites no longer turn a null / undefined / 0 answer into 404 RECORD_NOT_FOUND. Measured on origin/main before collapsing the three (base 4af32b99):

  • the by-id update reads the row as the caller before it writes and throws recordNotFoundError itself when the row is not there (engine-update.ts, the not-found gate, if (!priorRecord) throw recordNotFoundError(...)), so a call that returns has written;
  • null is 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;
  • undefined is what a driver returns when it answers update with nothing. That still comes after the pre-write existence gate, so the row was written;
  • 0 is the predicate (multi) branch's row count. This module never takes that branch: every write is addressed { where: { id } }, which assertEngineUpdateDispatch in 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_FOUND for 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. previousOwners is read before the parent's write, so a moved parent whose read-back is null still cascades.

#36262: the queue target asks for the provisioned queue column. offeredDefinition drops hasOwnProperty(fields, 'queue') for a local carriesQueueColumn(def) = resolveInjectedColumnProvenance(def, 'queue') === 'injected-provisioned', the engine's own test (assignment-rules.ts). @objectstack/core does not depend on @objectstack/objectql, which depends on core, so the predicate is spelled over the spec-level resolver @objectstack/spec/data exports, not imported from the engine. The resolver reads both fields shapes.

Tests

At head c5f810a3:

Test runs at c5f810a
  • pnpm --filter @objectstack/core test (lock VERDICT batch, part exit echoed CORE_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.
  • The dependency closure was built first (turbo run build --filter='@objectstack/rest^...', 31/31 tasks), and core was rebuilt after the second commit, before the REST suite read its dist/.

Ablations (each through scripts/ablation-replace.mjs: anchor hit 1 → 0, restore blob == HEAD, git diff HEAD empty). The core test imports the source directly, so no dist/ is involved:

  • Restoring the single-path written === null || undefined || 0 → throw made 3 pins red: single, queue target, cascade.
  • Restoring the bulk-path branch made 2 pins red: bulk, and the missing-row case (its moved arm, l1).
  • Restoring the hasOwnProperty(fields, 'queue') test made 4 pins red: the federated pin, the list-shaped pin, the control (its memo arm) and the author-declared pin.

Acceptance notes

Verification

Gates at c5f810a
  • node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack derived 65 commands for this diff at c5f810a. Each was run locally with its exit code captured before any pipe; --ran reconciled them as "65 derived famil(ies) accounted for, 63 run, 2 NOT-MEASURED (2 DERIVED from a recorded exit 3)".
  • 63 exited 0, including 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-files and check:issue-citations.
  • NOT MEASURED: 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's dist/ and only the rest closure was built. CI runs both.
  • No exported symbol was renamed or removed, so check-platform-checklist.mjs --changed-from is not owed.
  • Every family CI runs: see this PR's check-runs.

Read first (risk order):

  1. packages/core/src/security/change-record-owner.ts, writeOwner and its three call sites. The risk is reading a real not-found as moved; the engine's pre-write throw is the guard.
  2. packages/core/src/security/change-record-owner.ts, carriesQueueColumn. The risk is the author-declared queue arm (see Acceptance notes).
  3. packages/core/src/security/change-record-owner.test.ts, fakeEngine's update: 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

…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>
@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 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

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

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

  • content/docs/api/data-api.mdx (via /:object/:id/change-owner (route, bridged from symbol changeRecordOwner — its route source's handler names it), /:object/change-owner (route, bridged from symbol changeRecordsOwner — its route source's handler names it))
What this run could not see
  • 1 anchor(s) matched too much of the corpus to be a work list: VALIDATION_ERROR (literal, 39 pages)
  • the SDK route bridge reached 69 of 252 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 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; 124 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 — 40 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 bfc0dd054ba4e05ba35cc3f77d8260c0e144f2bd → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 795bf365de7be3d30d104dd76492ddb23bbc8a85 — the merge of head c5f810a35edca48944a82980657c06bab19e144f into base bfc0dd054ba4e05ba35cc3f77d8260c0e144f2bd, 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 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

⚠️ 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 bfc0dd054ba4e05ba35cc3f77d8260c0e144f2bd → 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-alice · session_011y7As8fiqghPfkY5FTbE3X

L1 review — ACCEPT · head c5f810a

Read against GitHub and origin/main, not against the dev report's own words.

Probe Reading at c5f810a
CI (l1-face --pr 38023) 57 success · 11 expected skip · 0 failed · 0 pending; floor checks green
Governed surface (check-governed-merges --pr 38023) NOT governed, 0 of 4 paths; +204 / -37 = 241 lines, under 3000
K (landing-k --pr 38023) K = 7 < 15; no locale or shared-book leg
Declarations Clause-②: no · Metadata-protocol: none; no ! and no (narrowing) arm, so no dogfood is owed

Premise, re-read on main: the by-id update throws recordNotFoundError before the write when the row is missing (packages/objectql/src/engine-update.ts, the not-found gate at about line 932, by-id branch only). Its comment at about line 891 names a null read-back after a landed owner hand-away. So treating the read-back as moved is correct, and a missing row still answers 404 from the engine.

#36262: carriesQueueColumn in core is now resolveInjectedColumnProvenance(def, 'queue') === 'injected-provisioned', the spec-level form of the engine's test. Core cannot import objectql, which depends on core.

Flags from l1-face, both accepted:

  • Fixes #36262 is the folded family the claim named (comment 7222680459). Merging is meant to close both cards.
  • No changeset for @objectstack/rest: the only rest file is src/change-owner-routes.test.ts. packages/rest/package.json files = dist, README.md, CHANGELOG.md, and tsconfig.json excludes **/*.test.ts, so nothing published changes. The @objectstack/core changeset is present.

Changeset read sentence by sentence against the diff: both bullets match the code. The sentence "A field the author declared and named queue is not the ownership queue" is the behaviour of injected-provisioned, and the dev recorded it in Acceptance notes.

In-place adjacent fix: the same null → 404 check in runCascade's child write. It is the same defect class, mechanical, unclaimed and in the same gate family, and the PR body names it with its pin. Accepted.

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.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 27, 2026 17:20
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 46041141973 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

分类:failure —— 按下面的日志分诊。

失败的 job(日志抽取,best effort):

  • Build Core — 失败步骤: Build packages (excluding docs)(日志不可读,点进 job 看)

  • Live E2E UI — 失败步骤: Build the Console for the live lane

    ✗ Build failed in 5.95s
    
  • Build & E2E UI — 失败步骤: Build the Console for E2E

    ✗ Build failed in 4.33s
    
  • Type Check UI — 失败步骤: Verify every sideEffects array names exactly its registering modules(日志不可读,点进 job 看)

↳ 失败原因 是判读的关键:超时(Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言(AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️ 断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError。 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

  • ⚠️ 本次没有可用的聚合签名(日志里没有能解析出测试文件名的 FAIL 行)—— 这不是「没有同签名的其他 PR」,是这一轮没测到。跨 PR 聚合本次不可用,请手工比对其他 PR 的同类评论。
  • ⚠️ 24h 评论账本没读完(超过 5 页仍未读到窗口尽头),所以上面的「不同 PR 数」是下界,不是全量。

历史信号:

  • 本 PR 过去 24h 无队列失败记录(首次)。
  • 过去 24h 队列共有 15 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-alice · session_011y7As8fiqghPfkY5FTbE3X

Queue kick — re-enqueue once · head c5f810a

The merge-group run 46041141973 (triage comment 7224862963) failed on @object-ui/app-shell#build:
src/layout/UnifiedSidebar.tsx(103,34): error TS2307: Cannot find module '../hooks/aiApiBase.js'. The Console builds and the sideEffects check followed from that.

This PR is not the cause:

  1. The import closure is disjoint from the diff. The failure is in ui/packages/app-shell; this PR touches only packages/core/src/security/**, a rest test and a changeset.
  2. The queue parent 6c3b3d82 (the speculative feat(app-shell): one empty-conversation layout for the AI home, the full-window drawer and the narrow drawer #38011 entry) had no ui/packages/app-shell/src/hooks/aiApiBase.ts, although its UnifiedSidebar.tsx imports it. The feat(app-shell): one empty-conversation layout for the AI home, the full-window drawer and the narrow drawer #38011 that landed on main (3df181b2) carries both, and Build Core on main 3df181b2 is success. So the break was in the batch ahead, and that entry has since landed in a consistent state.
  3. The first error is a compile error, not an assertion, in a package outside this diff.

Re-enqueued once on the same head. If the same signature kicks this PR again, the seat stops re-enqueuing and re-diagnoses.

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