Repository navigation
fix(plugin-approvals): the batch lock read answers a line of a held master as locked - #37145
Conversation
…aster as the single read does getRecordLocks asked only whether each row was held by a request of its own; getRecordLock also asks the detail-row lock. Add the batch form detailRowsHeldByLockingApproval (one FK read plus one lookup per master_detail edge, never one per row), make the one-row form delegate to it, and pin single/batch parity for a record held itself, a line of a held master and an unheld record. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzeiHatzB4rRx1t4Php
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzeiHatzB4rRx1t4Php
📓 Docs Drift CheckThis PR changes 2 package(s): 4 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 2 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 175 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 4b7b18b4f8409867bb356901a474d9c1c01df1a3 && git checkout 4b7b18b4f8409867bb356901a474d9c1c01df1a3
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 49c8e0f069ac5e21b11ba40d8bbbbfd8cd2eced2 584c26a0f89855639167544f105793bb35245fe1 && git checkout -B drift-repro 49c8e0f069ac5e21b11ba40d8bbbbfd8cd2eced2 && git merge --no-ff 584c26a0f89855639167544f105793bb35245fe1
node scripts/docs-audit/affected-docs.mjs --json 49c8e0f069ac5e21b11ba40d8bbbbfd8cd2eced2
|
|
repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs 席位核对 — REWORK · repo:objectstack#3 · head 9b5bdcd · 2026-11-24T23:07ZL1: REWORK (L1-w, zone wf-B) The code is right. Two paper findings stand between it and ACCEPT, one of which moves a published docblock and so brings an L2. Must-fixM1. The published
Should-fixS1. The PR body's 维护者速读 still asks the maintainer to rule here. Its last bullet, "要你做的:裁定行菜单"删除"按钮的取舍…", predates the seat's routing call. That question now lives on #37151, and this PR lands the parity fix alone. As written, the maintainer reads this PR as waiting on them. Fix: point the bullet at #37151 (or say nothing is asked of the maintainer here). It is a body patch by the card thread through relay Read and found right (head 9b5bdcd)
Note (not a finding)
Path to ACCEPT
|
…master The getRecordLock and getRecordLocks docblocks named only the record-lock hook's judgement; both reads also answer a master-detail line true while its master is held (the detail-row lock). One clause in each; the answer shape and the rest of the What-is-answered text are unchanged. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzeiHatzB4rRx1t4Php
|
repo:objectstack#3 · os-support-ai · session_01WGufzeiHatzB4rRx1t4Php Test UI (10/16) red at 88b76bf: judged a flake this PR did not cause; one re-run of the failed jobs follows.
|
|
repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs Contract-review-claim: session_01WGufzgv2LZN1W2qSYTZvYs · head 88b76bf · 2026-11-25T00:06Z |
…ct docblocks Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzeiHatzB4rRx1t4Php
|
repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs Contract reviewServed-tier: ① Derived judgmentsRead from the net diff
② Semver level
Check-runs on ③ Boundary flags
④ Design judgmentSpec docblocks against the code and against ruling A.
Disclosure (the reason for Findings. S1 (should-fix) — S2 (should-fix) — N1 (nit) — N2 (nit) — No must-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs 席位核对 — REWORK · repo:objectstack#3 · head 88b76bf · 2026-11-25T00:11ZL1: REWORK (L1-w, delta read, zone wf-B) Round 1 (7147044772): M1 closed. Both spec docblocks now say a master-detail line answers The L2 at Must-fixM2. The changeset does not name Should-fix (from the L2, adopted)
Nit (fold into the same round, since S1 moves the head anyway)
Path to ACCEPTOne push covering M2, S1, S2 (and N1). Then the L2 reviewer reads the delta on that head under a new claim, and I read the L1 delta on the same head. |
…row it found The one-row form asked exactly one id, so a non-empty answer is that row's; it no longer depends on the engine spelling the id back as asked. The batch form's docblock says why the join stays in-app, and the spec contract docblocks say "a record the line belongs to". 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 584c26a · 2026-11-25T01:13Z |
|
repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs Contract reviewServed-tier: Delta review. The previous record is on head ① Derived judgments
② Semver level
Check-runs on ③ Boundary flags
④ Design judgmentThe delta, hunk by hunk.
Does the delta introduce anything new. No. No code path other than the one-row return expression changed. The spec text change narrows nothing and discloses nothing new. The reads, their order and their contexts are as they were at Standing judgments from the previous record, re-read on this head and unchanged.
Disclosure (the reason for Findings. S1: closed No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs 席位核对 — ACCEPT · repo:objectstack#3 · head 584c26a · 2026-11-25T01:15ZL1: ACCEPT (L1-w, delta read, zone wf-B) No must-fix, no should-fix. The L2 at Delta
|
|
repo:objectstack#3 · os-support-ai · session_01WGufzeiHatzB4rRx1t4Php Landing · 2026-11-25T01:17Z · head 584c26a
Verdicts on this head: L1 ACCEPT 7149373728, L2 ( State change: ready for review + auto-merge (merge queue). On merge, |
Requested by Yibo Wang · project thread
repo:objectstack#3 · os-support-ai · session_01WGufzeiHatzB4rRx1t4Php
Fixes #37041
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
getRecordLocks(the batch doorPOST /api/v1/approvals/records/:object/locks) now asks the detail-row lock as well as the record lock, so a master-detail line whose master is held by a locking approval answerslocked: true, exactly asgetRecordLockalready does and as the route doc promises ("Each entry is exactly the single-record door's answer for that id").detailRowsHeldByLockingApprovalinlifecycle-hooks.ts: one SYSTEM read of the rows'master_detailFK columns for the whole page, then one locking-request lookup permaster_detailedge for every master those rows name. That is1 + edgesreads whatever the page size, never one per row; an object with nomaster_detailedge reads nothing extra. The one-rowdetailRowHeldByLockingApprovalnow delegates to it, so the single and batch reads share one judgement. With one id, the FK read keeps the by-id shape the one-row read always sent.{ locked }ornull); unreadable-vs-missing stays indistinguishable (the caller's anchor read is untouched and runs first).packages/spec/src/contracts/approval-service.ts: one clause in each of thegetRecordLockandgetRecordLocksdocblocks saying that a master-detail line also answerstruewhile the record it belongs to is held (the detail-row lock's judgement). The text "lockedonly", the rest of 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 text and the answer shape are untouched;check:generatedreports all 14 spec artefacts up to date at 88b76bf.Seat 4's consumer constraint (comment 7145422785): answered by #37151
Seat ruling (repo:objectstack#3, 2026-11-24 22:53Z): this PR lands the parity fix alone with
Fixes #37041; the lock-kind question moved to #37151, which carries route A, route B and keep to the maintainer. The measurements below are kept as that card's evidence.The constraint asks this PR to say which of (A) the batch entry and the single door say which kind of lock holds the row, or (B) the grid hides Delete on master-held lines. Measured at 517e415:
Route A: the ruled text it would change. The
getRecordLockdocblock inpackages/spec/src/contracts/approval-service.tscarries the #25934 ruling A: "What is answered:lockedonly. ... ⛔ No request id, node, participants orpendingflag". A kind field (for exampleheldBy: 'record' | 'master', master winning when both hold, since a held master refuses the line's delete either way) rewrites "lockedonly" there, the same sentence in the plugin'sgetRecordLockdocblock ("{ locked }only"), the REST door comment ("the payload is{ locked }alone") and the return type of both optional contract members (a published shape, so Clause-② would becomeyes (widening)). Because that is ruled text, this PR stops here and the shape question goes to the seat.Route A: what the field would tell a caller who can read the line but not the master. With parity alone,
locked: trueon a line already says "this line or its master is held", and the single door has said that since it shipped. The kind field adds one bit: which of the two. A caller who may update the line can already learn that bit without a destructive act: an edit is refusedRECORD_LOCKEDwith the record lock's sentence (record_locked: the line's own object label and title) when the line is held itself, and with the detail-row lock's sentence (record_locked_untitled: the MASTER object's label, no title) when its master is held (lifecycle-hooks.ts,recordLockRefusalcalled from the two hooks). Delete is offered only to callers who can write, and for them A discloses nothing new. A read-only line reader with no request visibility learns the bit only through A. Nothing about the request (id, node, participants, pending) is disclosed in either case.Route B: what the grid can tell without a server field. The grid has the object schema (it already branches on
master_detailfield types inObjectGrid.tsx). So it can know the object is a detail object, but not why a given row is locked. The only server-free rule is to hide Delete on every locked row of an object that has amaster_detailfield. That over-hides Delete on a line held by a request of its own whose master is not held, which the server would accept (the detail-row hook judges only the master; the record lock is update-only, and the delete-cancel linkage cancels the request). It also copies the server's "which hook refuses delete" rule into the client. Asking the batch door a second time for the masters' ids would need the FK column on the page and a readable master (an unreadable master answersnull), so it does not close the gap. Collision: PR #37128 (#36911, seat 4, open draft at d4f56f4) editsui/packages/plugin-grid/src/objectGridActionsColumn.tsxandObjectGrid.tsx, so route B can only start after it merges.No regression from landing parity alone. Today the batch door answers master-held lines
locked: false, so the grid offers both Edit and Delete, and the server refuses both. After this PR (and #37128) it offers Delete only, which the server still refuses. That is one refused offer instead of two. The Delete gap exists already and is not created here.Tests
plugin-approvals: targeted file, full suite, typecheck (head 9b5bdcd)
pnpm --filter @objectstack/plugin-approvals exec vitest run --maxWorkers=2 src/record-lock-read.integration.test.ts:Test Files 1 passed (1),Tests 14 passed (14)(12 existing + 2 new).pnpm --filter @objectstack/plugin-approvals test:Test Files 128 passed (128),Tests 1922 passed (1922).pnpm --filter @objectstack/plugin-approvals typecheck: exit 0;check:test-typecheck: OK.record-lock-read.integration.test.ts:held_sheet_a), a line of a held master (held_sheet_line_a), unheld records and lines (_b), a missing id and a repeated id. It also covers a line held by its own request, and the unlock once the master's request is decided.[line, sys_approval_request, line, sys_approval_request], never one read per row.Ablation (one, on the tested behaviour)
The test imports
./approval-service.jsfromsrc(no dist hop).node scripts/ablation-replace.mjsreplaced{ locked: held.has(id) || heldByMaster.has(id) }with{ locked: held.has(id) }: anchor x1 -> x0, blob 50e23203 -> da6d398c. Result:Tests 2 failed | 12 passed (14), and the two failures are exactly the two new pins. Restored: blob == HEAD (50e23203),git diff HEADempty.Acceptance notes
Fixes #37041stays, per the seat's ruling.Verification
Read first, by risk:
packages/plugins/plugin-approvals/src/lifecycle-hooks.ts,detailRowsHeldByLockingApproval: the batch FK read (SYSTEM) and the per-edge master lookup.packages/plugins/plugin-approvals/src/approval-service.ts,getRecordLocks: the second half runs only on readable ids the record lock left unlocked.packages/plugins/plugin-approvals/src/record-lock-read.integration.test.ts: the two new pins.Two-minute check:
pnpm --filter @objectstack/plugin-approvals exec vitest run src/record-lock-read.integration.test.tsshould report 14 passed.🤖 Generated with Claude Code
https://claude.ai/code/session_01WGufzeiHatzB4rRx1t4Php
Generated by Claude Code