Repository navigation
fix(plugin-detail): the approval badge says editable only when the record is editable - #34757
Conversation
…cord is editable On a `lockRecord: false` approval node the detail band read 「审批中 · 可编辑」 from the node alone. The host's `canEdit` (record permission, the edit action's disabledWhen / visibleWhen, an all-fields readonlyWhen lock) was never consulted, so a record those gates close said editable and every edit was refused. With `canEdit` false the badge now reads 「审批中」 / "In approval" (new `detail.approvalPending` and `detail.approvalPendingNotEditableTooltip` keys in all eleven locales). Claude-Session: https://claude.ai/code/session_01ADHkmNhzp7pQZtyqYheSKu Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#2 · os-steve · session_01ADHkmNhzp7pQZtyqYheSKu Final head for L1: |
|
repo:objectstack#2 · os-steve · session_01ADHkmTPcB6fZEwhd2hNQwC 席位核对L1 verdict: ACCEPT · PR #34757 · card #34701 (ui half, per Premise corrected 6944186660) · first review · L1-c2 of seat repo:objectstack#2 Head-sha: Read from GitHub and the diff at this head, not from the report. 19 files, +179/−17. Shape
Code (
i18n
Pins
Prose: one nit, not blocking. The changeset's "the badge still said editable and every edit was refused" is slightly loose for the gates now read. With Gates: 62 check-runs on this head, all L2 owed: no. None of the four contract faces is touched: Landing tier: NOT governed (0 of 19 paths), +179/−17 = 196 lines, no spec face and no narrowing. The area lands it (ordinary queue landing). |
Requested by Steve · project thread
Fixes #34701
Clause-②: no
Metadata-protocol: none
维护者速读
ui/packages/plugin-detail/src/DetailView.tsx徽章那段(新的editableHere判断);ui/packages/plugin-detail/src/__tests__/DetailView.approvalBadgeCanEdit-34701.test.tsx。pnpm --dir ui exec vitest run packages/plugin-detail/src/__tests__/DetailView.approvalBadgeCanEdit-34701.test.tsx,预期 5 条全绿;把 DetailView.tsx 换回 main 版本后,「THE DEFECT」和「keeps recall」两条变红。What changes
ui/packages/plugin-detail/src/DetailView.tsx: the approval band picks its label and tooltip from three states instead of two. Locked → "Locked for approval" (unchanged). Pending, not locked, and the host'scanEditis not false → "In approval · editable" (unchanged). Pending, not locked,canEditfalse → "In approval" with tooltip "This record has a pending approval request" (new).canEditis the record page's existing conjunction (record permission explain,userActions.editvisibleWhen/disabledWhen, an all-fieldsreadonlyWhenlock,!approvalLocked). The provider default istrue, so a host that threads nocanEditkeeps its label.ui/packages/plugin-detail/src/useDetailTranslation.tsand all elevenui/packages/i18n/src/locales/*.ts: two new keys,detail.approvalPendinganddetail.approvalPendingNotEditableTooltip.Out of this PR, per Premise corrected 6944186660 on the card:
updated_by/updated_atand runsafterUpdate) is objectql update: when every caller-supplied field is dropped (readonly / readonlyWhen), the row is still stamped and afterUpdate still runs (split from #34701) #34746.userActions.edit.disabledWhenorreadonlyWhen, which the record page already reads, and then this badge is right.DUPLICATE_REQUEST,approval-service.tsopenNodeRequest). Measured with the existing testapproval-service.test.ts› "openNodeRequest: deduplicates a pending request per (object, record)", which passes onorigin/main. The client's "first pending request" read is therefore the only one.Tests
DetailView.approvalBadgeCanEdit-34701.test.tsx(5 cases). The defect cell, recall kept on the neutral badge, and three controls:canEdittrue, nocanEditthreaded, and a locking node.canEdit={false}, which is the defect itself. Each now threadscanEdit: true(or!locked) where it asserts "editable":DetailView.approvalBand.test.tsx: 4 cases (labels a pending-but-unlocked approval as editable; uses a distinct tooltip; lets the host verdict beat the approval_status mirror; renders the tally on an editable node).DetailView.approvalRecallGate.test.tsx: 3 cases (withdraws recall from a non-submitter; keeps recall for the submitter; offers recall with no submitter identity).DetailView.approvalReadAnswered-12220.test.tsx: 1 case (control: an answeredlockRecord: falserequest reads editable).DetailView.printApprovalBand-12751.test.tsx: the shared harness now passescanEdit={!locked}, which is what the record page threads.Verification
Approval band tests and ablation
pnpm --dir ui exec vitest run packages/plugin-detail/src/__tests__/DetailView.approval packages/plugin-detail/src/__tests__/DetailView.printApprovalBand-12751.test.tsx: 40 passed.origin/main, new test kept): "THE DEFECT" fails, 1 failed / 4 passed. The recall case was then tightened to assert the badge does not say "editable", so it fails under the revert too.pnpm --dir ui exec vitest run packages/i18n/: 1894 passed, 13 skipped (locale key parity included).Derived gates at head c456037
node scripts/pm/dispatch-gates.mjs --commands: 40 commands, each run underos-verify-lock.shwith stdin closed; reconciliation--ran: 40 derived, 40 run, 0 NOT-MEASURED, 0 UNRUN.pnpm --dir ui exec vitest run scripts/exited 1 on the first pass, a prerequisite and not this diff:unit-registry-absence-collision.test.tscould not resolve@objectstack/clientwhile a parallel build was writing it. Afterpnpm turbo run build --filter='@objectstack/client...'it exited 0 (171 files, 5077 tests passed).pnpm --dir ui exec vitest run packages/plugin-detail/: 383 files, 3445 tests passed, 18 skipped.node scripts/pm/overlap-check.mjs: clean againstorigin/mainand the three open PRs that share the locale files (feat(console): phone Home folds the setup checklist to one line after the apps; the phone bar's badge and title fit #34723, feat(console-ai): an AI build shows the app itself in the main area, with one Publish on screen #34713, feat(studio): Open app returns from the workbench to the running app; the switcher hides kernel packages #34677)./mnt/project-files/objectstack-seat2/34701-gates-ran.txt(seat share).Acceptance notes
lock_recordis false, which is the samenodeConfigLocksRecordjudgement the server's record lock enforces. The refusal came from the app's own hook. Recorded on the card as Premise corrected 6944186660.🤖 Generated with Claude Code
https://claude.ai/code/session_01ADHkmNhzp7pQZtyqYheSKu