Skip to content

fix(console): a claim answered 404 or 403 says the record is no longer waiting; race pins per ruling B - #39238

Queued
objectstack-fleet[bot] wants to merge 7 commits into
mainfrom
claude/issue-39065-cold-claim-409
Queued

objectstack-fleet[bot] wants to merge 7 commits into
mainfrom
claude/issue-39065-cold-claim-409

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Bill · project thread
repo:objectstack@os-bill · os-bill · session_01Utp6CYUove7YBXgHy4iEsr
Fixes #39065
Ruling-ref: 7363773549
Clause-②: no
Metadata-protocol: none
Skills-docs: follow-up #39242

维护者速读

  • 用户能看到什么变化:客服在控制台点「认领」时,如果服务器回答「不存在」或「无权限」,页面不再显示原始报错,而是提示「这条记录已不在待认领状态」并刷新记录;抢到的人和以前一样。
  • 为什么做:执行认领裁决 B(两人同时认领时由谁收到什么回答),替排队认领的客服和下游 CRM 的并发认领测试解决「输家收到的回答不一致」的问题;裁决里的架构决策记录补注由另一张卡承担。
  • 出错会怎样:最坏是认领失败时的提示语不准确,记录归属不受影响、始终只有一个负责人;改动只在提示和测试,可直接撤回。
  • 要你做什么:无。

What changes

Ruling B on #39065 (record 7363773549): exactly one owner is the invariant; a losing claim whose gate read the record unowned answers 409 CONCURRENT_UPDATE, and one whose gate runs after the winner's commit gets what any request gets then, 404 (private) or 403 (public_read). Status codes, messages and the ownership gate are unchanged. The ADR note is carried by #39223; this PR is ruled term (3).

  • Console. claimQueuedRecord (@object-ui/plugin-detail) reports a 404 or 403 as a new outcome, unavailable, where it reported refused. The record page shows one sentence for it, "This record is no longer waiting to be claimed.", and re-reads the record, as it does for a 409. The sentence names no claimant, because a 404 is also what a deleted record answers. The key detail.claimUnavailable is added to all 11 shipped locales.
  • Race pin. The header of ownership-claim-race-sqlite.test.ts now states the ruling: one owner always; 409 for a loser whose gate read the row unowned; 404/403 for one whose gate ran after the commit. The five lockstep cells still pin the 409. Two new cells (private, public_read) put one real I/O tick ahead of one claimant, alternating which, and assert one owner per round, the stored owner is the winner, and every loser answered from 409, 404, 403.
  • HTTP door. A new file, packages/verify/src/claim-race-http-door-39065.test.ts, boots the real stack and races two members' PATCH /api/v1/data/OBJECT/ID with { owner_id: SELF } on a private and a public_read object, asserting the same invariant and set.

Read first, by risk:

  1. ui/packages/plugin-detail/src/queueClaim.ts, the refusalStatusOf helper and the unavailable branch in claimQueuedRecord: it reads httpStatus, status and statusCode, the spellings is404Error in @object-ui/data-objectstack already reads.
  2. ui/packages/app-shell/src/views/RecordDetailView.tsx, the unavailable arm in handleClaim: the only consumer of the outcome; the shared notifyDataChanged re-read already follows every answer.
  3. packages/plugins/plugin-security/src/ownership-claim-race-sqlite.test.ts, the ioTick cells.

Tests

  • Red first: the new claimQueuedRecord describe failed 3 of 16 on the unchanged queueClaim.ts (expected { outcome: 'refused', … } to deeply equal { outcome: 'unavailable', … }), then passed 16 of 16.
  • Ablation, once: deleting the unavailable line from queueClaim.ts (anchor hit 1 to 0, restored blob equal to HEAD) turns the same 3 cases red.
  • Race pin: 9 of 9 passed (7 existing, 2 new). The I/O-tick cells' loser readings, from a one-off mutated run: private {"RECORD_NOT_FOUND/404":25}, public_read {"PERMISSION_DENIED/403":25}. The ruling's named premise holds: one owner in every round, every loser in the set.
  • HTTP door: 2 of 2 passed. Loser readings, from a one-off mutated run: private {"RECORD_NOT_FOUND/404":4}, public_read {"PERMISSION_DENIED/403":4}.
  • Locale parity: all-locales-key-parity.test.ts passed.

Acceptance notes

  • The dispatch's file surface named queueClaim.ts and the plugin-detail translation bundles. The 409 toast and reload live in RecordDetailView.tsx (app-shell), its only consumer, and the Console's claim sentences live in ui/packages/i18n/src/locales/*.ts; both were edited, nothing else.
  • The existing pin "carries any other refusal through as refused" used a bare 403; under the ruling a 403 is unavailable, so it now uses a 400 VALIDATION_FAILED.
  • skills/objectstack-data/rules/security.md (the Claim paragraph) and the eval in skills/objectstack-data/evals/hooks-security-seeds-datasources.json still teach "the other gets 409 CONCURRENT_UPDATE" only. Not edited here (skills/** is outside this PR); a follow-up is owed.
  • ui/AGENTS.md rule ✨ Set up Copilot instructions #2 asks for a docs page update; content/docs/** is outside this PR, and the docs paragraph is ruled term (1), carried by ADR-0142 D4: amend the claim-race promise to the ruled answers (409 / 404 / 403, exactly one owner) and the queues docs paragraph with it #39223.

Verification

Two-minute check: pnpm --dir ui exec vitest run packages/plugin-detail/src/queueClaim-25769.test.tsx; expect 16 passed, including four cases under "a 404 or 403 straight after a claim is no longer waiting".

Local gates, at 55b556c (after the merge of origin/main)
  • dispatch-gates.mjs --repo objectstack-ai/objectstack --ran: 75 derived, 73 run, 2 NOT MEASURED, 0 unrun. Every run family exited 0 (exit codes captured before any pipe).
  • NOT MEASURED: pnpm check:dual-build-cjs-loads and pnpm check:i18n, both "PREREQUISITE NOT MET" (exit 3): they read built output of packages this tree has not built, and a full pnpm build does not fit the foreground limit. CI runs both.
  • pnpm --dir ui exec vitest run scripts/: 172 files passed, 2 skipped. pnpm check:new-line-citations (ui): 0 new citations.
  • Type checks: @object-ui/plugin-detail and @object-ui/i18n type-check exit 0; @objectstack/plugin-security and @objectstack/verify typecheck exit 0 (test layer included).
  • NOT MEASURED: @object-ui/app-shell type-check (its build closure is not built here: 386 errors, the TS2307 "cannot find module" family and the implicit-any errors it cascades into; none at the edited lines). Type Check UI in CI measures it.
  • NOT MEASURED: the whole plugin-detail and i18n suites together hit the 570 s foreground limit; the two touched test files ran and passed. Test UI in CI runs them.

Generated by Claude Code

…ilable (red first)

Claude-Session: https://claude.ai/code/session_01Utp6CYUove7YBXgHy4iEsr
Co-authored-by: Claude <noreply@anthropic.com>
…no longer waiting, and reloads

Claude-Session: https://claude.ai/code/session_01Utp6CYUove7YBXgHy4iEsr
Co-authored-by: Claude <noreply@anthropic.com>
… ahead of one claimant

Claude-Session: https://claude.ai/code/session_01Utp6CYUove7YBXgHy4iEsr
Co-authored-by: Claude <noreply@anthropic.com>
…ne owner and a loser answered 409, 404 or 403

Claude-Session: https://claude.ai/code/session_01Utp6CYUove7YBXgHy4iEsr
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 Dec 3, 2026
@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

Nothing in this diff resolved to a documentable surface (no symbol, route or SDK anchor derived from 0 changed package(s)), so this run has no opinion about the docs.

What this run could not see

Coarse fallback — 0 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 1fe9c6287f2f058c7d1f1972cdfa4ebcd58803b6 → packageMentionDocs.

…ce (contract review 7365351117)

Claude-Session: https://claude.ai/code/session_01Utp6CYUove7YBXgHy4iEsr
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-bill · os-bill · session_01Utp6CYUove7YBXgHy4iEsr

维护者速读

  • 做了什么:客服在控制台点「认领」时,如果服务器答「不存在」或「无权限」(别人刚抢到),页面提示「这条记录已不在待认领状态」并刷新,不再显示原始报错;11 种语言都有。另加并发认领钉测:始终只有一个负责人,输家收到 409 / 404 / 403 之一;持有转移权限的人另测(后写者赢)。
  • 范围:按你选的 B 第 (3) 条;状态码、报错和权限门不变。ADR 补注在 ADR-0142 D4: amend the claim-race promise to the ruled answers (409 / 404 / 403, exactly one owner) and the queues docs paragraph with it #39223(已交接)。
  • 要你做什么:无,区内落地。
  • 风险:低;只改提示和测试。

席位核对

ACCEPT — head d1b83c6d7f04771e26e8b8864a64b657d07967ca (#39065, zone data-p2).

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review December 3, 2026 03:25
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Dec 3, 2026
Any commits made after this event will not be merged.

This branch has not been deployed

No deployments
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

Development

Successfully merging this pull request may close these issues.

Concurrent claim: the first race after boot still answers 404 RECORD_NOT_FOUND to the loser instead of 409 CONCURRENT_UPDATE (residual of #35142)

2 participants