Repository navigation
Commit fe75349
fix(approvals): name an unstaffed position by its label on the timeline; system rows read as the system's (#36030)
<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4Uu9E1xEXQLqcywxKaDrDfGYv)_
repo:objectstack#1 · os-sales · session_01L6bhgT9mNgD8oKM93bFzg5
Fixes #35418
Clause-②: yes (widening) — @objectstack/plugin-approvals adds the
optional `ApprovalServiceOptions.positionLabelSource`; @object-ui/i18n
adds approvalsInbox.systemActor and approvalsInbox.actSystemNote;
nothing removed
Metadata-protocol: none
## 维护者速读
-
审批动态里「转交给管理员」那条说明不再出现内部岗位名:中文读者看到「岗位「销售经理」无人任职」,没有翻译时用岗位自己的显示名,都没有才退回内部名。
- 系统自动写的条目(转交说明、排除提交人、无人可审、自动撤销等)操作人显示「系统」,说明类条目类型显示「系统说明」,不再是「评论 ·
—」;真人评论照旧是「评论 · 某人」。
- 属于「控制台核心业务操作体验」专题;只改显示,库里存的审计原文、转交规则都不动,出问题可直接撤回。
- 已知没做:「无人可审」说明里的「担任 position 'x' 的成员」也带内部岗位名(存的是拼好的整句),列为后续,不在本 PR。
## What changes
1. **The routing note names a position by its label.**
`admin-rescue-note.ts`: `adminRescueNoteText(note, render,
positionLabel?)` maps each unheld-position clause's `value` through
`positionLabel` before rendering; `adminRescuePositions` lists the
note's position names. `ApprovalService.localizeRoutingNotes` builds the
map per read (`notePositionLabels`): the reader's pack
`positions.<name>.label` (new `ReaderLabels.positionLabel`, key spelled
by `positionLabelKey` beside the flow keys), else the declared `label`
from the new optional `ApprovalServiceOptions.positionLabelSource`, else
nothing (the name stands). `ApprovalsServicePlugin` wires that source to
the `metadata` service's `get('position', name)`, resolved lazily like
the i18n source. A throwing source is caught: the read never fails on a
label. The row's stored English `comment` (the audit text, and what a
read with no locale is served) is unchanged and keeps the name.
2. **The timeline names the platform's rows.**
`ApprovalActionTimeline.tsx`: a row with no `actor_id` reads its actor
as `approvalsInbox.systemActor` ("System" / 系统) instead of "—"; a
`comment` row with no actor (`isSystemNote`, new
`utils/approvalSystemNote.ts`) reads its kind as
`approvalsInbox.actSystemNote` ("System note" / 系统说明) instead of
"Commented". `system:sla` keeps "System (SLA)". New keys in all eleven
packs, translated.
3. **Docs.** `content/docs/automation/approvals.mdx`, "When a slate
names no one": the stored note keeps the English with the position's
name; a reader is served it in their language with the position's label,
shown as a system note (the Docs Drift Check listed this page).
The card allowed 「转交」 or 「系统」 for the kind. The three no-actor comment
notes are not all hand-offs (admin routing, submitter exclusion, no
approver), and telling them apart on the client would need a new field
on the actions contract, so they share "System note" and the sentence
itself says what happened. This reading was stated in the claim.
## Tests
<details><summary>Approvals plugin</summary>
- `admin-rescue-note.test.ts`: a position clause takes the label it is
given and only a position does (team literal and an unknown position
keep their names); a clause the pack lacks falls back to English with
the label; the stored English keeps the name; `adminRescuePositions`
dedupes and skips non-position and empty slots.
- `reader-locale-labels.test.ts`: `positionLabelKey` spelling, held to
`TranslationDataSchema` by the existing round trip; the pick reads
`positions.<name>.label` in the negotiated locale.
- `admin-rescue-named-slate.integration.test.ts`, new describe `[#35418]
the note names an unheld position by its label` (real in-memory i18n
with the plugin's catalog plus an app pack): zh-CN reads 「岗位「销售经理」无人任职」
and no `sales_manager`; en reads the declared label "position 'Sales
Manager' has no holder"; ja-JP with no translation reads the declared
label; CONTROL the stored row and a no-locale read keep the name; a
throwing source keeps the name and does not fail the read.
- Run: those three files 45 passed; `approval-service.test.ts` +
`submitter-exclusion-note.test.ts` 486 passed. `pnpm --filter
@objectstack/plugin-approvals typecheck` exit 0.
</details>
<details><summary>Console and i18n</summary>
- `ApprovalActionTimeline.systemNote-35418.test.tsx`: en "System note ·
System" with no "Commented" and no "—"; a person's comment keeps
"Commented · Bob" (live control in the same DOM); a no-actor `cancel`
row names "System"; zh 「系统说明 · 系统」 and 「评论 · Bob」. 3 passed.
- `pnpm --dir ui exec vitest run packages/i18n/` (includes all-locale
key parity): 105 files passed, 1957 passed, 13 skipped.
- eslint over the changed files: 0 errors (one pre-existing
`no-explicit-any` warning in `ApprovalActionTimeline.tsx`, not on a
changed line).
</details>
## Follow-ups (not in this PR)
- The no-approver note's `{{who}}` ("…a member who holds position
'crm_sales_manager'…") is stored pre-composed (`noApproverWho`), so it
still names the machine name; labelling it means storing the slots
instead of the joined string.
## Verification
Read first: `admin-rescue-note.ts` (`labelledPosition`),
`ApprovalService.localizeRoutingNotes` and `notePositionLabels`, the
`positionLabelSource` wiring in `approvals-plugin.ts`,
`ApprovalActionTimeline.tsx` (`actionText`, `actorName`).
Two-minute check: `cd packages/plugins/plugin-approvals && pnpm exec
vitest run src/admin-rescue-named-slate.integration.test.ts`; expect the
`[#35418]` describe green.
<details><summary>Local gates at 064e714</summary>
`node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack
--ran`: 109 derived families accounted for, 109 run, 0 NOT-MEASURED (all
with exit 0; the 28 families the docs commit added were run on 064e714,
the other 81 on cfacf20, which differs from it only by that docs page).
Four first answered on a shallow, partly built clone and were rerun
after the prerequisite: `check-plugin-teardown-shape --self-test`
(pinned fixture commit fetched), `pnpm --dir ui exec vitest run
scripts/` (needed the `@objectstack/client` dist; then 172 files passed,
2 skipped), `check:dual-build-cjs-loads` and `check:i18n` (after a full
`pnpm build`). `node scripts/pm/overlap-check.mjs`: clean against
origin/main 9b3227f and 4 open PRs sharing the locale packs or
`approval-service.ts` (#36018, #35994, #35969, #35968). CI families: not
yet reported at open.
</details>
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01L6bhgT9mNgD8oKM93bFzg5
<!-- signed: repo:objectstack#1 · os-sales ·
session_01L6bhgT9mNgD8oKM93bFzg5 -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent dab4712 commit fe75349
23 files changed
Lines changed: 361 additions & 6 deletions
File tree
- .changeset
- content/docs/automation
- packages/plugins/plugin-approvals/src
- ui/packages
- app-shell/src
- utils
- views/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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
575 | 575 | | |
576 | 576 | | |
577 | 577 | | |
578 | | - | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
579 | 583 | | |
580 | 584 | | |
581 | 585 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
475 | 475 | | |
476 | 476 | | |
477 | 477 | | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
478 | 549 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
| |||
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
51 | 69 | | |
52 | 70 | | |
53 | 71 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
123 | 129 | | |
124 | 130 | | |
125 | 131 | | |
126 | 132 | | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
127 | 138 | | |
128 | 139 | | |
129 | 140 | | |
130 | 141 | | |
131 | 142 | | |
| 143 | + | |
132 | 144 | | |
133 | 145 | | |
134 | 146 | | |
135 | 147 | | |
| 148 | + | |
136 | 149 | | |
137 | 150 | | |
138 | 151 | | |
| |||
142 | 155 | | |
143 | 156 | | |
144 | 157 | | |
| 158 | + | |
145 | 159 | | |
146 | 160 | | |
147 | 161 | | |
148 | 162 | | |
149 | 163 | | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
150 | 182 | | |
151 | 183 | | |
152 | 184 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| 130 | + | |
130 | 131 | | |
131 | 132 | | |
132 | 133 | | |
| |||
2074 | 2075 | | |
2075 | 2076 | | |
2076 | 2077 | | |
| 2078 | + | |
| 2079 | + | |
| 2080 | + | |
| 2081 | + | |
| 2082 | + | |
| 2083 | + | |
| 2084 | + | |
| 2085 | + | |
| 2086 | + | |
| 2087 | + | |
| 2088 | + | |
2077 | 2089 | | |
2078 | 2090 | | |
2079 | 2091 | | |
| |||
2211 | 2223 | | |
2212 | 2224 | | |
2213 | 2225 | | |
| 2226 | + | |
| 2227 | + | |
2214 | 2228 | | |
2215 | 2229 | | |
2216 | 2230 | | |
| |||
2255 | 2269 | | |
2256 | 2270 | | |
2257 | 2271 | | |
| 2272 | + | |
2258 | 2273 | | |
2259 | 2274 | | |
2260 | 2275 | | |
| |||
11346 | 11361 | | |
11347 | 11362 | | |
11348 | 11363 | | |
11349 | | - | |
| 11364 | + | |
| 11365 | + | |
| 11366 | + | |
| 11367 | + | |
11350 | 11368 | | |
11351 | 11369 | | |
11352 | 11370 | | |
11353 | 11371 | | |
11354 | 11372 | | |
11355 | 11373 | | |
| 11374 | + | |
| 11375 | + | |
| 11376 | + | |
| 11377 | + | |
| 11378 | + | |
| 11379 | + | |
| 11380 | + | |
| 11381 | + | |
| 11382 | + | |
| 11383 | + | |
| 11384 | + | |
| 11385 | + | |
| 11386 | + | |
| 11387 | + | |
| 11388 | + | |
| 11389 | + | |
| 11390 | + | |
| 11391 | + | |
| 11392 | + | |
| 11393 | + | |
| 11394 | + | |
| 11395 | + | |
| 11396 | + | |
| 11397 | + | |
| 11398 | + | |
11356 | 11399 | | |
11357 | 11400 | | |
11358 | 11401 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
295 | 307 | | |
296 | 308 | | |
297 | 309 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
| 58 | + | |
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
| |||
62 | 64 | | |
63 | 65 | | |
64 | 66 | | |
| 67 | + | |
65 | 68 | | |
66 | 69 | | |
67 | 70 | | |
| |||
70 | 73 | | |
71 | 74 | | |
72 | 75 | | |
| 76 | + | |
73 | 77 | | |
74 | 78 | | |
75 | 79 | | |
| |||
98 | 102 | | |
99 | 103 | | |
100 | 104 | | |
| 105 | + | |
101 | 106 | | |
102 | 107 | | |
103 | 108 | | |
| |||
0 commit comments