Repository navigation
Commit d57d6ee
feat(app-shell): fold the approver's decision band on a record under approval (#34641)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} -->
_Requested by **Yibo Wang** · [project
thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBLW6dHPW6sSheA32XPKZzPV)_
repo:objectstack#3 · os-support-ai · session_01WGufzg2evNa1V3zxrQq3KX
Fixes #34361
Clause-②: yes (widening — new @object-ui/i18n en keys only; no
metadata/schema accept set)
Metadata-protocol: none
## 维护者速读
- 改了什么:审批人打开审批中的记录时,原来平铺的 7 个审批按钮收成一条审批条:前面一行状态「待你审批 · 第 N 步 · 步骤名 · 提交人
X」,只露出「通过」「拒绝」两个按钮,转签 / 退回修改 / 退回补充 /
回复(审批人兼提交人还有撤回、催办)都放进一个「更多」菜单。业务记录页和审批请求页是同一条。记录自己标题栏的按钮不动。
- 为什么改:裁决 A(6917968848)。客户反馈记录页上有「两层菜单」,分不清哪一排是自己要做的事。
-
风险与回滚:只改按钮摆放,谁能审批、每个按钮的显示条件、对话框和发出的请求都不变;越权管理员的折叠(琥珀色菜单)和只是提交人的查看者都不变。回滚就是
revert 本 PR。
- 先看:① `ui/packages/app-shell/src/views/DeclaredActionsBar.tsx` 里
`decisionBand` 那段(决定哪些按钮留在外面、何时收进菜单);②
`ui/packages/app-shell/src/utils/approvalDecisionFold.ts`(按动作声明的 variant
判断,不按名字);③ 两个调用点各加了一个 `foldDecisions`。
- 两分钟验证:以审批人身份打开一条审批中的业务记录(或它的审批请求页),应看到一行「待你审批 · 第 N 步
…」,右边只有「通过」「拒绝」和一个「⋯ 更多」,点开「更多」能看到转签、退回修改、退回补充、回复。
- 需要你做的:无,席位落地。
## What changes
Ruling A (6917968848), executed as the coordinator's plan (6936836041)
lays it out.
- **`DeclaredActionsBar` gains a second fold, `foldDecisions`** (the
approver fold). It applies to a viewer the server says can act
(`viewer.can_act === true`) once more than two of the bar's actions are
shown:
- a status line names the task (「待你审批」 / "Awaiting your approval"), the
step's number on the served route (`flow_route`), the step's label
(`step_label`), and the submitter (`submitter_name`, or the existing
"You submitted this" when `viewer.is_submitter` is true);
- the actions whose declared `variant` is `primary` or `danger` stay
buttons (today `approval_approve` and `approval_reject`); the split is
read off metadata (`isLeadDecision`), never off a name list, so an
action shipped as metadata alone lands in the menu;
- every other permitted action goes into one neutral "More approval
actions" menu (`DropdownMenu` plus `DeclaredActionButton asMenuItem`,
the same mechanism the override fold uses). The trigger is a plain
outline button: the amber shield stays the override path's mark;
- phone: the status line on top, then one row with the two decisions at
equal width (`flex-1`) and the menu trigger at its end.
- **Gates and dispatch unchanged.** Every folded action keeps its own
`visible`, `disabled` and capability gates and its dialog, and sends the
same request.
- **`onDrawnActionsChange` semantics unchanged.** Menu actions still
count as drawn: a closed menu's actions report through the same
visibility probe the override fold uses. The only internal change is
that the drawn-set reporter now records a `false` verdict as a key too,
so "every action has reported" can be read; the drawn list itself still
holds `true` verdicts only.
- **Until every action has reported its `visible` verdict, the band
folds**, so the usual case never paints a flat row first. With two or
fewer shown, the rest stay buttons.
- **Disjoint from the admin override fold by construction**: that
viewer's `can_act` is `false`. `foldOverrides`, `isOverrideOnlyViewer`,
`data-approval-override-folded` and their tests are unchanged.
- **Both call sites** pass `foldDecisions`: the business record page
(`RecordDetailView`, beside its existing `foldOverrides`) and the
request page (`ApprovalDecisionPanel`).
- **Deviation from ruling A's wording — reply (`approval_comment`) stays
in the band's menu on both pages, not in the approvals panel.** Ruling
6917968848 and the card body say 回复 moves to the approvals panel or the
discussion. The complaint (two stacked bars, reply in the button row) is
still fixed: reply leaves the button row. Seat repo:objectstack#3
accepted the deviation on this reason; a line on #34361 lets the
maintainer ask for a panel entry later. Moving it into the
`RecordApprovalsPanel` timeline is more than a modest change here:
- on the synthesized record page the panel is a tab
(`record:approvals`), or a right-column block whose placement depends on
the page tier;
- the bar cannot tell whether a mounted panel is actually on screen, so
a panel entry plus a menu fallback can draw reply twice or not at all;
- the panel has no action runtime of its own: it would need a second
`ActionProvider` and the request definition just to run one declared
action.
In the menu, reply is reachable on every layout.
- **Recall for an approver who also submitted**: in the menu (allowed by
the plan).
- **Waited-days hint: not added.** No threshold logic for it exists in
`app-shell`. The only age logic is the console inbox's relative-time
formatter plus an SLA due date that the record page's request row does
not carry. So there was nothing to reuse, and inventing a threshold is
out of scope.
- **New `@object-ui/i18n` keys (four), in every pack**:
`approvalsInbox.awaitingYourDecision`, `approvalsInbox.stepNumber`,
`approvalsInbox.submittedByName`, `approvalsInbox.moreDecisionActions`.
en and zh-Hans are hand-written, zh-Hant is regenerated by `gen:zh-hant`
(byte-identical to what was written), and the other packs are
translated. Reused keys: `approvalsInbox.submittedByYou`, `common.more`,
`common.actions`.
## Why
Ruling A: 「A 收成一条“待你审批”」 — the approver's decision actions stay in their
own band above the page body, folded: a status line that names the step,
通过 and 拒绝 as the only buttons, the other decision actions in one menu;
the record's header actions do not move; no protocol change.
## Tests
- New
`ui/packages/app-shell/src/views/__tests__/DeclaredActionsBar.approverFold-34361.test.tsx`
(12 tests):
- approver: status line, two buttons, every other lever in the menu, in
declaration order;
- phone layout: `flex-1` on the decisions, the trigger last in the row;
- a menu lever dispatches exactly as its button would;
- approver plus submitter: remind and recall are in the menu, and the
line says "You submitted this";
- an action declared with no variant lands in the menu, not as a button;
- the submitter-only viewer is unchanged;
- the override-only admin stays on the override fold;
- a host without `foldDecisions` is unchanged;
- with two or fewer shown, the levers stay buttons;
- drawn-set reports: menu levers counted, hidden ones not, and an empty
set on unmount;
- the request page (`ApprovalDecisionPanel`, real bar) draws the same
band, remind included because that page excludes nothing.
- New `ui/packages/app-shell/src/utils/approvalDecisionFold.test.ts` (7
tests).
- Updated `RecordDetailView.approvalDeclaredActions.test.tsx`: the
approver's reassign, send back and request info are read from the band's
menu (the override fold set this precedent for the same file). The
submitter, override and fail-closed cases are untouched.
- `DeclaredActionsBar.foldOverrides-25877.test.tsx` and
`utils/approvalOverride.test.ts` are unchanged and green.
## Acceptance notes
- **Claim surface amendment 6938979625** (area o3-A, per L1-a
6938968708): the existing test
`ui/packages/app-shell/src/views/RecordDetailView.approvalDeclaredActions.test.tsx`
is edited (assertion edits only: three approver pins read reassign /
send back / request info from the band's menu).
- **Sticky band on scroll**: not in ruling A, so not done. The
coordinator's plan (6936836041) asks for the maintainer's confirmation
first.
- **Reply in the panel**: kept in the menu; reasons under What changes.
- **Waited-days hint**: not added, because no threshold logic exists to
reuse.
- **Docs**: `ui/AGENTS.md` #2 asks for a matching
`content/docs/frontend/` page. `content/docs/**` is outside this card's
claimed file surface, and the bar has no SDUI node type and no page that
documents its props today.
- **Hot files**: #34631 (#34588, request page) rewrites
`ApprovalDecisionPanel.tsx`. `overlap-check` reports a textual conflict
with that head in this file. This PR's change there is one prop
(`foldDecisions`) on the bar's call site, so whichever lands second
keeps that one prop.
## Verification
All on head `48d70e28` (origin/main merged at `97defd60` plus later; the
merge brought locale-pack and app-shell changes, so the closure was
rebuilt and the suites re-run after it).
<details><summary>Build of the app-shell dependency closure</summary>
`bash scripts/pm/os-verify-lock.sh -c "pnpm turbo run build
--filter='@object-ui/app-shell^...' --concurrency=2 && pnpm --dir ui
exec vitest run --maxWorkers=2 packages/i18n/
packages/app-shell/src/views/__tests__/DeclaredActionsBar.approverFold-34361.test.tsx
packages/app-shell/src/views/__tests__/DeclaredActionsBar.foldOverrides-25877.test.tsx
packages/app-shell/src/utils/approvalDecisionFold.test.ts
packages/app-shell/src/utils/approvalOverride.test.ts
packages/app-shell/src/views/RecordDetailView.approvalDeclaredActions.test.tsx
packages/app-shell/src/views/RecordDetailView.approvalRecallGate.test.tsx
packages/app-shell/src/views/approval-decision/
apps/console/src/services/approvalRequestsDataSource.decisionPage.test.tsx"`
```
Tasks: 68 successful, 68 total
Test Files 115 passed (115)
Tests 2059 passed | 13 skipped (2072)
os-verify-lock: VERDICT command-exit 0
```
</details>
<details><summary>Wider app-shell sweep (pre-merge tree, same
diff)</summary>
`pnpm --dir ui exec vitest run --maxWorkers=2
packages/app-shell/src/views/__tests__/
packages/app-shell/src/views/RecordDetailView.approval*.test.tsx …
packages/app-shell/src/views/approval-decision/ …
apps/console/src/services/approvalRequestsDataSource.decisionPage.test.tsx`
```
Test Files 110 passed (110)
Tests 956 passed (956)
os-verify-lock: VERDICT command-exit 0
```
</details>
<details><summary>Type check</summary>
`pnpm --filter @object-ui/i18n run type-check && pnpm --filter
@object-ui/app-shell run type-check` (each runs `tsc --noEmit` and `tsc
-p tsconfig.test.json`, so the new tests are compiled): `VERDICT
command-exit 0`.
</details>
<details><summary>Ablation (one, on the variant split)</summary>
`node scripts/ablation-replace.mjs --file
ui/packages/app-shell/src/utils/approvalDecisionFold.ts --anchor "return
typeof variant === 'string' && LEAD_VARIANTS.has(variant);"
--replacement "return true; // ABLATION-34361" -- …vitest run
…approverFold-34361.test.tsx`
```
ablation-replace: ok mutation landed: anchor 1 -> 0, blob 99b38f5 -> d6d63595670c
Tests 6 failed | 6 passed (12)
ablation-replace: ok restored: blob == HEAD (99b38f5) and `git diff HEAD` is empty
```
The six failures are exactly the tests that need a non-lead lever in the
menu; the six that stayed green do not depend on the split (unchanged
viewers, the two-or-fewer case, drawn-set reports).
</details>
<details><summary>Gates</summary>
- `node scripts/pm/dispatch-gates.mjs --commands`: 41 derived commands,
all `exit 0`. `--ran` reconciliation: `41 derived, 41 run, 0
NOT-MEASURED, 0 UNRUN (a DERIVED zero — all 41 recorded an exit code)`.
That includes `pnpm --dir ui exec vitest run scripts/` (173 files, 5077
passed, 2 skipped).
- Run beyond the derivation, all `exit 0`:
- `pnpm check:changeset-fixed`;
- `pnpm --dir ui run check:i18n-keys` ("Every in-scope call-site key
resolves against the en pack");
- `check:i18n-drift`;
- `check:i18n-dead-keys` (none of the four new keys is listed);
- `check:new-line-citations` (`0 new citation(s)`).
- `pnpm --dir ui exec eslint` on the six changed ts/tsx files: exit 0, 0
errors. The warnings are `no-explicit-any`, in the sibling suites'
style.
- `node scripts/pm/overlap-check.mjs`: clean against origin/main, #34624
and #34628; textual conflict with #34631 in `ApprovalDecisionPanel.tsx`
(see Acceptance notes).
- Not run locally, CI's: the repo-wide `pnpm lint`, `Test UI` shards,
`Type Check UI`.
</details>
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(not touched)
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes. (changed files lint
clean; repo-wide run is CI's)
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: not touched.
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01WGufzg2evNa1V3zxrQq3KX
<!-- signed: repo:objectstack#3 · os-support-ai ·
session_01WGufzg2evNa1V3zxrQq3KX -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent e533651 commit d57d6ee
19 files changed
Lines changed: 818 additions & 8 deletions
File tree
- .changeset
- ui/packages
- app-shell/src
- utils
- views
- __tests__
- approval-decision
- i18n/src/locales
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
0 commit comments