Repository navigation
Commit 4278c3b
fix(studio): list an order-only field change in the publish review and pin platform fields on the form canvas (#27646)
<!-- claude-projects-attribution: {"github_login":"os-bill"} -->
_Requested by **Bill** · [project
thread](https://claude.ai/code/project/chan_016iMXWSZDzqWRWvWzdNo8wg?thread=cmsg_016iMXWSZDzqWRWvWzdNo8wgVPwkGeZxvbHqGDhHfetYNP)_
Fixes #27516
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:发布审阅单对「只调整了字段顺序」的对象草稿,展开后列出一行「字段顺序已变更」并保留 Update 标记,不再显示「No
differences detected」;Studio 表单设计器里,与平台定义完全相同的字段(实际就是
Owner)在未分组区始终排在首位,把作者字段拖到它上方会落在它下方,拖放播报也报这个位置。
- 为什么改:发布按字段顺序计算内容哈希、纯重排会真的发布新版本,但审阅单说没有差异;画布允许把字段放在 Owner 上方,刷新后平台又把
Owner 放回最前,作者的排列悄悄失效。
- 风险与回滚:只动 Studio 两处界面与一个新文案键(10 个语言包各一行);不改元数据协议、不改服务端;回滚即 revert 本 PR。
- 先看:`DraftChangesPanel.tsx` 的
`fieldOrderChanged`(排除哪些平台注入列);`ObjectFormDesigner.tsx` 的 `settlePinned`
/ `dropLayout`(onDragEnd 与播报共用一套落点计算);两份新测试。
- 两分钟验证:`pnpm --dir ui exec vitest run
packages/app-shell/src/preview/__tests__/DraftChangesPanel.fieldOrder-27516.test.tsx
packages/app-shell/src/views/studio-design/ObjectFormDesigner.pinnedFields-27516.test.tsx`,预期
13 个用例全绿。
- 需要你做的:无,席位落地。
## What changes
- **Publish review sheet (`DraftChangesPanel`)** — `computeChangeDetail`
now reports `fields.reordered` for an `object` whose two versions
declare their shared fields in a different order, and the drill-in
prints a `~ Field order changed` row (new key
`preview.changes.fieldOrderChanged`). `isEmptyChangeDetail` counts it,
so such an entry keeps its Update badge instead of the "No differences
detected" glyph.
- The order compared is the order the publish door stores. Left out on
both sides: a column the platform injects while its definition is
exactly the platform's (`isInjectedColumnDefinition` over
`injectedSystemColumnDefs`, both from `@objectstack/spec/data`), which
the `/meta` reads prepend and the draft write strips; and a column the
platform injects and hides (`isStudioHiddenSystemField`, the search
companion among them). Only fields both versions declare are compared;
an added or removed field is already a row.
- Gated on `type === 'object'`, the one row of the door's ordered-map
table; the comment on `fieldOrderChanged` names that table as the
authority.
- **Form designer canvas (`ObjectFormDesigner`)** — `settlePinned`
places every shown ungrouped field whose definition, without its
`group`, is the platform's own first in the ungrouped bucket, in the
injection's order. It runs on the derived layout and on every drop.
`onDragEnd` and the live-region `dropPlaceIn` now share one `dropLayout`
(the arithmetic `dropPlaceIn` used to restate), so the place announced
is the settled place committed. A pinned field moved into a section
carries `group` and is the author's from then on; an edited one (a
changed label) likewise. `FieldControlPreview` is untouched.
- **i18n** — `preview.changes.fieldOrderChanged` in all ten locale
packs.
- Root changeset: `@object-ui/app-shell` and `@object-ui/i18n` patch.
## Tests
- New `DraftChangesPanel.fieldOrder-27516.test.tsx` (9 cases): a pure
reorder of authored fields, the array shape of `fields`, a same-order
control, platform columns placed differently on the two reads
(registry-backed vs overlay-backed) compare equal, an author-declared
`owner_id` counts, added/removed fields are not a reorder, non-`object`
types are not compared; on the panel, the row prints and the Update mark
stays, with a same-order control still reading "No differences
detected".
- New `ObjectFormDesigner.pinnedFields-27516.test.tsx` (4 cases), on the
real `DndContext` with the band geometry of the objectui#11802 suite,
and a `reload` that replays the round trip with the spec's helpers
(strip what equals the platform's definition, prepend the injected
columns): Condition dropped on Owner lands at 2 of 3, is announced
there, and the reloaded canvas shows the same order; author reorders
below Owner survive the reload; an author-changed `owner_id` keeps the
place it is given; Owner moved into a section keeps its section order
through the reload.
- Ablation, one leg per behaviour, via `scripts/ablation-replace.mjs`
(anchor 1 → 0, blob changed, restored with `git diff HEAD` empty);
app-shell tests import the source, no build in the path:
| Leg | Mutation | Result |
|---|---|---|
| review order | `reordered` forced false | 4 of 9 red (every positive
case); controls green |
| canvas settle | `settlePinned` returns the layout unsettled | 1 of 4
red (the drop above Owner); the three author-order cases green, as they
should be |
- `pnpm --dir ui exec vitest run
packages/app-shell/src/views/studio-design/
packages/app-shell/src/preview/`: 293 files, 2076 tests passed (includes
the objectui#11802 announcement suite, whose drop-vs-commit control now
runs through the shared `dropLayout`).
- `pnpm --dir ui exec vitest run packages/i18n/`: 90 files, 1379 passed,
13 skipped (locale key parity included).
- `type-check` for `@object-ui/app-shell` and `@object-ui/i18n`: exit 0.
eslint on the four touched source/test files: 0 errors (8 warnings, all
on lines this PR does not touch).
## Acceptance notes
- **Triage reading, measured.** Triage asked the review sheet to use
"the same order-aware comparison publish already uses". That comparison
is `canonicalize(body, 'object')` in `@objectstack/metadata-core` (its
`ORDERED_MAPS` table keeps the order of an `object`'s `fields`). It
cannot be imported here as is: the module imports `node:crypto` at its
top, and `@object-ui/app-shell` does not depend on
`@objectstack/metadata-core`. The sheet therefore restates that one
row's rule, keyed on the same type, and reuses the spec's exported
injection helpers rather than a second list of platform columns. The
seat approved this before it was written.
- **Where `owner_id` is re-injected, measured.** The `/meta` read exits
call `governServedItem`, whose `applyInjectedSystemColumns`
(`@objectstack/metadata-core`) builds `fields` as the
injected-but-undeclared columns followed by the declared ones; the draft
write's `stripInjectedSystemColumns` removes a column whose definition
equals the platform's (`isInjectedColumnDefinition`). The canvas pins
exactly that set, read through the same spec helpers.
- **File surface.** The ten `ui/packages/i18n/src/locales/*.ts` packs
(one key each) were added to the claim's file surface with the seat's
approval.
- The canvas does not add a visible "pinned" marker: a field dropped
above Owner lands below it and the live region names that place. A
marker would need new designer copy; noted, not added.
- A sighted drag still previews the card above Owner while the pointer
is there (dnd-kit's sortable preview); the drop settles it. Noted.
- Docs-driven rule (ui/AGENTS.md #2): no docs page describes the review
sheet's field rows or the designer's ungrouped order; nothing to update.
## Verification
- Derived gate list (`dispatch-gates --commands`): 34 families run
locally, 33 exit 0. `pnpm --dir ui exec vitest run scripts/` exited 1 on
one 15 s timeout (`check-vi-mock-inherit.test.ts`, run beside a locked
vitest run); that file alone under the lock: 83/83 passed. `--ran`
reconciliation: 34 derived, 34 run, 0 NOT-MEASURED. `node
scripts/check-sdui-manifest.mjs` exit 0.
- `origin/main` merged (`a7a422a4`); it touched neither
`DraftChangesPanel.tsx` nor `ObjectFormDesigner.tsx`. After rebuilding
the merged ui packages: the two new files, the objectui#11802
announcement suite and both locale parity suites, 69/69 passed;
`@object-ui/app-shell` `type-check` exit 0.
- Full readings are in the report comment on #27516.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01Utp6CZkEeDsL4LuR4hwqTN)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 4d1f52c commit 4278c3b
15 files changed
Lines changed: 524 additions & 45 deletions
File tree
- .changeset
- ui/packages
- app-shell/src
- preview
- __tests__
- views/studio-design
- 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
89 | 94 | | |
90 | 95 | | |
91 | 96 | | |
| |||
313 | 318 | | |
314 | 319 | | |
315 | 320 | | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
316 | 328 | | |
317 | 329 | | |
318 | 330 | | |
| |||
368 | 380 | | |
369 | 381 | | |
370 | 382 | | |
371 | | - | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
372 | 386 | | |
373 | 387 | | |
374 | 388 | | |
| |||
497 | 511 | | |
498 | 512 | | |
499 | 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 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
500 | 558 | | |
501 | 559 | | |
502 | 560 | | |
| |||
592 | 650 | | |
593 | 651 | | |
594 | 652 | | |
595 | | - | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
596 | 656 | | |
597 | 657 | | |
598 | 658 | | |
| |||
987 | 1047 | | |
988 | 1048 | | |
989 | 1049 | | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
990 | 1056 | | |
991 | 1057 | | |
992 | 1058 | | |
| |||
| 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 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
0 commit comments