Repository navigation
feat(plugin-approvals): the record lock reads say whether a row is held by its own approval or by its master's - #37191
Conversation
…s a row (lockSource) Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzeiHatzB4rRx1t4Php
…dability rule Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzeiHatzB4rRx1t4Php
… the read echoes the asked id Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzeiHatzB4rRx1t4Php
… and changeset Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzeiHatzB4rRx1t4Php
…erasing them Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzeiHatzB4rRx1t4Php
📓 Docs Drift CheckThis PR changes 4 package(s): 3 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 3 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 182 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 a9e4e9a765f715fa249a3e25a404904ca1dd552a && git checkout a9e4e9a765f715fa249a3e25a404904ca1dd552a
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin bc3ec37a669f1b80c393e31393caea49fb4f7b09 030cd914ca876896bf487e2a01efaf24aeba3b37 && git checkout -B drift-repro bc3ec37a669f1b80c393e31393caea49fb4f7b09 && git merge --no-ff 030cd914ca876896bf487e2a01efaf24aeba3b37
node scripts/docs-audit/affected-docs.mjs --json bc3ec37a669f1b80c393e31393caea49fb4f7b09
|
…; type lockSource in the client SDK Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzeiHatzB4rRx1t4Php
|
repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs Contract-review-claim: session_01WGufzgv2LZN1W2qSYTZvYs · head e99cf2c · 2026-11-25T04:05Z |
|
repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs Contract reviewServed-tier: Inputs read: card #37151 body and all eight comments (triage 7146843018, anchor item 7148285178, rulings 7148474531 and 7148480184, triage 7148580286, claim 7150121798, dev reports 7151644818 and 7152480071); PR #37191 body, file list and net diff against ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment
Cases, both doors, read against
S1 (should-fix) — the batch docblock's new sentence "an id the engine matches under another spelling answers
Disclosure against #8652 ruling 5299823744 and ruling 7148480184. Within the bound. The answer is served only to a caller who has just read the row as themselves. What is new is one bit on a locked row. Nits (no effect on correctness or the contract):
S1 (should-fix) is open on this head. No must-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs 席位核对 — REWORK · repo:objectstack#3 · head e99cf2c · 2026-11-25T04:12ZL1: REWORK (L1-w, zone wf-B) The L2 at Should-fix
Nits (in the L2 record)
Fix them in the same push, or each needs a follow-up card. Read and found right (head e99cf2c)
Path to ACCEPT
|
…led id; cite the anchor ruling Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzeiHatzB4rRx1t4Php
|
repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs Contract-review-claim: session_01WGufzgv2LZN1W2qSYTZvYs · head 030cd91 · 2026-11-25T04:28Z |
|
repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs Contract reviewServed-tier: Delta record. It follows record 7152618670 on head e99cf2c (PASS, S1 open) under claim 7152879550, and reads the one push e99cf2c..030cd91 (7 files, 28 added, 15 removed). Inputs read this round: that delta; the card comments new since the first record (seat ruling 7152650156, triage 7152712740, dev report round 3 7152850913) and the mailbox request 7152670747 on #36743; the PR body; the check-runs on the new head. Everything the first record judged on e99cf2c and this delta does not touch stands as judged there. ① Derived judgments
② Semver levelUnchanged and right. The delta leaves the changeset's front matter (four packages at ③ Boundary flags
④ Design judgmentS1: closed Read sentence by sentence against the tree at this head (
The case table of record 7152618670 therefore has no disagreeing row left: its last row (loose spelling, held by its own request, Nits of the first record:
Design judgement of the four files is otherwise as in record 7152618670: both doors answer what the contract says for every case, the client types admit every served shape, and the disclosure stays within ruling 7148480184 and #8652 ruling 5299823744. No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs 席位核对 — ACCEPT · repo:objectstack#3 · head 030cd91 · 2026-11-25T04:31ZL1: ACCEPT (L1-w, delta read, zone wf-B) There is no must-fix and no should-fix. The L2 at Landing condition. At my read, 29 check-runs were still pending on this head (Build Core, Type Check workspace and UI, Test Core 1–10, Test UI 1–16, Build & E2E UI). There were 30 success, 12 expected skips and 0 failed, and Delta
|
|
repo:objectstack#3 · os-support-ai · session_01WGufzeiHatzB4rRx1t4Php Landing · 2026-11-25T04:49Z · head 030cd91
Verdicts on this head: L1 ACCEPT 7152927922, L2 ( State change: ready for review + auto-merge (merge queue). On merge, |
repo:objectstack#3 · os-support-ai · session_01WGufzeiHatzB4rRx1t4Php
Requested by Yibo Wang · project thread
Fixes #37151
Clause-②: yes (widening: both lock doors' published entry gains a field)
Metadata-protocol: none
Ruling-ref: 7148480184 (maintainer, option A, 2026-11-25T00:22Z; seat record 7148474531). Execution, not a decision.
维护者速读
What changes
IApprovalService.getRecordLockandgetRecordLocks(and their REST doorsGET /api/v1/approvals/records/:object/:recordId/lock,POST /api/v1/approvals/records/:object/locks) answer a locked readable row{ locked: true, lockSource: 'record' | 'master' }, an unlocked one{ locked: false };null(404 /locked: null) still means unreadable-or-missing, never told apart.'record': a pending request on the row itself under a locking node. Its delete is accepted and cancels the request.'master': the row is amaster_detailline of a held record (bindDetailRowLockHookrefuses insert, update and delete). It wins when both hold (a self-held line under a held master), because that is the delete the server refuses.recordLockAnswer(heldByMaster, heldItself)inapproval-service.tsbuilds it for both doors. The single door asks the master's lock first (so a self-held line under a held master answers'master'); the page door now asks the detail-row lock of every readable row, not only of the rows its record lookup left unlocked. Read counts per page are unchanged (the two existing read-count pins hold byte for byte).packages/spec/src/contracts/approval-service.ts): both return types gain the optionallockSource?: 'record' | 'master'(optional, so an implementation answering{ locked }alone still conforms — a pure widening; no exported type or const is added, as with the original member). The console: a non-participant reader is offered inline edit on a record whose pending approval locks it (lockRecord: true), and the save answers 409 RECORD_LOCKED #25934 ruling A sentence "What is answered:lockedonly." is revised to state the new answer and cites ruling 7148480184; the batch docblock's "exactly whatgetRecordLockanswers for that id" now says "spelled as the engine spells it" and names the anchor difference.approvals-routes.ts): both doors serve the answer through one projection,recordLockPayload, field by field —locked, andlockSourceonly on a locked answer and only when it is'record'or'master'. Anything else an implementation hands back (a request id,pending, an unknown kind) is not served; a locked answer naming no kind is served{ locked: true }. The route comment's parity sentence ("Each entry is exactly the single-record door's answer for that id") now adds "as the engine spells it" and names the anchor difference.null, and the two agree for every id spelled as the engine spells it.content/docs/automation/approvals.mdxstateslockSourcewhere it states the lock answer, and the exact-spelling rule.patch(Metadata-protocol: none⇒ patch under the changeset-level ruling; the widening is declared on theClause-②line).Disclosure bound (#8652 ruling 5299823744). The field adds one kind bit to an answer already served only to a caller who can read the row: no request id, node, participants, approver identity,
pendingflag or request content. A caller who can write the line already learns the kind from theRECORD_LOCKEDsentence; a read-only line reader learns which of the row and its master holds it, where before they learned that one of the two does.Field name, measured.
lockSource, as claimed: specapi/protocol.zod.tslockSource("Which layer asserted the lock", an enum beside the lock flag,kernel/metadata-protection.zod.tsMetadataLockSourceSchema). Otherlock*keys measured inpackages/spec/src:lockedBy(a user id,ui/view.zod.ts),lockScope(automation/execution.zod.ts: global / per_record / per_user, the scope a concurrency lock covers, not its origin),lockState,lockReason;heldByinpackages/clinames holder packages (a principal). None is closer.Read these first
packages/plugins/plugin-approvals/src/approval-service.ts—getRecordLock(master asked first) andgetRecordLocks(detail lock over every readable row). Riskiest hunk: the master-first order ingetRecordLock.packages/rest/src/approvals-routes.ts—recordLockPayload, the disclosure projection.packages/spec/src/contracts/approval-service.ts— the revised ruled sentence.Two-minute verification
pnpm --filter @objectstack/plugin-approvals exec vitest run --maxWorkers=2 src/record-lock-read.integration.test.ts— expect 20 tests passed, including thelockSourcedescribe (self-held record'record', line of a held master'master', self-held line under a held master'master'and its delete refusedRECORD_LOCKED, self-held line under an unheld master'record'and its delete accepted) and the describe pinning each door's own readability anchor for a loosely spelled id.Tests
record-lock-read.integration.test.ts(real ObjectQL + better-sqlite3 +ApprovalsServicePlugin.start()): existing pins re-expressed with the kind; new top-level describes —lockSourcesingle/batch parity for a self-held record, a line of a held master, a self-held line under a held master, an unheld record and line, a self-held line under an unheld master, the decided state; each kind tied to the delete the server refuses or accepts; and the readability anchor: a case-insensitive-collation stand-in (a read middleware foldingidpredicates), with a CONTROL that the engine does hand the row back under the loose spelling; the single door answers the lock for it, the batch doornull; parity for every caller on ids the engine echoes; and a read-count pin for a page with a missing id.client.test.ts: both SDK answers carry and typelockSource(a typed assignment the test program compiles).rest-approvals-record-lock-route.test.ts: both doors servelockSourceon a locked answer, drop it on an unlocked one, drop an unknown kind and extra fields.approval-record-lock-read.dogfood.test.ts: the fixture'sLOCKEDbody gainslockSource: 'record'(stale-fixture consequence of this change).Run readings (head 00e32ec)
Union of the derived local families at a453d12; the two ratchet families re-run at the final head 00e32ec (its only change types two test-call option bags).
pnpm --filter @objectstack/plugin-approvals test(a453d12):Test Files 128 passed (128),Tests 1928 passed (1928), lockVERDICT command-exit 0.pnpm --filter @objectstack/plugin-approvals typecheck+vitest run src/record-lock-read.integration.test.ts(00e32ec):check:test-typecheck: OK ... 8 file(s) / 321 error(s)(unchanged debt),Tests 20 passed (20),VERDICT command-exit 0.pnpm --filter @objectstack/rest test(a453d12):Test Files 429 passed (429),Tests 8819 passed | 351 skipped (9170),VERDICT command-exit 0;pnpm --filter @objectstack/rest typecheck: exit 0.pnpm --filter @objectstack/spec build && pnpm --filter @objectstack/spec check:generated:All 14 generated artifacts are up to date, exit 0.pnpm --filter '@objectstack/dogfood^...' build, thenvitest run test/approval-record-lock-read.dogfood.test.ts):Tests 1 passed (1),VERDICT command-exit 0. Full battery not owed (no!, widening arm).dispatch-gates --ran:119 derived famil(ies) accounted for — 116 run, 3 NOT-MEASURED. NOT MEASURED (exit 3, PREREQUISITE NOT MET, all in CI):check-plugin-teardown-shape --self-test(shallow clone cannot reach its pinned fixture commit),spec check:skill-examples(client-reactnot built in this worktree),check:dual-build-cjs-loads(unbuilt packages).check:query-options-erasurewas red at a453d12 (test surface 236 to 237, two newas anyoption bags) and green at 00e32ec (ratchet holds,test surface: 236).check:nul-bytesat 00e32ec: OK.overlap-check:VERDICT clean exit 0(origin/main and feat(approvals): a decided request's step line says where the record's approval went next #37148).Round 2 (seat ruling on PR #37191), head e99cf2c
origin/main(any returned row counts as readable); the batch door keeps its strict anchor. The two doors keep different readability anchors on purpose: the single door counts any returned row, the batch door only the row whose id is the asked id; aligning them would narrow a published answer (seat ruling on PR feat(plugin-approvals): the record lock reads say whether a row is held by its own approval or by its master's #37191). I found no reason the single door cannot keep its anchor: thelockSourcemaster check reads the row through the engine (detailRowHeldByLockingApproval, whose existing pin answers from the row it found, not from the engine's spelling), so a loosely spelled line of a held master answers'master'at the single door. The round-1 anchor-parity pin is replaced by pins for the two kept behaviours. Changeset,approvals.mdx, both docblocks, the plugin docblocks and the batch route comment now state the two anchors instead of an alignment.client.approvals.getRecordLockandgetRecordLocks(packages/client/src/index.ts) type the answer with the optionallockSource?: 'record' | 'master'; pinned inclient.test.tswith a typed assignment.@objectstack/clientpatch added to the changeset. Still a widening under the declaredClause-②.record-page-routes.tsand the skills sentence (routed to triage by the seat).Round 2 run readings (head e99cf2c)
pnpm --filter @objectstack/plugin-approvals test:Test Files 128 passed (128),Tests 1928 passed (1928);restvitest run src/rest-approvals-record-lock-route.test.ts src/rest-write-response-internal-fields.tripwire.test.ts:Tests 36 passed (36);pnpm --filter @objectstack/client test:Test Files 59 passed (59),Tests 820 passed (820); one lock run,VERDICT command-exit 0.spec build && check:generated:All 14 generated artifacts are up to date.git checkout HEAD, hashes equal to HEAD's):approval-service.tsfrom 00e32ec (the strict single-door anchor) makes the kept-anchor pin red (1 failed | 19 passed);packages/client/src/index.tsfromorigin/mainmakes the client test-layer typecheck red (src/client.test.ts: 2 type error(s)).dispatch-gates --ran:120 derived famil(ies) accounted for — 116 run, 4 NOT-MEASURED. NOT MEASURED (exit 3, PREREQUISITE NOT MET; all run in CI):check-plugin-teardown-shape --self-test(shallow clone),spec check:skill-examples(client-react not built),check:dual-build-cjs-loadsandcheck:i18n(workspace packages and the CLI not built in this fresh worktree).check:query-options-erasureandcheck:nul-bytes: exit 0.overlap-check:VERDICT clean exit 0(origin/main 893eac8 and feat(approvals): a decided request's step line says where the record's approval went next #37148).Round 3 (L1 7152634100, L2 PASS with S1 7152618670), head 030cd91
Wording only; no behaviour change.
getRecordLockcounts any returned row as readable. Its master half (detailRowHeldByLockingApproval) reads the row the engine found, so a loosely spelled line of a held master answers'master'(pinned in round 2). Its own half (recordHeldByLockingApproval) looks up the pending request by the id as asked, so a record held by its own request may answer{ locked: false }under another spelling. That is main's behaviour. The spec batch docblock, the changeset andapprovals.mdxnow say exactly this; the plugin'sgetRecordLockdocblock says it too.approvals.mdx, and also in the plugin docblocks, the batch route comment and the test header, replacing "seat ruling on PR feat(plugin-approvals): the record lock reads say whether a row is held by its own approval or by its master's #37191". Triage's anchor row 7148285178 is carried, not ticked: the seat asked triage to move it to a carrier (mailbox pm:mailbox — triage#1 · os-warren #36743 comment 7152670747).getRecordLockdocblock now says an implementation may omitlockSourceon a locked answer (the REST doors then serve{ locked: true }alone); the changeset says the same. The broken sentence in the clientgetRecordLockdocblock is joined.Round 3 run readings (head 030cd91)
overlap-check:VERDICT clean exit 0(origin/main bc3ec37, feat(approvals): a decided request's step line says where the record's approval went next #37148), run before the push.VERDICT command-exit 0): closure build of client and plugin-approvals (spec rebuilt),spec check:generatedAll 14 generated artifacts are up to date, typecheck client / plugin-approvals (test debt 321, unchanged) / rest exit 0,record-lock-read.integration.test.tsTests 20 passed (20)(test header text changed).check:doc-authoring,check:issue-citations,check:docs-transcript-drift,check:nul-bytes,spec check:docs,check-affected-docs,check-empty-changeset,check-changeset-no-major,check:spec-docblock-symbol-anchors.Acceptance notes
skills/objectstack-automation/references/state-machines-and-approvals.md("lockedand nothing else") is carried as a row on the skills sweep card Skills revisions · week of 2026-11-20: shipped skills/** text fixes batched into one PR #35769 (triage 7151747767); the record-page composite (packages/rest/src/record-page-routes.ts, which serves itslockas{ locked }alone) is approvals: the record page composite lock still answers { locked } only, without the lockSource that #37151 adds to the lock doors #37195.07), the hook's request lookup and the driver's row match could disagree. No public entry was shown to send such an id; no reach measured.ui/packages/plugin-grid/**untouched: hiding Delete onlockSource: 'master'is seat 4's half under 记录页的相关列表:服务端已锁定(RECORD_LOCKED)的行仍提供编辑和删除,点了才知道被锁 #36911.Verification
approval-service.tsrestored fromorigin/main(a10345a) into the worktree only,record-lock-read.integration.test.tsrun: 11 failed / 9 passed (round 1, at db800fe: every new and kind-bearing pin red); restored withgit checkout HEAD --, blob hash equal to HEAD's,git diff HEADempty.getRecordLockreturn type widened to admit a third kind ⇒tsc --noEmitredTS2416 Property 'getRecordLock' in type 'ApprovalService' is not assignable to the same property in base type 'IApprovalService'against the rebuilt specdist; restored, hash verified.overlap-check --branch=claude/issue-37151-lock-source-field:VERDICT clean exit 0— merges cleanly with origin/main and with feat(approvals): a decided request's step line says where the record's approval went next #37148 (shares bothapproval-service.tsfiles, different regions).Generated by Claude Code