Repository navigation
Commit e95210d
feat(approvals): the approval request page shows the whole business record (#34631)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} -->
_Requested by **Yibo Wang** · [project
thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBCAJcTbxAnnc3gf8ESZGP1U)_
repo:objectstack#3 · os-support-ai · session_01WGufzhGHzMtixGDQoMmtqq
Fixes #34588
Clause-②: yes (widening — new @object-ui/i18n locale keys only; no
metadata or schema accept set)
Metadata-protocol: none
## 维护者速读
- 改了什么:审批请求页去掉「详情 /
时间线」两个标签页。审批按钮下面直接显示整条业务记录,分组和对象的默认记录页一致;下面是只读子表;右栏依次是审批进度、附件、动态,动态在最后。
- 为什么改:以前只显示金额加 6 个字段,审批人要跳到业务记录才能看全(维护者
2026-11-17:「审批页应该直接显示完整的记录;「动态」在最后」)。
- 风险与回滚:只改前端展示和请求页的页面元数据,不改快照存储和字段权限,审批页上不能编辑。回滚就是 revert 本 PR。改动 3463
行,超过 3000 行门槛,属于 Tier H。
-
先看:`ui/packages/app-shell/src/views/approval-decision/SubmittedRecord.tsx`
的文件头(规则),再看 `ApprovalDecisionPanel.tsx` 的布局。
-
两分钟验证:打开一条待审批的请求,确认整条记录都在。到业务记录上改一个字段后刷新,该字段应显示「已改动」和当前值。右栏顺序应是审批进度、附件、动态。
- 需要你做的:审一下,因为是 Tier H,需要 os-zhuang 或 hotlong 批准后才能合并。
## What changes
**The request page**
(`packages/plugins/plugin-approvals/src/sys-approval-request.page.ts`):
`page:header` → `record:highlights` → `record:approval_decision`, with
no `page:tabs`. The Details tab (the request's own fields) and the
Timeline tab (the `sys_approval_action` related list) are gone. Their
content is now inside the decision panel. No node type or prop was
added: `record:approval_decision` keeps its empty strict props row, so
every part of the layout lives in the panel.
**The decision panel**
(`ui/packages/app-shell/src/views/approval-decision/`):
- **Top:** the "Flow-initiated" marker, the deciding comment, and the
declared decision actions. All unchanged. #34361 ruling A is not
touched.
- **Left column, "As submitted"** (`SubmittedRecord.tsx` + pure
`submittedRecordPlan.ts`):
- Every field of the request's `payload` snapshot that the reader may
read, in the sections of the target object's default record page
(`deriveRecordDetailSections` with field groups resolved), each through
the record page's own cell, with `payload_display` names for references.
- Not drawn: undeclared keys, `hidden: true` fields, framework columns,
and fields the reader may not read. Field-level security is unchanged.
The service redacts per reader, and both rows also pass
`withoutDeniedFields`.
- One `findOne(object, id)` (no params) reads the current record. A
field whose current value differs is marked **Changed** (已改动) with its
current value. `valuesDiffer` treats empty values as equivalent, numbers
by value, dates by instant, references by id (stored or expanded), and
lists as sets.
- If the record cannot be read (refused, gone, not found), nothing is
marked and the card says so.
- "Open record" links to the business record.
- **Child tables:** owned `master_detail` children and `relatedList:
'primary'` tables (`deriveRelatedLists`), each a plugin-detail
`RelatedList` with no New, Add, edit or row action. They show CURRENT
rows, with a note saying so, because the snapshot keeps the record's own
row only. They are drawn only once the record reads.
- **Right rail, in this order:**
- Approval progress: the step line, the tally, and who it waits on.
- Attachments: the record's file and image fields.
- Activity: the request's thread, newest first, through the new
`approval-progress/ApprovalActionTimeline.tsx`, which
`RecordApprovalsPanel` now shares, so the two timelines cannot drift.
- The thread is read through the page's adapter
(`useRecordContext().dataSource`, which the console routes to `GET
/approvals/requests/:id/actions`). It is read only on a read verdict for
`sys_approval_action`, as the Timeline related list was.
- **Retired:** `RecordSnapshotSummary.tsx`, `snapshotSummaryPlan.ts` and
its test (the six-row cut and the amount lead).
**Copy:** seven new `approvalsInbox.*` keys in all eleven
`@object-ui/i18n` packs: `snapshotChanged`, `snapshotCurrentValue`,
`snapshotOpenRecord`, `snapshotCurrentUnreadable`,
`snapshotChildCurrent`, `progressTitle`, `attachmentsTitle`.
**Why this route, not embedding the business record page:** the record
page is a live, editable surface with its own approval bar (#34361) and
header actions. Embedding it would put editing and a second decision bar
on the request page, and it would show current values, not the evidence
the approver is asked to decide on. The snapshot-faithful card keeps the
submitted values primary and marks the drift. The seat accepted this
route on the card thread.
**Not done (card 不做):** no editing; no change to snapshot storage. Child
tables show current values, marked as such.
## Tests
- New `submittedRecordPlan.test.ts` (plan and comparison rules) and
`ApprovalDecisionPanel.fullRecord-34588.test.tsx`. The second covers
acceptance 1–3 on a 14-field record with groups, a denied field, a
`master_detail` child, a changed field, rail order, child tables
read-only, the `findOne` call shape, and an unreadable CONTROL.
- Updated app-shell pins: `ApprovalDecisionPanel.test.tsx`
(directory-read counts now exclude the one thread read; the pending
CONTROL expects that read),
`ApprovalDecisionPanel.stepLine-12491.test.tsx` (decisions on top, then
line above tally inside the progress card), and
`ApprovalDecisionPanel.decidedSnapshot-27502.test.tsx` (testids).
`RecordApprovalsPanel` tests are unchanged and green.
- `sys-approval-request-page.test.ts`: the body order is header,
highlights, decision, with a new "has no tabs" test. The step_label
timeline-column test is retired along with the tab.
### Console pins rewritten (seat-widened surface:
`approvalRequestsDataSource.servedPage*.test.tsx`)
The "Card line" column cites the card's 要做的 items. Item 1 is
「请求页在审批条下方直接显示该业务记录的完整内容:全部可读字段按对象的分组排列、子表(相关列表,只读)、附件」. Item 2 is
「提交后被改过的字段在旁边标出「已改动」并能看到当前值」. Item 4 is 「字段级权限照旧」.
`approvalRequestsDataSource.servedPageSummary-12483.test.tsx`
| Pin | Old assertion | New assertion | Card line |
|---|---|---|---|
| served page shape | `components[1]` is `record:approval_decision`
(page with tabs) | the last component is `record:approval_decision`; no
`page:tabs` | 1, 3 and the ruling 「「动态」在最后」 |
| labels and faces | the unresolved reference `contact` takes no row,
and its raw id is never printed | `contact` is drawn as the record page
draws it (the lookup cell's unresolved-reference face) | 1 (all readable
fields) |
| amount | the amount leads (`[data-summary-lead]`) and is not repeated
as a row | no lead; `amount` is an ordinary field, drawn once, through
the currency face | 1 |
| hidden field | rows are exactly the six: `name, account, cost_center,
region, status, issued_on` | rows are all ten declared visible fields;
`internal_score` stays out | 1 (not only 6) |
| COUNTER-PROBE nothing hidden | `internal_score` drawn and the last row
is cut | `internal_score` drawn, nothing cut (11 rows) | 1 |
| hidden amount | never leads, shown nowhere | shown nowhere (no lead
exists) | 1 |
| field permissions | denied fields' slots go to the next fields (six
rows) | the full list minus `cost_center` and `amount`; neither value
anywhere | 1, 4 |
| COUNTER-PROBE allowed | `lead.key === 'amount'` | `amount` is drawn |
1 |
| no read of the record | no read beyond the approvals get; no `invoice`
path on the transport | one `host.findOne('invoice', 'inv_1')`, no
params; `amount` marked Changed with its current value; an expanded
same-id account is not a change; still no `invoice` path on the
transport | 2 |
| new CONTROL | — | a record that does not read: the unreadable note,
nothing marked, all ten fields drawn | 2 |
| CONTROL no payload | waits for the definition read of `invoice`, no
summary | no record card; neither the definition nor the record is asked
for | 1 (nothing to draw without a snapshot) |
| CONTROLs: undeclared key, label clash, no definition |
`record-snapshot-summary` testid | `submitted-record` testid, same
assertions | 1 |
| roll-up name guess | no lead; `total_amount` a row inside the six
(cost center removed to make room) | no lead; `total_amount` an ordinary
field (no row cut, so cost center stays) | 1 |
| amount of zero | zero leads | zero is drawn as the `amount` field | 1
|
`approvalRequestsDataSource.servedPageSummaryAmount-12534.test.tsx`: the
whole file pinned which roll-up takes the lead. With no lead, every row
below is retired by item 1.
| Pin | Old assertion | New assertion |
|---|---|---|
| expense total | `total_amount` leads; the rows are six without it |
`total_amount` is an ordinary field; all ten fields, `sum` and `count`
roll-ups alike, in declared order |
| invoice subtotal | `total` leads | `total` is an ordinary field |
| definition read | the summarized object's definition is read once; no
record read | the summarized object's definition is never read (the
record read is pinned in 12483) |
| FLS | without `total_amount`, `approved_amount` leads | `total_amount`
is not drawn; `approved_amount` still is |
| CONTROL non-`sum` | no lead; `line_count` a row | folded into the
expense-total test (`line_count` row) |
| CONTROL `sum` over `number` | no lead | retired: no lead logic is left
to control |
| CONTROL currency-only | `unit_price` leads | `unit_price` is an
ordinary field |
| CONTROL child definition unreadable | the total is an ordinary row |
retired: the total is always an ordinary row |
| new | — | the record's child lines: once the record reads,
`showcase_expense_line` is drawn read-only, with the current-rows note
and its rows |
| new CONTROL | — | a record that does not read draws no child lines and
sends no child read |
Not edited, and green:
`approvalRequestsDataSource.decisionPage.test.tsx` (including :341,
where the timeline reads the actions route and never `host.find`) and
`approvalRequestsDataSource.servedPageMemberPermissions-13324.test.tsx`
(including the no-`ApprovalRecordReads` control, which sends no actions
GET). Both were red mid-change. The cause was fixed in source, not in
the pins: the thread read now goes through the page's adapter and is
gated on the read verdict.
## Acceptance notes
1. Full record below the approval bar: every readable field, grouped
like the default record page; child tables read-only; attachments. ✓
(`fullRecord-34588` acceptance 1, console 12483/12534.)
2. Snapshot values, with fields changed after submission marked 「已改动」
and showing their current value. ✓ (`fullRecord-34588` acceptance 2,
console 12483 "read once".)
3. Right rail: 审批进度 → 附件 → 动态. ✓ (`fullRecord-34588` rail order.)
4. Field-level security unchanged. ✓ (denied-field tests in both
suites.)
## Verification
Run on this head (9f91de6; the tree is identical to the gated working
tree):
- `pnpm exec vitest run
apps/console/src/services/approvalRequestsDataSource
apps/console/src/pages/system/ApprovalsInboxPage` (from `ui/`): 31
files, 219/219 pass, exit 0.
- `pnpm exec vitest run packages/app-shell/src/views/approval-decision
packages/app-shell/src/views/RecordApprovalsPanel` (from `ui/`): 16
files, 116/116 pass, exit 0.
- `vitest run` on
`packages/plugins/plugin-approvals/src/sys-approval-request-page.test.ts`
and `sys-approval-request-title.integration.test.ts`: 24/24 pass, exit
0.
- `tsc --noEmit`: `@object-ui/app-shell` exit 0, `@object-ui/i18n` exit
0, `@objectstack/plugin-approvals` exit 0.
- `eslint` on the changed ui files: exit 0, with 0 errors and 7
warnings. The warnings are in moved code: `no-explicit-any` on
`import.meta`, and react-refresh on a hook export.
- `node scripts/pm/overlap-check.mjs`: VERDICT clean (merges cleanly
with origin/main, #34624 and #34628), exit 0.
- `node scripts/check-platform-checklist.mjs --changed-from
origin/main`: exit 0.
- The `dispatch-gates --commands` battery (72 commands) runs under the
verify lock. Its exit codes, reconciled with `--ran`, are posted in the
os-dev-report comment on #34588.
## Before / after readings
- **Before** (origin/main 8dd8192): the request page has `page:tabs`
(Details, Timeline). The decision panel draws "As submitted" with the
amount lead and at most six rows (12483: rows `name, account,
cost_center, region, status, issued_on`), and never reads the target
record.
- **After** (this head): no tabs. 12483 draws all ten visible fields,
with `contact` through the lookup face. One
`findOne('invoice','inv_1')`, and a changed `amount` carries the Changed
mark with its current value (13,250) beside the submitted 12,500. 12534
draws the `showcase_expense_line` child table read-only from current
rows. The rail order is progress, attachments, activity
(`fullRecord-34588`).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01WGufzhGHzMtixGDQoMmtqq
<!-- signed: repo:objectstack#3 · os-support-ai ·
session_01WGufzhGHzMtixGDQoMmtqq -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 4107b3e commit e95210d
32 files changed
Lines changed: 1957 additions & 1516 deletions
File tree
- .changeset
- packages
- plugins/plugin-approvals/src
- spec/liveness
- ui
- apps/console/src/services
- packages
- app-shell
- src
- console/__tests__
- views
- approval-decision
- approval-progress
- 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
21 | 19 | | |
22 | 20 | | |
23 | 21 | | |
| |||
49 | 47 | | |
50 | 48 | | |
51 | 49 | | |
52 | | - | |
53 | | - | |
| 50 | + | |
54 | 51 | | |
55 | 52 | | |
56 | 53 | | |
| |||
134 | 131 | | |
135 | 132 | | |
136 | 133 | | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
146 | 143 | | |
147 | 144 | | |
148 | 145 | | |
| |||
153 | 150 | | |
154 | 151 | | |
155 | 152 | | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
160 | 157 | | |
161 | 158 | | |
162 | 159 | | |
| |||
167 | 164 | | |
168 | 165 | | |
169 | 166 | | |
170 | | - | |
171 | | - | |
172 | | - | |
| 167 | + | |
173 | 168 | | |
174 | 169 | | |
175 | 170 | | |
| |||
197 | 192 | | |
198 | 193 | | |
199 | 194 | | |
200 | | - | |
| 195 | + | |
201 | 196 | | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
208 | 200 | | |
209 | 201 | | |
210 | 202 | | |
211 | 203 | | |
212 | 204 | | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | 205 | | |
218 | 206 | | |
219 | 207 | | |
220 | 208 | | |
221 | 209 | | |
222 | 210 | | |
223 | 211 | | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
231 | 218 | | |
232 | 219 | | |
233 | 220 | | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | 221 | | |
252 | 222 | | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
| 223 | + | |
260 | 224 | | |
261 | 225 | | |
262 | 226 | | |
| |||
0 commit comments