Repository navigation
Commit a71564f
fix(app-shell): the approval step line draws the route the request's run took, not the flow graph's first branch (#26666)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbEUMTQYvfyB64ouDjzAxUjd)_
Fixes #26563
Clause-②: no
Metadata-protocol: none
## 维护者速读
- **改了什么**:审批步骤线不再画服务端 `flow_steps`(流程图从起点沿
approve/true/第一条边走出的那一条主干),改为只画本次流程运行真实走过的步骤:同一 `flow_run_id`
下已通过的审批请求,按到达先后排列,最后是当前待审步骤;当前步骤之后一概不画。业务记录的审批面板照此绘制;审批请求页只持有自身这一行,证明不了任何已走步骤,所以暂不画步骤线。
- **为什么改**:hotclm 的合同审批走「直属上级 → 仅财务」时,步骤线却写着「直属上级 · 法务负责人 + 财务负责人(会签) ·
分管领导 · 总经理」,审批人被告知要与法务会签、后面还有两级,实际都不会发生。分诊裁定:⛔ 永不画猜测的路径。
- **风险与回滚**:纯 UI
显示改动,无契约、无元数据、无服务端改动。代价是过渡期内审批请求页不再显示步骤线,业务记录面板上看不到自己未参与的步骤(列表读只对参与者开放)。回滚
= revert 本 PR。
- **先看**:① `ui/packages/app-shell/src/views/RecordApprovalsPanel.tsx`
新增的 `visitedApprovalSteps`(哪些请求算「已走过」);②
`ui/packages/app-shell/src/views/approval-decision/ApprovalDecisionPanel.tsx`
删去的那一行步骤线;③ `RecordApprovalsPanel.visitedRoute-26563.test.tsx`。
- **两分钟验证**:`pnpm --dir ui exec vitest run
packages/app-shell/src/views/RecordApprovalsPanel.visitedRoute-26563.test.tsx`,预期
11 个测试全绿,其中报告的路由只画出「直属上级、财务负责人」两步。
- **需要你做的**:无,席位落地。
## What changes
The approval step line drew the request's `flow_steps`. That field is
built by `plugin-approvals`' `attachFlowSteps`, which walks the flow
graph from its start node and takes the `approve` edge, else the `true`
edge, else the first edge at each node. It marks done, current and
upcoming against that one trunk. It is not the route the request takes.
A request that a decision sent down another branch was drawn on rungs it
never visits. When the request's own node is off the trunk, it is drawn
on none of the trunk's rungs as current. A rung reached after a side
branch rejoins showed the trunk's branch as done.
Measured first, as the triage asked: the single request read (`GET
/api/v1/approvals/requests/:id`) carries neither a resolved route nor
the visited nodes. Beyond `flow_steps`, the row names only its own node
(`flow_node_id`, `current_step`, `step_label`) and its run
(`flow_run_id`). So the route read is a `plugin-approvals` child (see
Acceptance notes), and this PR draws only what a request row proves:
- **Business record approvals panel.**
`visitedApprovalSteps(pendingRequest, requests)` builds the line from
the request rows the panel already holds (the list read, no new
request). A passed step is a request with the same `flow_run_id`, on
another node, `approved`, and opened before the pending one. A node
approved in several rounds is drawn once, at its latest round. The
pending request comes last. Nothing ahead of it is drawn, because no
request row says which branch the run takes next.
- **Approval request page** (`record:approval_decision`). The decision
panel no longer draws a step line. Its bound row proves only its own
step, which the page header already names, and one step is no line.
- `ApprovalRequestLite` declares the served `flow_run_id` and
`flow_node_id`. The `flow_steps` doc says why no surface draws it.
- `ApprovalStepLine`'s markup is unchanged. Its header now says the
caller owns the proof of the steps it hands in, and the stale paragraph
about the inbox sheet's copy of the stepper is gone (that sheet no
longer draws one).
- The app-shell README's two approval paragraphs say the same.
## Tests
- New `RecordApprovalsPanel.visitedRoute-26563.test.tsx`, 11 tests. The
panel cases use the reported route (manager → finance only) with the
served trunk attached. They pin a branch that rejoins the trunk (manager
→ legal only → executive), a request at the run's first rung, and a
viewer served only the pending row. The unit cases for
`visitedApprovalSteps` pin ordering, another run, a step not approved
(`returned`, `rejected`), a row opened after the pending one, round
dedup, an earlier round of the pending node, a decided request, an
unlabeled step, and the controls for a missing run, node or open time.
- `RecordApprovalsPanel.stepProgressVertical.test.tsx`: the layout
contract is unchanged. Its fixtures are now a run's request rows, so
they reach the line the way the panel builds it. The connector-tint case
now pins that every segment is green, because the line draws nothing
ahead of the pending step.
- `ApprovalDecisionPanel.stepLine-12491.test.tsx`: rewritten to pin the
absence of the line. The reported row with its served trunk draws no
line and none of the trunk's rungs, a decided row draws none either, and
the tally still draws above the decisions. The deleted layout cases
duplicate the ones `RecordApprovalsPanel.stepProgressVertical.test.tsx`
pins over the same `ApprovalStepLine` markup.
- `approvalRequestsDataSource.servedPageStepLine-12491.test.tsx`
(console, the real served page): the step-line cases now pin that no
line and no other trunk rung is drawn, at pending, at decided, and for a
person-submitted request. The flow-origin cases are unchanged.
<details><summary>Test readings, head 4743eb8 (all under
scripts/pm/os-verify-lock.sh, run from ui/)</summary>
- The four touched suites: `vitest run` over
`RecordApprovalsPanel.visitedRoute-26563`,
`RecordApprovalsPanel.stepProgressVertical`,
`ApprovalDecisionPanel.stepLine-12491` and the console
`approvalRequestsDataSource.servedPageStepLine-12491`: Test Files 4
passed (4), Tests 24 passed (24), VERDICT command-exit 0.
- Every approval test file in `packages/app-shell` and `apps/console`
(by file name, plus every test that names `RecordApprovalsPanel`,
`ApprovalDecisionPanel`, `ApprovalStepLine`, `useRecordApprovals`,
`approval-decision` or `approval-progress`): Test Files 68 passed (68),
Tests 765 passed (765), VERDICT command-exit 0, 7m00s. The whole
`packages/app-shell` suite (1757 test files) was not run locally; CI's
Test UI shards run it.
- `pnpm --filter @object-ui/app-shell run type-check` (both projects;
`tsconfig.test.json --listFilesOnly` lists the three touched app-shell
test files): VERDICT command-exit 0. `pnpm --filter @object-ui/console
run type-check` (`--listFilesOnly` lists the touched console test):
VERDICT command-exit 0.
</details>
<details><summary>Reverse verification, one-shot (no test file kept for
it)</summary>
- **Record panel.** `node scripts/ablation-replace.mjs` replaced the
panel's step line `steps={visitedApprovalSteps(pendingRequest,
requests)}` with the old `steps={pendingRequest?.flow_steps}`. The
mutation landed: anchor 1 to 0, blob `ddd69d0e14eb` to `347c203eb6ff`.
`RecordApprovalsPanel.visitedRoute-26563` then failed its 4 panel tests
(Tests 4 failed, 7 passed; the 7 are the unit cases, which call
`visitedApprovalSteps` directly). The tool restored the file: blob
`ddd69d0e14eb` equal to HEAD, `git diff HEAD` empty.
- **Request page.** `ApprovalDecisionPanel.tsx` was restored to the
merge base blob (`f61253e4b319`, which still draws
`steps={request.flow_steps}`) under an EXIT trap. The decision panel
suite and the console served-page suite then failed 6 of 9 tests (Test
Files 2 failed). The 3 still passing are the page-parse case, the
flow-origin case and the one-step control. Restored to HEAD blob
`4bf7bdb3f704`, with `git status` clean.
</details>
## Acceptance notes
- **Out of scope, for the seat to file (class a): the route read belongs
to `plugin-approvals`.** `ApprovalService.attachFlowSteps` serves the
flow graph's trunk as `flow_steps` on every single read. For the
reported request (node `finance_only`), every trunk entry is `upcoming`
and its own node is absent. The child should serve the route the run
took and only the steps ahead that the run's state determines. Then the
request page can draw its line again, and `visitedApprovalSteps` can be
deleted in favour of the served route. `flow_steps`' contract text in
`packages/spec/src/contracts/approval-service.ts` reads "The owning
flow's approval steps in graph order", so the child either changes that
text or adds a field. Either way it is a contract change.
- **Viewer-scoped steps.** The list read serves a request only to its
participants (slate, submitter, override actor). On the business record
a viewer who took no part in an earlier rung does not see it, so the
line can be shorter than the run's route, never wrong. The finance
controller in the report sees no line on the record panel (one step).
The submitter sees the whole route.
- **Request page: no line rather than a one-step line.** The seat
suggested a one-step "current step" line there. A one-step line would
repeat the step the page header already names, and `ApprovalStepLine`'s
own gate draws nothing under two steps, so the page draws none.
- **Steps not drawn.** A rung a `reject` edge routes to an approval
node, and a rung sent back for revision, are not "passed" (not
`approved`), so they are left out. A route that passes through them
shows only its approved rungs.
- The `upcoming` styling in `ApprovalStepLine` has no caller today. It
stays for the served route the child brings back.
## Verification
<details><summary>Derived gate sweep, head 4743eb8</summary>
`node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` derived 34 commands from the change set
against merge base `fb91e9793`. Each command ran with its exit code
captured before any pipe, and all 34 exited 0. `check:type-check-debt`
ran under the verify lock, with VERDICT command-exit 0. The PR-body
gates (`check-changeset-no-major`, `check-closing-keyword-parity`,
`check-adr-0087-registration`) read this body through
`GITHUB_EVENT_PATH`. `dispatch-gates --ran` reconciliation: `✓ 34
derived famil(ies) accounted for — 34 run, 0 NOT-MEASURED`.
</details>
- `origin/main` gained 12 commits after the branch point, and none of
them touches a file of this diff. The branch was not merged with main
before opening, and CI runs on the merge ref.
- No dogfood battery: the title carries no `!` and `Clause-②` carries no
`(narrowing)` arm.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01QsR2jThx2NXgeJ4uCUi1qo)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent d434481 commit a71564f
10 files changed
Lines changed: 487 additions & 267 deletions
File tree
- .changeset
- ui
- apps/console/src/services
- packages/app-shell
- src
- hooks
- views
- approval-decision
- approval-progress
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
10 | 16 | | |
11 | 17 | | |
12 | 18 | | |
| |||
283 | 289 | | |
284 | 290 | | |
285 | 291 | | |
286 | | - | |
| 292 | + | |
287 | 293 | | |
288 | 294 | | |
289 | 295 | | |
290 | 296 | | |
291 | 297 | | |
292 | 298 | | |
293 | | - | |
| 299 | + | |
294 | 300 | | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
302 | 309 | | |
303 | 310 | | |
304 | 311 | | |
305 | 312 | | |
306 | 313 | | |
307 | 314 | | |
308 | | - | |
309 | | - | |
| 315 | + | |
| 316 | + | |
310 | 317 | | |
311 | 318 | | |
312 | | - | |
| 319 | + | |
313 | 320 | | |
314 | 321 | | |
315 | 322 | | |
316 | 323 | | |
317 | 324 | | |
318 | 325 | | |
319 | 326 | | |
320 | | - | |
321 | | - | |
322 | | - | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
323 | 330 | | |
324 | 331 | | |
325 | | - | |
| 332 | + | |
326 | 333 | | |
327 | | - | |
328 | | - | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
329 | 337 | | |
330 | 338 | | |
| 339 | + | |
331 | 340 | | |
332 | 341 | | |
333 | 342 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1180 | 1180 | | |
1181 | 1181 | | |
1182 | 1182 | | |
1183 | | - | |
| 1183 | + | |
| 1184 | + | |
1184 | 1185 | | |
1185 | 1186 | | |
1186 | 1187 | | |
| |||
1251 | 1252 | | |
1252 | 1253 | | |
1253 | 1254 | | |
1254 | | - | |
1255 | | - | |
1256 | | - | |
1257 | | - | |
1258 | | - | |
1259 | | - | |
1260 | | - | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
1261 | 1261 | | |
1262 | 1262 | | |
1263 | 1263 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
110 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
111 | 120 | | |
112 | 121 | | |
113 | 122 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
48 | 54 | | |
49 | 55 | | |
50 | 56 | | |
| |||
67 | 73 | | |
68 | 74 | | |
69 | 75 | | |
70 | | - | |
| 76 | + | |
| 77 | + | |
71 | 78 | | |
72 | 79 | | |
73 | 80 | | |
| |||
78 | 85 | | |
79 | 86 | | |
80 | 87 | | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
87 | 94 | | |
88 | 95 | | |
89 | 96 | | |
90 | 97 | | |
91 | 98 | | |
92 | 99 | | |
93 | 100 | | |
94 | | - | |
95 | | - | |
| 101 | + | |
96 | 102 | | |
97 | 103 | | |
98 | | - | |
| 104 | + | |
| 105 | + | |
99 | 106 | | |
100 | | - | |
| 107 | + | |
101 | 108 | | |
102 | 109 | | |
103 | 110 | | |
104 | 111 | | |
105 | | - | |
| 112 | + | |
106 | 113 | | |
107 | 114 | | |
108 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
109 | 120 | | |
110 | | - | |
111 | 121 | | |
112 | 122 | | |
113 | 123 | | |
114 | | - | |
115 | | - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
116 | 128 | | |
117 | 129 | | |
118 | | - | |
| 130 | + | |
119 | 131 | | |
120 | 132 | | |
121 | 133 | | |
| |||
254 | 266 | | |
255 | 267 | | |
256 | 268 | | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
262 | 274 | | |
263 | 275 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| |||
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
209 | 266 | | |
210 | 267 | | |
211 | 268 | | |
| |||
424 | 481 | | |
425 | 482 | | |
426 | 483 | | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
433 | 490 | | |
434 | 491 | | |
435 | 492 | | |
| |||
0 commit comments