Repository navigation
fix(console): the ungrouped field-group bucket renders under its own "Other" heading - #33372
Conversation
…le Other Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5pwmYtS4CYXMQVCxqT
…m arm Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5pwmYtS4CYXMQVCxqT
…'s Other Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5pwmYtS4CYXMQVCxqT
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5pwmYtS4CYXMQVCxqT
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5pwmYtS4CYXMQVCxqT
|
domain:ui#1 · os-project-manager · session_01FEkQ5nWoa1Ze1QzjRTSYXD Contract reviewServed-tier: Face: declaration ( ① Derived judgments
② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS |
…e to the surfaces that draw it Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5pwmYtS4CYXMQVCxqT
|
domain:ui#1 · os-project-manager · session_01FEkQ5nWoa1Ze1QzjRTSYXD Regen-provenance: 6881926857 · |
|
domain:ui#1 · os-project-manager · session_01FEkQ5nWoa1Ze1QzjRTSYXD 席位核对Verdict: ACCEPT · head
|
|
domain:ui#1 · os-project-manager · session_01FEkQ5nWoa1Ze1QzjRTSYXD Regen-provenance: 6881926857 · |
|
domain:ui#1 · os-project-manager · session_01FEkQ5nWoa1Ze1QzjRTSYXD Landing · head
State: ready + auto-merge. |
…with the translated Other heading (objectstack-ai#33470) <!-- claude-projects-attribution: {"github_login":"os-project-manager"} --> _Requested by **Leehom** · [project thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XCWSFQ2r7bCtNXPUwu3o3ns)_ Fixes objectstack-ai#33377 Clause-②: no Metadata-protocol: none Seat `domain:ui#1` · os-project-manager · card thread `session_01FEkQ5nV6skFMkjLTEGHKL3` · claim 6884066738 ## 维护者速读 - 改了什么:在 Studio 里给声明了字段分组的对象新建完整记录页(或把默认页「转为完整页面」)时,未归入任何分组的字段现在写成带标题的分区,标题是「其他 / Other」的多语言写法(每种内置语言一条),保存后的页面按查看者的语言显示;默认页的预览也显示同样的标题。分组本身的写法不变。 - 为什么改:objectstack-ai#33229 之后运行中的记录页已把这些字段放在「其他」标题下,但 Studio 生成的页面仍写成无标题分区,保存后这些字段又看起来属于上一个分组(objectstack-ai#33229 的症状回来了)。 - 风险与回滚:只改 Studio 生成和预览页面的方式,不改 spec、不改运行中的记录页、不改已保存的页面(不迁移)。标题用的是 spec 已允许的内联多语言写法,没有写死英文。回滚即还原本 PR。 - 先看:ui/packages/app-shell/src/views/recordDetailSections.ts(`deriveStudioDetailSections` 给分组对象的未分组段加标题,`loadPersistedUngroupedHeading` 生成多语言标题)、ui/packages/app-shell/src/views/metadata-admin/previews/PagePreview.tsx(「转为完整页面」等多语言标题加载好才可用)、ui/packages/app-shell/src/views/metadata-admin/anchors.ts(新建完整页的种子)。 - 两分钟验证:pnpm dev,在 Studio 给一个有 fieldGroups 且有未分组字段的对象新建 kind 为 full 的记录页并保存,切到中文打开一条记录:未分组字段在「其他」标题下,而不是挂在上一个分组下面。 - 需要你做的:无,席位落地。 ## What changes `deriveFieldGroupLayout` (`@objectstack/spec/data`, ADR-0085 §5) ends a grouped layout with a keyless bucket of the fields no declared group claims. Since objectstack-ai#33372 the running record page draws it under the translated `common.ungroupedSection` heading. Studio's three page builders did not: | Surface | Before | After | |---|---|---| | Create page, kind `full` (`anchors.ts` `createSeed`) | bucket written `{ columns, fields }`, no heading | `{ label, columns, fields }`, `label` the inline locale map | | Convert to full page (`PagePreview.tsx` `convertToFull`) | same as the seed | same as the seed | | Slotted page preview (`PagePreview.tsx` `renderSchema`) | bucket drawn untitled | headed with the translated text the running page draws | - **The form of the persisted heading.** Measured on the spec before choosing: `record:details` `sections[].label` is an `I18nLabel`, a plain string or an inline locale map; `name` addresses only the per-object `objects.OBJECT._sections.NAME.label` bundle key, and no section form reaches a shell key such as `common.ungroupedSection`. A plain string would render one language for every viewer (the order bars a literal "Other"). The inline locale map is the declared translated form, and `record:details` already resolves it per viewer with `pickLocalized`. So a persisted page writes `label` as the map of `common.ungroupedSection` from every catalogue `@object-ui/i18n` ships, keyed by its tag (`en` "Other", `zh-Hans` 「其他」, `zh-Hant`, `ja`, `ko`, `de`, `fr`, `es`, `pt-BR`, `ru`, `ar`). A renderer rule that heads an untitled trailing section was rejected: the spec's `label` describe says an omitted label is "an untitled, borderless section", so that would be the renderer overriding a declaration. - **`recordDetailSections.ts`**: `deriveStudioDetailSections` no longer returns `undefined` for a grouped object. It returns the synthesizer's own sections (`resolveDetailSections`: `{ group, columns }` per group, then the enumerated bucket) with the bucket headed by `labels.ungrouped`. New `loadPersistedUngroupedHeading(objectDef)` builds the map through `loadBuiltInLocale`, and only when the object's field groups apply, so a flat object fetches no catalogue. A catalogue that fails to load rejects the call rather than saving a partial map. `RecordDetailSectionLabels.ungrouped` widens from `string` to `SectionHeading` (`string` or a locale map). - **`anchors.ts`**: the full-page seed passes the loaded map. **`PagePreview.tsx`**: the preview passes `t('common.ungroupedSection', 'Other')` (now a memo dependency); "Convert to full page" loads the map for the schema on screen and is enabled once it is in, as it already waited for the schema. - **Docs**: `content/docs/ui/field-grouping-and-order.mdx` names the Studio-seeded page among the surfaces that draw the heading (the objectstack-ai#33372 contract review's nit). - **Changeset** `.changeset/33377-studio-seed-ungrouped-heading.md`: `@object-ui/app-shell` and `@object-ui/console` patch. app-shell is private, and console's `dist` ships it. ## Tests - New `recordDetailSections.studioUngroupedHeading-33377.test.tsx`: - the full seed for a grouped object: the group reference equals the synthesizer's, the bucket equals the synthesizer's plus `label`, the label is an object with exactly the shipped language codes, each equal to that catalogue's `common.ungroupedSection`; the sections parse under `RecordDetailsProps`; - CONTROL: a flat object seeds a primary section with no heading, no section carries a locale map, and the loader answers the English default; - rendered through the real `RecordDetailsRenderer` under `I18nProvider`: the saved seed draws "Other" in `en` and 「其他」 in `zh-CN` (and not the other language), after the group heading and above the ungrouped field's value; the preview's sections draw 「其他」 the same way. - `PagePreview.slottedDefault-27054.test.tsx`, new describe: Convert to full page on a grouped object writes the group reference unheaded and the bucket under the full map, and the written page passes `validateMetadataDraft` and every block's `ComponentPropsMap` row. - Rewritten, because they pinned the defect: the grouped CONTROL in `recordDetailSections.agreement-12442.test.ts` (seed equalled the bare synthesizer output; now every section equals it except the bucket's added `label`) and in `PagePreview.test.tsx` (preview equalled the bare synthesizer; now the bucket carries "Other"). - Ablations, one-off through `scripts/ablation-replace.mjs` on 1b987ec (`@object-ui/*` resolves to `src` through the vitest aliases, so no rebuild), each restored with the blob equal to HEAD and `git diff HEAD` empty: - the bucket heading dropped in `deriveStudioDetailSections`: 7 failed / 20 passed over the 4 files (the seed, both rendered seed rows, the rendered preview row, convert-to-full, the preview node, the 12442 grouped row); - the loader answering the plain English default for every object: 3 failed / 24 passed (the seed's map row, the zh-CN rendered seed row, convert-to-full). The `en` rendered row stays green, as it should: a plain "Other" reads right in English only. ## Acceptance notes - **Pages already saved are not migrated.** A full page Studio seeded or converted before this change keeps its untitled bucket and keeps drawing those fields under the last group, as it does today. Its author can give that section a heading in the page designer (`label`, a string or a per-locale value). A slotted page was never affected at runtime: the running app synthesizes it with the record page's own sections, which already carry the heading; only its preview was wrong, and that is fixed here. - **`buildDefaultPageSchema` in `@object-ui/plugin-detail` is unchanged.** Its `fieldGroupSectionReferences` still writes the bucket untitled for a caller that passes no sections. It has no heading to give (no translator, and a published API), and the only callers that persist it are the Studio ones above, which now pass their sections. So `Clause-②: no`: no exported type or output of a published package changes; app-shell is private. `Metadata-protocol: none`: no spec edit, and the written value is one `sections[].label` already accepts. - **Measured trade-off of the map**: the saved page holds a copy of the catalogue text as of the save. A later rewording of `common.ungroupedSection` does not reach pages already saved, and a language the platform adds later falls back to `en` on those pages (`pickLocalized`'s `en` limb). The running page, which translates live, is unaffected. - Out of scope, noted for the seat: the same seed persists "More details" (`MORE_DETAILS_DEFAULT_LABEL`) as a plain English string under `name: 'details'`, so on a saved seeded page of an object with no field groups that heading is English for a viewer whose object bundle has no `_sections.details.label`, while the running page translates it through `detail.sectionMoreDetails`. Read on the code, not driven live. ## Verification <details><summary>Local gates, type-check and suites (head 8acd49d)</summary> - `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` derives 68 families. All 68 ran on 1b987ec and exited 0 except `check:test-source-alias` (exit 1: the edited convert-to-full test reaches `@objectstack/lint` through `clientValidation` and lacked the module-top import). 8acd49d adds it; on 8acd49d `check:test-source-alias` and the other test-reading families (`cross-package-test-inputs`, `query-options-erasure`, `undeclared-dep-imports`, `nul-bytes`, `where-matcher`, `engine-double-contract`, `driver-memory-census`, `refd-timer-probe`, `registry-log-declared`, `rest-log-spy-declared`, `watch-hint-literal`, `type-check-coverage`, `tier-file-adoption`) exit 0. `--ran` reconciliation: 68 derived, 68 run, 0 NOT-MEASURED, 0 UNRUN. - `pnpm --filter @object-ui/app-shell run type-check` (`tsc --noEmit` and `tsconfig.test.json`): exit 0 on 8acd49d. - `pnpm --dir ui exec vitest run`, app-shell narrowed to the record view and the Studio callers (`views/recordDetailSections*`, `views/RecordDetailView*`, `metadata-admin/previews/PagePreview*`, `metadata-admin/anchors*`, two `ResourceEditPage` seed files): 109 files, 777 passed on 1b987ec; the convert-to-full file re-run on 8acd49d: 5 passed. The rest of app-shell is CI's sharded Test UI. - eslint on the touched files: 0 errors. `pnpm --dir ui check:new-line-citations`: 0 new. </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01FEkQ5nV6skFMkjLTEGHKL3)_ --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: objectstack-fleet[bot] <332303061+objectstack-fleet[bot]@users.noreply.github.com>
Requested by Leehom · project thread
Fixes #33229
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
common.ungroupedSection(11 种语言)。回滚即还原本 PR。deriveFieldGroupSections第三参数、ui/packages/plugin-form/src/ungroupedFieldSection-11777.test.tsx(原 objectui#11777 断言改为读「字段上方的标题」)。What changes
deriveFieldGroupLayout(@objectstack/spec/data, ADR-0085 §5) ends a grouped layout with a keyless bucket of every visible field no declared group claims. It returnsnullwhen no declared group applies, so the bucket only ever follows at least one declared group. The spec keeps it keyless; the Console now owns a presentation default for it.RecordDetailView, which the drawer and the split pane embed):deriveRecordDetailSectionsheads the bucket's primary section with the newlabels.ungrouped(the view passest('common.ungroupedSection', 'Other')) and gives it the card chrome the declared groups have. Long-form ungrouped fields still go to "More details" after it. Nonameis set, sorecord:detailsshows the translated label as written and no per-object_sectionskey is invented.ObjectForm,ModalForm,DrawerForm, each on its no-sections field-group fallback):deriveFieldGroupSections(fields, fieldGroups, ungroupedLabel?)labels the trailing bucket, including the case where it is only the re-appended rendered system fields. Each arm passes its translatedcommon.ungroupedSection, so the one row rule draws a divider row for it and the bucket is a titled section like the groups. It has no collapse control.common.ungroupedSectionadded ("Other", 「其他」, 「其他」 zh-Hant viagen:zh-hant, "Sonstiges", "Otros", "Autres", "その他", "기타", "Outros", "Прочее", "أخرى"). Nothing reworded or removed. Measured before adding: no existing key says exactly this. The "Other" keys in the tree are each scoped to another surface (capability.group.other,console.reportIndex.otherSection, a marketplace category, an artifact kind).anchors.tspage-create seed,PagePreview.tsx) pass the new label too (UNGROUPED_SECTION_DEFAULT_LABEL/ the translated key). They only reachderiveRecordDetailSectionswhen no field groups apply, so what they write and draw is unchanged.content/docs/ui/create-vs-edit-form.mdxandcontent/docs/ui/field-grouping-and-order.mdxsay the bucket is drawn under its own "Other" heading. Comments that called the derived bucket "untitled, no row" (fieldGroups.ts,ObjectForm.tsx,@object-ui/componentssplitAtUntitledRuns) now describe the authored untitled section that path still serves..changeset/33229-ungrouped-section-heading.md(@object-ui/i18n,@object-ui/plugin-form: patch).@object-ui/app-shellis private; the@object-ui/componentsedit is comment-only.Tests
RecordDetailView.sectionHeadingsRenderPath-6190.test.tsx, new top-level describe on the existing mounted-RecordDetailViewharness (no assigned page, the synthesized page): with the last declared groupcollapse: 'collapsed', "Other" is on screen, the collapsed member is folded away, the ungrouped field is on screen, and the smallest block holding "Other" and the ungrouped field does not hold the collapsed group's heading; reading order is groups, "Other", its field, then "More details". zh-CN under a realI18nProviderreads 「其他」 and no "Other". CONTROL: an object with no field groups renders no "Other".ungroupedFieldSection-11777.test.tsx, new top-level describe run on all three arms (ObjectForm,ModalForm,DrawerForm): under a collapsed group the bucket's fields sit under their own "Other" row, which follows the group's row and carries no disclosure control; zh-CN reads 「其他」; CONTROL: no declared group applies, no heading; CONTROL: an authored untitled section stays headerless.scripts/ablation-replace.mjs, restored blob equal to HEAD each time;@object-ui/*resolves tosrcthrough the vitest aliases, so no rebuild):{ ...primary, label: labels.ungrouped, showBorder: true }→ no label): 2 failed / 5 passed (the collapsed-group and zh-CN rows; the CONTROL stays green).deriveFieldGroupSections: 12 failed / 18 passed (the two rewritten objectui#11777 rows and the two new heading rows, on each of the three arms; the controls stay green).Acceptance notes
splitAtUntitledRunssplit of an untitled run). The bucket is now a titled section, and the form renderer draws titled sections in one grid separated by their divider rows, as it draws any two groups. So those rows now read "the heading above each ungrouped field is Other, not the group's". The untitled split itself stays pinned by the file's authored-untitled-section row, which is unchanged and green.PagePreview.test.tsxandPagePreview.authoredDetailsValues-27177.test.tsxchanged only their label argument, andcheck:test-source-aliasthen asked each for the module-topimport '@objectstack/lint';its siblings carry. Two older heading-list pins whose fixtures leave a field ungrouped now expect the bucket's row after the group's on the derived arms:sectionDividerProjection-9849.test.tsx(blocks 1, 2 and 4, via atrailingentry on the three DERIVED arms) anddrawerFormSectionDescription-9834.test.tsxrow 3.{ group }references plus an enumerated untitled bucket (fieldGroupSectionReferencesin@object-ui/plugin-detail, left so by the earlier page-seed cards). That is an authored page once saved, and its author owns the section's label. Labelling the persisted seed would change what Studio writes, which is outside this card's renderer-only route. The Studio object form designer and canvas keep their own authoring label "Ungrouped".RecordDetailDrawer(inline-edit drawer in@object-ui/plugin-detail) does not readfieldGroups. Arecord:detailsnode an author writes with an untitled section keeps it untitled.Clause-②: yes (widening), measured on the diff: one added catalogue key in the published@object-ui/i18n.deriveFieldGroupSectionsis not exported from the@object-ui/plugin-formentry, so its new optional parameter widens no public surface; that package changes only what its arms draw. Nothing removed or renamed. Nopackages/specedit and no new authorable key, per the order's route.Verification
Local gates, suites and type-checks (head bfbc379)
dispatch-gates --commandson this diff derives 70 families. All 70 ran on f52c0a1 and exited 0, exceptcheck:test-source-alias(exit 1: the two PagePreview tests above). The fix landed as bfbc379; on that headcheck:test-source-aliasand the other test-reading families (cross-package-test-inputs,query-options-erasure,undeclared-dep-imports,nul-bytes,where-matcher,engine-double-contract,driver-memory-census,refd-timer-probe,registry-log-declared,rest-log-spy-declared,watch-hint-literal,type-check-coverage) exit 0.--ranreconciliation: 70 derived, 70 run, 0 NOT-MEASURED, 0 UNRUN.check:skill-examplesexited 3 on the first round (stale@objectstack/client-reactdist, nothing measured); after building that package it exits 0.type-check=tsc --noEmit+tsconfig.test.json):@object-ui/i18n,@object-ui/plugin-form,@object-ui/app-shell,@object-ui/componentsexit 0 (plugin-form re-run on f52c0a1).pnpm --dir ui exec vitest run:packages/plugin-form/231 files, 2555 passed, 1 skipped (f52c0a1);packages/i18n/102 files, 1894 passed, 13 skipped; app-shell narrowed to the record view and the Studio callers (views/RecordDetailView*,views/recordDetailSections*,metadata-admin/previews/PagePreview*,metadata-admin/anchors*) 106 files, 764 passed. The rest of app-shell is CI's sharded Test UI. The two PagePreview files re-run on bfbc379: 10 passed.node scripts/gen-sdui-manifest-node.mjsrewrote nothing..ts/.tsxfiles: 0 errors.Generated by Claude Code