Repository navigation
fix(studio): a seeded grouped record page heads its ungrouped fields with the translated Other heading - #33470
Conversation
…with the translated Other heading Studio's full-page seed, Convert to full page and the slotted preview wrote the field-group layout's keyless bucket as an untitled section, while the running record page draws it under common.ungroupedSection. The Studio derivation now heads the bucket: a persisted page carries the inline locale map of every shipped catalogue's common.ungroupedSection (the I18nLabel form record:details resolves per viewer), the preview the translated text. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5nV6skFMkjLTEGHKL3
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5nV6skFMkjLTEGHKL3
|
domain:ui#1 · os-project-manager · session_01FEkQ5nWoa1Ze1QzjRTSYXD 席位核对Verdict: ACCEPT · head
|
|
domain:ui#1 · os-project-manager · session_01FEkQ5nWoa1Ze1QzjRTSYXD Landing · head
State: ready + auto-merge. |
… the translated heading (objectstack-ai#33575) <!-- claude-projects-attribution: {"github_login":"os-project-manager"} --> _Requested by **Leehom** · [project thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XPgd8ZZWd9bveFNaYXhzdnR)_ domain:ui#1 · os-project-manager · session_01FEkQ5p26Duousy4rdtkRMB Fixes objectstack-ai#33471 Clause-②: no Metadata-protocol: none Seat `domain:ui#1` · card thread `session_01FEkQ5p26Duousy4rdtkRMB` · claim 6886592905 ## 维护者速读 - 改了什么:Studio 给没有字段分组的对象新建完整记录页(或把默认页「转为完整页面」)时,「More details / 更多详情」分区的标题不再写成英文原文,而是写成每种内置语言各一条的多语言写法(取自语言包 `detail.sectionMoreDetails`),保存后的页面按查看者的语言显示。对象自己语言包里的 `_sections.details.label` 仍然优先。 - 为什么改:运行中的记录页会翻译这个标题,但 Studio 生成的页面把它存成英文字符串,非英文用户打开保存过的页面看到的是 "More details"。objectstack-ai#33470 已为「其他」分区用了同一写法。 - 风险与回滚:只改 Studio 生成页面的方式,不改 spec、不改运行中的记录页、不迁移已保存的页面(它们仍显示英文,对象语言包的覆盖照样生效)。回滚即还原本 PR。 - 先看:`ui/packages/app-shell/src/views/recordDetailSections.ts` 的 `loadPersistedSectionLabels`;`metadata-admin/previews/PagePreview.tsx` 的 `convertToFull`;`metadata-admin/anchors.ts` 的 record 页 `createSeed`。 - 两分钟验证:`pnpm --dir ui exec vitest run packages/app-shell/src/views/recordDetailSections.studioMoreDetailsHeading-33471.test.tsx`,预期 5 条全绿(中文显示「更多详情」,英文显示 "More details",对象语言包的标题优先)。 - 需要你做的:无,席位落地。 ## What changes **Measured first, on `origin/main` (`8e63ed87`).** Studio's create seed (`metadata-admin/anchors.ts`, record page `kind: 'full'`) and `PagePreview.tsx` `convertToFull` passed `MORE_DETAILS_DEFAULT_LABEL` as the `details` section's label, so the saved section was `{ name: 'details', label: 'More details', … }`. The red-first run below draws that saved seed through the real `RecordDetailsRenderer` under `zh-CN`: 「更多详情」 is not on the page (the English text is), while en and an object bundle carrying `_sections.details.label` read correctly. It reproduces. **How `record:details` resolves the heading (the measurement the order asked for).** In `plugin-detail` `record-details.tsx`, a section's `label` is first resolved for the viewer with `pickLocalized(s.label, language)`, and when the section has a `name`, that text is passed as the FALLBACK to `sectionLabel(objectName, s.name, rawTitle ?? s.name)`, which answers `objects.OBJECT._sections.NAME.label` when the bundle has it (`useObjectLabel` `sectionLabel` → `resolve(objectSuffixes(…), fallback)`). So an inline locale map never shadows the per-object override: the override wins over the map exactly as it wins over a string. Leaving `label` unset would not help either: the fallback then becomes the literal section name `details`. ⇒ the form objectstack-ai#33470 chose for the ungrouped bucket fits here too, and this PR uses it. The CONTROL pin below draws the override winning over the map. **The change.** - `recordDetailSections.ts`: `loadPersistedUngroupedHeading` becomes `loadPersistedSectionLabels(objectDef)`, which answers both headings the derivation writes itself, each as the inline locale map of its catalogue key over every catalogue `@object-ui/i18n` ships (`BUILT_IN_LANGUAGE_CODES` + `loadBuiltInLocale`): `moreDetails` from `detail.sectionMoreDetails`, `ungrouped` from `common.ungroupedSection` (unchanged). It loads the catalogues only when the page writes one of them (the object's `fieldGroups` apply, or the flat split yields a `details` section), and otherwise answers the English defaults, which no section reads. One catalogue that fails to load rejects the whole call (`Promise.all`), so no partial map is ever saved (the objectstack-ai#33470 rule). `RecordDetailSectionLabels.moreDetails` widens from `string` to `SectionHeading` (app-shell internal). - `anchors.ts` (create seed) and `PagePreview.tsx` (`convertToFull`) pass `loadPersistedSectionLabels`' answer. "Convert to full page" stays disabled until it has loaded for the current object, as before, and stays unavailable if a catalogue fails. - The running record page (`RecordDetailView`) and the slotted preview still pass the translated text; they are untouched. **What an existing page shows.** No migration. A page saved before this change keeps `label: 'More details'` (a plain string): every viewer reads English, unless the object's bundle carries `_sections.details.label`, which still wins. An author can change the heading in the page designer, or re-create the page. ## Why The running record page translates the "More details" heading for every viewer; a page Studio seeded saved it as English, so the same page read differently once saved. objectstack-ai#33470 settled the persisted form for the sibling "Other" heading; this applies it to the other heading the seed writes itself. ## Tests - **New: `recordDetailSections.studioMoreDetailsHeading-33471.test.tsx`** (5 tests, the real `RecordDetailsRenderer` under `I18nProvider`, as objectstack-ai#33470's pins). - The seed for a flat object with a long-text field writes `details.label` as the map of every shipped catalogue's `detail.sectionMoreDetails` (keys = `BUILT_IN_LANGUAGE_CODES`, `en` "More details", `zh-Hans` 「更多详情」), never a string; firing control: the split yields `[['name','subject'],['notes']]`. - The seeded sections parse under the spec's `RecordDetailsProps`. - Drawn under `zh-CN`: 「更多详情」, no "More details", above the `notes` value. - CONTROL, `en`: "More details". - CONTROL: an object bundle with `_sections.details.label` (「补充信息」) wins over the saved map. - **New leg in `PagePreview.slottedDefault-27054.test.tsx`**: "Convert to full page" on a flat object with a textarea writes the `details` section under the same map, and the converted page passes `validateMetadataDraft('page', …)` and the block props check. - **Adjusted sibling pins** (they asserted the English string this card removes): - `recordDetailSections.studioUngroupedHeading-33377.test.tsx` CONTROL: a flat object's primary section stays unheaded and only its `details` section carries a map; a page that writes neither heading answers the English defaults (it called the removed `loadPersistedUngroupedHeading`). - `recordDetailSections.agreement-12442.test.ts`: the flat seed equals the runtime split with the persisted headings, and `details.label.en` is "More details". <details><summary>Red-first on origin/main sources (the three source files checked out at 8e63ed8, tests at head): 3 failed | 8 passed (11)</summary> ```text × the details section carries the locale map of every shipped catalogue 29ms × zh-CN: the section is headed 更多详情, never the English text, above its field 87ms × writes the details section under the locale map of every shipped catalogue 39ms ⎯⎯⎯⎯⎯⎯⎯ Failed Tests 3 ⎯⎯⎯⎯⎯⎯⎯ AssertionError: expected 'string' to be 'object' // Object.is equality TestingLibraryElementError: Unable to find an element with the text: 更多详情. AssertionError: expected 'string' to be 'object' // Object.is equality Test Files 2 failed (2) Tests 3 failed | 8 passed (11) os-verify-lock: VERDICT command-exit 1 · held the lock 16s · waited 0s · ⚠ SHARED-BOX SECONDS — this lock excluded other LOCKED runs, NOT unlocked sibling work (`check:*` gates and the rest), so these ``` </details> <details><summary>Ablation at head 8ade4c0: the map put back to the English string — 3 failed | 8 passed (11); restored, blob == HEAD</summary> ```text ablation-replace: anchor " return { moreDetails, ungrouped };" x1 (before) ablation-replace: replace " return { moreDetails: MORE_DETAILS_DEFAULT_LABEL, ungrouped };" x0 -> x1 ablation-replace: ok mutation landed: anchor 1 -> 0, blob 01bc7b3 -> 161be10235f8 × the details section carries the locale map of every shipped catalogue 69ms × zh-CN: the section is headed 更多详情, never the English text, above its field 132ms × writes the details section under the locale map of every shipped catalogue 39ms ⎯⎯⎯⎯⎯⎯⎯ Failed Tests 3 ⎯⎯⎯⎯⎯⎯⎯ Test Files 2 failed (2) Tests 3 failed | 8 passed (11) ablation-replace: ok restored: blob == HEAD (01bc7b3) and `git diff HEAD` is empty ``` </details> <details><summary>Touched and sibling files at head 8ade4c0</summary> ```text 8 touched/sibling files (the new pin, objectstack-ai#33377, objectstack-ai#12442, 27054, PagePreview, 27177, anchors.page-seed, 6190): Test Files 8 passed (8) Tests 54 passed (54) os-verify-lock: VERDICT command-exit 0 · held the lock 42s · waited 0s · ⚠ SHARED-BOX SECONDS — this lock excluded other LOCKED runs, NOT unlocked sibling work (`check:*` gates and the rest), so these Every app-shell test file importing recordDetailSections, metadata-admin/anchors or PagePreview (41 files): Test Files 41 passed (41) Tests 370 passed (370) os-verify-lock: VERDICT command-exit 0 · held the lock 219s (3m39s) · waited 0s · ⚠ SHARED-BOX SECONDS — this lock excluded other LOCKED runs, NOT unlocked sibling work (`check:*` gates and the rest), ``` </details> ## Acceptance notes - `@object-ui/app-shell` is private; its dist ships in `@object-ui/console`, so the changeset names both (the objectstack-ai#33470 precedent). `Clause-②: no`: no published API or metadata contract moves; the inline locale map is a form `record:details` `sections[].label` already declares (`I18nLabel`). `Metadata-protocol: none`. - No out-of-scope finding. ## Verification All local readings at head `8ade4c0d` (the PR head). - `pnpm --filter @object-ui/app-shell run type-check` (both `tsc --noEmit` and `tsc -p tsconfig.test.json`), after `pnpm --filter '@object-ui/app-shell^...' build`: exit 0 (`os-verify-lock: VERDICT command-exit 0 · held the lock 145s …`). - `pnpm check:new-line-citations` (ui): `VERDICT new-cross-file-line-citations: 0 new citation(s), enforcement report-only -> exit 0`. - Control-byte / NBSP scan of the added lines: 0 hits. - Derived gate families (`node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack`), each exit code captured before any pipe; reconciliation `✓ dispatch-gates --ran: 36 derived famil(ies) accounted for — 36 run, 0 NOT-MEASURED (a DERIVED zero — all 36 recorded an exit code and none of them is 3).` <details><summary>36 derived families, all exit 0</summary> ```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: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 ``` </details> Every family CI runs (the full Test UI shards, lint, the artifact roster) is read off this PR's check-runs; nothing there is re-run locally. ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. (No `packages/spec` change.) - [x] 2. Every name I added uses the casing for its kind. - [x] 3. No formatter ran; `pnpm lint` is CI's run. - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. - [x] 6. `packages/spec` touched: n/a. - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English (the 维护者速读 block is the seat channel's Chinese). --- _Generated by [Claude Code](https://claude.ai/code/session_01FEkQ5p26Duousy4rdtkRMB)_ Co-authored-by: Claude <noreply@anthropic.com>
Requested by Leehom · project thread
Fixes #33377
Clause-②: no
Metadata-protocol: none
Seat
domain:ui#1· os-project-manager · card threadsession_01FEkQ5nV6skFMkjLTEGHKL3· claim 6884066738维护者速读
deriveStudioDetailSections给分组对象的未分组段加标题,loadPersistedUngroupedHeading生成多语言标题)、ui/packages/app-shell/src/views/metadata-admin/previews/PagePreview.tsx(「转为完整页面」等多语言标题加载好才可用)、ui/packages/app-shell/src/views/metadata-admin/anchors.ts(新建完整页的种子)。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 #33372 the running record page draws it under the translatedcommon.ungroupedSectionheading. Studio's three page builders did not:full(anchors.tscreateSeed){ columns, fields }, no heading{ label, columns, fields },labelthe inline locale mapPagePreview.tsxconvertToFull)PagePreview.tsxrenderSchema)record:detailssections[].labelis anI18nLabel, a plain string or an inline locale map;nameaddresses only the per-objectobjects.OBJECT._sections.NAME.labelbundle key, and no section form reaches a shell key such ascommon.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, andrecord:detailsalready resolves it per viewer withpickLocalized. So a persisted page writeslabelas the map ofcommon.ungroupedSectionfrom every catalogue@object-ui/i18nships, 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'slabeldescribe says an omitted label is "an untitled, borderless section", so that would be the renderer overriding a declaration.recordDetailSections.ts:deriveStudioDetailSectionsno longer returnsundefinedfor a grouped object. It returns the synthesizer's own sections (resolveDetailSections:{ group, columns }per group, then the enumerated bucket) with the bucket headed bylabels.ungrouped. NewloadPersistedUngroupedHeading(objectDef)builds the map throughloadBuiltInLocale, 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.ungroupedwidens fromstringtoSectionHeading(stringor a locale map).anchors.ts: the full-page seed passes the loaded map.PagePreview.tsx: the preview passest('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.content/docs/ui/field-grouping-and-order.mdxnames the Studio-seeded page among the surfaces that draw the heading (the fix(console): the ungrouped field-group bucket renders under its own "Other" heading #33372 contract review's nit)..changeset/33377-studio-seed-ungrouped-heading.md:@object-ui/app-shelland@object-ui/consolepatch. app-shell is private, and console'sdistships it.Tests
recordDetailSections.studioUngroupedHeading-33377.test.tsx:label, the label is an object with exactly the shipped language codes, each equal to that catalogue'scommon.ungroupedSection; the sections parse underRecordDetailsProps;RecordDetailsRendererunderI18nProvider: the saved seed draws "Other" inenand 「其他」 inzh-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 passesvalidateMetadataDraftand every block'sComponentPropsMaprow.recordDetailSections.agreement-12442.test.ts(seed equalled the bare synthesizer output; now every section equals it except the bucket's addedlabel) and inPagePreview.test.tsx(preview equalled the bare synthesizer; now the bucket carries "Other").scripts/ablation-replace.mjson 1b987ec (@object-ui/*resolves tosrcthrough the vitest aliases, so no rebuild), each restored with the blob equal to HEAD andgit diff HEADempty: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);enrendered row stays green, as it should: a plain "Other" reads right in English only.Acceptance notes
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.buildDefaultPageSchemain@object-ui/plugin-detailis unchanged. ItsfieldGroupSectionReferencesstill 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. SoClause-②: 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 onesections[].labelalready accepts.common.ungroupedSectiondoes not reach pages already saved, and a language the platform adds later falls back toenon those pages (pickLocalized'senlimb). The running page, which translates live, is unaffected.MORE_DETAILS_DEFAULT_LABEL) as a plain English string undername: '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 throughdetail.sectionMoreDetails. Read on the code, not driven live.Verification
Local gates, type-check and suites (head 8acd49d)
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderives 68 families. All 68 ran on 1b987ec and exited 0 exceptcheck:test-source-alias(exit 1: the edited convert-to-full test reaches@objectstack/lintthroughclientValidationand lacked the module-top import). 8acd49d adds it; on 8acd49dcheck: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,tier-file-adoption) exit 0.--ranreconciliation: 68 derived, 68 run, 0 NOT-MEASURED, 0 UNRUN.pnpm --filter @object-ui/app-shell run type-check(tsc --noEmitandtsconfig.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*, twoResourceEditPageseed 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.pnpm --dir ui check:new-line-citations: 0 new.Generated by Claude Code