Repository navigation
Commit 98f640d
fix(plugin-designer): the fields and objects pages save an object as authored, not as served (#30877)
<!-- claude-projects-attribution: {"github_login":"os-tesla"} -->
_Requested by **Tesla** · [project
thread](https://claude.ai/code/project/chan_01AXsQkLFKRdQCqQ3RTr6Jao?thread=cmsg_01AXsQkLFKRdQCqQ3RTr6Jao5ZvZUE3RgkiyeEu1r7wiff)_
Fixes #30786: Wanted 3, the two plugin-designer pages. Wanted 1, 2 and 4
for Setup's editor landed in #30858.
Clause-②: yes
Metadata-protocol: none
## 维护者速读
- 改了什么:plugin-designer 的字段页和对象页保存对象时,改以分层读取里作者原样存的 `overlay ?? code`
为底,不再以按控制台语言翻译、且带平台注入列的列表或单项读取为底;对象页只写回本次编辑改动的键。这条读法移到
`@object-ui/data-objectstack` 导出,app-shell 原样转出。
- 为什么改:中文控制台里,在字段页改一个字段标签,或在对象页改一次描述,整个对象其余的中文标签和 `owner_id`
等注入列都会被当作作者原文存回去。
- 风险与回滚:只改客户端读哪一层,不改服务端和协议。data-objectstack 多了导出(Clause-②
yes,仅加宽)。字段页现在显示作者原文的字段标签,而不是翻译后的。回滚即 revert 本 PR。
- 先看:`authored-layers.ts`(从 app-shell 原样搬来),`MetadataFieldsPage.tsx` 的
`reload`,`MetadataObjectsPage.tsx` 的改动键合并,以及新测试
`MetadataPages.authoredBase-30786.test.tsx`。
- 两分钟验证:`pnpm --dir ui exec vitest run
packages/plugin-designer/src/MetadataPages.authoredBase-30786.test.tsx
packages/data-objectstack/src/authored-layers.test.ts`,应见 17 个测试全绿。
- 需要你做的:无,席位落地。
- **席位意见**:ui 席 2 对照 head `fc2fd5ab` 的 diff 复核:23 个文件、+782 /
−168,无受治理路径。#30858 落地的读法原样搬进
`@object-ui/data-objectstack`(只加文档段),从入口新增导出,属仅加宽,`Metadata-protocol:
none` 故三包 patch 合规;app-shell 的 `authoredObjectBuffer.ts` 只剩转出口且不在
app-shell 入口。字段页改从分层读取的 `overlay ?? code` 编辑,对象页只把这次改动的键盖在 `overlay ??
code` 上,两层都读不到就不保存并说明。席位 `TIER_DEFAULT` 契约复审 PASS(6681037914);CI
全绿。同意落地。
## What changes
- `@object-ui/data-objectstack` gains `authored-layers.ts`, the reading
#30858 put in app-shell's `authoredObjectBuffer.ts`, moved as it was:
`editsAuthoredLayers`, `authoredBuffer`, `authoredPublished`, and the
`AuthoredBuffer` and `AuthoredLayers` types, exported from the package
index beside `MetadataClient.layered`. It moves because plugin-designer
cannot import app-shell (app-shell depends on plugin-designer).
App-shell's `authoredObjectBuffer.ts` now re-exports them and keeps its
object spellings and `servedOnlyFields`, so `ResourceEditPage.tsx` and
`StudioDesignSurface.tsx` are not touched and behave the same.
- `MetadataFieldsPage`: `reload()` reads `client.layered('object',
name)` and edits `authoredPublished('object', layers)`, which is
`overlay ?? code`, in place of `client.get`. The designer is handed the
authored fields, and the save spreads that document. When the layered
read holds neither layer (it answers a 404 as all-null layers), the page
shows the same "not found" it showed for the item read's `null`.
- `MetadataObjectsPage`: the manager still shows the listed object as
served (display stays translated). On a save, the page reads the layered
read for that object, and lays only the keys the edit changed (`label`,
`pluralLabel`, `description`, `icon`, `isSystem`, each compared with
what the manager was shown) over `overlay ?? code`. A key the manager
hands back unchanged is the served translation, so it is never written.
When the layered read holds neither layer, nothing is sent, and the
row's error says so instead of saving a body with no fields. A new
object (no listed row) is saved as before.
- The `group` strip (objectui#6223) and `dropServedPicklistOptions`
(objectui#11692) stay on the write side of both pages.
## Tests
- `MetadataPages.authoredBase-30786.test.tsx` (new, 10 tests). It uses a
real `MetadataClient` with a zh-CN fetch double: the list and item reads
serve Chinese labels plus an injected `owner_id`, and `/layers` serves
`code` in English, an optional `overlay`, and a governed `effective`.
Fields page: the designer gets the authored fields with no injected
column and no item read. A relabel PUTs source text and no `owner_id`,
and so does the second save after the reload. An overlay is the base
when there is one, and a 404 shows "not found" and sends nothing.
Objects page: the manager still shows `任务`. A description edit, and a
label edit, PUT the authored labels and fields. An overlay is the base.
A layered read with no layer sends nothing and names the row.
- `authored-layers.test.ts` (new, 7 tests) pins the reading itself, case
by case.
- Twelve `MetadataFieldsPage.*` suites and three `MetadataObjectsPage.*`
suites used fetch doubles that served only the item or list read. Each
now also answers `/layers` with the stored document it already served as
the `code` layer (`servedAsLayers` / `layersAnswer`, one small helper
per file). No assertion changed.
<details><summary>Ablations (head fc2fd5a)</summary>
`node scripts/ablation-replace.mjs`, each against
`MetadataPages.authoredBase-30786.test.tsx`; each reported anchor 1 to 0
and then `ok restored: blob == HEAD`.
| file | anchor | replacement | result |
|:---|:---|:---|:---|
| `MetadataFieldsPage.tsx` | `const layers = await
client.layered('object', objectName);` | `const layers = { overlay:
null, code: await client.get('object', objectName) };` (the served read)
| 5 failed, 5 passed: all five fields-page cases red |
| `MetadataObjectsPage.tsx` | `if (!shown \|\| updated[key] !==
shown[key]) {` | `if (shown \|\| !shown) {` (every listed key written) |
3 failed: description edit, label edit, overlay base |
| `MetadataObjectsPage.tsx` | `base = authoredPublished('object',
layers);` | `base = { ...previous };` (the served base) | 3 failed:
description edit, label edit, overlay base |
</details>
## Acceptance notes
- The fields page now shows the authored field labels (English in a
zh-CN console), because what it shows is what it saves. The card allowed
display to stay on the served read; the designer is the editor here, so
it shows the buffer. The objects page's list stays as served.
- Neither page edits a pending draft: both saved over the published item
before and still do, now as authored. The draft half of the reading
(`authoredBuffer`) is used by Setup's editor only.
- Neither page passes `?package=` on the layered read, matching their
save, which names no package either. That is unchanged.
- Out of scope: the same class in Studio's editors is #30859, filed by
the seat; `EmbeddedItemEditor.tsx`'s object parent was reported with it
in #30858.
- These pages have no mount in this repo; there is no live measurement.
The served shape the doubles use is the one measured for #30858
(objects: the item and list reads are translated and governed, and
`/layers` `code` and `overlay` are untranslated).
## Verification
<details><summary>Local gates and tests (head fc2fd5a)</summary>
Derived with `node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` against this diff (37 families, plus `pnpm
check:changeset-fixed`, whose roster sits under `.changeset/`), each run
with stdin closed; reconciled with `--ran`: 37 derived, 37 run, 0
NOT-MEASURED, 0 UNRUN. The `vitest run scripts/` gate first timed out in
the verify-lock queue (exit 99, never ran) behind the ui suite below,
and was then run on its own: 170 files passed, 2 skipped.
```text
node scripts/check-adr-0087-registration.mjs --base origin/main :: exit 0
node scripts/check-adr-0087-registration.mjs --self-test :: exit 0
node scripts/check-changeset-no-major.mjs --base origin/main :: exit 0
node scripts/check-closing-keyword-parity.mjs :: exit 0
node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0
node scripts/check-comment-mask-corpus.mjs :: exit 0
node scripts/check-empty-changeset.mjs --base origin/main :: exit 0
node scripts/check-empty-changeset.mjs --self-test :: exit 0
node scripts/check-sdui-manifest.mjs :: exit 0
node scripts/check-sdui-manifest.mjs --self-test :: exit 0
node scripts/ci/snapshot-next.mjs --self-test :: exit 0
node scripts/pm/release-rehearsal-clone.mjs --self-test :: exit 0
node scripts/release-pending-publish.mjs --self-test :: exit 0
pnpm --dir ui exec vitest run scripts/ :: exit 0
pnpm --filter @objectstack/spec run check:duration-unit-keys :: exit 0
pnpm check:changeset-gate-self-tests :: exit 0
pnpm check:closed-ceremony-text :: exit 0
pnpm check:cross-package-test-inputs :: exit 0
pnpm check:dispatcher-error-vocabulary :: exit 0
pnpm check:driver-memory-census :: exit 0
pnpm check:engine-double-contract :: exit 0
pnpm check:error-status-conformance :: exit 0
pnpm check:gitlink-declared :: exit 0
pnpm check:nul-bytes :: exit 0
pnpm check:published-files :: exit 0
pnpm check:query-options-erasure :: exit 0
pnpm check:refd-timer-probe :: exit 0
pnpm check:registry-log-declared :: exit 0
pnpm check:rest-log-spy-declared :: exit 0
pnpm check:skill-identifier-liveness :: exit 0
pnpm check:test-source-alias :: exit 0
pnpm check:tier-file-adoption :: exit 0
pnpm check:type-check-coverage :: exit 0
pnpm check:type-check-debt :: exit 0
pnpm check:undeclared-dep-imports :: exit 0
pnpm check:watch-hint-literal :: exit 0
pnpm check:where-matcher :: exit 0
pnpm check:changeset-fixed :: exit 0
pnpm --filter @object-ui/data-objectstack run type-check :: exit 0
pnpm --filter @object-ui/plugin-designer run type-check :: exit 0
pnpm --filter @object-ui/app-shell run type-check :: exit 0
```
UI tests (vitest root `ui/`, under the verify lock): `pnpm --dir ui exec
vitest run packages/data-objectstack/ packages/plugin-designer/
packages/app-shell/src/views/metadata-admin/
packages/app-shell/src/views/studio-design/`: `Test Files 1229 passed
(1229)`, `Tests 12009 passed | 1 skipped (12010)`, on head fc2fd5a.
</details>
<!-- signed: domain:ui#2 · os-tesla · session_01L9qibw7DekEe3wx5f3zphf
-->
Co-authored-by: Claude <noreply@anthropic.com>1 parent d55acb7 commit 98f640d
23 files changed
Lines changed: 782 additions & 168 deletions
File tree
- .changeset
- ui/packages
- app-shell/src/views/metadata-admin
- data-objectstack/src
- plugin-designer/src
| 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 | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 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 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
38 | 8 | | |
39 | 9 | | |
40 | | - | |
| 10 | + | |
41 | 11 | | |
42 | 12 | | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
| 13 | + | |
| 14 | + | |
50 | 15 | | |
51 | 16 | | |
52 | 17 | | |
53 | 18 | | |
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 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | 19 | | |
111 | 20 | | |
112 | 21 | | |
| |||
| 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 | + | |
| 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 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7964 | 7964 | | |
7965 | 7965 | | |
7966 | 7966 | | |
| 7967 | + | |
| 7968 | + | |
| 7969 | + | |
| 7970 | + | |
| 7971 | + | |
7967 | 7972 | | |
7968 | 7973 | | |
7969 | 7974 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
94 | 104 | | |
95 | 105 | | |
96 | 106 | | |
| |||
110 | 120 | | |
111 | 121 | | |
112 | 122 | | |
113 | | - | |
114 | | - | |
| 123 | + | |
| 124 | + | |
115 | 125 | | |
116 | 126 | | |
117 | 127 | | |
118 | 128 | | |
119 | 129 | | |
120 | 130 | | |
121 | | - | |
| 131 | + | |
122 | 132 | | |
123 | 133 | | |
124 | 134 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
38 | 48 | | |
39 | 49 | | |
40 | 50 | | |
| |||
77 | 87 | | |
78 | 88 | | |
79 | 89 | | |
80 | | - | |
| 90 | + | |
81 | 91 | | |
82 | 92 | | |
83 | 93 | | |
| |||
0 commit comments