Repository navigation
Commit 17ceb2d
fix(plugin-designer): decide a generated nav entry's plural label from the authored object, not the served translation (#35299)
Fixes #35101
Clause-②: yes (widening)
Metadata-protocol: none
## 维护者速读
- 改了什么:新建/编辑应用向导离开「对象」步骤时,为新选对象生成的导航项,其复数标签改为读对象的原文定义(authored
layers)来判断和存储,不再用界面语言翻译后的对象列表。
- 为什么改:中文界面下会把翻译后的复数名称(如「项目列表」)当原文存进应用定义,其他语言的读者也被迫看到它;按裁定 A(「35101
A」)改为读原文,原文读取失败则不写标签(导航项继承对象标签),绝不回退到翻译文本。
- 风险与回滚:只影响新生成的导航项,已存的导航项不改写;读取期间「下一步/上一步/步骤」与对象选择被禁用,读完后自动进入导航步骤;回滚即
revert 本 PR。
-
先看:`ui/packages/plugin-designer/src/AppCreationWizard.tsx`(`enterNavigationStep`
与
`readAuthoredEntryLabels`)、`ui/packages/plugin-designer/src/pages/authoredObjectReader.ts`(按对象所属包读取)、`ui/packages/plugin-designer/src/__tests__/AppWizard.standardNavEntries-11201.test.tsx`。
- 两分钟验证:`pnpm --dir ui exec vitest run
packages/plugin-designer/src/__tests__/AppWizard.standardNavEntries-11201.test.tsx`,预期
10 个用例全部通过。
- 需要你做的:无,席位落地。
## What changes
The app wizard (Create app and Edit app) generates one navigation entry
per newly selected object when it leaves the Objects step. Under ruling
B (objectui#11201) the entry stored the object's plural label when it
differed from the label and the name, and both the decision and the
stored text came from the served object list, which is translated for
the console's locale. Under ruling A (comment 6996384871, the
maintainer's 「35101 A」):
- `AppCreationWizardProps` gains an optional
`readAuthoredObject(objectName)`. When the wizard leaves the Objects
step, it reads every object that needs a generated entry, in parallel,
and decides each entry's label from the authored answer alone: the
authored `pluralLabel`, stored only when it spells neither the authored
`label` nor the object name.
- A refused, failed or empty read writes NO label; the entry inherits
the object's label at render time. There is no fallback to served text
anywhere on this path (the maintainer's in-session instruction).
- `pages/authoredObjectReader.ts` holds `owningPackage` (moved out of
`EditAppPage`, unchanged) and `useAuthoredObjectReader`, which reads
`ObjectStackAdapter.getAuthoredItem('object', name, { packageId })` at
the package the served object came from. `CreateAppPage` and
`EditAppPage` pass it.
- While the reads run, Next, Back, the step header and the object
selection (cards, select-all, search) are disabled, so neither the step
nor the selection can move under the reads. Next carries `aria-busy`. An
unmount during the reads drops the result.
- Entries already stored are not rewritten; existing object entries in
an edited app are not re-read.
## Tests
- `AppWizard.standardNavEntries-11201.test.tsx`: the served list is now
a zh-CN list (every label translated) and the authored layers are
English. The four ruling-B cases now run against authored data. A new
describe for 35101 pins: the authored plural is stored, not the
translation (`project`); a translated plural equal to the translated
label does not suppress the authored plural (`task`); no stored label
carries Han text; a packaged object is read at its package and a
package-less one with no package; a refused read (403) writes no label.
A second new describe pins that, while a read is held open, Next, Back
and the object cards are disabled and the navigation step is not shown,
and that the step advances once the read settles.
- `AppWizard.specDocument-10867.test.tsx` and
`EditAppPage.keepsNavigation-10894.test.tsx`: their adapter mocks answer
`getAuthoredItem('object', …)`, and they await the navigation step after
leaving Objects.
## Acceptance notes
- Comparison basis: the reading on the card says "only when the authored
plural differs from the name". The card's option A text
(「只在原文的复数名称和名称不同时才存」) uses 名称 as ruling B did, where B compared against
both the label and the machine name. This PR keeps both comparisons,
against the authored values. If the ruling meant the machine name only,
the change is one line in `generatedEntryLabel`.
- A host that renders the exported `AppCreationWizard` without
`readAuthoredObject` now gets generated entries with no label at all
(they inherit). Before, it got the served plural. This follows the
ruling's "read fails ⇒ no label" and is stated in the changeset.
- A read that never settles leaves Next disabled. Cancel still works.
The adapter's own request handling bounds this; the wizard adds no timer
of its own.
- Declared deviations: the branch is `claude/cool-bardeen-unawl1`, not
`claude/issue-35101-*`, because this session may push only that branch.
The first three commits (up to `fc64ae98`) were written in the PM
session before dispatch. The dev reviewed every line from that sha and
owns the result. The dev's changes on top are: freezing the object
selection during the reads (Zone 3: the PM's guard disabled the step
buttons but left the object cards clickable, so an object toggled
mid-read got an entry nobody had read for); a test pinning that freeze;
and the changeset's `Clause-②:` line corrected from `no` to the measured
`yes (widening)`.
- Clause-② measurement: after `pnpm --filter @object-ui/plugin-designer
build`, `dist/index.d.ts` carries `export type { AppCreationWizardProps
} from './AppCreationWizard.js'`, and `dist/AppCreationWizard.d.ts` line
31 carries `readAuthoredObject?: (objectName: string) => Promise...`. On
origin/main the source has zero `readAuthoredObject`.
`pages/authoredObjectReader.d.ts` is emitted but nothing in the index
closure reaches it (`CreateAppPage.d.ts` does not reference it). An
optional prop on an exported type widens the public surface.
## Verification
<details><summary>Scoped tests, type-check, lint (head a82d33f, after
merging origin/main)</summary>
- `pnpm --dir ui exec vitest run --maxWorkers=2
packages/plugin-designer/` (under `os-verify-lock`): `Test Files 52
passed (52)`, `Tests 477 passed (477)`, `VERDICT command-exit 0`.
- `pnpm run type-check` in `ui/packages/plugin-designer` (`tsc --noEmit
&& tsc -p tsconfig.test.json`): clean, same lock run, `VERDICT
command-exit 0`.
- eslint on the 7 changed source and test files: exit 0, 0 errors, 10
warnings, all on lines this diff does not add (`any` in the pages'
object mapping, plus two older warnings in the wizard).
- The dependency closure was rebuilt after the merge: `pnpm
--workspace-concurrency=2 --filter '@object-ui/plugin-designer^...'
build`, `VERDICT command-exit 0`.
</details>
<details><summary>Ablations (one per tested behaviour, each through
scripts/ablation-replace.mjs, restore proven by blob == HEAD and an
empty git diff HEAD)</summary>
The tests import the wizard and pages by relative path from `src/`, so
no `dist` is involved.
- M1, a refused read falls back to the served plural: 2 failed / 8
passed ("no stored label carries served text", "a refused authored read
writes no label").
- M2, the label is decided from the served object instead of the
authored read: 5 failed / 5 passed (the ruling-B CONTROL, the project
and task cases, the Han check, the freeze test's final label).
- M3, the package is dropped from the read: 1 failed ("a packaged object
is read at the package the served object came from"). The first attempt
replaced the anchor with text that was already in the file, so the tool
refused it (replacement count 1 to 1) and nothing ran. It was re-run
with a distinct replacement.
- M4, the object selection is not frozen during the reads: 1 failed (the
freeze test).
This answers the PM's reverse-check gap: each label assertion now fails
on its own mutation, not only on the helper's call count.
</details>
<details><summary>Derived gate families</summary>
`node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` at a82d33f: 38 families, all run locally,
each with exit 0. `--ran`: "38 derived famil(ies) accounted for — 38
run, 0 NOT-MEASURED (a DERIVED zero — all 38 recorded an exit code and
none of them is 3)". The full farm, `Lint UI`, `Type Check UI`, `Test
UI` and `Build & E2E UI` are CI's.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01L6bhgUAofPTcVEUbSPa79e)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent a998964 commit 17ceb2d
8 files changed
Lines changed: 299 additions & 52 deletions
File tree
- .changeset
- ui/packages/plugin-designer/src
- __tests__
- pages
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
77 | 85 | | |
78 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
79 | 90 | | |
80 | 91 | | |
81 | 92 | | |
| |||
113 | 124 | | |
114 | 125 | | |
115 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
116 | 134 | | |
117 | | - | |
118 | | - | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
119 | 142 | | |
120 | | - | |
121 | | - | |
| 143 | + | |
| 144 | + | |
122 | 145 | | |
123 | 146 | | |
124 | | - | |
| 147 | + | |
125 | 148 | | |
126 | 149 | | |
127 | 150 | | |
128 | | - | |
| 151 | + | |
129 | 152 | | |
130 | 153 | | |
131 | 154 | | |
| |||
200 | 223 | | |
201 | 224 | | |
202 | 225 | | |
| 226 | + | |
203 | 227 | | |
204 | 228 | | |
205 | 229 | | |
206 | 230 | | |
207 | | - | |
| 231 | + | |
208 | 232 | | |
209 | 233 | | |
210 | 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 | + | |
| 266 | + | |
211 | 267 | | |
212 | 268 | | |
213 | 269 | | |
| |||
847 | 903 | | |
848 | 904 | | |
849 | 905 | | |
| 906 | + | |
850 | 907 | | |
851 | 908 | | |
852 | 909 | | |
| |||
857 | 914 | | |
858 | 915 | | |
859 | 916 | | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
860 | 924 | | |
861 | 925 | | |
862 | 926 | | |
| |||
948 | 1012 | | |
949 | 1013 | | |
950 | 1014 | | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
951 | 1039 | | |
952 | | - | |
953 | | - | |
954 | | - | |
| 1040 | + | |
955 | 1041 | | |
956 | | - | |
957 | | - | |
958 | | - | |
959 | | - | |
| 1042 | + | |
| 1043 | + | |
960 | 1044 | | |
961 | 1045 | | |
962 | | - | |
| 1046 | + | |
963 | 1047 | | |
964 | 1048 | | |
965 | | - | |
| 1049 | + | |
966 | 1050 | | |
967 | | - | |
| 1051 | + | |
968 | 1052 | | |
969 | 1053 | | |
970 | 1054 | | |
| |||
990 | 1074 | | |
991 | 1075 | | |
992 | 1076 | | |
| 1077 | + | |
993 | 1078 | | |
994 | 1079 | | |
995 | 1080 | | |
996 | 1081 | | |
997 | 1082 | | |
998 | 1083 | | |
999 | | - | |
1000 | | - | |
1001 | | - | |
1002 | | - | |
| 1084 | + | |
| 1085 | + | |
1003 | 1086 | | |
1004 | 1087 | | |
1005 | 1088 | | |
1006 | 1089 | | |
1007 | | - | |
| 1090 | + | |
1008 | 1091 | | |
1009 | 1092 | | |
1010 | 1093 | | |
| |||
1076 | 1159 | | |
1077 | 1160 | | |
1078 | 1161 | | |
1079 | | - | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
1080 | 1165 | | |
1081 | 1166 | | |
1082 | 1167 | | |
| |||
1136 | 1221 | | |
1137 | 1222 | | |
1138 | 1223 | | |
1139 | | - | |
| 1224 | + | |
1140 | 1225 | | |
1141 | 1226 | | |
1142 | 1227 | | |
| |||
1159 | 1244 | | |
1160 | 1245 | | |
1161 | 1246 | | |
1162 | | - | |
| 1247 | + | |
| 1248 | + | |
1163 | 1249 | | |
1164 | 1250 | | |
1165 | 1251 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
56 | 58 | | |
57 | 59 | | |
58 | 60 | | |
| |||
101 | 103 | | |
102 | 104 | | |
103 | 105 | | |
| 106 | + | |
104 | 107 | | |
105 | 108 | | |
106 | 109 | | |
| |||
142 | 145 | | |
143 | 146 | | |
144 | 147 | | |
| 148 | + | |
145 | 149 | | |
146 | 150 | | |
147 | 151 | | |
| |||
0 commit comments