Repository navigation
Commit ad2393f
fix(core,plugin-detail,app-shell): the related list, reference rail and packaged-actions table draw a served object label as served (#30583)
<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuEv8Fwf2b7dKNmdsotnksFm)_
Fixes #30486
Clause-②: yes (widening)
Metadata-protocol: none
## 维护者速读
- 改了什么:记录页上没写标题的相关列表、引用侧栏卡片,以及「设置 › 打包动作」表的对象列,改为显示服务端下发的对象名(含 `.custom`
扩展里的改名);只有服务端没下发名称时才查前端翻译目录。打包动作读对象列表时带上会话语言。
- 为什么改:客户在 `.custom` 扩展里把对象改名后,这三处仍显示基础包的旧译名(实测:服务端下发 Work items,界面显示 任务
/ Tasks),同一个对象出现两个名字;打包动作表读对象时带的是浏览器语言而非会话语言。
- 风险与回滚:未改名的对象显示不变(服务端下发的就是目录译文)。规则从 app-shell 移到
`@object-ui/core`(plugin-detail 引用不到 app-shell),新增 5 个导出,app-shell
原文件改为转出,行为逐字不变。回滚即 revert 本 PR。
-
先看:`ui/packages/core/src/utils/served-object-label.ts`(搬来的规则,函数体未改)、`ui/packages/plugin-detail/src/renderers/record-related-list.tsx`(新增一次与
RelatedList 同键同源的 schema
读取)、`ui/packages/app-shell/src/views/setup/PackagedActionsSection.tsx`(`Accept-Language`
与对象列)。
- 两分钟验证:`pnpm --dir ui exec vitest run
packages/plugin-detail/src/renderers/__tests__/record-related-list.titlePlural-11733.test.tsx
packages/plugin-detail/src/renderers/__tests__/record-reference-rail.titlePlural-11733.test.tsx
packages/app-shell/src/views/setup/PackagedActionsSection.test.tsx`,预期全绿,其中
objectstack#30486 分组断言改名后的对象名胜过目录旧译名。
- 需要你做的:无,席位落地。
## What changes
The served-object-label rule (PR #30388, PR #30475) reaches the three
sites the card names. Each was measured on `origin/main` `8e5fabe5`
first, live, and all three were still wrong (readings below), so none is
reported as already correct.
- **Rule home.** `@object-ui/plugin-detail` cannot import
`@object-ui/app-shell` (app-shell depends on it), so the rule moves,
function bodies unchanged, from app-shell's private
`hooks/servedObjectLabel.ts` to
`ui/packages/core/src/utils/served-object-label.ts`, a package both
already import that holds no provider and already reads
`@objectstack/spec/ui` at runtime. Named exports from the core entry:
`servedObjectLabel`, `servedObjectPluralLabel`, `metadataText`,
`ObjectLabelLookup`, `ObjectPluralLabelLookup` (hence `Clause-②: yes
(widening)`). app-shell's file is now a re-export, so its 30-odd
importers are untouched. Core over `@object-ui/react` or
`@object-ui/i18n`: about 400 app-shell and plugin-detail test files mock
those two packages with factories, and core is mocked by none of them.
- **Related list** (`record-related-list.tsx`): an untitled block reads
the related object's served definition with
`useSettledSchema(objectName, ctx.dataSource)`, the same key and data
source the inner `RelatedList` already reads for its columns (the
adapter's metadata cache answers both), and names the list by
`servedObjectPluralLabel`, the bundle plural and then the humanized name
as before when nothing is served.
- **Reference rail** (`record-reference-rail.tsx`): the rail already
reads each related object's schema for its fields and name field; it now
also keeps that schema's `label` / `pluralLabel`, and both names (the
card title and the empty line) read `servedObjectPluralLabel`.
- **Packaged actions** (`PackagedActionsSection.tsx`,
`packagedActions.ts` doc only): the `GET /meta/object` read sends
`Accept-Language` with the session language
(`useObjectTranslation().language`, also an effect dependency), and the
object column draws the served label through `servedObjectLabel` instead
of the bundle-first `objectLabel`.
- One root changeset, `patch` for `@object-ui/core`,
`@object-ui/plugin-detail`, `@object-ui/app-shell`.
## Tests
- New pins, each an objectstack#30486 top-level `describe` in the
component's existing harness file:
`record-related-list.titlePlural-11733.test.tsx` (served rename en / zh,
served label without plural),
`record-reference-rail.titlePlural-11733.test.tsx` (card and empty line
en / zh, plus a no-label control), `PackagedActionsSection.test.tsx`
(the object read's `Accept-Language`, served rename en / zh, no-label
control). The existing bundle cases in those files stay as the controls
for the not-served path.
- Reverse verification on `65c0b85f`: with the three source files
restored to `8e5fabe5` (tree only), `Tests 8 failed | 27 passed (35)`,
the 8 being exactly the new served-name cases; restored from `HEAD`,
`git diff HEAD` empty.
- Targeted run: `Test Files 5 passed (5)`, `Tests 61 passed (61)` (the
three files plus `servedObjectLabel-30390.test.ts` and
`packagedActions.test.ts`).
- Consumer sweep on `688f24a4`: every app-shell test file importing a
module that imports `servedObjectLabel` or `useNavTargetLabel` (669
files), plus the whole `plugin-detail` and `core` suites: `Test Files
1274 passed | 1 skipped (1275)`, `Tests 12687 passed | 45 skipped
(12732)`.
- `type-check` (both tsconfigs) for `@object-ui/core`,
`@object-ui/plugin-detail`, `@object-ui/app-shell`: all Done, exit 0.
eslint on the 10 changed files: 0 errors (28 existing warnings).
## Acceptance notes
- The branch is the card thread's harness-assigned
`claude/project-thread-28n2uz`, not `claude/issue-30486-*`.
- The live rig names the object through an `object_extension` in
`com.example.showcase.custom` (label `Work item`, plural `Work items`,
plain strings, so a zh-CN session is served the English rename too). The
served list label in zh-CN is `Work items`, the base translation `任务`.
- Not changed, observed on the same page: the sidebar navigation entry
and the authored tab label still say `任务` / `Tasks`. Both are their own
authored labels (an app navigation item, a page tab), not an object-name
lookup, so they are outside this rule.
- `#30126` row 6 (plugin-detail record-page field labels): no file
overlap; this PR touches only the two renderers named above in
plugin-detail.
## Verification
Live: showcase `objectstack dev --fresh` with the `.custom` rename above
and a `.custom` override of `showcase_project_detail` whose Related tab
holds an untitled `record:related_list` and an untitled
`record:reference_rail` entry for `showcase_task`; Console from
`ui/apps/console` vite, 1440 px. Three sessions: en-US browser, zh-CN
browser, and a zh-CN session in an en-US browser.
| Reading | before `8e5fabe5` | after |
|:---|:---|:---|
| Related list + rail title, en-US | Tasks, Tasks | Work items, Work
items |
| Related list + rail title, zh-CN | 任务, 任务 | Work items, Work items |
| Packaged actions, `showcase_task` object column, en-US / zh-CN | Task
/ 任务 | Work item / Work item |
| Packaged actions, the section's `/meta/object` `Accept-Language`,
zh-CN session in an en-US browser | en-US | zh-CN |
| Control: `sys_team` (not renamed), zh-CN session in an en-US browser |
团队 | 团队 |
Record page, zh-CN, before and after:


Record page, en-US:
[before](https://github.com/objectstack-ai/objectstack/blob/5ebc6c24151041487d35169abcf8a76b3bd84cb8/evidence/30486/before-1-record-related-en-US-1440.png?raw=true)
·
[after](https://github.com/objectstack-ai/objectstack/blob/5ebc6c24151041487d35169abcf8a76b3bd84cb8/evidence/30486/after-1-record-related-en-US-1440.png?raw=true)
Packaged actions, zh-CN:
[before](https://github.com/objectstack-ai/objectstack/blob/5ebc6c24151041487d35169abcf8a76b3bd84cb8/evidence/30486/before-2-packaged-actions-zh-CN-1440.png?raw=true)
·
[after](https://github.com/objectstack-ai/objectstack/blob/5ebc6c24151041487d35169abcf8a76b3bd84cb8/evidence/30486/after-2-packaged-actions-zh-CN-1440.png?raw=true).
en-US:
[before](https://github.com/objectstack-ai/objectstack/blob/5ebc6c24151041487d35169abcf8a76b3bd84cb8/evidence/30486/before-2-packaged-actions-en-US-1440.png?raw=true)
·
[after](https://github.com/objectstack-ai/objectstack/blob/5ebc6c24151041487d35169abcf8a76b3bd84cb8/evidence/30486/after-2-packaged-actions-en-US-1440.png?raw=true).
zh-CN session, en-US browser:
[before](https://github.com/objectstack-ai/objectstack/blob/5ebc6c24151041487d35169abcf8a76b3bd84cb8/evidence/30486/before-2-packaged-actions-zh-CN-session-en-browser-1440.png?raw=true)
·
[after](https://github.com/objectstack-ai/objectstack/blob/5ebc6c24151041487d35169abcf8a76b3bd84cb8/evidence/30486/after-2-packaged-actions-zh-CN-session-en-browser-1440.png?raw=true).
The screenshots are committed at `5ebc6c2415` and removed in the next
commit, so they never reach `main`.
<details><summary>Derived gates (35/35, 0 NOT-MEASURED)</summary>
`node scripts/pm/dispatch-gates.mjs --commands` on `0495f150` (the merge
of `origin/main`) derived 35 families; all 35 ran locally with exit 0,
`check:test-source-alias` after one fix (`6e098057`: the new
packaged-actions pin loaded `@object-ui/i18n` inside a test body; now a
module-top import). `--ran` reconciliation: 35 derived, 35 run, 0
NOT-MEASURED, 0 UNRUN. Every family CI runs is read from this PR's
check-runs.
</details>
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01L6bhgT79N7DN2Gcdsta3mm
---
_Generated by [Claude
Code](https://claude.ai/code/session_01L6bhgT79N7DN2Gcdsta3mm)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 3b8b23c commit ad2393f
11 files changed
Lines changed: 415 additions & 102 deletions
File tree
- .changeset
- ui/packages
- app-shell/src
- hooks
- views/setup
- core/src
- utils
- plugin-detail/src/renderers
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
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 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
537 | 538 | | |
538 | 539 | | |
539 | 540 | | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
97 | 98 | | |
98 | 99 | | |
99 | 100 | | |
| |||
125 | 126 | | |
126 | 127 | | |
127 | 128 | | |
128 | | - | |
| 129 | + | |
129 | 130 | | |
130 | 131 | | |
131 | | - | |
| 132 | + | |
132 | 133 | | |
133 | 134 | | |
134 | 135 | | |
135 | 136 | | |
136 | 137 | | |
137 | | - | |
138 | | - | |
139 | | - | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
140 | 148 | | |
141 | 149 | | |
142 | 150 | | |
| |||
208 | 216 | | |
209 | 217 | | |
210 | 218 | | |
211 | | - | |
| 219 | + | |
212 | 220 | | |
213 | 221 | | |
214 | 222 | | |
| |||
231 | 239 | | |
232 | 240 | | |
233 | 241 | | |
234 | | - | |
| 242 | + | |
235 | 243 | | |
236 | 244 | | |
237 | 245 | | |
| |||
253 | 261 | | |
254 | 262 | | |
255 | 263 | | |
256 | | - | |
| 264 | + | |
257 | 265 | | |
258 | 266 | | |
259 | 267 | | |
| |||
408 | 416 | | |
409 | 417 | | |
410 | 418 | | |
411 | | - | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
412 | 426 | | |
413 | 427 | | |
414 | | - | |
| 428 | + | |
415 | 429 | | |
416 | 430 | | |
417 | 431 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
93 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
94 | 96 | | |
95 | 97 | | |
96 | 98 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
188 | 199 | | |
189 | 200 | | |
190 | 201 | | |
| |||
| 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 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
0 commit comments