From edfd9eff82b0873a61ea45100de6606815613c72 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 06:23:30 +0000 Subject: [PATCH 1/7] feat(studio): the Field layout tab arranges an installed object's field groups into its .custom pair (WIP) Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01WGufzhpykmQZe1yMupC2CU --- ...uiltinDesigners.lateArrival-11939.test.tsx | 2 +- .../previews/object-fields-io.ts | 62 ++++++++ .../views/objectExtensionArrangementSave.ts | 10 +- .../DataPillar.authorRefusal-11785.test.tsx | 4 +- .../studio-design/DataPillar.celGate.test.tsx | 2 +- ...Pillar.choiceWithoutOptions-11253.test.tsx | 4 +- ...aPillar.designerRegistryPopulated.test.tsx | 2 +- ...ataPillar.destructiveChange-34931.test.tsx | 2 +- ...ataPillar.draftOnlyNoLayers-12508.test.tsx | 4 +- .../DataPillar.draftSavedNamed-28984.test.tsx | 6 +- ...DataPillar.formDraftPreview-12515.test.tsx | 2 +- .../DataPillar.heldIncomplete-11786.test.tsx | 6 +- ...taPillar.hiddenSystemFields-11780.test.tsx | 6 +- .../DataPillar.layoutBadge.test.tsx | 2 +- ...DataPillar.layoutSaveCancel-36511.test.tsx | 2 +- .../DataPillar.panelGate.test.tsx | 2 +- .../DataPillar.panelHold-27629.test.tsx | 2 +- .../DataPillar.saveCancel-36511.test.tsx | 2 +- .../DataPillar.summaryHeld-27461.test.tsx | 2 +- ...illar.validationVerdictHold-27644.test.tsx | 2 +- .../studio-design/ObjectFormDesigner.tsx | 141 ++++++++++++++---- .../studio-design/StudioCustomizeControls.tsx | 73 ++++++++- ...gnSurface.designerRegistryMissing.test.tsx | 2 +- ...urface.draftVersionConflict-11773.test.tsx | 2 +- .../StudioDesignSurface.formFields.test.tsx | 2 +- ...esignSurface.heldDataCreate-26845.test.tsx | 2 +- ...DesignSurface.heldDataLeave-26705.test.tsx | 2 +- ...ignSurface.lateRegistration-11939.test.tsx | 2 +- ...StudioDesignSurface.saveBar-36511.test.tsx | 2 +- .../studio-design/StudioDesignSurface.tsx | 104 ++++++++++--- .../views/studio-design/fieldLayoutSources.ts | 43 ++++++ ui/packages/i18n/src/namespaces/studio/en.ts | 17 ++- ui/packages/i18n/src/namespaces/studio/zh.ts | 10 +- 33 files changed, 436 insertions(+), 92 deletions(-) create mode 100644 ui/packages/app-shell/src/views/studio-design/fieldLayoutSources.ts diff --git a/ui/packages/app-shell/src/views/metadata-admin/__tests__/builtinDesigners.lateArrival-11939.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/__tests__/builtinDesigners.lateArrival-11939.test.tsx index d3153e1d201..e48f39042d6 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/__tests__/builtinDesigners.lateArrival-11939.test.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/__tests__/builtinDesigners.lateArrival-11939.test.tsx @@ -93,7 +93,7 @@ describe('Data pillar field rail — the built-in designers arrive after it rend , ); - fireEvent.click(await screen.findByRole('button', { name: 'Form' })); + fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); const card = (await screen.findByText('Title')).closest('.cursor-grab') as HTMLElement; expect(card).toBeTruthy(); fireEvent.click(card); diff --git a/ui/packages/app-shell/src/views/metadata-admin/previews/object-fields-io.ts b/ui/packages/app-shell/src/views/metadata-admin/previews/object-fields-io.ts index 3fa5a305823..7d646795841 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/previews/object-fields-io.ts +++ b/ui/packages/app-shell/src/views/metadata-admin/previews/object-fields-io.ts @@ -465,6 +465,68 @@ export function writeGroupLayout( }; } +/** A group standing for a related list's table (objectstack#27069): it holds no fields. */ +function isTableGroup(group: ObjectFieldGroup): boolean { + return typeof (group as { relatedList?: unknown }).relatedList === 'string'; +} + +/** + * objectstack#36505 — the grouping in the spelling `fieldGroups[].fields` + * keeps (objectstack#35900), membership and display order unchanged: each + * group lists its members in its own `fields` (a list it already has is kept + * as written, and the fields its older `group` spelling adds are appended, + * after the listed ones, which is where {@link groupMembership} shows them), + * and every field's `group` naming a declared group is dropped, since the list + * now holds it. A `group` naming no declared group says nothing and is kept. + * A related-table group holds no fields and is left as it is. + * + * The Field layout designer writes through this, so an object written in the + * older spelling converts on its first save, and what the canvas shows does + * not move. `changed` is false when the object already uses the lists alone. + */ +export function groupListLayout( + view: FieldsView, + groups: ObjectFieldGroup[], +): { view: FieldsView; groups: ObjectFieldGroup[]; changed: boolean } { + const membership = groupMembership(view, groups); + let changed = false; + const declared = new Set(); + const nextGroups = groups.map((g) => { + if (isTableGroup(g)) return g; + declared.add(g.key); + const own = (g as { fields?: unknown }).fields; + const listed = Array.isArray(own) ? own.filter((n): n is string => typeof n === 'string') : []; + const extra = (membership.members.get(g.key) ?? []).filter((n) => !listed.includes(n)); + if (Array.isArray(own) && extra.length === 0) return g; + changed = true; + return { ...g, fields: [...listed, ...extra] } as ObjectFieldGroup; + }); + const entries = view.entries.map((e) => { + if (typeof e.def.group !== 'string' || !declared.has(e.def.group)) return e; + changed = true; + const def = { ...e.def }; + delete def.group; + return { name: e.name, def }; + }); + return changed ? { view: { shape: view.shape, entries }, groups: nextGroups, changed } : { view, groups, changed }; +} + +/** + * objectstack#36505 (ADR-0146 D10) — the whole field arrangement an installed + * object's paired `.custom` extension writes (`ObjectExtensionSchema.fieldGroups`, + * the objectstack#36498 shape): every group, in order, each listing its members + * in display order ({@link groupMembership}), a related-table group as it is. + * Every group lists its `fields`, so the arrangement shows exactly what it + * lists: the older `group` spelling is never left to place a field in it. A + * field no group lists shows after the last group. + */ +export function groupArrangement(view: FieldsView, groups: ObjectFieldGroup[]): ObjectFieldGroup[] { + const membership = groupMembership(view, groups); + return groups.map((g) => + isTableGroup(g) ? g : ({ ...g, fields: [...(membership.members.get(g.key) ?? [])] } as ObjectFieldGroup), + ); +} + /** * The current grouped layout as {@link writeGroupLayout} takes it: every * declared group's members and the ungrouped bucket, in display order, over the diff --git a/ui/packages/app-shell/src/views/objectExtensionArrangementSave.ts b/ui/packages/app-shell/src/views/objectExtensionArrangementSave.ts index 674bff23c2c..791a31f86db 100644 --- a/ui/packages/app-shell/src/views/objectExtensionArrangementSave.ts +++ b/ui/packages/app-shell/src/views/objectExtensionArrangementSave.ts @@ -10,8 +10,14 @@ * Every arrangement editor of an installed object is a caller of this one * writer, never a second writer: the record page's 「Configure tabs」 hands it * `relatedLists` (objectstack#36499); the design mode's 「Header buttons」 - * hands it `actionLayout` (objectstack#36366); a field-layout editor hands it - * `fieldGroups` the same way. + * hands it `actionLayout` (objectstack#36366). One editor composes with + * {@link extensionWithArrangement} instead of calling the save: Studio's + * 「字段布局」 tab (objectstack#36505) edits `fieldGroups` inside the Data + * pillar's buffer of this same extension document, which already holds the + * object's `__c` fields and field patches and is saved, pinned and published + * by the pillar's extension Save. A save of its own would be a second writer + * of that buffered document: refused while the buffer's draft is pending, and + * overwritten by the buffer's next save once it lands. * * - Where: the pair the ensure door answers for the object's package * (`ensureCustomizationPackage`, which creates it on first use and names diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.authorRefusal-11785.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.authorRefusal-11785.test.tsx index ccc172a6c43..dbda5d759bc 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.authorRefusal-11785.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.authorRefusal-11785.test.tsx @@ -107,7 +107,7 @@ describe('Studio data page — a held Picklist reads as a sentence (objectui#117 , ); - fireEvent.click(await screen.findByRole('button', { name: 'Form' })); + fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); await addFieldFromFormToolbar(); await screen.findByText('Type', { selector: 'label' }, { timeout: 4000 }); const apiName = (controlUnder('API name') as HTMLInputElement).value; @@ -141,7 +141,7 @@ describe('Studio data page — a held Picklist reads as a sentence (objectui#117 , ); - fireEvent.click(await screen.findByRole('button', { name: 'Form' })); + fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); await addFieldFromFormToolbar(); await screen.findByText('Type', { selector: 'label' }, { timeout: 4000 }); const apiName = (controlUnder('API name') as HTMLInputElement).value; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.celGate.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.celGate.test.tsx index e6c6834660e..e38670b10fc 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.celGate.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.celGate.test.tsx @@ -161,7 +161,7 @@ async function openFormulaField() { , ); - fireEvent.click(await screen.findByRole('button', { name: 'Form' })); + fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); const card = (await screen.findByText('Total')).closest('.cursor-grab') as HTMLElement; fireEvent.click(card); const label = await screen.findByText('Formula (CEL)'); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.choiceWithoutOptions-11253.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.choiceWithoutOptions-11253.test.tsx index 0afeb6449c8..420b96791de 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.choiceWithoutOptions-11253.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.choiceWithoutOptions-11253.test.tsx @@ -157,7 +157,7 @@ async function addFieldAndType(typeLabel: RegExp): Promise { , ); - fireEvent.click(await screen.findByRole('button', { name: 'Form' })); + fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); await addFieldFromFormToolbar(); await screen.findByText('Type', { selector: 'label' }, { timeout: 4000 }); const fieldName = (controlUnder('API name') as HTMLInputElement).value; @@ -210,7 +210,7 @@ describe('Studio data page — an object that already stores an empty select (ob , ); - fireEvent.click(await screen.findByRole('button', { name: 'Form' })); + fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); // The unrelated edit: rename the text field's label. await selectCard('Title'); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.designerRegistryPopulated.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.designerRegistryPopulated.test.tsx index 6be440272bb..6e3f91e71a2 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.designerRegistryPopulated.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.designerRegistryPopulated.test.tsx @@ -169,7 +169,7 @@ describe('Data pillar consumers with the registries POPULATED (#6846 contrast)', assertRegistriesPopulated(); renderPillar(); - fireEvent.click(await screen.findByRole('button', { name: 'Form' })); + fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); const card = (await screen.findByText('Title')).closest('.cursor-grab') as HTMLElement; expect(card).toBeTruthy(); fireEvent.click(card); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.destructiveChange-34931.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.destructiveChange-34931.test.tsx index c51c9389317..0c04be2f90a 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.destructiveChange-34931.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.destructiveChange-34931.test.tsx @@ -108,7 +108,7 @@ async function removePlace(first: Response) { , ); - fireEvent.click(await screen.findByRole('button', { name: 'Form' })); + fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); fireEvent.click((await screen.findByText('Place')).closest('.cursor-grab') as HTMLElement); fireEvent.click(await screen.findByRole('button', { name: 'Remove “Place”' })); fireEvent.click(within(await screen.findByRole('alertdialog')).getByTestId('field-remove-confirm-action')); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.draftOnlyNoLayers-12508.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.draftOnlyNoLayers-12508.test.tsx index fe52af3607f..83bbbd6284a 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.draftOnlyNoLayers-12508.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.draftOnlyNoLayers-12508.test.tsx @@ -139,7 +139,7 @@ describe('DataPillar — a draft-only object logs no failed read (objectui#12508 expect(reads('st_ticket', ''), 'the draft read never ran: the harness is dead').toEqual([200]); expect(reads('st_ticket', '/layers')).toEqual([200]); expect(server.requests.filter((r) => r.status >= 400)).toEqual([]); - fireEvent.click(await screen.findByRole('button', { name: 'Form' })); + fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); expect(await screen.findByText('Subject')).toBeInTheDocument(); }); @@ -156,7 +156,7 @@ describe('DataPillar — a draft-only object logs no failed read (objectui#12508 await openPillar(); expect(reads('st_case', '/layers')).toEqual([200]); - fireEvent.click(await screen.findByRole('button', { name: 'Form' })); + fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); expect(await screen.findByText('Title')).toBeInTheDocument(); }); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.draftSavedNamed-28984.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.draftSavedNamed-28984.test.tsx index 614508351a6..eeb699da788 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.draftSavedNamed-28984.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.draftSavedNamed-28984.test.tsx @@ -143,7 +143,7 @@ describe('Studio Data pillar — a landed Save names what it saved (objectstack# it('a landed save toasts the object by its label', async () => { const success = vi.spyOn(toast, 'success'); mount(); - fireEvent.click(await screen.findByRole('button', { name: 'Form' })); + fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); await addFieldFromFormToolbar(); await pressStudioSave(); expect(puts.some((u) => u.includes('mode=draft')), `PUTs: ${puts.join(' | ')}`).toBe(true); @@ -157,7 +157,7 @@ describe('Studio Data pillar — a landed Save names what it saved (objectstack# server.refuse = true; const success = vi.spyOn(toast, 'success'); mount(); - fireEvent.click(await screen.findByRole('button', { name: 'Form' })); + fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); await addFieldFromFormToolbar(); await pressStudioSave(); await screen.findByTestId('studio-refusal', undefined, { timeout: 5000 }); @@ -170,7 +170,7 @@ describe('Studio Data pillar — a landed Save names what it saved (objectstack# it('saving one object again keeps one toast on screen, under one id', async () => { const success = vi.spyOn(toast, 'success'); mount(); - fireEvent.click(await screen.findByRole('button', { name: 'Form' })); + fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); await addFieldFromFormToolbar(); await screen.findByText('Label', { selector: 'label' }, { timeout: 4000 }); await pastAutosave(); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.formDraftPreview-12515.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.formDraftPreview-12515.test.tsx index 173f15acafe..cf5b9aad4a6 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.formDraftPreview-12515.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.formDraftPreview-12515.test.tsx @@ -159,7 +159,7 @@ async function openPreview() { , ); await settle(); - fireEvent.click(await screen.findByRole('button', { name: 'Form' })); + fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); await settle(); // The Records grid (the landing tab) reads the published definition through // the adapter; only what the Preview asks is counted. diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.heldIncomplete-11786.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.heldIncomplete-11786.test.tsx index 60c988a3407..20093574319 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.heldIncomplete-11786.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.heldIncomplete-11786.test.tsx @@ -119,7 +119,7 @@ async function addFieldAs(typeOption: RegExp): Promise<{ name: string; label: st , ); - fireEvent.click(await screen.findByRole('button', { name: 'Form' })); + fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); await addFieldFromFormToolbar(); await screen.findByText('Type', { selector: 'label' }, { timeout: 4000 }); const name = (controlUnder('API name') as HTMLInputElement).value; @@ -206,7 +206,7 @@ describe('Studio data page — complete bodies are sent as before (objectui#1178 , ); - fireEvent.click(await screen.findByRole('button', { name: 'Form' })); + fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); await addFieldFromFormToolbar(); await pressStudioSave(); await waitFor(() => expect(puts.length).toBe(1), { timeout: 4000 }); @@ -230,7 +230,7 @@ describe('Studio data page — complete bodies are sent as before (objectui#1178 , ); - fireEvent.click(await screen.findByRole('button', { name: 'Form' })); + fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); await addFieldFromFormToolbar(); await pressStudioSave(); const strip = await screen.findByTestId('studio-refusal', undefined, { timeout: 4000 }); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.hiddenSystemFields-11780.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.hiddenSystemFields-11780.test.tsx index 57210ff2fc4..400293b84cb 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.hiddenSystemFields-11780.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.hiddenSystemFields-11780.test.tsx @@ -264,7 +264,7 @@ describe.each(CASES)('Data pillar on an object with $title (objectui#11780)', ({ it('Form preview: the injected-and-hidden fields are not form fields; the author fields are', async () => { renderPillar(); await waitFor(() => expect(screen.getByTestId('grid-columns')).toBeInTheDocument(), { timeout: 4000 }); - fireEvent.click(screen.getByRole('button', { name: 'Form' })); + fireEvent.click(screen.getByRole('button', { name: 'Field layout' })); fireEvent.click(screen.getByRole('button', { name: 'Preview' })); await waitFor(() => expect(screen.getByTestId('form-fields')).toBeInTheDocument(), { timeout: 4000 }); @@ -277,7 +277,7 @@ describe.each(CASES)('Data pillar on an object with $title (objectui#11780)', ({ it('form designer: no card for the injected-and-hidden fields; the author fields have one', async () => { renderPillar(); await waitFor(() => expect(screen.getByTestId('grid-columns')).toBeInTheDocument(), { timeout: 4000 }); - fireEvent.click(screen.getByRole('button', { name: 'Form' })); + fireEvent.click(screen.getByRole('button', { name: 'Field layout' })); await waitFor(() => expect(screen.getByText('Account Name')).toBeInTheDocument(), { timeout: 4000 }); for (const label of AUTHOR_VISIBLE_LABELS) expect(screen.getByText(label)).toBeInTheDocument(); @@ -288,7 +288,7 @@ describe.each(CASES)('Data pillar on an object with $title (objectui#11780)', ({ it('write-back: a designer drop saves `fields` that still carry every hidden system field, definition unchanged', async () => { renderPillar(); await waitFor(() => expect(screen.getByTestId('grid-columns')).toBeInTheDocument(), { timeout: 4000 }); - fireEvent.click(screen.getByRole('button', { name: 'Form' })); + fireEvent.click(screen.getByRole('button', { name: 'Field layout' })); await waitFor(() => expect(screen.getByText('Account Name')).toBeInTheDocument(), { timeout: 4000 }); expect(dnd.onDragEnd).not.toBeNull(); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.layoutBadge.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.layoutBadge.test.tsx index a2a36adab92..98ea9654940 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.layoutBadge.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.layoutBadge.test.tsx @@ -85,7 +85,7 @@ async function openFormTab(props: Partial, ); // First object auto-selects; the Form tab is the second segmented control. - fireEvent.click(await screen.findByRole('button', { name: 'Form' })); + fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); // `formMode` defaults to 'layout', so the layout caption is on screen once // its sub-mode control is. (Not awaited on the caption text: a read-only // package has its own caption since objectui#11781.) diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.layoutSaveCancel-36511.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.layoutSaveCancel-36511.test.tsx index 05e0130f395..5ac79af036f 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.layoutSaveCancel-36511.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.layoutSaveCancel-36511.test.tsx @@ -112,7 +112,7 @@ async function mountOnLayout(): Promise { , ); - fireEvent.click(await screen.findByRole('button', { name: 'Form' })); + fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); await screen.findByTestId('form-toolbar'); await waitFor(() => expect(sections()).toEqual(['Main', 'Where'])); } diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.panelGate.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.panelGate.test.tsx index 95665cdf99c..66a0954c426 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.panelGate.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.panelGate.test.tsx @@ -190,7 +190,7 @@ describe('DataPillar — Save is gated on the validations panel’s CEL verdict await pressStudioSave(); expect(mockClient.save).not.toHaveBeenCalled(); - fireEvent.click(screen.getByRole('button', { name: 'Form' })); + fireEvent.click(screen.getByRole('button', { name: 'Field layout' })); await pressStudioSave(); expect(mockClient.save).not.toHaveBeenCalled(); expect(screen.getByTestId('studio-held-message')).toHaveTextContent('Rule A'); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.panelHold-27629.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.panelHold-27629.test.tsx index 9598b24c32a..c307678c213 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.panelHold-27629.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.panelHold-27629.test.tsx @@ -170,7 +170,7 @@ async function openActionVisible(): Promise { return rawEditorIn(root); } -const leaveToForm = () => fireEvent.click(screen.getByRole('button', { name: 'Form' })); +const leaveToForm = () => fireEvent.click(screen.getByRole('button', { name: 'Field layout' })); describe('DataPillar — a rule guard that does not parse holds with the draft (objectstack#27629)', () => { it('leaving the Validations tab keeps the hold, and the held line names the rule', async () => { diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.saveCancel-36511.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.saveCancel-36511.test.tsx index 3b6931fca79..a401442409f 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.saveCancel-36511.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.saveCancel-36511.test.tsx @@ -146,7 +146,7 @@ async function mountOnForm(): Promise { , ); - fireEvent.click(await screen.findByRole('button', { name: 'Form' })); + fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); await screen.findByTestId('form-toolbar'); } diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.summaryHeld-27461.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.summaryHeld-27461.test.tsx index 5cbf0647a3c..b2d130601f6 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.summaryHeld-27461.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.summaryHeld-27461.test.tsx @@ -111,7 +111,7 @@ async function addRollup(): Promise<{ name: string; label: string }> { , ); - fireEvent.click(await screen.findByRole('button', { name: 'Form' })); + fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); await addFieldFromFormToolbar(undefined, { label: 'Child Count', type: /^Rollup$/ }); await screen.findByText('Type', { selector: 'label' }, { timeout: 4000 }); const name = (controlUnder('API name') as HTMLInputElement).value; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.validationVerdictHold-27644.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.validationVerdictHold-27644.test.tsx index 88e0276670a..058bc56b62c 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.validationVerdictHold-27644.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.validationVerdictHold-27644.test.tsx @@ -278,7 +278,7 @@ describe('a server error at a validation rule\'s path holds the Data pillar Save await screen.findByText(REFUSAL); editMessage('Amount is over the cap'); - fireEvent.click(screen.getByRole('button', { name: 'Form' })); + fireEvent.click(screen.getByRole('button', { name: 'Field layout' })); await waitFor(() => expect(screen.getByTestId('studio-held-message')).toHaveTextContent('Amount cap'), AUTOSAVE); await pressStudioSave(); expect(server.sent).toHaveLength(0); diff --git a/ui/packages/app-shell/src/views/studio-design/ObjectFormDesigner.tsx b/ui/packages/app-shell/src/views/studio-design/ObjectFormDesigner.tsx index 1454b835557..63a7b779e23 100644 --- a/ui/packages/app-shell/src/views/studio-design/ObjectFormDesigner.tsx +++ b/ui/packages/app-shell/src/views/studio-design/ObjectFormDesigner.tsx @@ -1,19 +1,24 @@ // Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license. /** - * ObjectFormDesigner — the WYSIWYG form-layout designer for the Studio Data - * pillar's Form view. An admin arranges the form the app opens for the object: - * fields grouped into **sections**, drag-reordered within a section and - * dragged **across** sections, with per-field selection opening the same - * protocol field inspector the grid uses. + * ObjectFormDesigner — the WYSIWYG field-layout designer of the Studio Data + * pillar's 「字段布局」 (Field layout) tab. An admin arranges the object's + * field groups: fields grouped into **sections**, drag-reordered within a + * section and dragged **across** sections, with per-field selection opening + * the same protocol field inspector the grid uses. The record page, the + * right-side preview and the app's create and edit dialogs all lay the + * object's fields out by these groups (objectstack-ai/objectstack#36425: no + * internal form view is loaded), so this one arrangement is what they show. * - * The app's create and edit dialogs lay out the object's own fields by its - * `fieldGroups` (objectstack-ai/objectstack#36425: no internal form view is - * loaded), so the sections are the object's `fieldGroups`: membership and - * in-group order persist to the object draft (`fields[].group` + - * `fieldGroups`) via the pillar's draft → publish, through the tested - * `object-fields-io` helpers (readFields/writeFields · readGroups/addGroup/ - * renameGroup/removeGroup/moveGroup · clearFieldGroup). + * Membership and in-group order persist in the spelling + * `fieldGroups[].fields` keeps (objectstack#35900, objectstack#36505): each + * group lists its members, and an object still written with the older + * per-field `group` converts on its first save (`groupListLayout`), with no + * visible change. Writes go through the tested `object-fields-io` helpers + * (readFields/writeFields · readGroups/addGroup/renameGroup/removeGroup/ + * moveGroup · groupListLayout · writeGroupLayout); the host routes the patch: + * the object draft for a writable package, the paired `.custom` extension's + * whole arrangement for an installed object (ADR-0146 D10). * * Build boundary: this component is only the drag/section CHROME. No new * metadata shape. @@ -52,6 +57,7 @@ import { moveGroup, clearFieldGroup, groupMembership, + groupListLayout, writeGroupLayout, type FieldEntry, } from '../metadata-admin/previews/object-fields-io.js'; @@ -332,8 +338,27 @@ export interface ObjectFormDesignerProps { * carry the 草稿 chip the properties panel shows. */ draftMarkedFields?: ReadonlySet; + /** + * objectstack#36505 (ADR-0146 D10) — on an installed object whose paired + * `.custom` extension takes the arrangement, a field another package + * contributes is arranged like any other (the arrangement lists any field + * the object has, whoever declares it): its card is dragged, and a click + * still opens its read-only inspector. + */ + arrangeContributed?: boolean; + /** + * objectstack#36505 — on an installed object, where each field the object + * itself carries comes from, by name: the original package, or this + * environment (the paired `.custom` package). A field another package + * contributes is named by `contributedFields` instead. Omit on a writable + * package: every field there is its own. + */ + fieldSources?: ReadonlyMap; } +/** Where a field the object itself carries comes from, on an installed object. */ +export type FieldLayoutSource = 'base' | 'environment'; + /** One section on the canvas: a field group. */ interface DesignerSection { key: string; @@ -350,6 +375,33 @@ const NO_CONTRIBUTED_FIELDS: ReadonlyMap = new Map( const ContributedFieldsContext = React.createContext>(NO_CONTRIBUTED_FIELDS); const NO_DRAFT_MARKED_FIELDS: ReadonlySet = new Set(); const DraftMarkedFieldsContext = React.createContext>(NO_DRAFT_MARKED_FIELDS); +/** objectstack#36505 — whether a contributed card is dragged, and each own field's source (installed objects). */ +const LayoutSourcesContext = React.createContext<{ + arrangeContributed: boolean; + fieldSources: ReadonlyMap | null; +}>({ arrangeContributed: false, fieldSources: null }); + +/** + * objectstack#36505 — where a field of an installed object comes from: the + * original package or this environment, drawn as the contributed mark is + * (a package another package's field names is that mark's). + */ +function FieldSourceMark({ source, locale }: { source: FieldLayoutSource; locale: string }): React.ReactElement { + const text = t(source === 'base' ? 'engine.studio.designer.source.base' : 'engine.studio.designer.source.environment', locale); + return ( + + {text} + + ); +} /** * The Form tab's one toolbar row (objectui#12451): the host's mode control and @@ -457,7 +509,11 @@ function SortableField({ // read-only card on any surface, and names its package. const contributed = React.useContext(ContributedFieldsContext).get(entry.name) ?? null; const draftMarked = React.useContext(DraftMarkedFieldsContext).has(entry.name); - const locked = readOnly || contributed !== null; + const { arrangeContributed, fieldSources } = React.useContext(LayoutSourcesContext); + const source = contributed ? null : (fieldSources?.get(entry.name) ?? null); + // objectstack#36505 — on an installed object's `.custom` arrangement a + // contributed card is dragged like any other; it stays read-only to a click. + const locked = readOnly || (contributed !== null && !arrangeContributed); const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({ id: fid(entry.name), // objectui#11872 — the role a screen reader announces for the card, in the @@ -486,8 +542,9 @@ function SortableField({ {...attributes} // objectstack#29786 — a contributed card takes no drag listener: it is // never a drag source. Not `useSortable`'s `disabled`, which would mark - // it `aria-disabled` while a click still selects it. - {...(contributed ? {} : listeners)} + // it `aria-disabled` while a click still selects it. objectstack#36505: + // unless the installed object's arrangement takes it. + {...(contributed && locked ? {} : listeners)} // objectui#11924 — dnd-kit points every card's `aria-describedby` at the // canvas's drag instructions, and `useSortable` cannot take it away // (`disabled` keeps it and adds `aria-disabled`, though a click still @@ -530,6 +587,7 @@ function SortableField({ {contributed && ( )} + {source && } readFields(draft.fields), [draft.fields]); const fieldGroups = React.useMemo(() => readGroups(draft.fieldGroups), [draft.fieldGroups]); + // objectstack#36505 — what every write starts from: the grouping in the + // `fieldGroups[].fields` spelling, so a write of an object still in the + // older per-field `group` spelling converts it whole, membership and order + // unchanged (the canvas reads the same membership from either). + const listed = React.useMemo(() => groupListLayout(view, fieldGroups), [view, fieldGroups]); + const layoutSources = React.useMemo( + () => ({ arrangeContributed, fieldSources: fieldSources ?? null }), + [arrangeContributed, fieldSources], + ); // The sections the canvas draws: the object's field groups. const groups = React.useMemo( () => @@ -929,11 +998,31 @@ export function ObjectFormDesigner({ [items], ); + /** + * Hand a write to the host, the conversion to the list spelling included + * (objectstack#36505): an edit of an object still written with the older + * per-field `group` carries the converted `fields` and `fieldGroups` with + * it, whichever of the two the edit itself changed. + */ + const emit = React.useCallback( + (patch: { fields?: unknown; fieldGroups?: unknown }) => { + const out: Record = { ...patch }; + if (listed.changed) { + if (out.fields === undefined) out.fields = writeFields(listed.view); + if (out.fieldGroups === undefined) out.fieldGroups = listed.groups; + } + onChange(out); + }, + [listed, onChange], + ); + /** * Persist the container map. On the object's own groups the layout is * written where `fieldGroups[].fields` keeps it: each changed group's list, * never the object's field declaration order (objectstack#35900) — - * `writeGroupLayout` says exactly what moves. + * `writeGroupLayout` says exactly what moves. A drop that changes nothing + * the object can hold is put back (objectstack#36505: the ungrouped bucket + * of an installed object, whose declaration order is the package's). */ const commit = React.useCallback( (next: Record) => { @@ -951,16 +1040,16 @@ export function ObjectFormDesigner({ const was = derived[bucket] ?? []; const now = next[bucket] ?? []; const reorderUngrouped = was.length !== now.length || was.some((id, i) => id !== now[i]); - const patch = writeGroupLayout(view, fieldGroups, layout, { reorderUngrouped }); - if (patch.fields !== undefined || patch.fieldGroups !== undefined) onChange(patch); + const patch = writeGroupLayout(listed.view, listed.groups, layout, { reorderUngrouped }); + if (patch.fields !== undefined || patch.fieldGroups !== undefined) emit(patch); + else setItems(derived); }, [ containerOrder, entryByName, - view, derived, - onChange, - fieldGroups, + emit, + listed, ], ); @@ -1000,17 +1089,18 @@ export function ObjectFormDesigner({ }; const newLabel = t('engine.studio.designer.newGroup', locale); - const addSection = () => onChange({ fieldGroups: addGroup(fieldGroups, newLabel) }); - const renameSection = (key: string, label: string) => onChange({ fieldGroups: renameGroup(fieldGroups, key, label) }); - const moveSection = (key: string, dir: -1 | 1) => onChange({ fieldGroups: moveGroup(fieldGroups, key, dir) }); + const addSection = () => emit({ fieldGroups: addGroup(listed.groups, newLabel) }); + const renameSection = (key: string, label: string) => emit({ fieldGroups: renameGroup(listed.groups, key, label) }); + const moveSection = (key: string, dir: -1 | 1) => emit({ fieldGroups: moveGroup(listed.groups, key, dir) }); const deleteSection = (key: string) => - onChange({ fieldGroups: removeGroup(fieldGroups, key), fields: writeFields(clearFieldGroup(view, key)) }); + emit({ fieldGroups: removeGroup(listed.groups, key), fields: writeFields(clearFieldGroup(listed.view, key)) }); const activeEntry = activeId && !activeId.startsWith('g:') ? entryByName.get(unFid(activeId)) : null; return ( +
+
); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioCustomizeControls.tsx b/ui/packages/app-shell/src/views/studio-design/StudioCustomizeControls.tsx index 9270b0716b5..ef14aef1e3e 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioCustomizeControls.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioCustomizeControls.tsx @@ -553,7 +553,78 @@ export function foldObjectExtension( if (at >= 0) entries[at] = { name, def }; else entries.push({ name, def }); } - return { ...object, fields: writeFields({ shape: view.shape, entries }) }; + if (!Array.isArray(ext.fieldGroups)) return { ...object, fields: writeFields({ shape: view.shape, entries }) }; + return applyExtensionFieldGroups({ ...object, fields: writeFields({ shape: view.shape, entries }) }, ext.fieldGroups, own); +} + +/** + * objectstack#36505 (ADR-0146 D10) — `body` without the `place` entries a + * written `fieldGroups` replaces: a `{ field }` or `{ group }` placement + * beside the whole arrangement is refused at save + * (`refusePlacementsTheArrangementReplaces` on `ObjectExtensionSchema`), and + * the arrangement already lists the field, or holds the group, where the + * placement put it. A `{ list }` placement stays (the tab list is not + * replaced by `fieldGroups`); `place` left empty is taken off. + */ +export function withoutReplacedPlacements(body: ObjectExtensionBody): ObjectExtensionBody { + if (!Array.isArray(body.place)) return body; + const kept = body.place.filter((entry: unknown) => { + if (!isPlainRecord(entry)) return true; + return typeof entry.field !== 'string' && !isPlainRecord(entry.group); + }); + if (kept.length === body.place.length) return body; + const out: ObjectExtensionBody = { ...body }; + if (kept.length > 0) out.place = kept; + else delete out.place; + return out; +} + +/** + * objectstack#36505 (ADR-0146 D10) — the extension's whole field arrangement + * laid over `object`, the way the registry fold serves it + * (`applyCustomArrangement`, `@objectstack/objectql`): its `fieldGroups` + * replace the object's, a field a group lists follows that group, and a + * field the extension does not declare (`own`) loses a `group` naming a + * listing group or a group the arrangement does not have, so it shows after + * the last group. The served object already holds the PUBLISHED + * arrangement; this shows the buffer's before it is saved. + */ +function applyExtensionFieldGroups( + object: Record, + arrangement: unknown[], + own: Record, +): Record { + const groups = arrangement.filter(isPlainRecord).map((g) => ({ ...g })); + const listedIn = new Map(); + const keys = new Set(); + const listing = new Set(); + const tables = new Set(); + for (const g of groups) { + if (typeof g.key !== 'string') continue; + keys.add(g.key); + if (typeof g.relatedList === 'string') { + tables.add(g.key); + continue; + } + if (!Array.isArray(g.fields)) continue; + listing.add(g.key); + for (const name of g.fields) if (typeof name === 'string' && !listedIn.has(name)) listedIn.set(name, g.key); + } + const view = readFields(object.fields); + const entries = view.entries.map((e) => { + const group = e.def.group; + if (typeof group !== 'string') return e; + const listedAt = listedIn.get(e.name); + if (listedAt !== undefined) return listedAt === group ? e : { name: e.name, def: { ...e.def, group: listedAt } }; + const declaredHere = Object.prototype.hasOwnProperty.call(own, e.name); + if (tables.has(group) || ((!keys.has(group) || listing.has(group)) && !declaredHere)) { + const def = { ...e.def }; + delete def.group; + return { name: e.name, def }; + } + return e; + }); + return { ...object, fieldGroups: groups, fields: writeFields({ shape: view.shape, entries }) }; } /** diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.designerRegistryMissing.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.designerRegistryMissing.test.tsx index 0a35c4db382..0c6e8d571bc 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.designerRegistryMissing.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.designerRegistryMissing.test.tsx @@ -214,7 +214,7 @@ describe('Data pillar field rail — a field click must never be a no-op (#6795 , ); - fireEvent.click(await screen.findByRole('button', { name: 'Form' })); + fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); const card = (await screen.findByText('Title')).closest('.cursor-grab') as HTMLElement; expect(card).toBeTruthy(); fireEvent.click(card); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.draftVersionConflict-11773.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.draftVersionConflict-11773.test.tsx index 15a3eb33500..3ff8d0208bb 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.draftVersionConflict-11773.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.draftVersionConflict-11773.test.tsx @@ -411,7 +411,7 @@ describe('Data pillar — a create sends If-None-Match: * (objectui#11773)', () expect([server.saves[0]!.ifMatch, server.saves[0]!.ifNoneMatch]).toEqual([undefined, '*']); await loaded(a, '1 field'); - fireEvent.click(within(a).getAllByRole('button', { name: 'Form' })[0]!); + fireEvent.click(within(a).getAllByRole('button', { name: 'Field layout' })[0]!); await addFieldAndSave(a, addFieldFromFormToolbar); await addFieldAndSave(a, addFieldFromFormToolbar, SECOND); // The skeleton's draft, which the create publishes at once (objectstack#36511): diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.formFields.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.formFields.test.tsx index ebbb5a9a39c..0e8b1412292 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.formFields.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.formFields.test.tsx @@ -185,7 +185,7 @@ function Harness(): React.ReactElement { async function mountSettledFormPreview(): Promise { render(); await waitFor(() => expect(dataSource.find).toHaveBeenCalled(), { timeout: 4000 }); - fireEvent.click(screen.getByRole('button', { name: 'Form' })); + fireEvent.click(screen.getByRole('button', { name: 'Field layout' })); fireEvent.click(screen.getByRole('button', { name: 'Preview' })); await waitFor(() => expect(dataSource.getObjectSchema).toHaveBeenCalled(), { timeout: 4000 }); await settle(); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataCreate-26845.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataCreate-26845.test.tsx index b5ff92952a9..004717a7d2e 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataCreate-26845.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataCreate-26845.test.tsx @@ -171,7 +171,7 @@ async function openTask(): Promise { /** The card's repro: add a Picklist "Priority" with no option yet; the autosave holds it. */ async function holdAPicklist(): Promise { - fireEvent.click(await screen.findByRole('button', { name: 'Form' })); + fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); await addFieldFromFormToolbar(undefined, { label: 'Priority', type: /^Picklist$/ }); await screen.findByTestId('studio-held', undefined, { timeout: 8000 }); } diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataLeave-26705.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataLeave-26705.test.tsx index b9590ff5e6f..17dc3a019be 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataLeave-26705.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataLeave-26705.test.tsx @@ -148,7 +148,7 @@ async function openTask(): Promise { /** The card's repro: add a Picklist "Priority" with no option yet; the autosave holds it. */ async function holdAPicklist(): Promise { - fireEvent.click(await screen.findByRole('button', { name: 'Form' })); + fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); await addFieldFromFormToolbar(undefined, { label: 'Priority', type: /^Picklist$/ }); await screen.findByTestId('studio-held', undefined, { timeout: 8000 }); } diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.lateRegistration-11939.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.lateRegistration-11939.test.tsx index 9b1409367be..519bcc6d795 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.lateRegistration-11939.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.lateRegistration-11939.test.tsx @@ -157,7 +157,7 @@ describe('Data pillar field rail — a late object inspector fills the open rail , ); - fireEvent.click(await screen.findByRole('button', { name: 'Form' })); + fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); const card = (await screen.findByText('Title')).closest('.cursor-grab') as HTMLElement; expect(card).toBeTruthy(); fireEvent.click(card); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.saveBar-36511.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.saveBar-36511.test.tsx index 2601d7284a5..a31a8064363 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.saveBar-36511.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.saveBar-36511.test.tsx @@ -136,7 +136,7 @@ async function mountAndEdit(): Promise { , ); - fireEvent.click(await screen.findByRole('button', { name: 'Form' }, { timeout: 4000 })); + fireEvent.click(await screen.findByRole('button', { name: 'Field layout' }, { timeout: 4000 })); await addFieldFromFormToolbar(undefined, { label: 'Due' }); return screen.getByTestId('studio-shell-header'); } diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx index 3102f8c68f5..f3c5b85932a 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx @@ -437,8 +437,11 @@ import { readFields, writeFields, newField, + readGroups, + groupArrangement, type FieldEntry, } from '../metadata-admin/previews/object-fields-io.js'; +import { extensionWithArrangement } from '../objectExtensionArrangementSave.js'; import type { FieldTypeId } from '../metadata-admin/previews/field-types.js'; import { ExternalObjectNotice, @@ -453,6 +456,7 @@ import { StudioGridAddFieldButton, StudioGridAddFieldProvider, type StudioGridAd import { useDraftAutoSave, type DraftSend } from './useDraftAutoSave.js'; import { FLOW_PRESETS, flowPresetTrigger, type FlowPreset } from './flowPresets.js'; import { FormToolbar, ObjectFormDesigner } from './ObjectFormDesigner.js'; +import { fieldLayoutSourcesOf } from './fieldLayoutSources.js'; import { isStudioHiddenSystemField } from './studioHiddenSystemField.js'; import { ObjectGroupInspector } from './ObjectGroupInspector.js'; import { ObjectValidationsPanel } from './ObjectValidationsPanel.js'; @@ -520,6 +524,7 @@ import { foldObjectExtension, objectExtensionBodyOf, routeFoldedFieldsEdit, + withoutReplacedPlacements, type CustomizeBlock, type ObjectExtensionBody, type ServedOverride, @@ -5733,6 +5738,10 @@ export function DataPillar({ // answer names every write, ⛔ never a `.custom` spelled here. const extWalled = customization?.walled === true; const extWritable = extOpen !== null && !extWalled; + // objectstack#36505 (ADR-0146 D10) — an installed object's field layout is + // arranged in its pair's extension: the 「字段布局」 tab is editable where + // that extension is (not walled), and stays read-only where it is not. + const layoutWritable = extendsBase && extWritable; const shownDraft = React.useMemo( () => (extOpen ? foldObjectExtension(objDraft, extOpen.body, extOpen.published) : objDraft), [objDraft, extOpen], @@ -6938,6 +6947,43 @@ export function DataPillar({ }, [extWritable, objDraft], ); + // objectstack#36505 (ADR-0146 D10) — an edit of an installed object's field + // layout, written into the pair's extension of it as the WHOLE arrangement + // (`fieldGroups`, every group listing its members, the objectstack#36498 + // shape), composed by the shared arrangement writer's own composer + // (`extensionWithArrangement`) over the extension this buffer holds. The + // fields half of the edit (a pair field's dropped `group`) goes the way a + // field edit goes; a base field's `group` is not the extension's to write, + // and the arrangement places it. Saved by the extension's Save with the + // rest of the buffer, so one Save publishes the object's whole + // customization (objectstack#36511) and no second writer races this buffer. + const onExtLayoutPatch = React.useCallback( + (patch: Record) => { + if (!extWritable || !('fieldGroups' in patch || 'fields' in patch)) return; + setExt((prev) => { + if (!prev) return prev; + const folded = foldObjectExtension(objDraft, prev.body, prev.published); + const fieldsAfter = 'fields' in patch ? patch.fields : folded.fields; + const groupsAfter = readGroups('fieldGroups' in patch ? patch.fieldGroups : folded.fieldGroups); + let body: ObjectExtensionBody = + 'fields' in patch + ? routeFoldedFieldsEdit({ + before: folded.fields, + after: patch.fields, + baseOwned: baseOwnedFieldNames(objDraft, prev.body, prev.published), + ext: prev.body, + }) + : prev.body; + body = withoutReplacedPlacements(body); + body = extensionWithArrangement(body, prev.body.extend, { + fieldGroups: groupArrangement(readFields(fieldsAfter), groupsAfter), + }); + return { ...prev, body }; + }); + setExtDirty(true); + }, + [extWritable, objDraft], + ); // objectstack#27485 — an unsent edit the CEL verdict holds is named like an // incomplete one: the held line, the surface's Publish and the rail's // question all read it, so it outlives the inspector without going unseen. @@ -7285,9 +7331,26 @@ export function DataPillar({ () => contributedFieldsOf(baseContributionsOf(customizationMarks), current?.name), [customizationMarks, current?.name], ); + // objectstack#36505 — where each field of an installed object comes from, + // for the Field layout canvas: the original package or this environment + // (a contributed field is named by its own mark). + const fieldLayoutSources = React.useMemo( + () => + extendsBase + ? fieldLayoutSourcesOf(shownDraft.fields, { + contributed: contributedFields, + environment: [...extensionFieldNames(extOpen?.body), ...(extOpen?.published ?? [])], + }) + : undefined, + [extendsBase, shownDraft.fields, contributedFields, extOpen], + ); const selectedContributedField = fieldSel?.kind === 'field' ? (contributedFields.get(String(fieldSel.id)) ?? null) : null; - const fieldRailReadOnly = (readOnly && !(extWritable && fieldSel?.kind === 'field')) || selectedContributedField !== null; + // objectstack#36505 — a group of an installed object is arranged in the + // pair's extension too, so its inspector edits like a field's. + const fieldRailReadOnly = + (readOnly && !(extWritable && (fieldSel?.kind === 'field' || fieldSel?.kind === 'group'))) || + selectedContributedField !== null; const selectedBaseField = extWritable && fieldSel?.kind === 'field' && @@ -7380,9 +7443,9 @@ export function DataPillar({ // at all, so neither draft caption is true of it (objectui#11781), and // its read-only sentence is the header link's title (objectui#12453). title={ - readOnly + readOnly && !layoutWritable ? undefined - : dirty + : (layoutWritable ? extDirty : dirty) ? t('engine.studio.data.form.layoutBadge', locale) : t('engine.studio.data.form.layoutBadgeClean', locale) } @@ -7402,19 +7465,14 @@ export function DataPillar({ ); // objectstack-ai/objectstack#36425 — the create and edit dialogs lay out by - // the object's field groups, never by an internal form view, so the Form tab - // always edits the field groups and says so. + // the object's field groups, never by an internal form view, so the Field + // layout tab always edits the field groups. objectstack#36505 — it says + // where they are used, in one sentence, in place of the chip that named the + // field groups beside a form view. const formLayoutSource = current ? ( -
- - {t('engine.studio.data.form.layoutSource.fieldGroups', locale)} - -
+ + {t('engine.studio.data.form.usedOn', locale)} + ) : null; // objectstack#28575 — on a base object the Form toolbar's Add field sits // beside the Layout / Preview control: the designer, read-only on a base @@ -7712,7 +7770,7 @@ export function DataPillar({ setFieldSel({ kind: 'field', id: name })} selectedGroup={fieldSel?.kind === 'group' ? fieldSel.id : null} @@ -8062,10 +8122,12 @@ export function DataPillar({ // objectstack#30057 — on a base object a new field goes into // the pair's extension, from the toolbar beside the mode control. onAddField={canAddFields && !extendsBase ? addField : undefined} - readOnly={readOnly} + readOnly={readOnly && !layoutWritable} modeControl={formToolbarLeading} contributedFields={contributedFields} draftMarkedFields={agentMarkedFields} + arrangeContributed={layoutWritable} + fieldSources={fieldLayoutSources} /> ) : ( @@ -8234,12 +8296,12 @@ export function DataPillar({ {(() => { const fieldRailContent = fieldSel.kind === 'group' ? ( setFieldSel(null)} - readOnly={readOnly} + readOnly={readOnly && !layoutWritable} locale={locale} /> ) : inspector ? ( diff --git a/ui/packages/app-shell/src/views/studio-design/fieldLayoutSources.ts b/ui/packages/app-shell/src/views/studio-design/fieldLayoutSources.ts new file mode 100644 index 00000000000..fcb321db660 --- /dev/null +++ b/ui/packages/app-shell/src/views/studio-design/fieldLayoutSources.ts @@ -0,0 +1,43 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * objectstack#36505 (ADR-0146 D3, D10) — where each field of an INSTALLED + * object comes from, as the Field layout canvas marks it: the original + * package, another package, or this environment. Pure, so the rule is pinned + * without a render. + * + * The facts it reads, and only those: + * + * - another package: the base's one customization read (`contributions`, a + * `field` entry stamped with its package), the map `contributedFieldsOf` + * builds. The canvas draws that field with the contributed mark, which + * names the package, so this answer leaves it out; + * - this environment: a field the pair's `.custom` extension declares (its + * buffer's `fields`, and the ones its published row declared), and any + * customer `__c` field, which only a `.custom` package may declare; + * - the original package: every other field the object carries. + * + * Field groups are not marked: the served object carries no per-group source + * (the registry fold records who placed a group, and no read serves it), so a + * group's source would be a guess. + * + * @module + */ + +import { isExtensionFieldName } from '@objectstack/spec/data'; +import { readFields } from '../metadata-admin/previews/object-fields-io.js'; +import type { FieldLayoutSource } from './ObjectFormDesigner.js'; + +/** Each field's source, by name; a contributed field is absent (its own mark names it). */ +export function fieldLayoutSourcesOf( + fields: unknown, + facts: { contributed: ReadonlyMap; environment: Iterable }, +): ReadonlyMap { + const environment = new Set(facts.environment); + const out = new Map(); + for (const { name } of readFields(fields).entries) { + if (facts.contributed.has(name)) continue; + out.set(name, environment.has(name) || isExtensionFieldName(name) ? 'environment' : 'base'); + } + return out; +} diff --git a/ui/packages/i18n/src/namespaces/studio/en.ts b/ui/packages/i18n/src/namespaces/studio/en.ts index 59ba67da4e5..6b7c6315726 100644 --- a/ui/packages/i18n/src/namespaces/studio/en.ts +++ b/ui/packages/i18n/src/namespaces/studio/en.ts @@ -2621,7 +2621,8 @@ const STUDIO_EN: Record = { 'engine.studio.data.firstObjectHint': 'Objects are your app’s data foundation (e.g. “Orders”, “Customers”). Create one below; then design its fields, forms, and automations. Each Save is live at once.', 'engine.studio.data.tab.records': 'Records', - 'engine.studio.data.tab.form': 'Form', + // objectstack#36505 — the tab edits the object's field groups only. + 'engine.studio.data.tab.form': 'Field layout', 'engine.studio.data.tab.rules': 'Validations', 'engine.studio.data.tab.settings': 'Settings', 'engine.studio.data.tab.hooks': 'Hooks', @@ -2657,11 +2658,10 @@ const STUDIO_EN: Record = { 'engine.studio.data.form.sourceLabel': 'Preview source', 'engine.studio.data.form.sourceDraft': 'Draft', 'engine.studio.data.form.sourcePublished': 'Published', - // objectstack-ai/objectstack#36425 — the Form tab edits the object's field - // groups, which the app's create and edit dialogs lay out by. - 'engine.studio.data.form.layoutSource.fieldGroups': 'Field groups', - 'engine.studio.data.form.layoutSource.fieldGroupsTitle': - 'New and Edit in the app lay out this object\'s fields by these groups.', + // objectstack-ai/objectstack#36425, objectstack#36505 — the Field layout + // tab edits the object's field groups, which these surfaces lay out by. + 'engine.studio.data.form.usedOn': + 'These groups and this order are used on the record page, the right-side preview, and the create and edit dialogs.', 'engine.studio.data.fieldProps': 'Field properties', 'engine.studio.data.groupProps': 'Group properties', 'engine.studio.data.fieldInspectorMissing': @@ -3720,6 +3720,11 @@ const STUDIO_EN: Record = { 'engine.studio.designer.fieldTitleReadOnly': 'Click a field to view its properties', // objectui#12451 — the Form tab toolbar's hint. 'engine.studio.designer.toolbarHint': 'Drag fields to arrange · click a field to edit its properties', + // objectstack#36505 — where a field of an installed object comes from. + 'engine.studio.designer.source.base': 'Original package', + 'engine.studio.designer.source.baseTitle': 'Comes with the installed package, as it ships', + 'engine.studio.designer.source.environment': 'This environment', + 'engine.studio.designer.source.environmentTitle': 'Added in this environment, in its customization package', 'engine.studio.designer.addGroup': 'Add group', // What the form designer's drag live region says (objectui#11802): labels, // never the canvas's internal ids, and the place as "N of M" in the group. diff --git a/ui/packages/i18n/src/namespaces/studio/zh.ts b/ui/packages/i18n/src/namespaces/studio/zh.ts index a34aaadc282..007acb76b93 100644 --- a/ui/packages/i18n/src/namespaces/studio/zh.ts +++ b/ui/packages/i18n/src/namespaces/studio/zh.ts @@ -2357,7 +2357,8 @@ const STUDIO_ZH: Record = { 'engine.studio.data.firstObjectHint': '对象是应用的数据基座(如「订单」「客户」)。点击下方按钮创建一个;之后为它设计字段、表单与自动化,每次保存即生效。', 'engine.studio.data.tab.records': '记录', - 'engine.studio.data.tab.form': '表单', + // objectstack#36505 — the tab edits the object's field groups only. + 'engine.studio.data.tab.form': '字段布局', 'engine.studio.data.tab.rules': '验证', 'engine.studio.data.tab.settings': '设置', 'engine.studio.data.tab.hooks': '钩子', @@ -2385,8 +2386,7 @@ const STUDIO_ZH: Record = { 'engine.studio.data.form.sourceLabel': '预览来源', 'engine.studio.data.form.sourceDraft': '草稿', 'engine.studio.data.form.sourcePublished': '已发布', - 'engine.studio.data.form.layoutSource.fieldGroups': '字段分组', - 'engine.studio.data.form.layoutSource.fieldGroupsTitle': '应用中的新建和编辑按这些分组排布此对象的字段。', + 'engine.studio.data.form.usedOn': '这里的分组和顺序用在记录页、右侧预览、新建和编辑弹窗上。', 'engine.studio.data.fieldProps': '字段属性', 'engine.studio.data.groupProps': '分组属性', 'engine.studio.data.fieldInspectorMissing': '本次会话没有注册字段检查器,因此无法在这里编辑该字段的属性。', @@ -3284,6 +3284,10 @@ const STUDIO_ZH: Record = { 'engine.studio.designer.newGroup': '新分组', 'engine.studio.designer.fieldTitleReadOnly': '点选字段查看属性', 'engine.studio.designer.toolbarHint': '拖动字段排布 · 点选字段编辑属性', + 'engine.studio.designer.source.base': '原始包', + 'engine.studio.designer.source.baseTitle': '随已安装的软件包而来,保持出厂原样', + 'engine.studio.designer.source.environment': '本环境', + 'engine.studio.designer.source.environmentTitle': '在本环境添加,存于其定制包', 'engine.studio.designer.addGroup': '添加分组', 'engine.studio.formDnd.instructions': '按空格键或回车键拿起字段。拖动时用方向键移动,再按空格键或回车键放到新位置,按 Esc 键取消。', From 4b07d313283ab9e5338064863dc8e1c0d6bd44a9 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 06:30:39 +0000 Subject: [PATCH 2/7] test(studio): pin the list-spelling conversion, the .custom arrangement fold and the field sources Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01WGufzhpykmQZe1yMupC2CU --- .../previews/object-fields-io.test.ts | 81 ++++++++++- .../studio-design/ObjectFormDesigner.test.tsx | 136 +++++++++++++++++- ...mizeControls.objectExtension-28575.test.ts | 59 ++++++++ 3 files changed, 274 insertions(+), 2 deletions(-) diff --git a/ui/packages/app-shell/src/views/metadata-admin/previews/object-fields-io.test.ts b/ui/packages/app-shell/src/views/metadata-admin/previews/object-fields-io.test.ts index ac4fd8d640c..40c19796b1a 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/previews/object-fields-io.test.ts +++ b/ui/packages/app-shell/src/views/metadata-admin/previews/object-fields-io.test.ts @@ -1,7 +1,7 @@ // Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license. import { describe, it, expect } from 'vitest'; -import { ObjectSchema } from '@objectstack/spec/data'; +import { ObjectExtensionSchema, ObjectSchema } from '@objectstack/spec/data'; import { newField, readFields, @@ -20,6 +20,9 @@ import { groupEntries, currentGroupLayout, writeGroupLayout, + groupListLayout, + groupArrangement, + groupMembership, diffFields, type FieldsView, } from './object-fields-io'; @@ -509,3 +512,79 @@ describe('groupEntries reads a group\'s own fields list (objectstack#35900)', () ]); }); }); + +describe('groupListLayout — an object in the older per-field `group` spelling converts, membership unchanged (objectstack#36505)', () => { + // `basic` holds name and account by the older `group`; `money` lists + // valid_until and also picks up `fee` by its `group`; terms is ungrouped; + // `orphan` names no declared group. + const view: FieldsView = readFields({ + name: { type: 'text', group: 'basic' }, + account: { type: 'text', group: 'basic' }, + valid_until: { type: 'date' }, + fee: { type: 'currency', group: 'money' }, + terms: { type: 'textarea' }, + orphan: { type: 'text', group: 'gone' }, + }); + const groups = readGroups([ + { key: 'basic', label: 'Basic' }, + { key: 'money', label: 'Money', fields: ['valid_until'] }, + { key: 'kids', label: 'Kids', relatedList: 'quote_line' }, + ]); + + it('lists every group\'s members in display order and drops each `group` a list now holds', () => { + const out = groupListLayout(view, groups); + expect(out.changed).toBe(true); + expect(out.groups).toEqual([ + { key: 'basic', label: 'Basic', fields: ['name', 'account'] }, + { key: 'money', label: 'Money', fields: ['valid_until', 'fee'] }, + { key: 'kids', label: 'Kids', relatedList: 'quote_line' }, + ]); + const fields = writeFields(out.view) as Record>; + expect(Object.keys(fields)).toEqual(['name', 'account', 'valid_until', 'fee', 'terms', 'orphan']); + expect(['name', 'account', 'fee'].map((n) => fields[n].group)).toEqual([undefined, undefined, undefined]); + // A `group` naming no declared group says nothing and is kept. + expect(fields.orphan.group).toBe('gone'); + }); + + it('the converted object places every field exactly where the old spelling did', () => { + const before = groupMembership(view, groups); + const out = groupListLayout(view, groups); + const after = groupMembership(out.view, out.groups); + expect([...after.members]).toEqual([...before.members]); + expect(Object.fromEntries(after.groupOf)).toEqual(Object.fromEntries(before.groupOf)); + const parsed = ObjectSchema.safeParse({ name: 'quote', label: 'Quote', fields: writeFields(out.view), fieldGroups: out.groups }); + expect(parsed.success, JSON.stringify(parsed.error?.issues)).toBe(true); + }); + + it('an object already in the list spelling is answered as it is', () => { + const out = groupListLayout(view, groups); + const again = groupListLayout(out.view, out.groups); + expect(again.changed).toBe(false); + expect(again.view).toBe(out.view); + expect(again.groups).toBe(out.groups); + }); +}); + +describe('groupArrangement — the whole arrangement an installed object\'s .custom extension writes (objectstack#36505)', () => { + it('lists every group\'s members, the older spelling included, and keeps a related-table group as it is', () => { + const view = readFields({ + name: { type: 'text', group: 'basic' }, + region__c: { type: 'text' }, + account: { type: 'text' }, + terms: { type: 'textarea' }, + }); + const groups = readGroups([ + { key: 'basic', label: 'Basic' }, + { key: 'extra', label: 'Extra', fields: ['region__c', 'account'] }, + { key: 'kids', label: 'Kids', relatedList: 'quote_line' }, + ]); + const arrangement = groupArrangement(view, groups); + expect(arrangement).toEqual([ + { key: 'basic', label: 'Basic', fields: ['name'] }, + { key: 'extra', label: 'Extra', fields: ['region__c', 'account'] }, + { key: 'kids', label: 'Kids', relatedList: 'quote_line' }, + ]); + const parsed = ObjectExtensionSchema.safeParse({ extend: 'quote', fieldGroups: arrangement }); + expect(parsed.success, JSON.stringify(parsed.error?.issues)).toBe(true); + }); +}); diff --git a/ui/packages/app-shell/src/views/studio-design/ObjectFormDesigner.test.tsx b/ui/packages/app-shell/src/views/studio-design/ObjectFormDesigner.test.tsx index b5e11b63734..b814f5dd3d7 100644 --- a/ui/packages/app-shell/src/views/studio-design/ObjectFormDesigner.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/ObjectFormDesigner.test.tsx @@ -6,7 +6,7 @@ * LICENSE file in the root directory of this source tree. */ import { describe, it, expect, vi } from 'vitest'; -import { render, screen, fireEvent } from '@testing-library/react'; +import { render, screen, fireEvent, within } from '@testing-library/react'; import React from 'react'; import '@testing-library/jest-dom/vitest'; import userEvent from '@testing-library/user-event'; @@ -401,3 +401,137 @@ describe('ObjectFormDesigner — a disabled group arrow says why (objectstack#32 expect(onChange).toHaveBeenCalledTimes(1); }); }); + +/** + * objectstack#36505 — an object still written with the older per-field + * `group` shows its groups as the record page does, and the first write the + * designer makes converts it to the `fieldGroups[].fields` spelling with no + * visible change. + */ +describe('ObjectFormDesigner — a legacy `fields[].group` object converts on its first save (objectstack#36505)', () => { + const legacy = { + name: 'crm_quote', + fields: { + name: { type: 'text', label: 'Name', group: 'basic' }, + account: { type: 'text', label: 'Account', group: 'basic' }, + fee: { type: 'currency', label: 'Fee', group: 'money' }, + terms: { type: 'textarea', label: 'Terms' }, + }, + fieldGroups: [ + { key: 'basic', label: 'Basic' }, + { key: 'money', label: 'Money' }, + ], + }; + /** Each section's title and the labels of the cards under it, in canvas order. */ + const canvas = (container: HTMLElement) => + Array.from(container.querySelectorAll('.\\@container')).map((section) => { + const input = section.querySelector('input'); + const title = input ? input.value : (section.querySelector('span')?.textContent ?? ''); + const cards = Array.from(section.querySelectorAll('.touch-none')).map( + (card) => card.querySelector('.truncate')?.textContent ?? '', + ); + return [title, cards]; + }); + + it('shows the legacy groups, and a rename saves every group\'s list and drops each field\'s `group`', async () => { + const onChange = vi.fn(); + const { container, rerender } = render( + , + ); + const before = canvas(container); + expect(before).toEqual([ + ['Basic', ['Name', 'Account']], + ['Money', ['Fee']], + [t('engine.studio.designer.ungrouped', 'en'), ['Terms']], + ]); + + const money = screen.getByDisplayValue('Money'); + await userEvent.clear(money); + await userEvent.type(money, 'Pricing'); + fireEvent.blur(money); + + expect(onChange).toHaveBeenCalledTimes(1); + const patch = onChange.mock.calls[0][0] as { fields: Record>; fieldGroups: unknown }; + expect(patch.fieldGroups).toEqual([ + { key: 'basic', label: 'Basic', fields: ['name', 'account'] }, + { key: 'money', label: 'Pricing', fields: ['fee'] }, + ]); + expect(Object.values(patch.fields).map((def) => def.group)).toEqual([undefined, undefined, undefined, undefined]); + + // The saved body draws the same canvas, the rename aside. + rerender( + , + ); + expect(canvas(container)).toEqual([ + ['Basic', ['Name', 'Account']], + ['Pricing', ['Fee']], + [t('engine.studio.designer.ungrouped', 'en'), ['Terms']], + ]); + }); + + it('CONTROL: an object already in the list spelling saves only what the edit changed', async () => { + const onChange = vi.fn(); + const listed = { + name: 'crm_quote', + fields: { name: { type: 'text', label: 'Name' }, fee: { type: 'currency', label: 'Fee' } }, + fieldGroups: [{ key: 'basic', label: 'Basic', fields: ['name'] }, { key: 'money', label: 'Money', fields: ['fee'] }], + }; + render(); + const money = screen.getByDisplayValue('Money'); + await userEvent.clear(money); + await userEvent.type(money, 'Pricing'); + fireEvent.blur(money); + expect(onChange).toHaveBeenCalledTimes(1); + expect(Object.keys(onChange.mock.calls[0][0])).toEqual(['fieldGroups']); + }); +}); + +/** + * objectstack#36505 — on an installed object the canvas names where each + * field comes from, and a field another package contributes is arranged like + * any other once the `.custom` arrangement takes it. + */ +describe('ObjectFormDesigner — an installed object\'s field sources (objectstack#36505)', () => { + const draft = { + name: 'crm_lead', + fields: { + name: { type: 'text', label: 'Name' }, + region__c: { type: 'text', label: 'Region' }, + visit_count: { type: 'number', label: 'Visits' }, + }, + }; + const contributed = new Map([ + ['visit_count', { kind: 'field' as const, object: 'crm_lead', name: 'visit_count', packageId: 'com.acme.visits', packageName: 'Visits' }], + ]); + const sources = new Map([['name', 'base' as const], ['region__c', 'environment' as const]]); + const card = (label: string) => screen.getByText(label).closest('[aria-label]') as HTMLElement; + + it('marks the original package\'s field and this environment\'s, and the contributed one with its package', () => { + render( + , + ); + expect(within(card('Name')).getByTestId('field-source-mark')).toHaveAttribute('data-source', 'base'); + expect(within(card('Name')).getByTestId('field-source-mark')).toHaveTextContent(t('engine.studio.designer.source.base', 'en')); + expect(within(card('Region')).getByTestId('field-source-mark')).toHaveAttribute('data-source', 'environment'); + expect(within(card('Visits')).queryByTestId('field-source-mark')).toBeNull(); + expect(within(card('Visits')).getByTestId('contribution-mark')).toHaveAttribute('data-package', 'com.acme.visits'); + // Arranged: the contributed card is a drag source like the others. + expect(card('Visits')).toHaveAttribute('aria-roledescription', t('engine.studio.designer.fieldRole', 'en')); + }); + + it('CONTROL: without the arrangement a contributed card is not dragged, and a writable package draws no source', () => { + render( + , + ); + expect(screen.queryAllByTestId('field-source-mark')).toHaveLength(0); + expect(card('Visits').getAttribute('aria-roledescription') ?? '').toBe(''); + }); +}); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioCustomizeControls.objectExtension-28575.test.ts b/ui/packages/app-shell/src/views/studio-design/StudioCustomizeControls.objectExtension-28575.test.ts index b2bd4853c0d..dee9a0655ef 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioCustomizeControls.objectExtension-28575.test.ts +++ b/ui/packages/app-shell/src/views/studio-design/StudioCustomizeControls.objectExtension-28575.test.ts @@ -23,7 +23,9 @@ import { foldObjectExtension, objectExtensionBodyOf, routeFoldedFieldsEdit, + withoutReplacedPlacements, } from './StudioCustomizeControls.js'; +import { groupMembership, readFields } from '../metadata-admin/previews/object-fields-io.js'; const OBJECT = 'crm_account'; const served = { @@ -134,3 +136,60 @@ describe('an edit of the folded fields, routed (#28575)', () => { ).toEqual({ extend: OBJECT, fieldPatches: { name: { label: 'Company' } } }); }); }); + +describe('the extension\'s whole field arrangement, folded and written (objectstack#36505)', () => { + const grouped = { + name: OBJECT, + fieldGroups: [{ key: 'basic', label: 'Basic' }, { key: 'more', label: 'More' }], + fields: { + name: { type: 'text', label: 'Account Name', group: 'basic' }, + industry: { type: 'select', label: 'Industry', group: 'basic' }, + notes: { type: 'textarea', label: 'Notes', group: 'more' }, + }, + }; + const membersOf = (object: Record) => + [...groupMembership(readFields(object.fields), object.fieldGroups).members]; + + it('the buffer\'s fieldGroups replace the object\'s, as the registry fold serves them', () => { + const ext = { + extend: OBJECT, + fields: { region__c: { type: 'text', label: 'Region', group: 'more' } }, + fieldGroups: [ + { key: 'more', label: 'More', fields: ['industry', 'notes'] }, + { key: 'mine', label: 'Mine', fields: ['region__c'] }, + ], + }; + const folded = foldObjectExtension(grouped, ext); + expect((folded.fieldGroups as Array<{ key: string }>).map((g) => g.key)).toEqual(['more', 'mine']); + // `name` named `basic`, which the arrangement no longer has: it shows + // after the last group. `industry` follows the list that names it. + expect(membersOf(folded)).toEqual([ + ['more', ['industry', 'notes']], + ['mine', ['region__c']], + ]); + const fields = folded.fields as Record>; + expect(fields.name.group).toBeUndefined(); + expect(fields.industry.group).toBe('more'); + }); + + it('CONTROL: an extension with no fieldGroups leaves the object\'s groups as served', () => { + const folded = foldObjectExtension(grouped, { extend: OBJECT, fields: {} }); + expect(folded.fieldGroups).toBe(grouped.fieldGroups); + expect(membersOf(folded)).toEqual(membersOf(grouped)); + }); + + it('a field or group placement beside the arrangement is taken off; a list placement stays', () => { + const body = { + extend: OBJECT, + place: [ + { field: 'region__c', after: 'name' }, + { group: { key: 'mine', label: 'Mine' }, after: 'basic' }, + { list: 'crm_visit', after: 'crm_contact' }, + ], + }; + expect(withoutReplacedPlacements(body)).toEqual({ extend: OBJECT, place: [{ list: 'crm_visit', after: 'crm_contact' }] }); + expect(withoutReplacedPlacements({ extend: OBJECT, place: [{ field: 'region__c', after: 'name' }] })).toEqual({ extend: OBJECT }); + const untouched = { extend: OBJECT, place: [{ list: 'crm_visit', after: 'crm_contact' }] }; + expect(withoutReplacedPlacements(untouched)).toBe(untouched); + }); +}); From fef9376528a0b607abb624f08491e49d290b5558 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 06:32:47 +0000 Subject: [PATCH 3/7] test(studio): the installed object's Field layout writes the whole arrangement into its pair Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01WGufzhpykmQZe1yMupC2CU --- ...aPillar.baseObjectExtension-28575.test.tsx | 91 ++++++++++++++++++- ...aPillar.internalFormRetired-36425.test.tsx | 18 ++-- ...mizeControls.objectExtension-28575.test.ts | 15 +++ .../studio-design/StudioCustomizeControls.tsx | 15 ++- 4 files changed, 128 insertions(+), 11 deletions(-) diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.baseObjectExtension-28575.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.baseObjectExtension-28575.test.tsx index f8eed0d7cfc..6481853408d 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.baseObjectExtension-28575.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.baseObjectExtension-28575.test.tsx @@ -149,6 +149,7 @@ vi.mock('@object-ui/plugin-view', async (importOriginal) => { // warmed here so its first load is paid at import, not inside a test's clock. import '@objectstack/lint'; import { DataPillar, type StudioBaseCustomization } from './StudioDesignSurface'; +import { ObjectExtensionSchema } from '@objectstack/spec/data'; import { StudioSaveHarness, pressStudioSave } from './__tests__/studioSaveHarness'; import { t, tFormat } from '../metadata-admin/i18n'; import { emitMetadataRefresh } from '../../assistant/assistantBus'; @@ -235,9 +236,14 @@ async function addFromFormToolbar(label: string): Promise { await userEvent.click(within(popover).getByTestId('add-field-create')); } -/** A field card of the Form layout, by its label (a base object's layout is read-only). */ -const cardOf = (label: string) => - screen.queryAllByLabelText(tFormat('engine.studio.designer.fieldAriaReadOnly', 'en', { label })); +/** + * A field card of the Field layout, by its label: arranged in the pair's + * extension where it is writable (objectstack#36505), read-only where walled. + */ +const cardOf = (label: string) => [ + ...screen.queryAllByLabelText(tFormat('engine.studio.designer.fieldAria', 'en', { label })), + ...screen.queryAllByLabelText(tFormat('engine.studio.designer.fieldAriaReadOnly', 'en', { label })), +]; describe('Studio adds a field to a read-only base object as an extension in its pair (objectstack#28575)', () => { it('Add field "Region" asks the ensure door once, writes region__c into an extension at the pair, and sends no body of the base object', async () => { @@ -563,3 +569,82 @@ describe('a base object follows an extension draft the copilot writes (objectsta expect(extensionDraftReads()).toBe(before + 1); }); }); + +/** + * objectstack#36505 (ADR-0146 D10) — the 「字段布局」 tab of an installed + * object: no longer walled read-only, its edits go into the pair's extension + * as the WHOLE arrangement (`fieldGroups`, every group listing its members), + * saved and published by the extension's Save with the rest of the buffer; + * the base object is never written, and the canvas marks each field's source. + */ +describe('the Field layout tab arranges an installed object into its pair (objectstack#36505)', () => { + const groupedServed = () => ({ + ...baseServed(), + fieldGroups: [{ key: 'basic', label: 'Basic' }, { key: 'more', label: 'More' }], + fields: { + name: { type: 'text', label: 'Account Name', required: true, group: 'basic' }, + industry: { type: 'select', label: 'Industry', options: [{ value: 'technology', label: 'Technology' }], group: 'more' }, + // Served in `more`, where the pair's published placement put it. + region__c: { type: 'text', label: 'Region', group: 'more' }, + }, + }); + const DELETE_GROUP = t('engine.studio.designer.groupDelete', 'en'); + const sourceOf = (label: string) => within(cardOf(label)[0]!).queryByTestId('field-source-mark')?.getAttribute('data-source'); + + beforeEach(() => { + srv.served = groupedServed(); + srv.publishedExt = { + extend: OBJECT, + fields: { region__c: { type: 'text', label: 'Region' } }, + fieldPatches: { name: { label: 'Account Name' } }, + place: [{ field: 'region__c', group: 'more' }, { list: 'crm_contact', after: 'sys_activity' }], + _packageId: PAIR, + }; + }); + + it('the tab reads Field layout and says where its groups are used; the canvas is editable and marks each source', async () => { + await renderBase(); + expect(FORM).toBe('Field layout'); + await openForm(); + expect(screen.getByTestId('form-layout-used-on')).toHaveTextContent(t('engine.studio.data.form.usedOn', 'en')); + expect(await screen.findByTestId('form-designer-add-section-footer')).toBeInTheDocument(); + await waitFor(() => expect(sourceOf('Region')).toBe('environment'), { timeout: 8000 }); + expect(sourceOf('Account Name')).toBe('base'); + expect(sourceOf('Industry')).toBe('base'); + }); + + it('deleting a group writes the whole arrangement into the pair, keeps every other key, and never writes the base', async () => { + await renderBase(); + await openForm(); + await screen.findByDisplayValue('Basic', undefined, { timeout: 8000 }); + const basic = screen.getByDisplayValue('Basic').closest('.\\@container') as HTMLElement; + await userEvent.click(within(basic).getByRole('button', { name: DELETE_GROUP })); + await pressStudioSave(); + await waitFor(() => expect(extensionSaves()).toHaveLength(1), { timeout: 8000 }); + + const [, name, body, opts] = extensionSaves()[0]; + expect([name, opts.packageId]).toEqual([OBJECT, PAIR]); + // The whole arrangement, every group listing its members: `name` left + // `basic` with it, so it is listed nowhere and shows after the last group. + expect(body.fieldGroups).toEqual([{ key: 'more', label: 'More', fields: ['industry', 'region__c'] }]); + // Every other key of the stored extension is kept; the field placement + // the arrangement replaces is taken off, the tab placement stays. + expect(body.fields).toEqual({ region__c: { type: 'text', label: 'Region' } }); + expect(body.fieldPatches).toEqual({ name: { label: 'Account Name' } }); + expect(body.place).toEqual([{ list: 'crm_contact', after: 'sys_activity' }]); + const parsed = ObjectExtensionSchema.safeParse(body); + expect(parsed.success, JSON.stringify(parsed.error?.issues)).toBe(true); + expect(saves().some(([type]) => type === 'object')).toBe(false); + expect(mockClient.publish).toHaveBeenCalledWith('object_extension', OBJECT, expect.objectContaining({ packageId: PAIR })); + }); + + it('CONTROL: walled, the layout stays read-only and nothing is written', async () => { + await renderBase({ walled: true }); + await openForm(); + await screen.findByText('Basic', undefined, { timeout: 8000 }); + expect(screen.queryByTestId('form-designer-add-section-footer')).toBeNull(); + expect(screen.queryByRole('button', { name: DELETE_GROUP })).toBeNull(); + await new Promise((r) => setTimeout(r, 300)); + expect(mockClient.save).not.toHaveBeenCalled(); + }); +}); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.internalFormRetired-36425.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.internalFormRetired-36425.test.tsx index 9efa6fe9004..224dadd55e9 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.internalFormRetired-36425.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.internalFormRetired-36425.test.tsx @@ -15,7 +15,7 @@ * * Pinned: * - an object with a default internal form view: the field groups are the - * canvas, the chip says so, Add group then the top bar's Save + * canvas, the tab says where they are used (objectstack#36505), Add group then the top bar's Save * (objectstack#36511) saves the object's `fieldGroups` and writes no view; Preview shows the field groups, not the view's sections; * - CONTROL: no form view: the same canvas and the same save. */ @@ -173,7 +173,7 @@ async function openForm(props: { readOnly?: boolean; customization?: StudioBaseC /** The headings the canvas draws for its declared sections. */ const sectionTitles = () => screen.queryAllByRole('textbox', { name: SECTION_NAME }).map((el) => (el as HTMLInputElement).value); -const chip = () => screen.getByTestId('form-layout-source-chip'); +const usedOn = () => screen.getByTestId('form-layout-used-on'); type SaveCall = [string, string, Record, { packageId?: string; mode?: string }]; const saves = () => mockClient.save.mock.calls as unknown as SaveCall[]; @@ -183,7 +183,7 @@ describe('the Form tab lays out by field groups, internal form or not (objectsta await openForm(); await waitFor(() => expect(sectionTitles()).toEqual(['Designer group'])); - expect(chip()).toHaveAttribute('data-source', 'field-groups'); + expect(usedOn()).toHaveTextContent(t('engine.studio.data.form.usedOn', 'en')); expect(screen.queryByDisplayValue('Basic info')).toBeNull(); expect(screen.queryByTestId('form-layout-flow')).toBeNull(); @@ -192,10 +192,13 @@ describe('the Form tab lays out by field groups, internal form or not (objectsta await waitFor(() => expect(saves().length).toBe(1), { timeout: 4000 }); const [type, name, body] = saves()[0]; expect([type, name]).toEqual(['object', OBJECT]); + // objectstack#36505 — the first save converts the older per-field + // `group` to the group's own list. expect(body.fieldGroups).toEqual([ - { key: 'designer', label: 'Designer group' }, + { key: 'designer', label: 'Designer group', fields: ['name'] }, { key: 'new_group', label: NEW_GROUP }, ]); + expect((body.fields as Record>).name.group).toBeUndefined(); expect(saves().some(([ty]) => ty === 'view')).toBe(false); }); @@ -218,7 +221,7 @@ describe('the Form tab lays out by field groups, internal form or not (objectsta await openForm(); await waitFor(() => expect(sectionTitles()).toEqual(['Designer group'])); - expect(chip()).toHaveAttribute('data-source', 'field-groups'); + expect(usedOn()).toHaveTextContent(t('engine.studio.data.form.usedOn', 'en')); expect(screen.getByText(UNGROUPED)).toBeInTheDocument(); await userEvent.click(screen.getByTestId('form-designer-add-section-footer')); @@ -226,10 +229,13 @@ describe('the Form tab lays out by field groups, internal form or not (objectsta await waitFor(() => expect(saves().length).toBe(1), { timeout: 4000 }); const [type, name, body] = saves()[0]; expect([type, name]).toEqual(['object', OBJECT]); + // objectstack#36505 — the first save converts the older per-field + // `group` to the group's own list. expect(body.fieldGroups).toEqual([ - { key: 'designer', label: 'Designer group' }, + { key: 'designer', label: 'Designer group', fields: ['name'] }, { key: 'new_group', label: NEW_GROUP }, ]); + expect((body.fields as Record>).name.group).toBeUndefined(); expect(saves().some(([ty]) => ty === 'view')).toBe(false); }); }); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioCustomizeControls.objectExtension-28575.test.ts b/ui/packages/app-shell/src/views/studio-design/StudioCustomizeControls.objectExtension-28575.test.ts index dee9a0655ef..61410c108fd 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioCustomizeControls.objectExtension-28575.test.ts +++ b/ui/packages/app-shell/src/views/studio-design/StudioCustomizeControls.objectExtension-28575.test.ts @@ -193,3 +193,18 @@ describe('the extension\'s whole field arrangement, folded and written (objectst expect(withoutReplacedPlacements(untouched)).toBe(untouched); }); }); + +describe('a field the extension places into a group stays there when its declaration is laid over (objectstack#36505)', () => { + it('keeps the served group of a placed field, and only of a placed one', () => { + const servedPlaced = { + name: OBJECT, + fieldGroups: [{ key: 'more', label: 'More' }], + fields: { name: { type: 'text', label: 'Account Name' }, region__c: { type: 'text', label: 'Region', group: 'more' } }, + }; + const region = { type: 'text', label: 'Region' }; + const placed = foldObjectExtension(servedPlaced, { extend: OBJECT, fields: { region__c: region }, place: [{ field: 'region__c', group: 'more' }] }); + expect((placed.fields as Record>).region__c.group).toBe('more'); + const unplaced = foldObjectExtension(servedPlaced, { extend: OBJECT, fields: { region__c: region } }); + expect((unplaced.fields as Record>).region__c.group).toBeUndefined(); + }); +}); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioCustomizeControls.tsx b/ui/packages/app-shell/src/views/studio-design/StudioCustomizeControls.tsx index ef14aef1e3e..d81cef9344d 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioCustomizeControls.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioCustomizeControls.tsx @@ -547,11 +547,22 @@ export function foldObjectExtension( const patch = patches[entry.name]; entries.push(isPlainRecord(patch) ? { name: entry.name, def: applyFieldPatch(entry.def, patch) } : entry); } + // objectstack#36505 — a field the extension places into a group (`place` + // `{ field, group }`) is served in that group: laying the extension's own + // declaration (which carries no `group`) over the served field keeps it. + const placedIn = new Set(); + if (Array.isArray(ext.place)) { + for (const entry of ext.place) { + if (isPlainRecord(entry) && typeof entry.field === 'string' && typeof entry.group === 'string') placedIn.add(entry.field); + } + } for (const [name, def] of Object.entries(own)) { if (!isPlainRecord(def)) continue; const at = entries.findIndex((e) => e.name === name); - if (at >= 0) entries[at] = { name, def }; - else entries.push({ name, def }); + const servedGroup = at >= 0 ? entries[at].def.group : undefined; + const laid = placedIn.has(name) && def.group === undefined && typeof servedGroup === 'string' ? { ...def, group: servedGroup } : def; + if (at >= 0) entries[at] = { name, def: laid }; + else entries.push({ name, def: laid }); } if (!Array.isArray(ext.fieldGroups)) return { ...object, fields: writeFields({ shape: view.shape, entries }) }; return applyExtensionFieldGroups({ ...object, fields: writeFields({ shape: view.shape, entries }) }, ext.fieldGroups, own); From bb18a4ded76e60418d30f80544830bd8a8bbc9f9 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 06:34:13 +0000 Subject: [PATCH 4/7] docs(qa): the checklist names the Field layout tab; changeset for the Field layout tab Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01WGufzhpykmQZe1yMupC2CU --- .changeset/36505-field-layout-tab.md | 17 +++++++++ .../areas/access-security.json | 10 ++++-- .../areas/studio-authoring.json | 35 ++++++++++++++----- 3 files changed, 52 insertions(+), 10 deletions(-) create mode 100644 .changeset/36505-field-layout-tab.md diff --git a/.changeset/36505-field-layout-tab.md b/.changeset/36505-field-layout-tab.md new file mode 100644 index 00000000000..0ee4a476fb4 --- /dev/null +++ b/.changeset/36505-field-layout-tab.md @@ -0,0 +1,17 @@ +--- +'@object-ui/app-shell': patch +'@object-ui/i18n': patch +--- + +feat(studio): the object page's 「表单」 tab is now 「字段布局」 (Field layout), edits the object's field groups only, and arranges an installed object into its paired `.custom` package + +Clause-②: no +Metadata-protocol: none + +The Studio object page's Form tab is renamed 「字段布局」 / Field layout, and says in one sentence where its groups and order are used: the record page, the right-side preview, and the create and edit dialogs. It reads and writes the object's field groups and nothing else; no form view is read or written there. + +Group membership and order are saved in each group's own `fields` list. An object still written with a `group` on each field shows its groups as before, and its first save from the tab converts it to the lists, with nothing on the canvas moving. + +On an object of an installed (read-only) package the tab is no longer read-only where the customization door is open: adding, renaming, deleting and reordering groups, dragging fields (a field another package brings included) and the group settings all edit the object extension of the base's paired `.custom` package, as the whole `fieldGroups` arrangement (every group listing its members), saved and published by the top bar's Save with the rest of that extension. The original package is not written. A field or group `place` entry of that extension, which a written arrangement replaces, is taken off on save; a tab placement stays. Each field card of an installed object is marked 「原始包」 / Original package, 「本环境」 / This environment, or with the package that contributes it. Where the door is walled the tab stays read-only, as before. + +New Studio strings: `engine.studio.data.form.usedOn` and `engine.studio.designer.source.{base,baseTitle,environment,environmentTitle}` (en, zh); `engine.studio.data.form.layoutSource.*` is removed with the chip it labelled. diff --git a/docs/qa/platform-checklist/areas/access-security.json b/docs/qa/platform-checklist/areas/access-security.json index e897e686f43..60f92079207 100644 --- a/docs/qa/platform-checklist/areas/access-security.json +++ b/docs/qa/platform-checklist/areas/access-security.json @@ -405,7 +405,7 @@ "title": "A read-only package actually locks Studio editing surfaces", "since": "v16", "status": "active", - "revision": 6, + "revision": 7, "priority": "P2", "surface": "mixed", "personas": [ @@ -428,7 +428,7 @@ { "clause": "the read-only badge renders AND the controls are actually disabled — checkboxes/Save inert, edit affordances absent", "oracle": "dom", - "verify": "after screenshot confirms render, assert disabled state on the controls (a badge alone is not a lock). The object designer's Form tab is the designed exception: on a read-only base it stays editable and saves the form view as a declared override in the base's .custom pair, not into the base (ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx formViewReadOnly; ADR-0146 D2), so editable Form-tab controls are not a FAIL; they are inert only when the pair is walled or no form view is chosen", + "verify": "after screenshot confirms render, assert disabled state on the controls (a badge alone is not a lock). The object designer's Field layout tab (字段布局, formerly Form) is the designed exception: on a read-only base it stays editable and saves the object's field groups as the whole fieldGroups arrangement of the object extension in the base's .custom pair, not into the base (ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx layoutWritable; ADR-0146 D10), so editable Field-layout controls are not a FAIL; they are inert only when the pair is walled", "evidence": "screenshot + disabled-state DOM read" }, { @@ -500,6 +500,12 @@ "date": "2026-11-14", "change": "acceptance[0].verify re-pointed (card #33332; QA run #33094 comment 6852480973): the run found the Form tab editable on a read-only base. That is by design: StudioDesignSurface.tsx makes the Form tab read-only only when no form view is chosen or the pair is walled, because its save lands as a declared override in the base's .custom pair (ADR-0146 D2), never in the base. The verify now names that exception so it is not scored as the lock failing. The clause is unchanged. Read from source at base fca5f89c", "ref": "#33332" + }, + { + "revision": 7, + "date": "2026-11-24", + "change": "acceptance[0].verify re-pointed (card #36505): the Form tab is renamed Field layout (字段布局) and edits the object's field groups only; no form view is read or written there. On a read-only base its edits go into the .custom pair's object extension as the whole fieldGroups arrangement (ADR-0146 D10), and it is read-only only where the pair is walled.", + "ref": "#36505" } ] }, diff --git a/docs/qa/platform-checklist/areas/studio-authoring.json b/docs/qa/platform-checklist/areas/studio-authoring.json index f7ac81581b4..d0b74435300 100644 --- a/docs/qa/platform-checklist/areas/studio-authoring.json +++ b/docs/qa/platform-checklist/areas/studio-authoring.json @@ -9,7 +9,7 @@ "title": "The first-run authoring loop closes: package → object → record → app → publish → end-user, zero code, zero restarts", "since": "v16", "status": "active", - "revision": 13, + "revision": 14, "priority": "P0", "surface": "mixed", "personas": ["admin (seeded admin@objectos.ai)", "end user (same account driving the published app)"], @@ -28,7 +28,7 @@ "steps": [ "boot the showcase example (objectstack dev --ui --seed-admin -p -d file:/tmp//data.db), sign in as admin@objectos.ai/admin123, and note the boot timestamp in the server log (the zero-restart clause reads it later). Run steps[0] to [8] once per locale leg (fixtures.requires[0]): the en leg, then the zh-CN leg, each switched with the avatar-menu language switcher right after sign-in", "Home → the build chip → create a NEW writable package (维修中心 / com.example.repairs, namespace repairs) via the new-package wizard. Type the identifier yourself: since #29734 a Chinese display name derives its id through pinyin (维修中心 gives com.ORG.weixiu-zhongxin, deriveCreatePackageId in ui/packages/app-shell/src/views/metadata-admin/PackageFormDialog.tsx), which is not the id the later steps name, and the namespace derives from the id you type. The build chip has two forms (ui/packages/app-shell/src/console/home/HomePage.tsx): with an agent catalog it reads 'Build an app' (data-testid home-build-app) and opens the Studio landing, where New package opens the wizard; with none it reads 'New in Studio' (home-build-in-studio) and opens Studio with the New package dialog already open, the form QA run #27481 met on the stock showcase. Record which", - "Data pillar → new object 'Repair Ticket' (the identifier auto-suggests repair_ticket from the display name, and the dialog PREFIXES it with the package namespace, so the object is named repairs_repair_ticket — the name every later step and clause uses (framework#2694, objectui StudioDesignSurface prefixObjectName). The dialog also carries an OWD (sharing model) choice, pre-selected to the platform's recommended baseline: confirm or change it, then click 'Save as draft', the dialog's confirm button (engine.studio.createDraft; no Studio create dialog has a button named Create)) → add a picklist field Status with 3 values. After a navigation the object surface opens on its Records tab (the Data pillar's default view, ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx); Add field is the Form tab's button (where QA run #28545 found it; the Records grid's add-column header carries it too). Each option's stored value derives from its label as you type it — 'In Repair' stores in_repair (ui/packages/app-shell/src/views/metadata-admin/inspectors/ObjectFieldInspector.tsx OptionsEditor) — so overwrite the value wherever the run wants a different one (a short code such as wip), and note the three stored values: acceptance[1] and acceptance[2] read them. There is no Save draft button: the designer autosaves, and a picklist field is held unsaved until it has at least one option (the status line reads 'Not saved yet: the field “Status” needs at least one option'), so add the field and fill its options, and the draft save fires", + "Data pillar → new object 'Repair Ticket' (the identifier auto-suggests repair_ticket from the display name, and the dialog PREFIXES it with the package namespace, so the object is named repairs_repair_ticket — the name every later step and clause uses (framework#2694, objectui StudioDesignSurface prefixObjectName). The dialog also carries an OWD (sharing model) choice, pre-selected to the platform's recommended baseline: confirm or change it, then click 'Save as draft', the dialog's confirm button (engine.studio.createDraft; no Studio create dialog has a button named Create)) → add a picklist field Status with 3 values. After a navigation the object surface opens on its Records tab (the Data pillar's default view, ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx); Add field is the Field layout tab's (字段布局, formerly Form) button (where QA run #28545 found it; the Records grid's add-column header carries it too). Each option's stored value derives from its label as you type it — 'In Repair' stores in_repair (ui/packages/app-shell/src/views/metadata-admin/inspectors/ObjectFieldInspector.tsx OptionsEditor) — so overwrite the value wherever the run wants a different one (a short code such as wip), and note the three stored values: acceptance[1] and acceptance[2] read them. There is no Save draft button: the designer autosaves, and a picklist field is held unsaved until it has at least one option (the status line reads 'Not saved yet: the field “Status” needs at least one option'), so add the field and fill its options, and the draft save fires", "open the Changes panel and Publish, then confirm with 'Publish all' in the review sheet; the toast names the count — 'Published N items in this package' (N = the drafts promoted), 'Published 1 item in this package' for one (engine.studio.publishedAllCount / publishedAllCountOne, objectui#11807; 'Published all drafts in this package' is the fallback when the count is unknown) — and, because the publish puts an object live, it adds 'Members can use it once a permission set grants them access.' with an 'Open Access' action (StudioDesignSurface.tsx)", "create a record in the runtime-faithful Records grid with a Status value chosen", "Create app 'Repair Center' (identifier auto-suggested) → Interfaces pillar → add a nav item bound to repairs_repair_ticket → Publish", @@ -99,7 +99,8 @@ { "revision": 10, "date": "2026-11-01", "change": "QA run #28545 (W3-C1R) finding on steps[2]: the object surface opens on Records after a navigation, Add field is on the Form tab, and an option's stored value derives from its label ('In Repair' gives in_repair), so a run that wants wip must overwrite it. steps[2] now says so, read from source (StudioDesignSurface.tsx viewMode default 'grid'; OptionsEditor derives a new row's value with toFieldNameOrEmpty). The same card's steps[3] finding, the stale publish toast, was fixed upstream by revision 9 (#28526, after eeec88d1). No clause changed. Read from source at base 6b9c1ca991. Wave anchor #27377, wave-3 accuracy slice S9 (#28641); finding parked in anchor comment 6554042054", "ref": "#28545" }, { "revision": 11, "date": "2026-11-03", "change": "fixtures.requires[0], steps[0] and a new negative[2] name two locale legs, en and zh-CN, and a clause holds only on both; a new fixtures.knownGaps[3] records the zh-CN leg's open failure; steps[1]'s identifier note follows pinyin derivation. QA run #29672 found the item named no locale while steps[1] uses a Chinese display name: its en leg passed and its zh-CN leg failed acceptance[2] (#29673, extracted by the run), so a run that drove one locale could score the loop either way. Read at base 339f63da30: the registry judge and the swallowed registration are unchanged and #29673 is open; and since #29734 (11c4eb59dd) a Chinese display name derives a pinyin package id (deriveCreatePackageId), so steps[1]'s 'derives no package id' no longer held, while its instruction to type com.example.repairs stands. No clause text changed; each now holds per leg. Card #29679, from QA run #29672", "ref": "#29679" }, { "revision": 12, "date": "2026-11-04", "change": "acceptance[0].verify re-pointed: the Studio package switcher, which declares the studio-pkg-chip testid, moved unchanged from ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx to PackageSwitcher.tsx beside it (#29988 slice 2, a move-only split). Re-read at base f7aab8958. No clause changed", "ref": "#29988" }, - { "revision": 13, "date": "2026-11-04", "change": "fixtures.knownGaps[3] corrected from QA run #29877 (W5-P0, at 589049b0; the list of record is comment 6600018008 on #27377): the zh-CN leg's acceptance[2] failure is fixed by PR #29790 (#29673 closed), and the run read that leg passing acceptance[2] and [3], so the instruction to score it FAIL citing #29673 is withdrawn and the row is a regression row. Read at base f68b47ca", "ref": "#29906" } + { "revision": 13, "date": "2026-11-04", "change": "fixtures.knownGaps[3] corrected from QA run #29877 (W5-P0, at 589049b0; the list of record is comment 6600018008 on #27377): the zh-CN leg's acceptance[2] failure is fixed by PR #29790 (#29673 closed), and the run read that leg passing acceptance[2] and [3], so the instruction to score it FAIL citing #29673 is withdrawn and the row is a regression row. Read at base f68b47ca", "ref": "#29906" }, + { "revision": 14, "date": "2026-11-24", "change": "steps name the object page tab by its new name, Field layout (字段布局, formerly Form; card #36505).", "ref": "#36505" } ] }, { @@ -107,7 +108,7 @@ "title": "Object designer round-trip: field add/edit/reorder persists to metadata, identifiers derive and survive typing", "since": "v16", "status": "active", - "revision": 13, + "revision": 14, "priority": "P1", "surface": "mixed", "personas": ["admin"], @@ -126,7 +127,7 @@ "add a Text field, set its label to 'Asset Code', blur — the API name input must derive asset_code (F3)", "add a Picklist field and author its 3 real options, THEN add one EMPTY option row; wait out the debounced live validation — no validation banner may appear for the empty row (F4). ⚠ Order matters: with NO real option yet the select-needs-options banner fires, legitimately — the empty rows ARE dropped, so the field has no options — which collides with a literal 'no banner' (objectui F4, as repaired at 0b36ffa, gives its picklist one real option first for this reason). Assert the empty-row half with real options present", "let the autosave land (Studio has no Save button; on the Data pillar the autosave shows as the PUT …?mode=draft answering 200 and the header chip 'Draft · N unpublished', engine.studio.itemDraftPending; QA run #29893 found no 'Saved HH:MM' status there), then Publish → the review sheet → 'Publish all'; GET /api/v1/meta/object/NS_repair_asset and record the full field list and its order", - "reopen the object in the Data pillar: rename one picklist value, then reorder the fields on the Form tab — the form designer is dnd-kit (ObjectFormDesigner.tsx: a PointerSensor with a 4 px activation distance and a KeyboardSensor), so drag with intermediate pointer moves past 4 px, or focus a field's drag handle and press Space, an arrow key, Space; a single synthetic jump does not start a drag (automation-input). Let the autosave land and Publish again", + "reopen the object in the Data pillar: rename one picklist value, then reorder the fields on the Field layout tab (字段布局, formerly Form) — the form designer is dnd-kit (ObjectFormDesigner.tsx: a PointerSensor with a 4 px activation distance and a KeyboardSensor), so drag with intermediate pointer moves past 4 px, or focus a field's drag handle and press Space, an arrow key, Space; a single synthetic jump does not start a drag (automation-input). Let the autosave land and Publish again", "GET /api/v1/meta/object/NS_repair_asset again — the rename AND the new field order must be in the persisted metadata, not just the canvas", "create a record via the Records tab and GET /api/v1/data/NS_repair_asset/ — the stored column key must be the derived API name (asset_code)" ], @@ -232,6 +233,12 @@ "date": "2026-11-04", "change": "steps[4] corrected from QA run #29893 (W5-STUDIO, at 589049b0): the Data pillar shows no 'Saved HH:MM' line; the autosave is read as the draft PUT's 200 and the 'Draft · N unpublished' chip. Wording only. Read at base f68b47ca", "ref": "#29906" + }, + { + "revision": 14, + "date": "2026-11-24", + "change": "steps name the object page tab by its new name, Field layout (字段布局, formerly Form; card #36505).", + "ref": "#36505" } ] }, @@ -2260,7 +2267,7 @@ "title": "Studio asks before an unsent edit is left behind: a held (incomplete) or dirty edit in any pillar survives a pillar switch, a rail switch, the package switcher, Home and a reload — or is discarded only after the author confirms", "since": "v18", "status": "active", - "revision": 10, + "revision": 11, "priority": "P1", "surface": "browser", "personas": [ @@ -2380,6 +2387,12 @@ "date": "2026-11-15", "change": "steps[4]: departure (a) from the Automations pillar must use another pillar's link, since the Automations link is a no-op there (QA run #33861, comment 6894395705; ledger 6896511848 of #33761 row 167; the record numbers it steps[2]). The clauses are unchanged. Read at base 895783a1", "ref": "#33981" + }, + { + "revision": 11, + "date": "2026-11-24", + "change": "steps name the object page tab by its new name, Field layout (字段布局, formerly Form; card #36505).", + "ref": "#36505" } ] }, @@ -3243,7 +3256,7 @@ "title": "The Data pillar's API tab is a truthful REST reference: five endpoints under /api/v1/data/OBJECT, an example body built from the object's draft fields that the write path accepts, and copied cURL commands that succeed once a token is put in", "since": "v18", "status": "active", - "revision": 3, + "revision": 4, "priority": "P2", "surface": "mixed", "personas": [ @@ -3259,7 +3272,7 @@ }, "steps": [ "open /_console/studio/PKG/data → the object → API: list the endpoints the tab shows (method + path) and read the create example body", - "add a field in the Form tab WITHOUT publishing; return to API and re-read the example body (with the inspector panel open, the flat tabs, API among them, fold into 'Advanced' below about 1000 px of container width: reach API through Advanced or close the panel)", + "add a field in the Field layout tab (字段布局, formerly Form) WITHOUT publishing; return to API and re-read the example body (with the inspector panel open, the flat tabs, API among them, fold into 'Advanced' below about 1000 px of container width: reach API through Advanced or close the panel)", "publish; copy each endpoint's cURL (Copy cURL), replace with the session token and each `` placeholder (a REQUIRED reference) with the id of an existing TARGET record, and run them in order: list, create (with the tab's example body), get, update, delete on the created id" ], "acceptance": [ @@ -3316,6 +3329,12 @@ "date": "2026-11-04", "change": "steps[1] annotated from QA run #29893 (W5-STUDIO, at 589049b0): with the inspector open the tabs fold into 'Advanced' in a narrow container. Wording only. Read at base f68b47ca", "ref": "#29906" + }, + { + "revision": 4, + "date": "2026-11-24", + "change": "steps name the object page tab by its new name, Field layout (字段布局, formerly Form; card #36505).", + "ref": "#36505" } ] }, From 2f815c509df4d34997e014d7d970fd6823495c05 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 06:57:26 +0000 Subject: [PATCH 5/7] test(studio): the move pins read the first save's list-spelling conversion Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01WGufzhpykmQZe1yMupC2CU --- .../ObjectFormDesigner.keyboardDrop-11871.test.tsx | 14 +++++++++----- .../ObjectFormDesigner.pinnedFields-27516.test.tsx | 6 +++++- .../StudioDesignSurface.oneSurface-28572.test.tsx | 6 ++++-- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/ui/packages/app-shell/src/views/studio-design/ObjectFormDesigner.keyboardDrop-11871.test.tsx b/ui/packages/app-shell/src/views/studio-design/ObjectFormDesigner.keyboardDrop-11871.test.tsx index bc6bce565ac..90ada3eedea 100644 --- a/ui/packages/app-shell/src/views/studio-design/ObjectFormDesigner.keyboardDrop-11871.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/ObjectFormDesigner.keyboardDrop-11871.test.tsx @@ -251,16 +251,20 @@ describe('a keyboard drag in the form designer reaches a drop target (objectui#1 }); describe('a move writes the group\'s own fields list, not the object\'s field order (objectstack#35900)', () => { - it('reordering inside a group changes only that group\'s fields: the fields array is untouched', async () => { + it('reordering inside a group changes only that group\'s fields: the fields array keeps its order', async () => { renderDesigner(); await keyboardMove('Phone', ['ArrowDown']); expect(said()).toBe('Phone moved to Contact, position 2 of 2.'); - // Same array, same order, same definitions: the list default columns and - // the form order read are where they were. - expect(latest.fields).toBe(DRAFT.fields); + // Same order, same definitions: the list default columns and the form + // order read are where they were. objectstack#36505: the first save also + // converts the older per-field `group` into the lists, so `phone` and + // `email` lose it and nothing else changes. + const fields = latest.fields as Field[]; + expect(fields.map((f) => f.name)).toEqual(DRAFT.fields.map((f) => f.name)); + expect(fields).toEqual(DRAFT.fields.map(({ group: _group, ...def }) => def)); expect(latest.fieldGroups).toEqual([ { key: 'contact', label: 'Contact', fields: ['email', 'phone'] }, - { key: 'new_group', label: 'New group' }, + { key: 'new_group', label: 'New group', fields: [] }, ]); }); diff --git a/ui/packages/app-shell/src/views/studio-design/ObjectFormDesigner.pinnedFields-27516.test.tsx b/ui/packages/app-shell/src/views/studio-design/ObjectFormDesigner.pinnedFields-27516.test.tsx index 7f47317b8e2..ca7174adb00 100644 --- a/ui/packages/app-shell/src/views/studio-design/ObjectFormDesigner.pinnedFields-27516.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/ObjectFormDesigner.pinnedFields-27516.test.tsx @@ -168,7 +168,11 @@ describe('the form canvas settles the platform’s pinned fields first (objectst // objectstack#35900: the section lists Owner where it was dropped (after Condition), and the // column stays exactly the platform's, so the write may still strip it and // the read put it back: the list keeps its place either way. - expect(commits).toHaveLength(0); + // objectstack#36505: the one fields write is the conversion of + // Condition's older `group` into the list; Owner's column is untouched. + expect(commits).toHaveLength(1); + expect(commits[0].owner_id).toEqual(OWNER_FIELD_DEF); + expect(commits[0].condition.group).toBeUndefined(); expect(groupCommits.at(-1)).toEqual([{ key: 'details', label: 'Details', fields: ['condition', 'owner_id'] }]); cleanup(); renderDesigner({ ...served(reload({ condition: { ...condition, group: 'details' }, notes })), fieldGroups: groupCommits.at(-1) }); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.oneSurface-28572.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.oneSurface-28572.test.tsx index c143211a1f5..0ee3c0418a5 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.oneSurface-28572.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.oneSurface-28572.test.tsx @@ -662,7 +662,8 @@ describe('items another package contributes are drawn greyed, with the package ( { timeout: 8000 }, ); expect(card).toHaveTextContent('Acme score'); - // Never a drag source, yet still a card a click selects: not announced as disabled. + // objectstack#36505: arranged in the pair's layout like any field, and a + // card a click selects: not announced as disabled. expect(card).not.toHaveAttribute('aria-disabled', 'true'); expect(within(card).getByTestId('contribution-mark')).toHaveTextContent(FROM_ACME); expect(card.getAttribute('title')).toBe( @@ -680,7 +681,8 @@ describe('items another package contributes are drawn greyed, with the package ( ); // CONTROL: the base's own field opens in the pair's display-property mode, not read-only. - fireEvent.click(screen.getByLabelText(tFormat('engine.studio.designer.fieldAriaReadOnly', 'en', { label: 'Account Name' }))); + // objectstack#36505: its card is arranged in the pair, so it reads as draggable. + fireEvent.click(screen.getByLabelText(tFormat('engine.studio.designer.fieldAria', 'en', { label: 'Account Name' }))); await waitFor(() => expect(screen.getByTestId('data-field-inspector').querySelector('[data-disabled-reason]')).toBeNull()); }); From a144b6220688b4a72a6ac5ccb64942bd342276cd Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 07:22:52 +0000 Subject: [PATCH 6/7] test(studio): the renamed Field layout tests pay the lint load at collection check:test-source-alias judges the test files a change edits; the eight that reach a dynamic import of @objectstack/lint get the module-top side-effect import the convention asks for. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01WGufzhpykmQZe1yMupC2CU --- .../__tests__/builtinDesigners.lateArrival-11939.test.tsx | 2 ++ .../studio-design/DataPillar.designerRegistryPopulated.test.tsx | 2 ++ .../studio-design/DataPillar.draftOnlyNoLayers-12508.test.tsx | 2 ++ .../studio-design/DataPillar.formDraftPreview-12515.test.tsx | 2 ++ .../src/views/studio-design/DataPillar.layoutBadge.test.tsx | 2 ++ .../StudioDesignSurface.designerRegistryMissing.test.tsx | 2 ++ .../views/studio-design/StudioDesignSurface.formFields.test.tsx | 2 ++ .../StudioDesignSurface.lateRegistration-11939.test.tsx | 2 ++ 8 files changed, 16 insertions(+) diff --git a/ui/packages/app-shell/src/views/metadata-admin/__tests__/builtinDesigners.lateArrival-11939.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/__tests__/builtinDesigners.lateArrival-11939.test.tsx index e48f39042d6..35145bd024e 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/__tests__/builtinDesigners.lateArrival-11939.test.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/__tests__/builtinDesigners.lateArrival-11939.test.tsx @@ -68,6 +68,8 @@ vi.mock('@object-ui/react', async (importOriginal) => { return { ...mod, useAdapter: () => dataSource }; }); +// The source reaches a dynamic `import('@objectstack/lint')`: its first load is paid at collection (`check:test-source-alias`). +import '@objectstack/lint'; import { DataPillar } from '../../studio-design/StudioDesignSurface'; import { createEmptyDataSource, failOnAbsorbedFetchError } from '../../studio-design/__tests__/emptyDataSource'; import { getMetadataInspector, listMetadataInspectorTypes } from '../inspector-registry'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.designerRegistryPopulated.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.designerRegistryPopulated.test.tsx index 6e3f91e71a2..486a5950044 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.designerRegistryPopulated.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.designerRegistryPopulated.test.tsx @@ -115,6 +115,8 @@ vi.mock('@object-ui/react', async (importOriginal) => { return { ...mod, useAdapter: () => dataSource }; }); +// The source reaches a dynamic `import('@objectstack/lint')`: its first load is paid at collection (`check:test-source-alias`). +import '@objectstack/lint'; import { DataPillar } from './StudioDesignSurface'; import { createEmptyDataSource, failOnAbsorbedFetchError } from './__tests__/emptyDataSource'; import { registerBuiltinInspectors } from '../metadata-admin/inspectors'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.draftOnlyNoLayers-12508.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.draftOnlyNoLayers-12508.test.tsx index 83bbbd6284a..7d0729c4449 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.draftOnlyNoLayers-12508.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.draftOnlyNoLayers-12508.test.tsx @@ -95,6 +95,8 @@ vi.mock('@object-ui/react', async (importOriginal) => { return { ...mod, useAdapter: () => dataSource }; }); +// The source reaches a dynamic `import('@objectstack/lint')`: its first load is paid at collection (`check:test-source-alias`). +import '@objectstack/lint'; import { DataPillar } from './StudioDesignSurface'; import { createEmptyDataSource } from './__tests__/emptyDataSource'; import { registerBuiltinInspectors } from '../metadata-admin/inspectors'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.formDraftPreview-12515.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.formDraftPreview-12515.test.tsx index cf5b9aad4a6..1ff4cc14fdd 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.formDraftPreview-12515.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.formDraftPreview-12515.test.tsx @@ -96,6 +96,8 @@ vi.mock('@object-ui/react', async (importOriginal) => { return { ...mod, useAdapter: () => dataSource }; }); +// The source reaches a dynamic `import('@objectstack/lint')`: its first load is paid at collection (`check:test-source-alias`). +import '@objectstack/lint'; import { DataPillar } from './StudioDesignSurface'; import { createEmptyDataSource } from './__tests__/emptyDataSource'; import { registerBuiltinInspectors } from '../metadata-admin/inspectors'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.layoutBadge.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.layoutBadge.test.tsx index 98ea9654940..89675462783 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.layoutBadge.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.layoutBadge.test.tsx @@ -25,6 +25,8 @@ import '@testing-library/jest-dom/vitest'; import * as React from 'react'; import { afterEach, describe, expect, it, vi } from 'vitest'; import { render, screen, fireEvent, cleanup } from '@testing-library/react'; +// The source reaches a dynamic `import('@objectstack/lint')`: its first load is paid at collection (`check:test-source-alias`). +import '@objectstack/lint'; import { completeAddFieldPopover } from './__tests__/dataPillarAddField'; import { MemoryRouter } from 'react-router-dom'; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.designerRegistryMissing.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.designerRegistryMissing.test.tsx index 0c6e8d571bc..fb308f8e9b0 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.designerRegistryMissing.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.designerRegistryMissing.test.tsx @@ -100,6 +100,8 @@ vi.mock('@object-ui/react', async (importOriginal) => { return { ...mod, useAdapter: () => dataSource }; }); +// The source reaches a dynamic `import('@objectstack/lint')`: its first load is paid at collection (`check:test-source-alias`). +import '@objectstack/lint'; import { AutomationsPillar, DataPillar, InterfacesPillar } from './StudioDesignSurface'; import { createEmptyDataSource, failOnAbsorbedFetchError } from './__tests__/emptyDataSource'; import { listMetadataPreviewTypes } from '../metadata-admin/preview-registry'; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.formFields.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.formFields.test.tsx index 0e8b1412292..6b65d962621 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.formFields.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.formFields.test.tsx @@ -140,6 +140,8 @@ vi.mock('@object-ui/plugin-form', async (importOriginal) => { }; }); +// The source reaches a dynamic `import('@objectstack/lint')`: its first load is paid at collection (`check:test-source-alias`). +import '@objectstack/lint'; import { DataPillar } from './StudioDesignSurface'; import { addFieldFromFormToolbar } from './__tests__/dataPillarAddField'; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.lateRegistration-11939.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.lateRegistration-11939.test.tsx index 519bcc6d795..983b5988420 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.lateRegistration-11939.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.lateRegistration-11939.test.tsx @@ -82,6 +82,8 @@ vi.mock('@object-ui/react', async (importOriginal) => { return { ...mod, useAdapter: () => dataSource }; }); +// The source reaches a dynamic `import('@objectstack/lint')`: its first load is paid at collection (`check:test-source-alias`). +import '@objectstack/lint'; import { AutomationsPillar, DataPillar, InterfacesPillar } from './StudioDesignSurface'; import { createEmptyDataSource, failOnAbsorbedFetchError } from './__tests__/emptyDataSource'; import { getMetadataPreview, registerMetadataPreview } from '../metadata-admin/preview-registry'; From 4b0d7ee635b4dd86200aad8c0435f2ef33b814dd Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 07:54:07 +0000 Subject: [PATCH 7/7] test(e2e): the customize journey opens the Field layout tab The Studio object page's Form tab is now Field layout (objectstack#36505); step 3 of studio-customize-journey clicks it by its new name. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01WGufzhpykmQZe1yMupC2CU --- ui/e2e/live/studio-customize-journey.spec.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ui/e2e/live/studio-customize-journey.spec.ts b/ui/e2e/live/studio-customize-journey.spec.ts index 063023dac65..c9e05168487 100644 --- a/ui/e2e/live/studio-customize-journey.spec.ts +++ b/ui/e2e/live/studio-customize-journey.spec.ts @@ -12,7 +12,8 @@ import { test as base, expect, type APIRequestContext, type Page, type Request, * type's list) — not what the canvas draws. * 2. Restore package original: the pair's draft and row are deleted at the * pair, and the three reads serve the shipped column set again. - * 3. Add `region__c`: Add field on the base object's Form, then the top + * 3. Add `region__c`: Add field on the base object's Field layout tab + * (字段布局, formerly Form; objectstack#36505), then the top * bar's Save (objectstack#36511), writes an `object_extension` into the * pair and publishes that one item there, so the base object is served * with the field at once and the pair's own read and export carry it. @@ -226,7 +227,7 @@ test('a read-only base is customized, restored and extended through Studio, and await test.step(`Add ${FIELD.name}: an extension in the pair, served on the base object`, async () => { await page.goto(`/studio/${BASE}/data?surface=${encodeURIComponent(`object:${OBJECT}`)}`); - await page.getByTestId('data-object-header').getByRole('button', { name: 'Form', exact: true }).click(); + await page.getByTestId('data-object-header').getByRole('button', { name: 'Field layout', exact: true }).click(); await page.getByTestId('data-form-add-extension-field').click(); await page.getByTestId('add-field-label-input').fill(FIELD.label); await expect(page.getByTestId('add-field-api-name-preview')).toContainText(FIELD.name);