Repository navigation
fix(plugin-grid): row menu hides Edit on a row held by a locking approval - #37128
Conversation
…oval The grid's row menu (list page and record-page related tab) now reads the approval locks the select-first cells read, asked when a row's actions are reached for. An answered lock hides Edit; Delete stays. Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D Co-authored-by: Claude <noreply@anthropic.com>
…lated-list-locked-rows
|
repo:objectstack#4 · os-justin · session_01QSeKYmRepQK9DkZeU7F53D Final head for L1 · area a4-U · 2026-11-24T21:41Z
|
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ 席位核对 — REWORK · L1 · head
|
…ight; narrow the Delete claim Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#4 · os-justin · session_01QSeKYmRepQK9DkZeU7F53D Final head for delta L1 (fix round 1) · area a4-U · 2026-11-25T00:20Z
|
|
repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ 席位核对 — ACCEPT · L1 · head
|
|
repo:objectstack#4 · os-justin · session_01QSeKYmRepQK9DkZeU7F53D Landing · area a4-U · 2026-11-25T00:44Z · head
State change: ready for review + auto-merge armed; the queue lands it. On MERGED the card #36911 closes through |
Fixes #36911
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
The grid's row menu (
@object-ui/plugin-grid) now follows the approval lock the grid's select-first cells already read. Both the list page and a record page's related tab (the related list's enlarged face, which rendersobject-grid) draw this menu, so both change together.useRowApprovalLockshook (POST /api/v1/approvals/records/:object/locks), which is not exported, and its ruleresolveApprovalLock. Nothing is copied. The read is made once for the rows on screen, when a row's actions are first reached for: the existingonActionsDemandchannel (pointer or focus on the actions cell, the "⋮" opening, the row context menu, the page bar's single-row menu). It is never made on first paint (the objectstack#35795 posture). The hook now also runs on a grid whose rows offer Edit, not only on a select-first grid. It still reads nothing until it is asked.locked: trueoffers no Edit. That matches the record page, which draws no Edit on an approval-locked record (objectstack#35593). Delete stays for a record held by its own approval, because the server lets such a record be deleted and cancels its request ([finding] 删除记录后,它的审批单仍留在审批收件箱:pending 与 approved 两种都留,记录引用退化为原始 id #13568). The batch read answers only for that case. A line held because its master is held refuses delete too, so if Approvals batch lock read answers "not locked" for a master-detail line of a locked master, unlike the single-record read it claims to equal #37041 makes the read report such lines, the read must tell the two apart before this menu uses it.approval_statuscolumn, so the column does not stand in for a read. In each of these cases the menu stays as it was: a 501 (no approvals service), anullentry (a row the reader cannot read), a failed read, or a read not yet asked. The select-first cells keep their column fallback unchanged.Files:
ui/packages/plugin-grid/src/ObjectGrid.tsx(hook gate anddemandRowActions),ui/packages/plugin-grid/src/objectGridActionsColumn.tsx(Edit verdict and demand wiring), and the new testui/packages/plugin-grid/src/__tests__/rowMenuApprovalLock-36911.test.tsx.RowActionMenu.tsxanduseRowApprovalLocks.tsare unchanged.The reading this card asked for (served state)
Tree: objectstack-ai/objectstack at 8e4ac50 (re-read at 1e96009).
userActions.edit/deletevisibleWhen/disabledWhen): already served, and already followed by both related-list faces.withDetailWritesWithheld, objectstack#35599 ruling A).userActionspredicates. The toast from fix(plugin-detail): a refused related-list row delete toasts its refusal #36885 covers refusals after the fact.Tests
New file
rowMenuApprovalLock-36911.test.tsx, 7 pins. Five come from the first round: a locked row offers no Edit and keeps Delete, while its unlocked sibling keeps Edit; no lock read before a row's actions are reached for, then one read for the page and none on repeat; a 501 over anapproval_status: pendingrow leaves the menu as it was; anullentry leaves Edit; a failed or not-yet-asked read leaves Edit. Two were added in fix round 1. List page: on the list page, a row's actions come from the single-row selection bar (SelectionBar.tsx), not a ⋮ column. With the locked row selected, the bar offers no Edit and still offers Delete; with its unlocked sibling selected, the bar offers Edit, which is the control. The bar already read the lock before this round, because it resolves its actions from the samerowActionMenuPropsand asks through the sameonActionsDemandon mount. No wiring was added; only the pin is new. Read in flight: the lock answer is held, the ⋮ menu is opened and Edit shows; the answer is released and Edit leaves the open menu while Delete stays. Result at 4c64a0a: 7/7 passed.Ablation, run once and not kept:
canEdit && rowOps?.update !== false && !approvalLockAnswered(row),was replaced bycanEdit && rowOps?.update !== false,throughscripts/ablation-replace.mjs. The mutation was confirmed on disk (anchor count 1 to 0, blob 2c0f37ef to dc3f8dc5). The first pin turned red as predicted (Tests 1 failed, 4 passed). After the restore, the blob matched HEAD andgit diff HEADwas empty. In fix round 1, the same ablation was run at 4c64a0a (blob c420482d to 2f180f3e) and turned 3 pins red: the ⋮ pin, the list-page bar pin and the in-flight pin (Tests 3 failed, 4 passed; the bar pin received{ edit: true, delete: true }). A second ablation changedapprovalLocks.isLocked(rowRecordId(row), null)toapprovalLocks.isLocked(rowRecordId(row), row), which lets theapproval_statuscolumn stand in (blob c420482d to be48f357). It turned the 501-over-pending-column pin red (Tests 1 failed, 6 passed; received{ edit: false, delete: true }). Both restores were confirmed: blob == HEAD andgit diff HEADempty.Stale fixtures fixed in this PR. Two existing explain-engine fakes (
rowRecordCrudVerdict.test.tsx,inlineEditRecordVerdict-27365.test.tsx) answered every URL as the explain engine. Once reaching a row's actions also read the lock door, they counted that read as an explain call: 19 tests red on the first full run. Each fake now answers the lock door "unlocked" and leaves it out of its call count. Their assertions are unchanged.Fix round 1 readings, at head
4c64a0a1: the full plugin-grid suite gaveTest Files 312 passed (312) · Tests 2773 passed (2773), VERDICT command-exit 0.pnpm --dir ui exec vitest run scripts/gave 172 passed and 2 skipped files, 5130 passed and 2 skipped tests, exit 0. The 39 derived gate families all exited 0. One of them,check:type-check-debt, first hit a queue timeout (exit 3, not measured) and then exited 0 on a re-run. Reconciliation with--rangave 39 derived, 39 run, 0 NOT-MEASURED. overlap-check exited 0 and merges cleanly with origin/main and with #37084.The readings below are from the first round, at head
d4f56f4a(which includes a merge oforigin/mainat 9d70768), unless a line says otherwise.Full plugin-grid suite: 312/312 files, 2771/2771 tests
cd ui && pnpm exec vitest run --maxWorkers=2 packages/plugin-grid/under os-verify-lock:Test Files 312 passed (312) · Tests 2771 passed (2771), VERDICT command-exit 0. The earlier run before the fixture fix, at 2f9deb3, was2 failed | 310 passedfiles, with the 19 tests named above.Type-check and the ui scripts suite
pnpm exec turbo run type-check --concurrency=2 --filter=@object-ui/plugin-gridat abbeea2: 54/54 tasks, plugin-grid a cache miss (tsc --noEmit && tsc -p tsconfig.test.json), VERDICT command-exit 0.tsc --listFilesOnlyconfirms thattsconfig.test.jsoncompiles all three changed test files.pnpm run type-checkinui/packages/plugin-grid, exit 0. Declared narrowing: this ran without the lock, because the lock was held by a dogfood run past two 540-second budgets andtsc --noEmitwrites nothing. The dependency type-checks are left to CI.@objectstackpackages as Test UI does:pnpm --dir ui exec vitest run --maxWorkers=2 scripts/gaveTest Files 172 passed | 2 skipped (174) · Tests 5130 passed | 2 skipped, VERDICT command-exit 0.Derived gate families: 39 of 39 exit 0
node scripts/pm/dispatch-gates.mjs --commandson this diff derived 39 commands, and every one exited 0 at d4f56f4.pnpm check:changeset-fixedwas also run (exit 0), because its roster sits under.changeset. Reconciliation with--rangave:39 derived, 39 run, 0 NOT-MEASURED, 0 UNRUN (a DERIVED zero — all 39 recorded an exit code).pnpm check:type-check-debtexited 3 once on the first pass, at 2f9deb3, and was not measured then; both of its later runs exited 0.overlap-check before each push
Every run exited 0. The last one, at d4f56f4:
merges cleanlywith origin/main 9d70768, with #37084, and with #37079 (both also editObjectGrid.tsx).Acceptance notes
componentsdata-table (DataTableBuiltinRowActionItem). Neither can reach the grid's lock hook without a new dependency or export. No card is filed for this, per the seat's ruling. On those surfaces Edit on a locked row stays until it is refused, and the fix(plugin-detail): a refused related-list row delete toasts its refusal #36885 toast explains the refusal.approval_statuscolumn reads pending is read-only in its cells (the cells use the column fallback), while its menu still offers Edit (the menu uses answered locks only).Verification
Read first (riskiest first):
ui/packages/plugin-grid/src/objectGridActionsColumn.tsx:approvalLockAnsweredand thecanEditexpression inrowCrudVerdicts, the one verdict both the column's draw decision and every menu read.ui/packages/plugin-grid/src/ObjectGrid.tsx: theuseRowApprovalLocksgate anddemandRowActions, which together decide when the read is made.ui/packages/plugin-grid/src/__tests__/rowMenuApprovalLock-36911.test.tsx.Two-minute check:
cd ui && pnpm exec vitest run packages/plugin-grid/src/__tests__/rowMenuApprovalLock-36911.test.tsx. Expect 7 passed.Generated by Claude Code