diff --git a/.changeset/37456-studio-top-left-rows.md b/.changeset/37456-studio-top-left-rows.md new file mode 100644 index 00000000000..1b7fbf25e8e --- /dev/null +++ b/.changeset/37456-studio-top-left-rows.md @@ -0,0 +1,9 @@ +--- +'@object-ui/app-shell': patch +'@object-ui/i18n': patch +--- + +feat(studio): Studio's left column opens with two rows — App Studio with its collapse control, then the way back and a package switcher that ends with New package; a read-only package shows a lock; collapsed, the column is a rail that keeps the app's logo and the way back. Studio no longer has a top bar: Changes and Publish are on 概览's Pending tab (the package-less scope, now named Organization metadata in the switcher, keeps its Changes in the left column), the "Create app" button is gone, and below 768 px a strip at the top opens the menu + +Clause-②: no +Metadata-protocol: none diff --git a/ui/e2e/live/studio-customize-journey.spec.ts b/ui/e2e/live/studio-customize-journey.spec.ts index 8e29c1a3957..3d41e6721f9 100644 --- a/ui/e2e/live/studio-customize-journey.spec.ts +++ b/ui/e2e/live/studio-customize-journey.spec.ts @@ -123,16 +123,27 @@ async function threeReads(request: APIRequestContext) { }; } -/** Publish the pair's drafts through the surface's Publish / Pending changes dialog. */ +/** + * Publish the pair's drafts through 概览's Pending tab, which the menu's 概览 + * badge opens (objectstack#37456: Studio has no top bar, so its Publish lives + * there), then come back to the item the step was on. + */ async function publishPair(page: Page) { - await page.getByRole('button', { name: /^Publish/ }).first().click(); + const item = page.url(); + await page.getByTestId('studio-menu-overview-pending').click(); + const panel = page.getByTestId('draft-changes-panel'); + await expect(panel).toBeVisible(); const published = page.waitForResponse( (r) => r.request().method() === 'POST' && r.url().includes(`/api/v1/packages/${PAIR}/publish-drafts`), ); - await page.getByTestId('draft-changes-publish').click(); + await panel.getByTestId('draft-changes-publish').click(); const res = await published; expect(res.status(), await res.text()).toBe(200); expect((await res.json()).data.outcome).toBe('published'); + // Back on the item, its header is drawn (the chip in the row, or the ⋯ it + // folds into) before anything is read from it. + await page.goto(item); + await expect(page.getByTestId('studio-override-chip').or(page.getByTestId(ITEM_MORE)).first()).toBeVisible({ timeout: 15_000 }); } /** diff --git a/ui/e2e/studio-left-menu-36899.spec.ts b/ui/e2e/studio-left-menu-36899.spec.ts index f8084cadb9d..aabfa96b913 100644 --- a/ui/e2e/studio-left-menu-36899.spec.ts +++ b/ui/e2e/studio-left-menu-36899.spec.ts @@ -14,8 +14,8 @@ import { uiRoot } from '../scripts/ui-root.mjs'; * jsdom has no layout engine. The unit tests (`StudioMenu.test.tsx`) pin what * the menu lists, its current entry, its search and its cookie; this page * proves where it is drawn: docked at the left of a wide window with the - * content beside it, off the canvas once collapsed with the content taking the - * full width, still collapsed after a reload (Studio's own cookie, on a real + * content beside it, a rail of icons once collapsed with the content beside it + * (objectstack#37456), still collapsed after a reload (Studio's own cookie, on a real * http origin), and a drawer over the page at phone width. * * objectstack#37201 — the 「高级」 fold laid out: closed by default with its @@ -239,12 +239,21 @@ test.describe('Studio left menu (objectstack#36899)', () => { await expect(page.getByTestId('studio-menu-advanced-toggle')).toHaveAttribute('aria-expanded', 'true'); }); - test('collapsed: off the canvas, the content takes the full width, and a reload keeps it', async ({ page }, testInfo) => { + // objectstack#37456 (ADR-0084, amended 2026-11-26, `#amendment-2026-11-26-frame`): collapsed, the + // column is a rail of icons (the sidebar's 3rem icon width), no longer off the canvas; the content + // starts where the rail ends. + test('collapsed: a rail of icons, the content beside it, and a reload keeps it', async ({ page }, testInfo) => { await open(page, 1280); await page.getByTestId('studio-menu-toggle').click(); await expect(page.locator('[data-side="left"][data-state="collapsed"]')).toHaveCount(1); - await expect.poll(async () => (await rect(page, PANEL)).right).toBeLessThanOrEqual(0); - await expect.poll(async () => (await rect(page, '#content')).left).toBe(0); + // Read once the width transition has finished. + await expect.poll(async () => (await rect(page, PANEL)).right).toBeLessThanOrEqual(49); + const rail = await rect(page, PANEL); + expect(rail.left).toBe(0); + expect(rail.right).toBeGreaterThan(40); + await expect(page.getByTestId('studio-menu-toggle')).toBeVisible(); + await expect.poll(async () => (await rect(page, '#content')).left).toBeGreaterThanOrEqual(rail.right - 1); + expect((await rect(page, '#content')).left).toBeLessThanOrEqual(rail.right + 1); const cookies = await page.context().cookies(ORIGIN); expect(cookies.find((c) => c.name === 'studio_menu_state')?.value).toBe('false'); expect(cookies.find((c) => c.name === 'sidebar_state')).toBeUndefined(); diff --git a/ui/packages/app-shell/src/views/metadata-admin/PackageFormDialog.newAppStep-36748.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/PackageFormDialog.newAppStep-36748.test.tsx index 08a165e5ffd..77cecb41d3a 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/PackageFormDialog.newAppStep-36748.test.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/PackageFormDialog.newAppStep-36748.test.tsx @@ -12,7 +12,7 @@ * 2. One confirm creates the package AND its app: the package `POST`, the * app's draft under the first-write pin, then that one app's publish * (objectstack#36511: a human-created item is live at once). The author - * lands in the new package's Studio, whose header names the app, and + * lands in the new package's Studio, whose way back names the app, and * 「‹ Back to app」 opens it. * 3. A taken app name refuses the whole confirm and writes nothing. * @@ -240,7 +240,7 @@ describe('PackageFormDialog with a new-app step: offered as 「同时创建应 }); describe('PackageFormDialog with a new-app step: one confirm creates the package and its app, and the app opens (objectstack#36748)', () => { - it('package, app draft, app publish — then the header names the app and 「‹ Back to app」 opens it', async () => { + it('package, app draft, app publish — then the way back names the app and opens it', async () => { renderDoor(); const dialog = await openNewAppDialog(); fireEvent.change(nameInput(dialog), { target: { value: 'Visits' } }); @@ -267,16 +267,18 @@ describe('PackageFormDialog with a new-app step: one confirm creates the package expect(toast.success).toHaveBeenCalledWith('Created package “Visits” and its app.'); expect(toast.error).not.toHaveBeenCalled(); - // The author lands in the new package's Studio; the header names the app. - const header = await screen.findByTestId('studio-shell-header', undefined, { timeout: 8000 }); + // The author lands in the new package's Studio; the way back names the app + // (objectstack#37456: the package row's first control, beside the switcher). + const row = await screen.findByTestId('studio-package-row', undefined, { timeout: 8000 }); await waitFor( - () => expect(within(header).getByTestId('studio-back-app-name')).toHaveAttribute('data-names', 'app'), + () => expect(within(row).getByTestId('studio-package-back')).toHaveAccessibleName('Leave Studio and go back to Visits'), { timeout: 8000 }, ); - expect(within(header).getByTestId('studio-back')).toHaveTextContent(/^Back to app·Visits·App Studio$/); - // The app is live: no Create app is offered, and the back link opens it. - expect(within(header).queryByRole('button', { name: /Create app/ })).toBeNull(); - fireEvent.click(within(header).getByTestId('studio-back-to-app')); + expect(within(row).getByTestId('studio-pkg-switcher-name')).toHaveTextContent('Visits'); + expect(screen.getByTestId('studio-brand-name')).toHaveTextContent(/^App Studio$/); + // The app is live: no Create app is offered, and the way back opens it. + expect(screen.queryByRole('button', { name: /Create app/ })).toBeNull(); + fireEvent.click(within(row).getByTestId('studio-package-back')); expect(await screen.findByTestId('running-app')).toHaveTextContent(`/apps/${packageId}`); }); @@ -358,7 +360,7 @@ describe('CreatePackageDialog: 「同时创建应用」 is offered, ticked by de }); describe('CreatePackageDialog: ticked creates the package and its app; unticked only the package (objectstack#37134)', () => { - it('ticked: package, app draft, app publish — then the Studio header names the app', async () => { + it('ticked: package, app draft, app publish — then Studio’s way back names the app', async () => { renderCreatePackage(); const dialog = await openNewAppDialog(); await nameAndWait(dialog, 'Visits'); @@ -379,13 +381,14 @@ describe('CreatePackageDialog: ticked creates the package and its app; unticked expect(toast.error).not.toHaveBeenCalled(); // Where the wrapper lands does not change (Studio on the new package), - // and with an app the header names it. - const header = await screen.findByTestId('studio-shell-header', undefined, { timeout: 8000 }); + // and with an app the way back names it (objectstack#37456). + const row = await screen.findByTestId('studio-package-row', undefined, { timeout: 8000 }); await waitFor( - () => expect(within(header).getByTestId('studio-back-app-name')).toHaveAttribute('data-names', 'app'), + () => expect(within(row).getByTestId('studio-package-back')).toHaveAccessibleName('Leave Studio and go back to Visits'), { timeout: 8000 }, ); - expect(within(header).getByTestId('studio-back')).toHaveTextContent(/^Back to app·Visits·App Studio$/); + expect(within(row).getByTestId('studio-pkg-switcher-name')).toHaveTextContent('Visits'); + expect(screen.getByTestId('studio-brand-name')).toHaveTextContent(/^App Studio$/); }); it('unticked: only the package is created, as before', async () => { @@ -401,13 +404,10 @@ describe('CreatePackageDialog: ticked creates the package and its app; unticked expect(srv.apps).toEqual([]); expect(srv.appDrafts).toEqual([]); // The same landing: Studio on the new package, which has no app to name. - const header = await screen.findByTestId('studio-shell-header', undefined, { timeout: 8000 }); + const row = await screen.findByTestId('studio-package-row', undefined, { timeout: 8000 }); const packageId = String((srv.writes[0].body?.manifest as Record).id); - expect(await screen.findByTestId('studio-back-app-name', undefined, { timeout: 8000 })).toHaveAttribute( - 'data-names', - 'package', - ); - expect(header).toBeInTheDocument(); + await waitFor(() => expect(within(row).getByTestId('studio-pkg-switcher-name')).toHaveTextContent('Shared parts'), { timeout: 8000 }); + expect(within(row).getByTestId('studio-package-back')).toHaveAccessibleName('Leave Studio and go back to your apps'); expect(packageId).toMatch(/shared-parts$/); }); @@ -466,9 +466,13 @@ function mounts(component: string): string[] { } describe('every create-package door offers 「同时创建应用」 (objectstack#37134)', () => { - it('Setup → Packages (its button and the `?new=package` door) and the resource list mount CreatePackageDialog', () => { + it('Setup → Packages (its button and the `?new=package` door), the resource list and Studio’s package switcher (objectstack#37456) mount CreatePackageDialog', () => { const doors = mounts('CreatePackageDialog').map((m) => m.split(':')[0]); - expect(doors.sort()).toEqual(['views/metadata-admin/PackagesPage.tsx', 'views/metadata-admin/ResourceListPage.tsx']); + expect(doors.sort()).toEqual([ + 'views/metadata-admin/PackagesPage.tsx', + 'views/metadata-admin/ResourceListPage.tsx', + 'views/studio-design/StudioPackageSwitcher.tsx', + ]); }); it('no create-mode PackageFormDialog is mounted outside CreatePackageDialog, and that one passes the step', () => { diff --git a/ui/packages/app-shell/src/views/studio-design/CreateItemDialog.labels-13128.test.tsx b/ui/packages/app-shell/src/views/studio-design/CreateItemDialog.labels-13128.test.tsx index a092e165a80..092e8596cb6 100644 --- a/ui/packages/app-shell/src/views/studio-design/CreateItemDialog.labels-13128.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/CreateItemDialog.labels-13128.test.tsx @@ -8,8 +8,8 @@ * screen reader announced two unlabeled edit fields and `getByLabelText` * found nothing. The component is shared by every Studio create dialog * (package, app, object, flow, permission set), so the fix is there and this - * suite drives two real openers: the Data pillar's New object, and the - * toolbar's Create app. + * suite drives a real opener: the object list's New object. (The toolbar's + * Create app, the second, went with Studio's top bar: objectstack#37456.) * * Label strings are read by their catalog key, so the pin is on the binding, * not on the copy. @@ -20,8 +20,8 @@ import '@objectstack/lint'; import '@object-ui/plugin-detail'; import '@testing-library/jest-dom/vitest'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; -import { cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react'; -import { MemoryRouter, Route, Routes } from 'react-router-dom'; +import { cleanup, fireEvent, render, screen, within } from '@testing-library/react'; +import { MemoryRouter } from 'react-router-dom'; let clientImpl: any; @@ -47,8 +47,6 @@ vi.mock('./packages-io', async (importOriginal) => { vi.mock('./StudioAiCopilot', () => ({ StudioChatDock: () => null })); vi.mock('../../preview/DraftChangesPanel', () => ({ DraftChangesPanel: () => null })); -import { StudioDesignSurface } from './StudioDesignSurface'; -import { StudioPillarRedirect } from './StudioPillarRedirect'; import { MetadataListCreateDialog } from '../metadata-admin/MetadataListCreateDialog'; import { t } from '../metadata-admin/i18n'; @@ -115,24 +113,4 @@ describe('Studio create dialogs bind each label to its input (objectui#13128)', expect(idInput.value).toBe('repair_ticket'); }); - it('Create app (a sibling dialog on the same component): "App name" and "Identifier" each find their input', async () => { - // objectstack#36903 — the Automations pillar is retired; the sharing overview's page hosts the toolbar. - render( - - - } /> - - , - ); - const toolbar = await screen.findByTestId('studio-shell-header'); - await waitFor(() => - expect(within(toolbar).getByRole('button', { name: 'Create app' })).toBeInTheDocument(), - ); - fireEvent.click(within(toolbar).getByRole('button', { name: 'Create app' })); - const dialog = await screen.findByRole('dialog'); - - const nameInput = expectBound(dialog, t('engine.studio.app.nameLabel', 'en')); - const idInput = expectBound(dialog, t('engine.studio.app.idLabel', 'en')); - expect(nameInput).not.toBe(idInput); - }); }); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioBackToApp.tsx b/ui/packages/app-shell/src/views/studio-design/StudioBackToApp.tsx index 83de9e18e6b..372803e8ecb 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioBackToApp.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioBackToApp.tsx @@ -1,12 +1,13 @@ // Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. /** - * The Studio top bar's left end (objectstack#36501): 「‹ Back to app」, the - * app's name, and the Studio mark. It is Studio's one way out to the running - * app; it replaced the Studio-home button, the package switcher and the - * top-right Open app. + * Studio's way back to the running app (objectstack#36501). It was the top + * bar's left end, 「‹ Back to app」 with the app's name; objectstack#37456 took + * the bar away, and the way back is now one control, the first of the left + * column's package row ({@link StudioBackButton}), the open package named by + * the switcher beside it (ADR-0084, amended 2026-11-26). * - * What it names is the CURRENT PACKAGE's app, never the app the author + * What it leads to is the CURRENT PACKAGE's app, never the app the author * happened to come from (objectstack#36890 decision 5): Studio is the * development surface of that package's app (ADR-0084, amended 2026-11-24). * Where it goes, first match wins ({@link studioBackTarget}): @@ -21,17 +22,7 @@ * (`useHomePath`), with no app name. A draft app has no running * front-end yet, so it counts as none. * - * With no app to name, the name slot names the open package — or the scope — - * instead (objectstack#36748, and the maintainer's ruling on #36899: show the - * package's name, go back to the apps home), so the bar still says what the - * author is building. - * - * Leaving asks first when a pillar holds unsaved work, like every other - * header departure (`beforeNavigate`). - * - * objectstack#37454 — the package's 「⋯」 menu, which sat right of the name - * (objectstack#37139), moved to 概览 Overview's header (ADR-0084, amended - * 2026-11-26). + * Leaving asks first when a pillar holds unsaved work (`beforeNavigate`). */ import * as React from 'react'; @@ -81,81 +72,52 @@ export function studioBackTarget({ return { path: `/apps/${segment}`, appLabel: labelOf(first) }; } -export function StudioBackToApp({ +/** + * The way back as one control (objectstack#37456; ADR-0084, amended + * 2026-11-26, `#amendment-2026-11-26-frame`): the first control of the top + * left's package row, and of the collapsed rail. It leads where + * {@link studioBackTarget} says, where the retired top bar's 「‹ Back to app」 went; + * the name beside it is the package switcher's, so the button carries the + * name only in its accessible name and tooltip. + */ +export function StudioBackButton({ packageId, - packageLabel, apps, locale, beforeNavigate, navigate, + className, }: { - /** The open package, or `null` in the package-less scope. */ packageId: string | null; - /** - * The open package's display name, or in the package-less scope and the - * cross-package leg the scope's: the name slot shows it when there is no - * app to name (objectstack#36748). Absent while the package list loads. - */ - packageLabel?: string | null; - /** The package's published apps. */ apps: readonly StudioAppTarget[]; locale: string; - /** The header's unsaved-work veto: return false to stay in Studio. */ beforeNavigate: () => boolean; navigate: (path: string) => void; + className?: string; }): React.ReactElement { - // Read once per visit: nothing in Studio is an app page, so the record - // cannot change while the author is here. const [remembered] = React.useState(readAppReturnPage); const homePath = useHomePath(); const target = studioBackTarget({ remembered, packageId, apps, locale, landingPath: homePath }); const title = target.appLabel ? tFormat('engine.studio.backToAppTitle', locale, { app: target.appLabel }) : t('engine.studio.backToAppTitleNoApp', locale); - // objectstack#36748 — no app to name: the slot names the open package, or - // the scope (the ruling on #36899 treats the package-less entry the same way). - const fallbackLabel = packageLabel?.trim() || null; - const name = target.appLabel ?? fallbackLabel; - return ( -
- - {name && ( - <> - - {/* The one piece that gives way on a narrow bar. `data-names` says - whether it names the app or, with none, the package. */} - - {name} - - - )} - - - {t('engine.studio.mark', locale)} - -
+ ); } diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.accessSegment-12452.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.accessSegment-12452.test.tsx index 5e6f806d431..f15640046fb 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.accessSegment-12452.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.accessSegment-12452.test.tsx @@ -220,7 +220,7 @@ function shieldMarkup(): string { describe('Studio menu: Access is a group of its own, and More is gone (objectui#12452, objectstack#36899)', () => { it('the Access group holds the permission-set entry, a link to the area list, with no More trigger', async () => { renderAt(`/studio/${PKG}/data`); - await screen.findByTestId('studio-shell-header'); + await screen.findByTestId('studio-top-left'); const group = within(menu()).getByTestId('studio-menu-group-security'); expect(group).toHaveTextContent(ACCESS); @@ -250,7 +250,7 @@ describe('Studio menu: Access is a group of its own, and More is gone (objectui# it('control: with Data open, the permission-set entry carries neither, and the object entry carries both', async () => { renderAt(`/studio/${PKG}/data`); - await screen.findByTestId('studio-shell-header'); + await screen.findByTestId('studio-top-left'); expect(entry(PERMISSION_ENTRY)).not.toHaveAttribute('aria-current'); expect(entry(PERMISSION_ENTRY)).toHaveAttribute('data-active', 'false'); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.backToApp-36501.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.backToApp-36501.test.tsx index 1e6c15c88d8..0e98aaf8a01 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.backToApp-36501.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.backToApp-36501.test.tsx @@ -62,7 +62,6 @@ import { StudioPillarRedirect } from './StudioPillarRedirect'; import { studioBackTarget } from './StudioBackToApp'; import { rememberAppReturnPage, resetAppReturnPageForTests } from '../../utils/appReturnPage'; import { parsePackages } from './packages-io'; -import { STUDIO_HEADER_PACKAGE_COLUMN } from './studio-tokens'; window.matchMedia = ((query: string) => ({ matches: false, @@ -154,18 +153,23 @@ function renderAt(entry: string) { ); } -const header = () => screen.getByTestId('studio-shell-header'); -const backLink = () => within(header()).findByTestId('studio-back-to-app', undefined, { timeout: 8000 }); +// objectstack#37456 — the top bar is gone: the way back is the first control of +// the left column's package row, and the package switcher beside it names the +// open package. The button names where it leads in its accessible name. +const row = () => screen.getByTestId('studio-package-row'); +const backLink = () => within(row()).findByTestId('studio-package-back', undefined, { timeout: 8000 }); +const leadsTo = (app: string) => `Leave Studio and go back to ${app}`; -describe('「‹ Back to app」 returns to the app page the author came from (objectstack#36501)', () => { +describe('the way back returns to the app page the author came from (objectstack#36501)', () => { it('names the app the author came from and returns to that page, query kept', async () => { rememberAppReturnPage({ path: `/apps/${OWN}/opportunity?view=open`, app: 'sales', label: 'Sales' }); renderAt(`/studio/${OWN}/data?surface=object:opportunity`); const link = await backLink(); - expect(link).toHaveAccessibleName('Back to app'); - expect(within(header()).getByTestId('studio-back-app-name')).toHaveTextContent('Sales'); - expect(within(header()).getByTestId('studio-mark')).toHaveTextContent(/^App Studio$/); - expect(within(header()).getByTestId('studio-back')).toHaveTextContent(/^Back to app·Sales·App Studio$/); + await waitFor(() => expect(link).toHaveAccessibleName(leadsTo('Sales')), { timeout: 8000 }); + expect(within(row()).getAllByRole('button')[0]).toBe(link); + // The app is named beside it, and Studio's row carries the brand (objectstack#37566). + expect(within(row()).getByTestId('studio-pkg-switcher-name')).toHaveTextContent('Sales'); + expect(screen.getByTestId('studio-brand-name')).toHaveTextContent(/^App Studio$/); fireEvent.click(link); expect(await screen.findByTestId('running-app')).toHaveTextContent(`/apps/${OWN}/opportunity?view=open`); }); @@ -174,47 +178,41 @@ describe('「‹ Back to app」 returns to the app page the author came from (ob rememberAppReturnPage({ path: '/apps/service/opportunity', app: 'service', label: 'Service desk' }); renderAt(`/studio/${OWN}/data`); const link = await backLink(); - // Read the name while the header is still on screen; the click leaves Studio. - await waitFor(() => expect(within(header()).getByTestId('studio-back-app-name')).toHaveTextContent('Sales'), { - timeout: 8000, - }); + // Read the name while the row is still on screen; the click leaves Studio. + await waitFor(() => expect(link).toHaveAccessibleName(leadsTo('Sales')), { timeout: 8000 }); fireEvent.click(link); expect(await screen.findByTestId('running-app')).toHaveTextContent(new RegExp(`^/apps/${OWN.replace(/\./g, '\\.')}$`)); }); }); -describe('opened directly, 「‹ Back to app」 lands on the package app\'s first screen (objectstack#36501)', () => { +describe('opened directly, the way back lands on the package app\'s first screen (objectstack#36501)', () => { it('names the published app and lands on its home, whatever is in focus', async () => { renderAt(`/studio/${OWN}/data?surface=object:opportunity`); - await waitFor(() => expect(within(header()).getByTestId('studio-back-app-name')).toHaveTextContent('Sales'), { - timeout: 8000, - }); - fireEvent.click(await backLink()); + const link = await backLink(); + await waitFor(() => expect(link).toHaveAccessibleName(leadsTo('Sales')), { timeout: 8000 }); + fireEvent.click(link); expect(await screen.findByTestId('running-app')).toHaveTextContent(new RegExp(`^/apps/${OWN.replace(/\./g, '\\.')}$`)); }); it('with several published apps, the first, addressed by its name', async () => { srv.apps = [SERVICE_APP, SALES_APP]; renderAt(`/studio/${OWN}/owd`); - await waitFor(() => expect(within(header()).getByTestId('studio-back-app-name')).toHaveTextContent('Service desk'), { - timeout: 8000, - }); - fireEvent.click(await backLink()); + const link = await backLink(); + await waitFor(() => expect(link).toHaveAccessibleName(leadsTo('Service desk')), { timeout: 8000 }); + fireEvent.click(link); expect(await screen.findByTestId('running-app')).toHaveTextContent(/^\/apps\/service$/); }); }); -describe('a package with no app: 「‹ Back to app」 names the package and goes to the default landing (objectstack#36501, objectstack#36748)', () => { +describe('a package with no app: the switcher names the package and the way back goes to the default landing (objectstack#36501, objectstack#36748)', () => { it('no app at all: the package is named, and the link goes to the console landing', async () => { srv.apps = []; renderAt(`/studio/${OWN}/data`); const link = await backLink(); - // Settled: the header has read the package's apps (it offers Create app). - await within(header()).findByRole('button', { name: /Create app/ }, { timeout: 8000 }); - // objectstack#36748 — the name slot names the open package, by its label. - const name = await within(header()).findByTestId('studio-back-app-name', undefined, { timeout: 8000 }); - expect(name).toHaveAttribute('data-names', 'package'); - expect(within(header()).getByTestId('studio-back')).toHaveTextContent(/^Back to app·Sales·App Studio$/); + // objectstack#36748 — the open package is named, by its label (now the switcher's name). + await waitFor(() => expect(within(row()).getByTestId('studio-pkg-switcher-name')).toHaveTextContent('Sales'), { timeout: 8000 }); + expect(link).toHaveAccessibleName('Leave Studio and go back to your apps'); + expect(screen.getByTestId('studio-brand-name')).toHaveTextContent(/^App Studio$/); fireEvent.click(link); expect(await screen.findByTestId('elsewhere')).toHaveTextContent('/home'); }); @@ -224,40 +222,24 @@ describe('a package with no app: 「‹ Back to app」 names the package and goe srv.appDrafts = [{ name: 'sales', label: 'Sales', type: 'app' }]; renderAt(`/studio/${OWN}/data`); const link = await backLink(); - // The draft app is resolved (the header's create-app slot reads it) ... - await waitFor(() => expect(within(header()).queryByRole('button', { name: /Create app/ })).toBeNull(), { timeout: 8000 }); - // ... and still no app is named or opened: the slot names the package. - expect(await within(header()).findByTestId('studio-back-app-name')).toHaveAttribute('data-names', 'package'); + await waitFor(() => expect(within(row()).getByTestId('studio-pkg-switcher-name')).toHaveTextContent('Sales'), { timeout: 8000 }); + // No app is named or opened. + expect(link).toHaveAccessibleName('Leave Studio and go back to your apps'); fireEvent.click(link); expect(await screen.findByTestId('elsewhere')).toHaveTextContent('/home'); }); }); -describe('the controls the back link replaced are gone (objectstack#36501)', () => { - it('no Studio-home button, no package switcher, no Open app', async () => { +describe('the controls the back link replaced stay gone (objectstack#36501)', () => { + it('no Studio-home button and no Open app; the switcher is the package row\'s one other control', async () => { renderAt(`/studio/${OWN}/data`); - await waitFor(() => expect(within(header()).getByTestId('studio-back-app-name')).toHaveTextContent('Sales'), { - timeout: 8000, - }); + const link = await backLink(); + await waitFor(() => expect(link).toHaveAccessibleName(leadsTo('Sales')), { timeout: 8000 }); for (const id of ['studio-home', 'studio-pkg-chip', 'studio-open-app']) { - expect(within(header()).queryByTestId(id)).toBeNull(); + expect(screen.queryByTestId(id)).toBeNull(); } - expect(within(header()).queryByRole('button', { name: /Open app|Studio home/ })).toBeNull(); - expect(within(header()).queryByTitle(/Switch \/ create package/)).toBeNull(); - }); -}); - -describe('on a narrow bar the app name gives way, nothing else (objectstack#36501, objectui#12611)', () => { - it('the column is the container; the name truncates; the link and the mark keep their width', async () => { - renderAt(`/studio/${OWN}/data`); - const name = await within(header()).findByTestId('studio-back-app-name', undefined, { timeout: 8000 }); - const column = header().children[0] as HTMLElement; - expect(column).toHaveClass(STUDIO_HEADER_PACKAGE_COLUMN); - expect(column.contains(name)).toBe(true); - expect(name).toHaveClass('min-w-0', 'truncate'); - expect(within(header()).getByTestId('studio-back-to-app')).toHaveClass('shrink-0'); - expect(within(header()).getByTestId('studio-mark')).toHaveClass('shrink-0'); - expect(within(header()).getByTestId('studio-back')).toHaveClass('min-w-0', 'whitespace-nowrap'); + expect(screen.queryByRole('button', { name: /Open app|Studio home/ })).toBeNull(); + expect(within(row()).getAllByRole('button').map((b) => b.dataset.testid)).toEqual(['studio-package-back', 'studio-pkg-switcher']); }); }); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.changesCount-11787.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.changesCount-11787.test.tsx deleted file mode 100644 index e6682606e22..00000000000 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.changesCount-11787.test.tsx +++ /dev/null @@ -1,193 +0,0 @@ -// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. - -/** - * objectui#11787 — the header's Changes count after a draft save. - * - * Found in a browser QA pass: after an autosave, an item showed its - * "Unpublished draft" chip while the header beside it still said "No drafts - * pending publish", until the count's read caught up. A draft save stamped with - * this package means at least one draft is pending, so from the render in which - * the save lands the header says so, and the read the save asks for is sent - * after it rather than joined to one already on the wire. - * - * Driven through a create that still writes a draft: Create app in the Studio - * header. objectstack#36511 — a permission set is created live now, so it - * leaves no draft for this count to follow. - * - * Real: the surface, its pillar, `useMetadataClient` and the client it builds, - * and `usePendingDrafts`. Stubbed: `globalThis.fetch` (the server; every - * `_drafts` read is held open until the test answers it), `packages-io`'s - * package list, `sonner`, and the dock and panels no assertion reads. - */ - -import '@testing-library/jest-dom/vitest'; -import * as React from 'react'; -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; -import { act, cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react'; -import { MemoryRouter, Route, Routes } from 'react-router-dom'; - -const PACKAGE_ID = 'app.a'; -const DRAFTS = `/api/v1/meta/_drafts?package=${PACKAGE_ID}`; - -vi.mock('sonner', () => ({ - toast: { - warning: vi.fn(), - error: vi.fn(), - success: vi.fn(), - info: vi.fn(), - message: vi.fn(), - dismiss: vi.fn(), - }, - Toaster: () => null, -})); - -vi.mock('./packages-io', async (importOriginal) => { - const actual = await importOriginal>(); - return { - ...actual, - fetchPackages: vi.fn(async () => [{ id: PACKAGE_ID, name: PACKAGE_ID, writable: true, namespace: 'a' }]), - }; -}); - -vi.mock('@object-ui/react', async (importOriginal) => { - const actual = await importOriginal>(); - return { ...actual, useAdapter: () => ({}) }; -}); - -vi.mock('../../components/SuggestedBindingsPanel', () => ({ SuggestedBindingsPanel: () => null })); -vi.mock('../metadata-admin/AccessExplainPanel', () => ({ AccessExplainPanel: () => null })); -vi.mock('./StudioAiCopilot', () => ({ StudioChatDock: () => null })); -vi.mock('../../preview/DraftChangesPanel', () => ({ DraftChangesPanel: () => null })); - -// The console's preview and authoring code loads `@objectstack/lint` lazily; -// warmed here so its first load is paid at import, not inside a test's clock. -import '@objectstack/lint'; -// objectstack#36900 — the surface mounts the command palette, which reaches the -// record preview's `lazy()` detail entry: its first load is paid at collection too. -import '@object-ui/plugin-detail'; -import { StudioDesignSurface } from './StudioDesignSurface'; -import { StudioPillarRedirect } from './StudioPillarRedirect'; -import { t } from '../metadata-admin/i18n'; - -window.matchMedia = ((query: string) => ({ - matches: false, - media: query, - onchange: null, - addEventListener: () => {}, - removeEventListener: () => {}, - addListener: () => {}, - removeListener: () => {}, - dispatchEvent: () => false, -})) as unknown as typeof window.matchMedia; -(globalThis as unknown as { ResizeObserver: unknown }).ResizeObserver = - (globalThis as unknown as { ResizeObserver?: unknown }).ResizeObserver ?? - class { - observe() {} - unobserve() {} - disconnect() {} - }; - -interface HeldRead { - respond: (drafts: Array>) => void; -} - -/** The `_drafts` reads, in the order they were sent, each held until answered. */ -const draftReads: HeldRead[] = []; -/** Draft saves the surface sent (`PUT …?mode=draft`). */ -const draftSaves: string[] = []; - -function json(body: unknown) { - return new Response(JSON.stringify(body), { status: 200, headers: { 'content-type': 'application/json' } }); -} - -beforeEach(() => { - draftReads.length = 0; - draftSaves.length = 0; - vi.stubGlobal( - 'fetch', - vi.fn(async (input: unknown, init?: { method?: string }) => { - const url = String(input); - if (url === DRAFTS) { - return new Promise((resolve) => { - draftReads.push({ respond: (drafts) => resolve(json({ drafts })) }); - }); - } - if (init?.method === 'PUT' && url.includes('mode=draft')) { - draftSaves.push(url); - return json({}); - } - // Every other read (the pillar's lists, the type registry, the matrix's - // reads) answers empty — none of them is under test here. - return json([]); - }) as unknown as typeof fetch, - ); -}); - -afterEach(() => { - cleanup(); - vi.unstubAllGlobals(); -}); - -const NONE_PENDING = t('engine.studio.publishNoneTitle', 'en'); -const changesButton = () => screen.getByRole('button', { name: new RegExp(`^${t('engine.studio.changes', 'en')}`) }); - -async function drain() { - for (let i = 0; i < 5; i++) await new Promise((r) => setTimeout(r, 0)); -} - -async function createAppThroughTheDialog() { - const toolbar = await screen.findByTestId('studio-shell-header'); - fireEvent.click(await within(toolbar).findByRole('button', { name: t('engine.studio.app.create', 'en') })); - const dialog = await screen.findByRole('dialog'); - fireEvent.change(dialog.querySelectorAll('input')[0], { target: { value: 'Field Desk' } }); - // A draft-writing create says so (objectui#11787). - fireEvent.click(within(dialog).getByRole('button', { name: t('engine.studio.createDraft', 'en') })); -} - -describe('the Changes count after a draft save (objectui#11787)', () => { - it('says a draft is pending from the render the save lands in, and the read it asks for is its own', async () => { - render( - - - } /> - - , - ); - // The mount read is on the wire and unanswered. - await waitFor(() => expect(draftReads.length).toBeGreaterThan(0)); - await act(drain); - const beforeSave = draftReads.length; - - await act(async () => { - await createAppThroughTheDialog(); - }); - await waitFor(() => expect(draftSaves).toHaveLength(1)); - await act(drain); - - // The save landed: the header no longer says nothing is pending, and the - // count is at least the draft the save wrote — before any read answers. - expect(screen.queryByText(NONE_PENDING)).toBeNull(); - expect(changesButton()).toHaveTextContent('· 1'); - // The save sent a read of its own, not one joined to the read on the wire. - expect(draftReads.length).toBe(beforeSave + 1); - - // The reads sent before the save answer with the ledger as it was: ignored. - await act(async () => { - for (const read of draftReads.slice(0, beforeSave)) read.respond([]); - await drain(); - }); - expect(screen.queryByText(NONE_PENDING)).toBeNull(); - expect(changesButton()).toHaveTextContent('· 1'); - - // The read sent after the save answers with the server's count. - await act(async () => { - draftReads[beforeSave].respond([ - { type: 'app', name: 'a_field_desk', packageId: PACKAGE_ID }, - { type: 'object', name: 'a_account', packageId: PACKAGE_ID }, - ]); - await drain(); - }); - await waitFor(() => expect(changesButton()).toHaveTextContent('· 2')); - expect(screen.queryByText(NONE_PENDING)).toBeNull(); - }); -}); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.copilotDoors-12894.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.copilotDoors-12894.test.tsx index 0f037b41f50..08a9d4e82c1 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.copilotDoors-12894.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.copilotDoors-12894.test.tsx @@ -275,7 +275,7 @@ async function drain() { async function mountWithAppliedCard() { const view = renderStudio(); const card = await screen.findByTestId('applied-card'); - await waitFor(() => expect(screen.getByTestId('studio-changes-count')).toHaveTextContent('1')); + await waitFor(() => expect(screen.getByTestId('studio-menu-overview-pending')).toHaveTextContent('1')); await act(drain); return { view, card }; } @@ -367,7 +367,7 @@ describe('the Studio copilot\'s applied card undoes through discard-drafts (obje await waitFor(() => expect(within(card).getByTestId('applied-card-discarded')).toBeInTheDocument()); expect(sdk.discardDrafts).toHaveBeenCalledTimes(1); expect(sdk.discardDrafts).toHaveBeenCalledWith(PACKAGE_ID); - await waitFor(() => expect(screen.queryByTestId('studio-changes-count')).toBeNull()); + await waitFor(() => expect(screen.queryByTestId('studio-menu-overview-pending')).toBeNull()); expect(draftReads).toBeGreaterThan(readsBefore); }); @@ -391,7 +391,7 @@ describe('the Studio copilot\'s applied card undoes through discard-drafts (obje expect(failed).toHaveTextContent('object/hcpl_borrowing: draft is locked by a publish in progress'); expect(within(card).queryByTestId('applied-card-discarded')).toBeNull(); expect(pulses).toBe(1); - expect(screen.getByTestId('studio-changes-count')).toHaveTextContent('1'); + expect(screen.getByTestId('studio-menu-overview-pending')).toHaveTextContent('1'); } finally { unsubscribe(); } diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.copilotDraftBadge-12725.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.copilotDraftBadge-12725.test.tsx index c898fe9bcd6..36366703ef2 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.copilotDraftBadge-12725.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.copilotDraftBadge-12725.test.tsx @@ -272,7 +272,7 @@ async function mountQuiet() { const view = renderStudio(); await screen.findByTestId('copilot-chat-body'); await act(drain); - expect(screen.queryByTestId('studio-changes-count')).toBeNull(); + expect(screen.queryByTestId('studio-menu-overview-pending')).toBeNull(); return view; } @@ -306,7 +306,7 @@ describe('the 变更 badge counts the copilot\'s drafts the moment they land (ob true, ); - await waitFor(() => expect(screen.getByTestId('studio-changes-count')).toHaveTextContent('2')); + await waitFor(() => expect(screen.getByTestId('studio-menu-overview-pending')).toHaveTextContent('2')); expect(draftReads).toBeGreaterThan(readsBeforeLanding); // No reload: the same surface tree; no navigation: the same location. expect(view.container.lastElementChild).toBe(surfaceRoot); @@ -327,7 +327,7 @@ describe('the 变更 badge counts the copilot\'s drafts the moment they land (ob ], true, ); - await waitFor(() => expect(screen.getByTestId('studio-changes-count')).toHaveTextContent('1')); + await waitFor(() => expect(screen.getByTestId('studio-menu-overview-pending')).toHaveTextContent('1')); }); it('announces each result once: later chunks and the turn\'s end send no second pulse for it', async () => { @@ -352,7 +352,7 @@ describe('the 变更 badge counts the copilot\'s drafts the moment they land (ob play([USER_TURN, { ...landed, parts: [...landed.parts, { type: 'text', text: '已存为草稿,请在「变更」里发布。' }] }], false); await act(drain); expect(pulses).toBe(1); - await waitFor(() => expect(screen.getByTestId('studio-changes-count')).toHaveTextContent('2')); + await waitFor(() => expect(screen.getByTestId('studio-menu-overview-pending')).toHaveTextContent('2')); } finally { unsubscribe(); } @@ -363,7 +363,7 @@ describe('the 变更 badge counts the copilot\'s drafts the moment they land (ob serverDrafts = DRAFTED_ROWS; renderStudio(); await screen.findByTestId('copilot-chat-body'); - await waitFor(() => expect(screen.getByTestId('studio-changes-count')).toHaveTextContent('2')); + await waitFor(() => expect(screen.getByTestId('studio-menu-overview-pending')).toHaveTextContent('2')); let pulses = 0; const unsubscribe = subscribeMetadataRefresh(() => { pulses += 1; @@ -375,7 +375,7 @@ describe('the 变更 badge counts the copilot\'s drafts the moment they land (ob [USER_TURN, { id: 'm-asst-5', role: 'assistant', parts: [toolPart('apply_edit', 'call_apply_edit_5', APPLY_EDIT_PUBLISHED)] }], true, ); - await waitFor(() => expect(screen.queryByTestId('studio-changes-count')).toBeNull()); + await waitFor(() => expect(screen.queryByTestId('studio-menu-overview-pending')).toBeNull()); expect(pulses).toBe(1); } finally { unsubscribe(); @@ -408,7 +408,7 @@ describe('the 变更 badge counts the copilot\'s drafts the moment they land (ob // (The chat's own pending-drafts bar re-reads on the turn's idle edge, as // it always has; that read is its own, not an announcement.) expect(pulses).toBe(0); - expect(screen.queryByTestId('studio-changes-count')).toBeNull(); + expect(screen.queryByTestId('studio-menu-overview-pending')).toBeNull(); } finally { unsubscribe(); } @@ -433,7 +433,7 @@ describe('the 变更 badge counts the copilot\'s drafts the moment they land (ob await act(drain); expect(pulses).toBe(0); // The badge reads the ledger on its own mount, as it always has. - await waitFor(() => expect(screen.getByTestId('studio-changes-count')).toHaveTextContent('2')); + await waitFor(() => expect(screen.getByTestId('studio-menu-overview-pending')).toHaveTextContent('2')); } finally { unsubscribe(); } diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.createAppAccessibleName.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.createAppAccessibleName.test.tsx deleted file mode 100644 index 542a03793fb..00000000000 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.createAppAccessibleName.test.tsx +++ /dev/null @@ -1,247 +0,0 @@ -// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. - -/** - * Studio — the Create app dialog must be targetable BY ACCESSIBLE NAME - * (objectui#9231). - * - * ## The defect, as measured on `origin/main` before this fix - * - * The package workspace toolbar carries a button whose accessible name is - * `Create app`; it opens a dialog whose own accessible name is also - * `Create app` (its title — which is correct, a dialog is named after the - * action that opened it). The one control inside that dialog which actually - * creates the app was named `Create (save as draft)`. - * - * So every name a caller could write for "the control that creates the app" - * was ambiguous: `Create app` resolved ONLY to openers (three of them: the - * toolbar, the Interfaces empty state, the Interfaces rail), and the shorter - * `Create` — the only handle the confirm control offered — matched the openers - * too. There was no way to target the confirm control by name without also - * matching the toolbar button. - * - * The cost is not cosmetic. While the dialog is open Radix marks the rest of - * the tree `aria-hidden`, so a by-name click on `Create app` lands on the modal - * overlay and Radix dismisses the dialog — silently, with no error and nothing - * created. The failure only surfaces much later at the app's list route, on the - * screen for an app that is not there. That screen used to read - * `App not available … it may still be publishing` — blaming a publish that - * never started — which is the second half objectui#9231 asked to be measured - * rather than special-cased here; objectui#9262 measured it and retired the - * sentence, so the same path now reads `This app can't be opened`. The delay - * between the silent dismissal and the screen is what this suite is about, and - * that is unchanged. - * - * ## What this suite pins - * - * Only accessible names, never `data-testid` — a testid would pin *around* the - * very name the defect is about and would stay green while the defect persists. - * Everything is asserted through the REAL `StudioDesignSurface` + the REAL - * `CreateItemDialog`, so the names under test are the ones a browser, a screen - * reader and an automation harness compute. - */ - -// Paid at collection, not inside a case's clock (check:test-source-alias). -import '@objectstack/lint'; -import '@object-ui/plugin-detail'; -import '@testing-library/jest-dom/vitest'; -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; -import { cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react'; -import { MemoryRouter, Route, Routes } from 'react-router-dom'; - -let clientImpl: any; -let saved: Array<[string, string, unknown, unknown]>; - -vi.mock('../metadata-admin/useMetadata', async (importOriginal) => { - const actual = await importOriginal>(); - return { - ...actual, - useMetadataClient: () => clientImpl, - useMetadataTypes: () => ({ loading: false, error: null, entries: [] }), - }; -}); - -// The surface's writability gate — one writable package, so the toolbar's -// create affordance is enabled rather than disabled. -vi.mock('./packages-io', async (importOriginal) => { - const actual = await importOriginal>(); - return { - ...actual, - fetchPackages: vi.fn(async () => [ - { id: 'app.a', name: 'App A', writable: true, namespace: 'a' }, - ]), - }; -}); - -// Docks irrelevant to the names under test — keep the render light. -vi.mock('./StudioAiCopilot', () => ({ StudioChatDock: () => null })); -vi.mock('../../preview/DraftChangesPanel', () => ({ DraftChangesPanel: () => null })); - -import { StudioDesignSurface } from './StudioDesignSurface'; -import { StudioPillarRedirect } from './StudioPillarRedirect'; -import { t } from '../metadata-admin/i18n'; - -// jsdom has no matchMedia — useIsMobile / useIsWideViewport need a stub. -window.matchMedia = ((query: string) => ({ - matches: false, - media: query, - onchange: null, - addEventListener: () => {}, - removeEventListener: () => {}, - addListener: () => {}, - removeListener: () => {}, - dispatchEvent: () => false, -})) as any; - -// Radix Popover (PackageSwitcher) floats via floating-ui, which observes size. -(globalThis as any).ResizeObserver = - (globalThis as any).ResizeObserver ?? - class { - observe() {} - unobserve() {} - disconnect() {} - }; - -beforeEach(() => { - saved = []; - clientImpl = { - // No published app and no draft app, so the toolbar renders `Create app` - // rather than the pending badge or the open-app bridge. - list: async () => [], - listDrafts: async () => [], - layered: async () => ({ effective: null, code: null }), - getDraft: async () => null, - get: async () => null, - save: async (type: string, name: string, body: unknown, opts: unknown) => { - saved.push([type, name, body, opts]); - return body; - }, - }; - // The surface's pending-drafts counter polls over raw fetch — stub it flat. - vi.stubGlobal('fetch', vi.fn(async () => ({ ok: true, json: async () => [] })) as any); -}); - -afterEach(() => { - cleanup(); - vi.unstubAllGlobals(); -}); - -async function renderSurface() { - render( - - - } /> - } /> - - , - ); - // The header landmark is the toolbar under test; wait for its own create - // affordance rather than for a frame count. - // objectui#12725 — by test id: the Interfaces properties now sit in the right - // slot beside the top bar, and testing-library reads their aside's `header` - // as a second banner (a browser does not: it is inside an `aside`). - const toolbar = await screen.findByTestId('studio-shell-header'); - await waitFor(() => - expect(within(toolbar).getByRole('button', { name: 'Create app' })).toBeInTheDocument(), - ); - return toolbar; -} - -/** Open the dialog from the toolbar CONTROL, by its accessible name. */ -async function openFromToolbar(): Promise { - const toolbar = await renderSurface(); - fireEvent.click(within(toolbar).getByRole('button', { name: 'Create app' })); - return await screen.findByRole('dialog'); -} - -/** Every accessible name carried by a `button` inside `scope`. */ -function buttonNames(scope: HTMLElement): string[] { - const names: string[] = []; - within(scope).queryAllByRole('button', { - name: (n: string) => { - names.push(n); - return false; - }, - }); - return names; -} - -/** Length of the longest common leading run of two strings. */ -function commonPrefixLength(a: string, b: string): number { - let i = 0; - while (i < a.length && i < b.length && a[i] === b[i]) i += 1; - return i; -} - -describe('Studio create-app — accessible names (objectui#9231)', () => { - it('the toolbar CONTROL still answers to the accessible name "Create app"', async () => { - const toolbar = await renderSurface(); - // As the CONTROL, not as text: a heading or a dialog title carrying the - // same string would not satisfy a caller trying to open the dialog. - const opener = within(toolbar).getByRole('button', { name: 'Create app' }); - expect(opener).toHaveAccessibleName('Create app'); - expect(opener.tagName).toBe('BUTTON'); - }); - - it('the dialog it opens keeps that same name — the dialog, not a control', async () => { - const dialog = await openFromToolbar(); - // Naming a dialog after the action that opened it is correct and stays. - // Pinned so a future "fix" cannot resolve the collision by renaming the - // dialog, which would only move the ambiguity somewhere less visible. - expect(dialog).toHaveAccessibleName('Create app'); - }); - - it('NOTHING inside the dialog answers to the opener’s verb', async () => { - const dialog = await openFromToolbar(); - // THE PIN. Before this fix the confirm control was `Create (save as - // draft)`, so this query returned it — i.e. a caller reaching for "the - // create control" could not tell the confirm from the three openers, and a - // by-name click outside the modal is silently swallowed by Radix's overlay. - expect(within(dialog).queryAllByRole('button', { name: /\bcreate\b/i })).toHaveLength(0); - expect(within(dialog).queryByRole('button', { name: 'Create app' })).toBeNull(); - }); - - it('the confirm control is reachable BY ACCESSIBLE NAME and actually creates the app', async () => { - const dialog = await openFromToolbar(); - // Found by name — no testid, no positional pick (DialogContent renders - // Radix's own sr-only Close AFTER the footer, so "the last button" is - // Close and a positional pick silently dismisses the dialog). - const confirm = within(dialog).getByRole('button', { name: 'Save as draft' }); - - const nameField = dialog.querySelectorAll('input')[0]; - fireEvent.change(nameField, { target: { value: 'Field Service' } }); - fireEvent.click(confirm); - - // The claim is not "a button exists" — it is that THIS name creates the - // app. Anything else is the silent no-op the card is about. - await waitFor(() => expect(saved.length).toBe(1)); - expect(saved[0][0]).toBe('app'); - expect(saved[0][1]).toBe('field_service'); - expect(saved[0][3]).toMatchObject({ mode: 'draft', packageId: 'app.a' }); - }); - - it('opener and confirm share no name prefix — in BOTH Studio locales', async () => { - // The render-level pins above run in the catalogue's English face. The - // collision was present in the Chinese face too, so the rule is asserted - // on the catalogue directly, for both of the locales it carries. - // - // A caller writes a by-name query from the FRONT of a label, so a shared - // leading run is exactly what makes two controls indistinguishable — and - // unlike a word-boundary rule this one holds for a script with no spaces. - for (const locale of ['en-US', 'zh-CN'] as const) { - const opener = t('engine.studio.app.create', locale); - const confirm = t('engine.studio.createDraft', locale); - expect(commonPrefixLength(opener, confirm), `${locale}: ${opener} / ${confirm}`).toBe(0); - expect(confirm.includes(opener)).toBe(false); - expect(opener.includes(confirm)).toBe(false); - } - }); - - it('the open dialog exposes exactly three controls, all distinctly named', async () => { - const dialog = await openFromToolbar(); - const names = buttonNames(dialog); - // Cancel, the confirm, and Radix's sr-only Close. Distinctness is the - // whole contract this suite defends, so assert the SET, not the count. - expect(new Set(names).size).toBe(names.length); - expect(names).toEqual(expect.arrayContaining(['Cancel', 'Save as draft', 'Close'])); - }); -}); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.createTaken-26917.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.createTaken-26917.test.tsx index 635299657d2..4b5ef4d6a12 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.createTaken-26917.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.createTaken-26917.test.tsx @@ -15,8 +15,8 @@ * - Automations: a published flow on this rail is refused with "Open"; one * another package holds is refused without it; nothing is written either way. * - Data: the same for objects (the namespace-prefixed identifier). - * - App: an app another package holds is refused (Create app is offered only - * to a package with no app, so there is nothing of its own to open). + * - App: Studio's Create app went with the top bar (objectstack#37456, ADR-0084 + * amended 2026-11-26, silent item 5), so it has no case here. * - A fresh identifier is created as before, with the pin. * * The REAL pillars and dialogs, over a client double that keeps published and @@ -32,7 +32,7 @@ import '@testing-library/jest-dom/vitest'; import * as React from 'react'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react'; -import { MemoryRouter, Route, Routes, useLocation } from 'react-router-dom'; +import { MemoryRouter, useLocation } from 'react-router-dom'; const PKG = 'com.acme.app'; const OTHER_PKG = 'com.other.app'; @@ -124,8 +124,6 @@ vi.mock('../metadata-admin/AccessExplainPanel', () => ({ AccessExplainPanel: () vi.mock('./StudioAiCopilot', () => ({ StudioChatDock: () => null })); vi.mock('../../preview/DraftChangesPanel', () => ({ DraftChangesPanel: () => null })); -import { StudioDesignSurface } from './StudioDesignSurface'; -import { StudioPillarRedirect } from './StudioPillarRedirect'; import { ListFlowCreate } from './__tests__/listFlowCreateHost'; import { MetadataListCreateDialog } from '../metadata-admin/MetadataListCreateDialog'; import { createEmptyDataSource } from './__tests__/emptyDataSource'; @@ -158,7 +156,6 @@ window.matchMedia = ((query: string) => ({ const en = (key: string) => t(key, 'en'); const save = mockClient.save as ReturnType; -const getDraft = mockClient.getDraft as ReturnType; function publish(type: string, pkg: string, body: Record) { door.published.set(`${type}/${String(body.name)}`, { pkg, body } satisfies Row); @@ -182,7 +179,6 @@ const FLOW_ESCALATE = { }; const OBJ_ACCOUNT = { name: 'acme_account', label: 'Account', fields: { name: { type: 'text', label: 'Name' } } }; const OBJ_TICKET = { name: 'acme_ticket', label: 'Ticket', fields: { subject: { type: 'text', label: 'Subject' } } }; -const APP_FIELD = { name: 'field_service', label: 'Field Service', active: true, navigation: [{ id: 'nav_x', type: 'object', objectName: 'other_x' }] }; beforeEach(() => { door.published.clear(); @@ -343,55 +339,6 @@ describe('objectstack#26917 — Data: New object over a taken identifier', () => }); }); -describe('objectstack#26917 — Create app over a taken identifier', () => { - async function openCreateApp() { - // objectstack#36903, objectstack#36904 — the Automations and Data pillars - // are retired (their addresses redirect to the area); the sharing - // overview's page hosts the toolbar's Create app. - render( - - - } /> - - , - ); - const toolbar = await screen.findByTestId('studio-shell-header', undefined, { timeout: 8000 }); - await waitFor(() => expect(within(toolbar).getByRole('button', { name: en('engine.studio.app.create') })).toBeInTheDocument()); - fireEvent.click(within(toolbar).getByRole('button', { name: en('engine.studio.app.create') })); - return await screen.findByRole('dialog'); - } - - it('a published app another package holds: refused, nothing written', async () => { - publish('app', OTHER_PKG, APP_FIELD); - const before = publishedBody('app', 'field_service'); - const dialog = await openCreateApp(); - submitCreate(dialog, 'Field Service'); - - const taken = await within(dialog).findByTestId('app-create-taken'); - expect(taken).toHaveTextContent( - tFormat('engine.studio.app.createTaken', 'en', { name: 'field_service', label: 'Field Service' }), - ); - expect(within(taken).queryByTestId('app-create-open-existing')).toBeNull(); - expect(save).not.toHaveBeenCalled(); - expect(door.drafts.size).toBe(0); - expect(door.published.get('app/field_service')!.body).toEqual(before); - }); - - it('a fresh identifier is created as before, under the first-write pin', async () => { - publish('app', OTHER_PKG, APP_FIELD); - const dialog = await openCreateApp(); - submitCreate(dialog, 'Dispatch'); - - await waitFor(() => expect(save).toHaveBeenCalledTimes(1)); - const [type, name, , opts] = save.mock.calls[0]!; - expect([type, name, opts]).toEqual([ - 'app', - 'dispatch', - { mode: 'draft', packageId: PKG, ifNoneMatch: '*', surface: 'studio' }, - ]); - }); -}); - describe('objectstack#30038 — Automations: New automation never saves a typed prefix as the trigger object', () => { async function openRecordPreset() { publish('flow', PKG, FLOW_ALPHA); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.customizePublish-28562.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.customizePublish-28562.test.tsx index 812798c3050..c73d12385ea 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.customizePublish-28562.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.customizePublish-28562.test.tsx @@ -260,7 +260,6 @@ function renderWorkbench() { ); } -const publishButton = () => screen.getByRole('button', { name: /^Publish/ }); const panelPackage = () => screen.getByTestId('changes-panel').getAttribute('data-package'); /** The base label the host hands the sheet's "saved to" sentence (objectstack#29691); '' when none. */ const panelCustomizationOf = () => screen.getByTestId('changes-panel').getAttribute('data-customization-of'); @@ -275,8 +274,9 @@ describe('a read-only base with its pair listed: Pending, the panel and Publish // objectstack#29691 — the sheet names the base the pair's drafts are saved for. expect(panelCustomizationOf()).toBe('HotCRM'); await waitFor(() => expect(srv.reads).toContain(`/api/v1/meta/_drafts?package=${encodeURIComponent(PAIR)}`)); - await waitFor(() => expect(publishButton()).toBeEnabled(), { timeout: 8000 }); - expect(publishButton().parentElement).not.toHaveAttribute('data-disabled-reason'); + // The pair's drafts are counted: 概览's badge says so (objectstack#37456 — + // the top bar's Publish is gone; the sheet's Publish all is the door). + await waitFor(() => expect(screen.getByTestId('studio-menu-overview-pending')).toHaveTextContent('1'), { timeout: 8000 }); fireEvent.click(screen.getByTestId('publish-all-drafts')); await waitFor(() => expect(srv.publishes).toEqual([PAIR])); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.desktopHint-11795.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.desktopHint-11795.test.tsx index c9e1de70f47..6563a0dd012 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.desktopHint-11795.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.desktopHint-11795.test.tsx @@ -2,7 +2,8 @@ /** * objectui#11795 — Studio stays a desktop tool, and on a phone it says so: one - * line under the header (`engine.studio.desktopHint`), shown below `md` (the + * line under the strip that opens the menu (`engine.studio.desktopHint`; + * objectstack#37456 — Studio has no top bar), shown below `md` (the * width `useIsMobile` answers for), and nowhere wider. * * The REAL surface on its Data tab; the chat dock and the panels it does not @@ -112,21 +113,21 @@ function renderSurfaceAt(width: number) { const HINT = t('engine.studio.desktopHint', 'en'); describe('StudioDesignSurface — the one-line desktop hint on a phone (objectui#11795)', () => { - it('a phone-width window shows the hint once, under the header', async () => { + it('a phone-width window shows the hint once, under the strip that opens the menu', async () => { renderSurfaceAt(390); const hint = await screen.findByText(HINT); expect(hint).toHaveAttribute('role', 'note'); expect(screen.getAllByText(HINT)).toHaveLength(1); - // Directly below the Studio header, above the pillar. - expect(hint.previousElementSibling?.tagName).toBe('HEADER'); + // Directly below the phone's strip (the menu's drawer control), above the pillar. + expect(hint.previousElementSibling).toHaveAttribute('data-testid', 'studio-mobile-strip'); }); it('the control: from `md` up, no hint', async () => { renderSurfaceAt(768); - // The header is up (its first control drawn), and the phone's line is not. - await screen.findByTestId('studio-back-to-app'); + // The left column is up (its way back drawn), and the phone's line is not. + await screen.findByTestId('studio-package-back'); await act(async () => { await new Promise((r) => setTimeout(r, 50)); }); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.entryReadsOnce-11797.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.entryReadsOnce-11797.test.tsx index dde19dfe9f1..42b79e4f55e 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.entryReadsOnce-11797.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.entryReadsOnce-11797.test.tsx @@ -161,9 +161,9 @@ describe('StudioDesignSurface — entry reads each question once (objectui#11797 for (const h of held) h.release(); await drain(); }); - // The writability gate's answer reaches the top bar: the package is served - // read-only, so Create app turns disabled. (The package switcher, the - // third reader, was removed by objectstack#36501.) - await waitFor(() => expect(screen.getByRole('button', { name: /Create app/ })).toBeDisabled()); + // The writability gate's answer reaches the left column: the package is + // served read-only, so the package switcher draws its lock + // (objectstack#37456; the top bar's Create app, which said it before, is gone). + await waitFor(() => expect(screen.getByTestId('studio-pkg-readonly')).toBeInTheDocument()); }); }); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.graphite-37455.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.graphite-37455.test.tsx index dbe9f5f4e50..e8258f838b5 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.graphite-37455.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.graphite-37455.test.tsx @@ -150,33 +150,34 @@ function carriesAccent(el: Element): boolean { describe('a non-default app theme does not tint Studio (objectstack#37455)', () => { it('CONTROL: the app\'s colour is on the page root, and it is not graphite', async () => { render(); - await screen.findByTestId('studio-shell-header'); + await screen.findByTestId('studio-pillars-host'); const root = document.documentElement.style; expect(root.getPropertyValue('--primary').trim()).not.toBe(''); expect(root.getPropertyValue('--accent').trim()).not.toBe(''); expect(root.getPropertyValue('--primary').trim()).not.toBe(STUDIO_ACCENT_HSL.light); }); - it('the surface\'s root carries Studio\'s accent: its header, the page and its buttons sit under it', async () => { + it('the surface\'s root carries Studio\'s accent: its top-left rows, the page and its buttons sit under it', async () => { render(); - const header = await screen.findByTestId('studio-shell-header'); - const scope = header.closest(ACCENT_SCOPE); + const host = await screen.findByTestId('studio-pillars-host'); + const scope = host.closest(ACCENT_SCOPE); expect(scope).not.toBeNull(); expect(scope).not.toBe(document.body); expect(carriesAccent(scope as Element)).toBe(true); - expect(scope).toContainElement(screen.getByTestId('studio-pillars-host')); + // objectstack#37456 — no top bar: the left column's top rows stand where it was. + expect(scope).toContainElement(screen.getByTestId('studio-top-left')); expect(scope).toContainElement(await screen.findByTestId('topbar-ai-assistant')); }); it('a portalled surface (the command palette) is outside the root and still under the accent, on body', async () => { render(); - const header = await screen.findByTestId('studio-shell-header'); + const host = await screen.findByTestId('studio-pillars-host'); const palette = await waitFor(() => { const el = document.querySelector(`[data-testid="${COMMAND_PALETTE_TESTID}"]`); expect(el).not.toBeNull(); return el as HTMLElement; }); - const studioRoot = header.closest(ACCENT_SCOPE) as Element; + const studioRoot = host.closest(ACCENT_SCOPE) as Element; expect(studioRoot.contains(palette)).toBe(false); expect(palette.closest(ACCENT_SCOPE)).toBe(document.body); expect(carriesAccent(document.body)).toBe(true); @@ -184,7 +185,7 @@ describe('a non-default app theme does not tint Studio (objectstack#37455)', () it('Studio unmounted: the accent leaves body, and the app\'s branding on the page root is as the app wrote it', async () => { const { rerender } = render(); - await screen.findByTestId('studio-shell-header'); + await screen.findByTestId('studio-pillars-host'); const primary = document.documentElement.style.getPropertyValue('--primary'); expect(carriesAccent(document.body)).toBe(true); @@ -286,8 +287,9 @@ describe('dark theme: the accent\'s dark declarations apply on the surface root it('under the dark theme, the surface root and body match the variant and carry dark graphite', async () => { document.documentElement.classList.add('dark'); render(); - const header = await screen.findByTestId('studio-shell-header'); - const studioRoot = header.closest(ACCENT_SCOPE) as Element; + // objectstack#37456 — no top bar: the left column's top-left is the anchor inside the surface root. + const topLeft = await screen.findByTestId('studio-top-left'); + const studioRoot = topLeft.closest(ACCENT_SCOPE) as Element; expect(studioRoot).not.toBeNull(); expect(document.documentElement).toHaveClass('dark'); for (const node of [studioRoot, document.body]) { @@ -300,8 +302,9 @@ describe('dark theme: the accent\'s dark declarations apply on the surface root it('CONTROL: under the light theme neither matches the variant, so the dark declarations do not apply', async () => { render(); - const header = await screen.findByTestId('studio-shell-header'); - const studioRoot = header.closest(ACCENT_SCOPE) as Element; + // objectstack#37456 — no top bar: the left column's top-left is the anchor inside the surface root. + const topLeft = await screen.findByTestId('studio-top-left'); + const studioRoot = topLeft.closest(ACCENT_SCOPE) as Element; expect(matchesDarkVariant(studioRoot)).toBe(false); expect(matchesDarkVariant(document.body)).toBe(false); // The accent still sits on both: only its light declarations apply. diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.homeLoop-12513.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.homeLoop-12513.test.tsx index ba2228d7158..41d975adbd5 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.homeLoop-12513.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.homeLoop-12513.test.tsx @@ -217,22 +217,21 @@ function renderAt(url: string) { } describe('Studio home loop (objectui#12513)', () => { - it('the header’s first way out is 「‹ Back to app」 now, not Studio home (objectstack#36501)', async () => { + it('the first way out is the way back, first in the package row, not Studio home (objectstack#36501, objectstack#37456)', async () => { // The Studio-home button and the switcher's Studio-home row were removed - // with the switcher: the landing is reached from the app. objectstack#36899 - // — the left menu's show / hide control leads the bar, so the way out is - // the button right after it. + // with the old switcher: the landing is reached from the app. + // objectstack#37456 — the top left's two rows: Studio's row holds the + // menu's show / hide control, and the package row starts with the way back. // objectstack#36903, objectstack#36904, objectstack#36905 — on the sharing // overview's page: the Automations, Data and Access pillars' addresses // redirect to the area now. renderAt(`/studio/${SHOWCASE}/owd`); - const back = await screen.findByTestId('studio-back-to-app'); - const header = screen.getByTestId('studio-shell-header'); - const buttons = within(header).getAllByRole('button'); - expect(buttons[0]).toBe(within(header).getByTestId('studio-menu-toggle')); - expect(buttons[1]).toBe(back); - expect(within(header).queryByRole('button', { name: 'Studio home' })).toBeNull(); + const back = await screen.findByTestId('studio-package-back'); + const row = screen.getByTestId('studio-package-row'); + expect(within(row).getAllByRole('button')[0]).toBe(back); + expect(within(screen.getByTestId('studio-brand-row')).getByTestId('studio-menu-toggle')).toBeTruthy(); + expect(screen.queryByRole('button', { name: 'Studio home' })).toBeNull(); }); // objectstack#36903 — the Automations rail's empty blocks went with the rail: // the package-less scope's list offers no create (StudioDesignSurface.packageLessFlows-11553). diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.interfacesRetired-36502.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.interfacesRetired-36502.test.tsx index 4a48e76ad49..f55ae7c8338 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.interfacesRetired-36502.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.interfacesRetired-36502.test.tsx @@ -214,7 +214,7 @@ const notice = () => screen.queryByTestId('studio-interfaces-retired'); describe('an old Interfaces URL lands on the Studio home (objectstack#36502)', () => { it('the bare URL: Data pillar, the notice, and a link back to the app', async () => { renderAt(`/studio/${PKG}/interfaces`); - await screen.findByTestId('studio-shell-header'); + await screen.findByTestId('studio-top-left'); await waitFor(() => expect(where()).toBe(STUDIO_HOME)); const strip = await screen.findByTestId('studio-interfaces-retired'); @@ -232,7 +232,7 @@ describe('an old Interfaces URL lands on the Studio home (objectstack#36502)', ( it('a `?surface=` deep link lands on the same home, its retired parameter dropped', async () => { renderAt(`/studio/${PKG}/interfaces?surface=${encodeURIComponent('page:home')}`); - await screen.findByTestId('studio-shell-header'); + await screen.findByTestId('studio-top-left'); await waitFor(() => expect(where()).toBe(STUDIO_HOME)); expect(await screen.findByTestId('studio-interfaces-retired')).toBeInTheDocument(); }); @@ -243,7 +243,7 @@ describe('an old Interfaces URL lands on the Studio home (objectstack#36502)', ( // that carries it is `studioInterfacesRetired.test`'s; the drawer opening // on an old link, with the real drawer mounted, is `copilotDoors-12894`'s. renderAt(`/studio/${PKG}/interfaces?surface=${encodeURIComponent('page:home')}&changes=review`); - await screen.findByTestId('studio-shell-header'); + await screen.findByTestId('studio-top-left'); expect(pathname()).toBe(HOME_PATH); expect(where()).not.toContain('surface=page'); expect(await screen.findByTestId('studio-interfaces-retired')).toBeInTheDocument(); @@ -272,13 +272,13 @@ describe('an old Interfaces URL lands on the Studio home (objectstack#36502)', ( expect(notice()).toBeNull(); fireEvent.click(screen.getByTestId('back-to-data')); await waitFor(() => expect(pathname()).toBe(HOME_PATH)); - await screen.findByTestId('studio-shell-header'); + await screen.findByTestId('studio-top-left'); expect(notice()).toBeNull(); }); it('the left menu links no Interfaces page', async () => { renderAt(`/studio/${PKG}/interfaces`); - await screen.findByTestId('studio-shell-header'); + await screen.findByTestId('studio-top-left'); const links = within(screen.getByTestId('studio-menu')).getAllByRole('link'); expect(links.map((a) => a.getAttribute('href'))).not.toContain(`/studio/${PKG}/interfaces`); expect(links.map((a) => a.textContent)).not.toContain('Interfaces'); @@ -286,7 +286,7 @@ describe('an old Interfaces URL lands on the Studio home (objectstack#36502)', ( it('CONTROL: an ordinary arrival on the Data pillar shows no notice', async () => { renderAt(`/studio/${PKG}/data`); - await screen.findByTestId('studio-shell-header'); + await screen.findByTestId('studio-top-left'); await waitFor(() => expect(where()).toBe(STUDIO_HOME)); expect(notice()).toBeNull(); }); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.itemDraftLine-12725.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.itemDraftLine-12725.test.tsx index 84945ff36b3..63e5cbcbcc7 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.itemDraftLine-12725.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.itemDraftLine-12725.test.tsx @@ -176,7 +176,7 @@ async function openTask() { // objectstack#36904 — the object designer opens on the object's address. await waitFor(() => expect(within(header()).getAllByText('Task')[0]).toBeInTheDocument(), SLOW); expect(headerStatus()).toBeNull(); - expect(screen.queryByTestId('studio-changes-count')).toBeNull(); + expect(screen.queryByTestId('studio-menu-overview-pending')).toBeNull(); } /** The copilot's tool wrote drafts server-side, and its result landed. */ @@ -193,7 +193,7 @@ describe('the item header\'s draft line follows the badge\'s ledger (objectui#12 await copilotDrafts(COPILOT_DRAFTS); await waitFor(() => expect(headerStatus()).toHaveTextContent(draftLine(2))); - expect(screen.getByTestId('studio-changes-count')).toHaveTextContent('2'); + expect(screen.getByTestId('studio-menu-overview-pending')).toHaveTextContent('2'); // The longer sentence says what N counts. expect(headerStatus()).toHaveAccessibleDescription(tFormat('engine.studio.itemDraftPendingTitle', 'en', { count: 2 })); // The pillar's own reading re-read the object, which has no draft of its own here. @@ -211,7 +211,7 @@ describe('the item header\'s draft line follows the badge\'s ledger (objectui#12 expect(mockClient.publishPackageDrafts).toHaveBeenCalledWith(PACKAGE_ID); await waitFor(() => expect(headerStatus()).toBeNull()); - expect(screen.queryByTestId('studio-changes-count')).toBeNull(); + expect(screen.queryByTestId('studio-menu-overview-pending')).toBeNull(); }); it('is gone after a discard takes the item off the ledger', async () => { @@ -224,7 +224,7 @@ describe('the item header\'s draft line follows the badge\'s ledger (objectui#12 await copilotDrafts(COPILOT_DRAFTS.slice(1)); await waitFor(() => expect(headerStatus()).toBeNull()); - expect(screen.getByTestId('studio-changes-count')).toHaveTextContent('1'); + expect(screen.getByTestId('studio-menu-overview-pending')).toHaveTextContent('1'); }); it('CONTROL: a draft of another item is counted by the badge and marks no header', async () => { @@ -233,7 +233,7 @@ describe('the item header\'s draft line follows the badge\'s ledger (objectui#12 { type: 'object', name: 'acme_project', label: 'Project', packageId: PACKAGE_ID, updatedAt: null, updatedBy: 'u1' }, ]); - await waitFor(() => expect(screen.getByTestId('studio-changes-count')).toHaveTextContent('1')); + await waitFor(() => expect(screen.getByTestId('studio-menu-overview-pending')).toHaveTextContent('1')); expect(headerStatus()).toBeNull(); }); }); @@ -264,7 +264,7 @@ describe('the item header\'s draft line after the copilot\'s undo, the object op await copilotDrafts([]); await waitFor(() => expect(headerStatus()).toBeNull()); - expect(screen.queryByTestId('studio-changes-count')).toBeNull(); + expect(screen.queryByTestId('studio-menu-overview-pending')).toBeNull(); await waitFor(() => expect(objectDraftReads()).toBe(before + 1)); expect(screen.queryByText(t('engine.studio.unpublishedDraft', 'en'))).toBeNull(); }); @@ -294,7 +294,7 @@ describe('a draft an agent stages outside the tab reaches the open item when the switchTab(false); - await waitFor(() => expect(screen.getByTestId('studio-changes-count')).toHaveTextContent('2'), SLOW); + await waitFor(() => expect(screen.getByTestId('studio-menu-overview-pending')).toHaveTextContent('2'), SLOW); await waitFor(() => expect(headerStatus()).toHaveTextContent(draftLine(2))); // The Data pillar re-read its open object on the same pulse — where its // draft marks are read from (objectstack#32610). diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.metadataArea-28561.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.metadataArea-28561.test.tsx index af0758ae3df..bc9fee8db9d 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.metadataArea-28561.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.metadataArea-28561.test.tsx @@ -279,10 +279,10 @@ describe('the area\'s form editor in the builder (objectstack#28569)', () => { renderAt(`/studio/${PACKAGE_ID}/metadata/translation/ui_en?package=${PACKAGE_ID}`); const editor = await screen.findByTestId('form-editor', undefined, { timeout: 8000 }); expect(editor).toHaveAttribute('data-customization', 'null'); - expect(screen.queryByTestId('studio-changes-count')).toBeNull(); + expect(screen.queryByTestId('studio-menu-overview-pending')).toBeNull(); fireEvent.click(within(editor).getByRole('button', { name: 'save a draft' })); // The header counts the draft the save wrote, before its own re-read answers. - expect(await screen.findByTestId('studio-changes-count')).toHaveTextContent('1'); + expect(await screen.findByTestId('studio-menu-overview-pending')).toHaveTextContent('1'); }); }); @@ -390,7 +390,7 @@ describe('⌘K and the header ask before they drop edits the item page holds (ob servePackages(); renderAt(ITEM_URL); expect((await areaPage()).page).toBe('item'); - fireEvent.click(await screen.findByTestId('studio-back-to-app')); + fireEvent.click(await screen.findByTestId('studio-package-back')); expect(confirmSpy).toHaveBeenCalledWith(ITEM_QUESTION); expect(where()).toBe(ITEM_URL); }); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.narrowHeader-12509.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.narrowHeader-12509.test.tsx deleted file mode 100644 index 3a231d963d1..00000000000 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.narrowHeader-12509.test.tsx +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. - -/** - * objectui#12509, objectstack#36899 — the Studio shell header on a narrow - * window. - * - * objectui#12509 measured a 558 px window where the one 48 px row put the - * pillar switcher's Access segment under Changes and clipped Publish, and gave - * the switcher a second row below 640 px. objectstack#36899 moved navigation - * out of the header into the left menu (a drawer below 768 px), so the header - * holds two things at every width: the menu toggle with 「‹ Back to app」 and - * the package name on the left, the package actions on the right. It is one - * 48 px row of two columns: the left one shrinks to nothing (the name - * truncates), the right one never drops below its content, so nothing sits - * under anything. - * - * jsdom has no layout, so the pin reads the Tailwind classes of the token. The - * wide / narrow / collapsed screenshots in the PR are the layout evidence. - */ - -import { describe, expect, it } from 'vitest'; -import { STUDIO_HEADER } from './studio-tokens'; - -describe('Studio shell header at every width (objectui#12509, objectstack#36899)', () => { - it('is one 48 px row of two columns: a left column that shrinks, a right column that never drops below its content', () => { - const classes = STUDIO_HEADER.split(/\s+/).filter(Boolean); - expect(classes).toEqual(expect.arrayContaining(['grid', 'h-12', 'shrink-0', 'items-center', 'grid-cols-[minmax(0,1fr)_auto]'])); - // No breakpoint re-lays it out: the switcher's second row is gone. - expect(classes.filter((c) => /^[a-z0-9]+:/.test(c) && !c.startsWith('@container'))).toEqual([]); - }); -}); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.noTopBar-37456.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.noTopBar-37456.test.tsx new file mode 100644 index 00000000000..4c1ff4d48f1 --- /dev/null +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.noTopBar-37456.test.tsx @@ -0,0 +1,293 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * objectstack#37456 — ACCEPTANCE: Studio has no top bar, and every tenant the + * bar held is reached at its new home (ADR-0084, amended 2026-11-26, + * `#amendment-2026-11-26-homes`, the seven-row table), walked on the real + * surface: + * + * 1. The way back: the first control of the package row, the open package + * named by the switcher beside it; a package picked there opens on 概览. + * 2. The ⋯ package menu: 概览 Overview's header, not the left column. + * 3. Changes with its count, and Publish: the count is the badge on the + * menu's 概览 row; one click opens the Pending tab, whose Publish sends the + * package's one publish request. + * 4. Save and Cancel: the item header (pinned on this bar-less surface by + * `StudioDesignSurface.saveBar-36511`). + * 5. The AI assistant and the right panel's toggle: the end of the page's + * title row (`StudioDesignSurface.rightSlot-12725`), and, on a page with + * none, the title-row fallback (`StudioTopLeft-37456`). + * 6. The menu's show / hide control: Studio's row; under 768 px, the strip + * above the page, since the rows live inside the drawer there. + * 7. 「Create app」 and its 「waits for a publish」 label: no home (silent item + * 5) — drawn nowhere. + */ + +import '@testing-library/jest-dom/vitest'; +import * as React from 'react'; +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; +import { cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react'; +import { MemoryRouter, Route, Routes, useLocation } from 'react-router-dom'; +// The surface's reach loads `@objectstack/lint` lazily; pay that load during +// collection, not inside a case's clocked window (`check:test-source-alias`). +import '@objectstack/lint'; +// The surface mounts the command palette, which reaches the record preview's +// `lazy()` detail entry: its first load is paid at collection too. +import '@object-ui/plugin-detail'; +import { MePermissionsProvider, type MePermissionsAuthenticatedResponse } from '@object-ui/permissions'; +import { loadStudioCatalogue } from '@object-ui/i18n/namespaces/studio'; +await loadStudioCatalogue('zh'); + +let localeFixture: 'en-US' | 'zh-CN' = 'en-US'; +vi.mock('../metadata-admin/i18n', async (importOriginal) => ({ + ...(await importOriginal>()), + useMetadataLocale: () => localeFixture, +})); +vi.mock('@object-ui/react', async (importOriginal) => { + const actual = await importOriginal>(); + return { ...actual, useAdapter: () => ({}) }; +}); +vi.mock('sonner', () => ({ + toast: { warning: vi.fn(), error: vi.fn(), success: vi.fn(), info: vi.fn(), message: vi.fn(), dismiss: vi.fn() }, + Toaster: () => null, +})); +vi.mock('../../components/SuggestedBindingsPanel', () => ({ SuggestedBindingsPanel: () => null })); +vi.mock('../metadata-admin/AccessExplainPanel', () => ({ AccessExplainPanel: () => null })); +vi.mock('./StudioAiCopilot', () => ({ StudioChatDock: () => null })); + +/** + * The changes panel, as a probe: the Pending tab's (`embedded`) draws a Publish + * that fires the `onPublish` the surface hands it, so the walk reaches the + * package's publish request itself. + */ +vi.mock('../../preview/DraftChangesPanel', () => ({ + DraftChangesPanel: (props: { embedded?: boolean; onPublish?: () => void }) => + props.embedded ? ( +
+ {props.onPublish ? ( + + ) : null} +
+ ) : null, +})); + +import { StudioDesignSurface } from './StudioDesignSurface'; +import { StudioPillarRedirect } from './StudioPillarRedirect'; +import { t } from '../metadata-admin/i18n'; + +const OWN = 'com.example.sales'; +const INSTALLED = 'com.vendor.crm'; + +window.matchMedia = ((query: string) => ({ + matches: false, + media: query, + onchange: null, + addEventListener: () => {}, + removeEventListener: () => {}, + addListener: () => {}, + removeListener: () => {}, + dispatchEvent: () => false, +})) as unknown as typeof window.matchMedia; +(globalThis as unknown as { ResizeObserver: unknown }).ResizeObserver = + (globalThis as unknown as { ResizeObserver?: unknown }).ResizeObserver ?? + class { + observe() {} + unobserve() {} + disconnect() {} + }; + +function json(body: unknown, status = 200): Response { + return new Response(JSON.stringify(body), { status, headers: { 'content-type': 'application/json' } }); +} + +const PACKAGE_LIST = { + success: true, + data: [ + { + manifest: { id: OWN, name: 'Sales', namespace: 'sales', version: '0.1.0', type: 'app', description: 'Pipeline and orders' }, + writable: true, + enabled: true, + source: 'authored', + }, + { + manifest: { id: INSTALLED, name: 'Vendor CRM', namespace: 'vcrm', version: '2.0.0', type: 'app' }, + writable: false, + enabled: true, + source: 'marketplace', + }, + ], +}; + +/** The paths of the POSTs the surface sent. */ +let posts: string[] = []; + +/** Each package's pending drafts. */ +let drafts: Record> = {}; + +beforeEach(() => { + localeFixture = 'en-US'; + posts = []; + window.innerWidth = 1280; + drafts = { [OWN]: [{ type: 'object', name: 'sales_lead' }, { type: 'flow', name: 'notify' }] }; + vi.stubGlobal( + 'fetch', + vi.fn(async (input: unknown, init?: RequestInit) => { + const url = new URL(String(input), 'http://localhost'); + const path = url.pathname; + if (init?.method === 'POST') posts.push(path); + if (path.endsWith('/publish-drafts')) return json({ success: true, data: { published: 2 } }); + if (path === '/api/v1/packages') return json(PACKAGE_LIST); + if (path === '/api/v1/meta/_drafts') return json({ drafts: drafts[url.searchParams.get('package') ?? ''] ?? [] }); + if (path.endsWith('/layers')) return json({ code: null, overlay: null, overlayScope: null, effective: null }); + if (/^\/api\/v1\/meta\/[^/]+\/[^/]+$/.test(path)) return json({}, 404); + return json([]); + }) as unknown as typeof fetch, + ); +}); + +afterEach(() => { + cleanup(); + vi.unstubAllGlobals(); +}); + +function answer(held: string[]): MePermissionsAuthenticatedResponse { + return { + authenticated: true, + userId: 'u1', + tenantId: null, + positions: [], + hasAnyQueue: false, + objectsUsingQueues: [], + permissionSets: [], + systemPermissions: held, + objects: { '*': { allowRead: true, allowCreate: true, allowEdit: true, allowDelete: true } }, + fields: {}, + } as MePermissionsAuthenticatedResponse; +} + +const AUTHOR = answer(['studio.access', 'manage_metadata', 'setup.access', 'manage_platform_settings']); + +function Where() { + const location = useLocation(); + return

{`${location.pathname}${location.search}`}

; +} + +function renderAt(entry: string, perms = AUTHOR) { + return render( + + + + } /> + + + + + + + } + /> + + + , + ); +} + +const topLeft = () => screen.getByTestId('studio-top-left'); + +/** The surface has read the package list: the switcher names the open package. */ +async function settled(name: string) { + await waitFor(() => expect(screen.getByTestId('studio-pkg-switcher-name')).toHaveTextContent(name), { timeout: 8000 }); +} + +describe('Studio has no top bar; every tenant at its new home (objectstack#37456)', () => { + it('no top bar on a pillar nor on 概览; CONTROL: the left column\'s two rows are drawn', async () => { + renderAt(`/studio/${OWN}/data`); + await settled('Sales'); + expect(screen.queryByTestId('studio-shell-header')).toBeNull(); + expect(screen.queryByRole('banner')).toBeNull(); + expect(within(topLeft()).getByTestId('studio-brand-row')).toBeInTheDocument(); + expect(within(topLeft()).getByTestId('studio-package-row')).toBeInTheDocument(); + cleanup(); + renderAt(`/studio/${OWN}/overview`); + await settled('Sales'); + expect(screen.queryByTestId('studio-shell-header')).toBeNull(); + }); + + it('1 + 6: the way back leads the package row; the one menu toggle is in Studio\'s row', async () => { + renderAt(`/studio/${OWN}/data`); + await settled('Sales'); + const row = within(topLeft()).getByTestId('studio-package-row'); + expect(within(row).getAllByRole('button')[0]).toBe(within(row).getByTestId('studio-package-back')); + expect(within(row).getByTestId('studio-pkg-switcher')).toBeInTheDocument(); + const toggles = screen.getAllByTestId('studio-menu-toggle'); + expect(toggles).toHaveLength(1); + expect(within(screen.getByTestId('studio-brand-row')).getByTestId('studio-menu-toggle')).toBe(toggles[0]); + expect(screen.queryByTestId('studio-mobile-strip')).toBeNull(); + }); + + it('6: under 768 px the strip above the page holds the drawer control, and it opens the drawer', async () => { + window.innerWidth = 390; + renderAt(`/studio/${OWN}/data`); + const strip = await screen.findByTestId('studio-mobile-strip', undefined, { timeout: 8000 }); + expect(screen.queryByTestId('studio-top-left')).toBeNull(); + fireEvent.click(within(strip).getByTestId('studio-menu-toggle')); + const drawer = await screen.findByRole('dialog'); + expect(within(drawer).getByTestId('studio-top-left')).toBeInTheDocument(); + expect(within(drawer).getByTestId('studio-package-back')).toBeInTheDocument(); + }); + + it('1: picking a package in the switcher opens it on its 概览 (ADR-0084, amended 2026-11-26)', async () => { + renderAt(`/studio/${OWN}/data`); + await settled('Sales'); + fireEvent.click(screen.getByTestId('studio-pkg-switcher')); + const menu = await screen.findByTestId('studio-pkg-switcher-menu'); + const row = await waitFor(() => { + const el = menu.querySelector(`[data-package="${INSTALLED}"]`); + expect(el).not.toBeNull(); + return el as HTMLElement; + }); + fireEvent.click(row); + await waitFor(() => expect(screen.getByTestId('where')).toHaveTextContent(`/studio/${INSTALLED}/overview`)); + }); + + it('2: the ⋯ menu is in 概览\'s header, and nowhere in the left column', async () => { + renderAt(`/studio/${OWN}/overview`); + await settled('Sales'); + const header = await screen.findByTestId('studio-package-overview-header', undefined, { timeout: 8000 }); + await waitFor(() => expect(within(header).getByTestId('studio-package-menu')).toBeInTheDocument()); + expect(screen.getAllByTestId('studio-package-menu')).toHaveLength(1); + expect(within(topLeft()).queryByTestId('studio-package-menu')).toBeNull(); + }); + + it('3: the count is 概览\'s badge; one click opens Pending, and its Publish sends the package publish', async () => { + renderAt(`/studio/${OWN}/data`); + await settled('Sales'); + const badge = await screen.findByTestId('studio-menu-overview-pending', undefined, { timeout: 8000 }); + await waitFor(() => expect(badge).toHaveTextContent('2')); + expect(screen.queryByTestId('studio-changes-count')).toBeNull(); + fireEvent.click(badge); + await waitFor(() => expect(screen.getByTestId('where')).toHaveTextContent(`/studio/${OWN}/overview?tab=pending`)); + const panel = await screen.findByTestId('pending-panel-probe', undefined, { timeout: 8000 }); + fireEvent.click(within(panel).getByTestId('pending-panel-publish')); + await waitFor(() => expect(posts).toContain(`/api/v1/packages/${encodeURIComponent(OWN)}/publish-drafts`)); + }); + + it('3, CONTROL: a read-only package\'s Pending offers no Publish', async () => { + drafts = { [INSTALLED]: [{ type: 'object', name: 'vcrm_deal' }] }; + renderAt(`/studio/${INSTALLED}/overview?tab=pending`); + const panel = await screen.findByTestId('pending-panel-probe', undefined, { timeout: 8000 }); + expect(within(panel).queryByTestId('pending-panel-publish')).toBeNull(); + }); + + it('7: 「Create app」 and its pending label are drawn nowhere, for a package with no app', async () => { + renderAt(`/studio/${OWN}/data`); + await settled('Sales'); + expect(screen.queryByRole('button', { name: t('engine.studio.app.create', 'en') })).toBeNull(); + expect(screen.queryByText(t('engine.studio.app.create', 'en'))).toBeNull(); + }); +}); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.notFound-26708.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.notFound-26708.test.tsx index f8ebd5d054f..c41e925aec4 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.notFound-26708.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.notFound-26708.test.tsx @@ -195,12 +195,19 @@ describe('Studio: a package id no package has renders "package not found" (objec const notFound = await screen.findByTestId('studio-package-not-found'); expect(notFound).toHaveTextContent(tFormat('engine.studio.notFound.package', 'en', { id: PHANTOM })); - const header = screen.getByTestId('studio-shell-header'); + // objectstack#37456 — no top bar, and no left column (its rows live in the menu)… + expect(screen.queryByTestId('studio-shell-header')).toBeNull(); + // …but the way back the bar drew stays, on a strip of its own, to the apps home. + const strip = screen.getByTestId('studio-missing-package-strip'); + const back = within(strip).getByTestId('studio-package-back'); + expect(back).toHaveAccessibleName(t('engine.studio.backToAppTitleNoApp', 'en')); + expect(back).toHaveAttribute('data-target', '/home'); expect(screen.queryByTestId('studio-menu')).toBeNull(); - expect(within(header).queryByTestId('studio-menu-toggle')).toBeNull(); - expect(within(header).queryByRole('button', { name: new RegExp(t('engine.studio.publish', 'en')) })).toBeNull(); - expect(within(header).queryByRole('button', { name: new RegExp(t('engine.studio.changes', 'en')) })).toBeNull(); - expect(within(header).queryByTitle(t('engine.studio.app.noneTitle', 'en'))).toBeNull(); + expect(screen.queryByTestId('studio-menu-toggle')).toBeNull(); + expect(screen.queryByTestId('studio-mobile-strip')).toBeNull(); + expect(screen.queryByRole('button', { name: new RegExp(t('engine.studio.publish', 'en')) })).toBeNull(); + expect(screen.queryByRole('button', { name: new RegExp(t('engine.studio.changes', 'en')) })).toBeNull(); + expect(screen.queryByTitle(t('engine.studio.app.noneTitle', 'en'))).toBeNull(); // The one list read the builder already makes — no second request. expect(packageListReads(fetchMock)).toBe(1); }); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.packageLessFlows-11553.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.packageLessFlows-11553.test.tsx index a85765c3ac7..76b274bc943 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.packageLessFlows-11553.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.packageLessFlows-11553.test.tsx @@ -335,7 +335,7 @@ describe('the package-less scope lists a package-less flow and opens it editable expect(saved!.options?.packageId).toBeUndefined(); }); - it('offers its one page, no Create app, no package copilot, and names the scope beside 「‹ Back to app」', async () => { + it('offers its one page, no Create app, no package copilot, and names the scope beside the way back', async () => { renderAt(ORG_CLONE); await openedFlow('qa_urgent_alert_clone'); @@ -354,8 +354,14 @@ describe('the package-less scope lists a package-less flow and opens it editable expect(screen.queryByRole('button', { name: /Create app/ })).not.toBeInTheDocument(); expect(chatDock.mounts).toBe(0); // objectstack#36501, decision 5 (objectstack#36899) — no app owns the - // scope, so the name slot names the scope, as for a package with no app. - expect(screen.getByTestId('studio-back')).toHaveTextContent(/^Back to app·Organization flows·App Studio$/); + // scope, so it is named, as a package with no app is: objectstack#37456 — + // by the package row's switcher, beside the way back to the apps home. + const row = within(screen.getByTestId('studio-package-row')); + // Named for what it holds, not after its one flow entry (the menu row keeps that name). + expect(row.getByTestId('studio-pkg-switcher-name')).toHaveTextContent(/^Organization metadata$/); + expect(screen.getByTestId('studio-menu-entry-orgFlows')).toHaveTextContent('Organization flows'); + expect(row.getByTestId('studio-package-back')).toHaveAccessibleName('Leave Studio and go back to your apps'); + expect(screen.getByTestId('studio-brand-name')).toHaveTextContent(/^App Studio$/); // No "New" flow here: authoring stays package-first. expect(screen.queryByTitle('New automation')).not.toBeInTheDocument(); }); @@ -439,10 +445,30 @@ describe('the package-less scope reviews and publishes exactly its own drafts (o ); }); - it('counts only package-less flow drafts', async () => { + // objectstack#37456 — the top bar's Changes moved to 概览's Pending tab, and + // the scope has no 概览: its Changes is a row of the left column's top. + it('counts only package-less flow drafts, in the left column\'s Changes row', async () => { renderAt(ORG_CLONE); await openedFlow('qa_urgent_alert_clone'); - await waitFor(() => expect(screen.getByRole('button', { name: /Changes · 1$/ })).toBeInTheDocument()); + const changes = await screen.findByRole('button', { name: /Changes · 1$/ }, { timeout: 8000 }); + expect(screen.getByTestId('studio-top-left')).toContainElement(changes); + }); + + it('the Changes row opens the sheet, to review, and the sheet carries the scope\'s Publish', async () => { + renderAt(ORG_CLONE); + await openedFlow('qa_urgent_alert_clone'); + fireEvent.click(await screen.findByTestId('studio-scope-changes', undefined, { timeout: 8000 })); + await waitFor(() => expect(panelProps()?.open).toBe(true)); + // To review: no door sets the confirm posture any more (objectstack#37456). + expect(panelProps()?.posture).not.toBe('confirm'); + expect(panelProps()?.onPublish).toBeTypeOf('function'); + }); + + it('CONTROL: a package draws no Changes row; its count is 概览\'s badge', async () => { + renderAt(`/studio/${SHOWCASE}/metadata/flow/showcase_urgent_task_alert`); + await openedFlow('showcase_urgent_task_alert'); + await waitFor(() => expect(screen.getByTestId('studio-menu-overview-pending')).toHaveTextContent('1')); + expect(screen.queryByTestId('studio-scope-changes')).toBeNull(); }); it('hands the sheet a filter that keeps only package-less flow drafts', async () => { diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.packageListErrorPosture.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.packageListErrorPosture.test.tsx index a086c76a187..d01c5c8b0dc 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.packageListErrorPosture.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.packageListErrorPosture.test.tsx @@ -138,7 +138,7 @@ describe('Studio top bar — package-list fetch failure is reported, not swallow expect(screen.getByRole('navigation', { name: 'Studio menu' })).toBeInTheDocument(); // …and its way out still works (objectstack#36501): no app is known, so // it goes to the console's landing. - fireEvent.click(screen.getByTestId('studio-back-to-app')); + fireEvent.click(screen.getByTestId('studio-package-back')); expect(await screen.findByTestId('home-page')).toBeInTheDocument(); }); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.pillarNavGuard.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.pillarNavGuard.test.tsx index fe5c8a7d1b9..47a6fd4909b 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.pillarNavGuard.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.pillarNavGuard.test.tsx @@ -363,20 +363,20 @@ describe('Studio — unsaved pillar edits guard (#2600)', () => { dirtyTheMatrix(); confirmSpy.mockReturnValueOnce(false); - fireEvent.click(screen.getByTestId('studio-back-to-app')); + fireEvent.click(screen.getByTestId('studio-package-back')); expect(confirmSpy).toHaveBeenCalledTimes(1); expect(inSetHeader().getByTitle('set_a')).toBeInTheDocument(); matrixEditSurvived(); confirmSpy.mockReturnValueOnce(true); - fireEvent.click(screen.getByTestId('studio-back-to-app')); + fireEvent.click(screen.getByTestId('studio-package-back')); expect(await screen.findByTestId('left-studio')).toBeInTheDocument(); }); it('never prompts a clean 「‹ Back to app」', async () => { await renderSurfaceOnSet(); - fireEvent.click(screen.getByTestId('studio-back-to-app')); + fireEvent.click(screen.getByTestId('studio-package-back')); expect(confirmSpy).not.toHaveBeenCalled(); expect(await screen.findByTestId('left-studio')).toBeInTheDocument(); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.pillarsClaimSlot-12725.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.pillarsClaimSlot-12725.test.tsx index e9d07bd642b..f29c523989a 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.pillarsClaimSlot-12725.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.pillarsClaimSlot-12725.test.tsx @@ -459,7 +459,9 @@ describe('no copilot served: the slot\'s toggle ends the page\'s title row (obje const button = await screen.findByTestId('studio-slot-toggle'); expect(screen.getAllByTestId('studio-slot-toggle')).toHaveLength(1); - expect(within(screen.getByTestId('studio-shell-header')).queryByTestId('studio-slot-toggle')).toBeNull(); + // objectstack#37456 — there is no top bar to hold it, and the left column does not either. + expect(screen.queryByTestId('studio-shell-header')).toBeNull(); + expect(screen.getByTestId('studio-top-left')).not.toContainElement(button); expect(screen.getByTestId('studio-pillars-host')).toContainElement(button); expect(slot().contains(button)).toBe(false); // The last control of its row, the hairline right before it. diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishBackfill-12929.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishBackfill-12929.test.tsx index 1c419ad5ab7..0a206d6726c 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishBackfill-12929.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishBackfill-12929.test.tsx @@ -5,8 +5,8 @@ * rows publishes with the option checked and the response count N is shown; * unchecked, nothing is written. * - * End to end through the Studio's own publish: the header's Publish opens the - * real review sheet (confirm posture, every row expanded), the drill-in offers + * End to end through the Studio's own publish: 概览's Pending tab (objectstack#37456; + * the menu's badge opens it) draws the real changes panel in place, the drill-in offers * the unchecked choice naming the object's N records, the sheet's Publish all * hands the checked field to the surface, and the surface sends it through the * real `MetadataClient` to `POST /packages/:id/publish-drafts`. The server's @@ -168,7 +168,7 @@ afterEach(() => { }); /** - * Open the sheet the way the author does: the header's Publish, which opens it to confirm. + * Open the panel the way the author does: the menu's 概览 badge, onto the Pending tab. * * Resolves once the backfill option is drawn, NOT once its count is: the drill-in * asks the adapter for the record count only after the option renders, and names @@ -184,10 +184,14 @@ async function openSheet(): Promise { , ); - const publish = () => screen.getByRole('button', { name: t('engine.studio.publish', 'en') }); - await waitFor(() => expect(publish()).toBeEnabled()); - fireEvent.click(publish()); - const sheet = await screen.findByTestId('draft-changes-panel'); + // objectstack#37456 — Publish lives on 概览's Pending tab: the menu's badge opens it. + fireEvent.click(await screen.findByTestId('studio-menu-overview-pending', undefined, { timeout: 8000 })); + const sheet = await screen.findByTestId('draft-changes-panel', undefined, { timeout: 8000 }); + expect(sheet).toHaveAttribute('data-embedded'); + // In place the rows open to review, collapsed: the author opens the object's + // row to reach its drill-in (the top bar's Publish opened them all, to confirm). + const toggle = await within(sheet).findByTestId('draft-entry-toggle', undefined, { timeout: 8000 }); + fireEvent.click(toggle); await within(sheet).findByTestId('draft-backfill-option'); return sheet; } diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishPosture-12517.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishPosture-12517.test.tsx deleted file mode 100644 index 666e8a3d538..00000000000 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishPosture-12517.test.tsx +++ /dev/null @@ -1,192 +0,0 @@ -// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. - -/** - * objectui#12517 — the shell header's two doors into the one pending-changes - * sheet open it in two postures: Publish opens it to confirm, Changes opens it - * to review. One sheet, one component; the host only says which door was used. - * - * Publish stays review-then-confirm (objectui#2261): the header click opens the - * sheet and publishes nothing; only the sheet's footer button does. With - * nothing pending, neither door is drawn (objectstack#36511). - * - * Real: the surface, `useMetadataClient` and `usePendingDrafts`. Stubbed: - * `globalThis.fetch`, `packages-io`'s package list, `sonner`, the dock and - * panels no assertion reads, and `DraftChangesPanel`, replaced by a probe that - * prints the props the surface mounts it with (the panel's own postures are - * pinned by `DraftChangesPanel.posture-12517.test.tsx`). - */ - -import '@testing-library/jest-dom/vitest'; -import * as React from 'react'; -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; -import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'; -import { MemoryRouter, Route, Routes } from 'react-router-dom'; - -const PACKAGE_ID = 'app.a'; -const DRAFTS = `/api/v1/meta/_drafts?package=${PACKAGE_ID}`; - -vi.mock('sonner', () => ({ - toast: { - warning: vi.fn(), - error: vi.fn(), - success: vi.fn(), - info: vi.fn(), - message: vi.fn(), - dismiss: vi.fn(), - }, - Toaster: () => null, -})); - -vi.mock('./packages-io', async (importOriginal) => { - const actual = await importOriginal>(); - return { - ...actual, - fetchPackages: vi.fn(async () => [{ id: PACKAGE_ID, name: PACKAGE_ID, writable: true, namespace: 'a' }]), - }; -}); - -vi.mock('@object-ui/react', async (importOriginal) => { - const actual = await importOriginal>(); - return { ...actual, useAdapter: () => ({}) }; -}); - -vi.mock('../../components/SuggestedBindingsPanel', () => ({ SuggestedBindingsPanel: () => null })); -vi.mock('../metadata-admin/AccessExplainPanel', () => ({ AccessExplainPanel: () => null })); -vi.mock('./StudioAiCopilot', () => ({ StudioChatDock: () => null })); -vi.mock('../../preview/DraftChangesPanel', () => ({ - DraftChangesPanel: (props: { open: boolean; posture?: string; onPublish?: unknown }) => - props.open ? ( -
- ) : null, -})); - -// The console's preview and authoring code loads `@objectstack/lint` lazily; -// warmed here so its first load is paid at import, not inside a test's clock. -import '@objectstack/lint'; -// objectstack#36900 — the surface mounts the command palette, which reaches the -// record preview's `lazy()` detail entry: its first load is paid at collection too. -import '@object-ui/plugin-detail'; -import { StudioDesignSurface } from './StudioDesignSurface'; -import { StudioPillarRedirect } from './StudioPillarRedirect'; -import { t } from '../metadata-admin/i18n'; - -window.matchMedia = ((query: string) => ({ - matches: false, - media: query, - onchange: null, - addEventListener: () => {}, - removeEventListener: () => {}, - addListener: () => {}, - removeListener: () => {}, - dispatchEvent: () => false, -})) as unknown as typeof window.matchMedia; -(globalThis as unknown as { ResizeObserver: unknown }).ResizeObserver = - (globalThis as unknown as { ResizeObserver?: unknown }).ResizeObserver ?? - class { - observe() {} - unobserve() {} - disconnect() {} - }; - -let pending: Array> = []; -/** Every request the surface sent that is not a read. */ -const writes: string[] = []; - -function json(body: unknown) { - return new Response(JSON.stringify(body), { status: 200, headers: { 'content-type': 'application/json' } }); -} - -beforeEach(() => { - writes.length = 0; - vi.stubGlobal( - 'fetch', - vi.fn(async (input: unknown, init?: { method?: string }) => { - const url = String(input); - if (init?.method && init.method !== 'GET') writes.push(`${init.method} ${url}`); - if (url === DRAFTS) return json({ drafts: pending }); - return json([]); - }) as unknown as typeof fetch, - ); -}); - -afterEach(() => { - cleanup(); - vi.unstubAllGlobals(); -}); - -function renderSurface() { - render( - - - } /> - - , - ); -} - -const changesButton = () => screen.getByRole('button', { name: new RegExp(`^${t('engine.studio.changes', 'en')}`) }); -const publishButton = () => screen.getByRole('button', { name: t('engine.studio.publish', 'en') }); - -describe('objectui#12517 — Publish opens the sheet to confirm, Changes opens it to review', () => { - beforeEach(() => { - pending = [ - { type: 'object', name: 'a_ticket', packageId: PACKAGE_ID }, - { type: 'app', name: 'a_app', packageId: PACKAGE_ID }, - { type: 'page', name: 'a_home', packageId: PACKAGE_ID }, - ]; - }); - - it('Publish opens the one sheet in the confirm posture, and publishes nothing by itself', async () => { - renderSurface(); - await waitFor(() => expect(screen.getByTestId('studio-changes-count')).toHaveTextContent('3')); - await waitFor(() => expect(publishButton()).toBeEnabled()); - fireEvent.click(publishButton()); - const sheet = await screen.findByTestId('probe-changes-panel'); - expect(sheet).toHaveAttribute('data-posture', 'confirm'); - expect(sheet).toHaveAttribute('data-can-publish', 'true'); - expect(screen.getAllByTestId('probe-changes-panel')).toHaveLength(1); - // Review-then-confirm (objectui#2261): the header click wrote nothing. - expect(writes.filter((w) => w.includes('publish'))).toEqual([]); - }); - - it('Changes opens the same sheet in the review posture', async () => { - renderSurface(); - await waitFor(() => expect(screen.getByTestId('studio-changes-count')).toHaveTextContent('3')); - fireEvent.click(changesButton()); - const sheet = await screen.findByTestId('probe-changes-panel'); - expect(sheet).toHaveAttribute('data-posture', 'review'); - expect(screen.getAllByTestId('probe-changes-panel')).toHaveLength(1); - }); - - it('each door sets its own posture: Publish, then Changes, reads review the second time', async () => { - renderSurface(); - await waitFor(() => expect(publishButton()).toBeEnabled()); - fireEvent.click(publishButton()); - expect(await screen.findByTestId('probe-changes-panel')).toHaveAttribute('data-posture', 'confirm'); - fireEvent.click(changesButton()); - await waitFor(() => - expect(screen.getByTestId('probe-changes-panel')).toHaveAttribute('data-posture', 'review'), - ); - }); -}); - -describe('objectui#12517 — nothing pending', () => { - beforeEach(() => { - pending = []; - }); - - it('neither Changes nor Publish is drawn, and no count pill (objectstack#36511)', async () => { - renderSurface(); - // The ledger was read and answered nothing. - await waitFor(() => expect(vi.mocked(fetch).mock.calls.some(([u]) => String(u) === DRAFTS)).toBe(true)); - await new Promise((r) => setTimeout(r, 50)); - expect(screen.queryByRole('button', { name: new RegExp(`^${t('engine.studio.changes', 'en')}`) })).toBeNull(); - expect(screen.queryByRole('button', { name: t('engine.studio.publish', 'en') })).toBeNull(); - expect(screen.queryByTestId('studio-changes-count')).toBeNull(); - expect(screen.queryByTestId('publish-none-reason')).toBeNull(); - }); -}); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishReadOnlyReason-12303.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishReadOnlyReason-12303.test.tsx deleted file mode 100644 index 8fd210900c7..00000000000 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishReadOnlyReason-12303.test.tsx +++ /dev/null @@ -1,232 +0,0 @@ -// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. - -/** - * objectui#12303 row 4 — on a read-only package, the Studio header's Publish - * says why it is disabled, to a keyboard and to assistive tech, not only to a - * mouse. - * - * Measured on the card: the reason ("Read-only package — switch to or create - * a writable package to edit.") was a `title` on the disabled button, with no - * focusable wrapper. A natively disabled button fires no hover or focus, so - * the `title` reached nobody who does not hover, and Tab from "Changes" - * skipped Publish entirely. It now rides the record page's Archive pattern - * (`DeclaredActionsBar`, objectui#11811): a wrapping span that is the tooltip - * trigger and a tab stop, and an `sr-only` copy of the reason that both the - * span and the button are described by. The automation enable switch, the - * other half of the row, is pinned in - * `StudioDesignSurface.automationsReadOnly-11124.test.tsx`. - * - * objectstack#36511 — Publish is drawn only while drafts are pending, so the - * read-only cases below hold one, and with nothing pending there is no Publish - * and no "No drafts pending publish" reason (which objectstack#31495 had - * wrapped the same way). Pinned in the last block below. - * - * The REAL `StudioDesignSurface` over a fetch stub (the harness of - * `StudioDesignSurface.interfacePolish.test.tsx`); only the package list's - * `writable` differs between the case and its control. - */ - -import '@testing-library/jest-dom/vitest'; -import * as React from 'react'; -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; -import { act, cleanup, render, screen, waitFor } from '@testing-library/react'; -import userEvent from '@testing-library/user-event'; -import { MemoryRouter, Route, Routes } from 'react-router-dom'; -import { I18nProvider } from '@object-ui/i18n'; -// The surface loads the linter lazily; pay that load at collection, not inside -// a case's clocked window. -import '@objectstack/lint'; -import '@object-ui/plugin-detail'; - -const PACKAGE_ID = 'com.acme.app'; - -const pkg = vi.hoisted(() => ({ writable: false })); -/** The draft ledger `/meta/_drafts` answers. */ -let drafts: Array<{ type: string; name: string; packageId: string }> = []; - -vi.mock('./packages-io', async (importOriginal) => { - const actual = await importOriginal>(); - return { - ...actual, - fetchPackages: vi.fn(async () => [{ id: PACKAGE_ID, name: 'Acme', writable: pkg.writable }]), - }; -}); - -vi.mock('@object-ui/react', async (importOriginal) => { - const actual = await importOriginal>(); - return { ...actual, useAdapter: () => ({}) }; -}); - -vi.mock('../../components/SuggestedBindingsPanel', () => ({ SuggestedBindingsPanel: () => null })); -vi.mock('../metadata-admin/AccessExplainPanel', () => ({ AccessExplainPanel: () => null })); -vi.mock('./StudioAiCopilot', () => ({ StudioChatDock: () => null })); - -import { StudioDesignSurface } from './StudioDesignSurface'; -import { StudioPillarRedirect } from './StudioPillarRedirect'; -import { fetchPackages } from './packages-io'; -import { t } from '../metadata-admin/i18n'; - -window.matchMedia = ((query: string) => ({ - matches: false, - media: query, - onchange: null, - addEventListener: () => {}, - removeEventListener: () => {}, - addListener: () => {}, - removeListener: () => {}, - dispatchEvent: () => false, -})) as unknown as typeof window.matchMedia; -(globalThis as unknown as { ResizeObserver: unknown }).ResizeObserver = - (globalThis as unknown as { ResizeObserver?: unknown }).ResizeObserver ?? - class { - observe() {} - unobserve() {} - disconnect() {} - }; - -const REASON = t('engine.studio.pkg.readonlyHint', 'en-US'); -const NONE_PENDING = t('engine.studio.publishNoneTitle', 'en-US'); - -function json(body: unknown, status = 200) { - return new Response(JSON.stringify(body), { status, headers: { 'content-type': 'application/json' } }); -} - -beforeEach(() => { - pkg.writable = false; - drafts = [{ type: 'dashboard', name: 'acme_dashboard', packageId: PACKAGE_ID }]; - vi.stubGlobal( - 'fetch', - vi.fn(async (input: unknown) => { - const path = new URL(String(input), 'http://localhost').pathname; - if (path === '/api/v1/meta/_drafts') return json(drafts); - if (path === '/api/v1/meta/app') return json([{ name: 'acme_app', label: 'Acme' }]); - if (path === '/api/v1/meta/app/acme_app/layers') { - return json({ code: null, overlay: null, overlayScope: null, effective: { name: 'acme_app', label: 'Acme', navigation: [] } }); - } - if (path.endsWith('/layers')) return json({ code: null, overlay: null, overlayScope: null, effective: null }); - if (/^\/api\/v1\/meta\/[^/]+\/[^/]+$/.test(path)) return json({}, 404); - return json([]); - }) as unknown as typeof fetch, - ); -}); - -afterEach(() => { - cleanup(); - vi.unstubAllGlobals(); -}); - -function renderWorkbench() { - return render( - - - - } /> - } /> - - - , - ); -} - -const publish = () => screen.getByRole('button', { name: /^Publish/ }); -/** The element an `aria-describedby` names, or `null`. */ -const describedBy = (el: HTMLElement) => { - const id = el.getAttribute('aria-describedby'); - return id ? document.getElementById(id) : null; -}; - -/** Publish once its wrapper gives `reason`. */ -async function wrappedPublish(reason: string): Promise { - renderWorkbench(); - return waitFor( - () => { - const btn = publish(); - expect(btn.parentElement).toHaveAttribute('data-disabled-reason'); - expect(describedBy(btn.parentElement as HTMLElement)).toHaveTextContent(reason); - return btn; - }, - { timeout: 8000 }, - ); -} - -/** Publish once the package list has said the package is read-only. */ -const readOnlyPublish = () => wrappedPublish(REASON); - -describe('Studio header Publish on a read-only package — the reason reaches the author (objectui#12303)', () => { - it('Publish is described by the reason, carries no `title`, and its wrapper is described by it too', async () => { - const btn = await readOnlyPublish(); - expect(btn).toBeDisabled(); - expect(btn).not.toHaveAttribute('title'); - expect(describedBy(btn)).toHaveTextContent(REASON); - const wrapper = btn.parentElement as HTMLElement; - expect(wrapper).toHaveAttribute('tabindex', '0'); - expect(describedBy(wrapper)).toHaveTextContent(REASON); - }); - - it('hovering Publish opens a tooltip with the reason', async () => { - const user = userEvent.setup(); - const btn = await readOnlyPublish(); - await user.hover(btn.parentElement as HTMLElement); - expect(await screen.findByRole('tooltip')).toHaveTextContent(REASON); - }); - - it('a keyboard user reaches the reason: Tab from "Changes" lands on Publish’s wrapper, which opens the tooltip', async () => { - const user = userEvent.setup(); - const btn = await readOnlyPublish(); - screen.getByRole('button', { name: /^Changes/ }).focus(); - await user.tab(); - expect(btn.parentElement).toHaveFocus(); - expect(await screen.findByRole('tooltip')).toHaveTextContent(REASON); - }); - - it('CONTROL — a writable package: Publish gives no read-only reason', async () => { - pkg.writable = true; - renderWorkbench(); - // Read after the package list has answered `writable: true`. - await waitFor(() => expect(fetchPackages).toHaveBeenCalled(), { timeout: 8000 }); - await act(async () => { - for (let i = 0; i < 10; i++) await new Promise((r) => setTimeout(r, 0)); - }); - const btn = publish(); - expect(btn).toBeEnabled(); - expect(btn).not.toHaveAttribute('title', REASON); - expect(btn.parentElement).not.toHaveAttribute('data-disabled-reason'); - expect(screen.queryByText(REASON)).toBeNull(); - }); -}); - -describe('Studio header with nothing pending: no Publish, so no reason (objectstack#31495, objectstack#36511)', () => { - beforeEach(() => { - pkg.writable = true; - }); - - it('a writable package with an empty ledger draws no Publish and no "No drafts pending publish"', async () => { - drafts = []; - renderWorkbench(); - await waitFor(() => expect(fetchPackages).toHaveBeenCalled(), { timeout: 8000 }); - await act(async () => { - for (let i = 0; i < 10; i++) await new Promise((r) => setTimeout(r, 0)); - }); - expect(screen.queryByRole('button', { name: /^Publish/ })).toBeNull(); - expect(screen.queryByTestId('publish-none-reason')).toBeNull(); - expect(screen.queryByText(NONE_PENDING)).toBeNull(); - }); - - it('CONTROL — a draft pending: a plain enabled Publish, no wrapper and no reason', async () => { - drafts = [{ type: 'dashboard', name: 'acme_dashboard', packageId: PACKAGE_ID }]; - renderWorkbench(); - const btn = await waitFor( - () => { - const b = publish(); - expect(b).toBeEnabled(); - return b; - }, - { timeout: 8000 }, - ); - expect(btn.parentElement).not.toHaveAttribute('data-disabled-reason'); - expect(btn).not.toHaveAttribute('aria-describedby'); - expect(btn.className).not.toMatch(/(^|\s)disabled:pointer-events-none(\s|$)/); - expect(screen.queryByTestId('publish-none-reason')).toBeNull(); - expect(screen.queryByText(NONE_PENDING)).toBeNull(); - }); -}); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.rightSlot-12725.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.rightSlot-12725.test.tsx index 91c14c7d9b6..792b93a1703 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.rightSlot-12725.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.rightSlot-12725.test.tsx @@ -198,12 +198,15 @@ describe('Studio right slot — controls (objectui#12725)', () => { // objectstack#37455 — the slot's control left the top bar for the end of the // open page's title row: the item header's, and the list page's. describe('Studio right slot — its control ends the page\'s title row (objectstack#37455)', () => { - it('the sharing overview: the AI assistant ends its item header behind a hairline, not the top bar, and hides and shows the slot', async () => { + it('the sharing overview: the AI assistant ends its item header behind a hairline, not the left column, and hides and shows the slot', async () => { renderAt('owd'); await waitFor(() => expect(slot()).toHaveAttribute('data-mode', 'copilot')); const itemHeader = screen.getByTestId('owd-item-header'); const ai = await within(itemHeader).findByTestId('topbar-ai-assistant'); - expect(within(screen.getByTestId('studio-shell-header')).queryByTestId('topbar-ai-assistant')).toBeNull(); + // objectstack#37456 — there is no top bar to hold a second one, and the + // left column holds none. + expect(screen.queryByTestId('studio-shell-header')).toBeNull(); + expect(within(screen.getByTestId('studio-top-left')).queryByTestId('topbar-ai-assistant')).toBeNull(); expect(screen.getAllByTestId('topbar-ai-assistant')).toHaveLength(1); // The last control of the header's action slot, the hairline right before it. const actionSlot = ai.parentElement as HTMLElement; @@ -221,10 +224,17 @@ describe('Studio right slot — its control ends the page\'s title row (objectst expect(slot()).toHaveAttribute('data-mode', 'copilot'); }); - it('a list page: the AI assistant ends the list\'s title row, inside the page, not the top bar', async () => { + it('a list page: the AI assistant ends the list\'s title row, inside the page, not the left column', async () => { renderAt('data'); - const ai = await screen.findByTestId('topbar-ai-assistant', undefined, { timeout: 4000 }); - expect(within(screen.getByTestId('studio-shell-header')).queryByTestId('topbar-ai-assistant')).toBeNull(); + // objectstack#37456 — while the list loads it has no title row, and the + // pane's fallback holds the control (`StudioTitleRowFallback`); once the + // list's title row is drawn the control is there, and only there. + await waitFor( + () => expect(screen.getByTestId('topbar-ai-assistant').closest('[data-slot="studio-title-row-end"]')).not.toBeNull(), + { timeout: 4000 }, + ); + const ai = screen.getByTestId('topbar-ai-assistant'); + expect(within(screen.getByTestId('studio-top-left')).queryByTestId('topbar-ai-assistant')).toBeNull(); expect(screen.getByTestId('studio-pillars-host')).toContainElement(ai); expect(ai.closest('[data-slot="studio-title-row-end"]')).not.toBeNull(); expect(screen.getAllByTestId('topbar-ai-assistant')).toHaveLength(1); @@ -238,7 +248,7 @@ describe('Studio right slot — the rails read whether it squeezes the pillars ( it('a page with no slot to show (the sharing overview, no copilot) keeps its host closed', async () => { copilot.available = false; renderAt('owd'); - await screen.findByTestId('studio-shell-header'); + await screen.findByTestId('owd-item-header'); await act(async () => {}); expect(slot()).not.toBeVisible(); expect(screen.getByTestId('studio-pillars-host')).toHaveAttribute('data-studio-slot', 'closed'); 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 309215de204..fa2c1e51a86 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 @@ -5,13 +5,15 @@ * Publish only for drafts. objectstack#37455 — Cancel and Save moved from the * top bar to the page's item header, behaviour unchanged. * - * - With no draft pending, the top bar draws neither Changes nor Publish. + * - With no draft pending, 概览's menu row carries no count. * - An edit on the object page draws Cancel and Save at the end of the item - * header's actions, not in the top bar; Save is the last action, and only - * the assistant (behind its hairline) follows it. - * - With a draft pending (the copilot's), Changes and Publish are drawn in the - * top bar, and a publish is refused while the page holds edits Save has not - * sent: the publish re-reads the page and would drop them. + * header's actions, and nowhere else (objectstack#37456: Studio has no top + * bar); Save is the last action, and only the assistant (behind its + * hairline) follows it. + * - With a draft pending (the copilot's), 概览's row counts it (its Pending tab + * holds Changes and Publish, objectstack#37454), and a publish is refused + * while the page holds edits Save has not sent: the publish re-reads the + * page and would drop them. * * Real: the surface, the Data pillar, the coordinator and `usePendingDrafts`. * Doubles: the metadata client's reads and transport, the `_drafts` ledger @@ -129,10 +131,7 @@ afterEach(() => { vi.mocked(toast.error).mockClear(); }); -const CHANGES = new RegExp(`^${t('engine.studio.changes', 'en')}`); -const PUBLISH = new RegExp(`^${t('engine.studio.publish', 'en')}$`); - -async function mountAndEdit(): Promise<{ header: HTMLElement; itemHeader: HTMLElement }> { +async function mountAndEdit(): Promise<{ topLeft: HTMLElement; itemHeader: HTMLElement }> { render( @@ -143,23 +142,23 @@ async function mountAndEdit(): Promise<{ header: HTMLElement; itemHeader: HTMLEl ); fireEvent.click(await screen.findByRole('button', { name: 'Field layout' }, { timeout: 4000 })); await addFieldFromFormToolbar(undefined, { label: 'Due' }); - return { header: screen.getByTestId('studio-shell-header'), itemHeader: screen.getByTestId('data-object-header') }; + return { topLeft: screen.getByTestId('studio-top-left'), itemHeader: screen.getByTestId('data-object-header') }; } /** The item header's action slot: the right-aligned box of its title row. */ const actionSlot = (save: HTMLElement): HTMLElement => save.parentElement as HTMLElement; describe('the Studio page\'s Save and Cancel, Changes and Publish for drafts (objectstack#36511, objectstack#37455)', () => { - it('with no draft pending: no Changes, no Publish; an edit draws Cancel and Save at the end of the item header', async () => { - const { header, itemHeader } = await mountAndEdit(); + it('with no draft pending: no count; an edit draws Cancel and Save at the end of the item header, and only there', async () => { + const { topLeft, itemHeader } = await mountAndEdit(); const save = await within(itemHeader).findByTestId('studio-save'); const cancel = within(itemHeader).getByTestId('studio-cancel'); - // objectstack#37455 — nothing of the pair is left in the top bar. - expect(within(header).queryByTestId('studio-save')).toBeNull(); - expect(within(header).queryByTestId('studio-cancel')).toBeNull(); + // objectstack#37455, objectstack#37456 — one Save, one Cancel, none in the left column. + expect(within(topLeft).queryByTestId('studio-save')).toBeNull(); + expect(within(topLeft).queryByTestId('studio-cancel')).toBeNull(); expect(screen.getAllByTestId('studio-save')).toHaveLength(1); - expect(within(header).queryByRole('button', { name: CHANGES })).toBeNull(); - expect(within(header).queryByRole('button', { name: PUBLISH })).toBeNull(); + expect(screen.getAllByTestId('studio-cancel')).toHaveLength(1); + expect(screen.queryByTestId('studio-menu-overview-pending')).toBeNull(); // Cancel, then Save: the last of the item header's actions; only the // assistant follows it, behind the hairline. expect(cancel.compareDocumentPosition(save) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy(); @@ -170,16 +169,14 @@ describe('the Studio page\'s Save and Cancel, Changes and Publish for drafts (ob expect(writes).toEqual([]); }); - it('with a draft pending: Changes and Publish in the top bar, Cancel and Save in the item header; Publish waits for Save', async () => { + it('with a draft pending: 概览 counts it, Cancel and Save in the item header; Publish waits for Save', async () => { ledger.drafts = [{ type: 'flow', name: 'a_notify', packageId: PACKAGE_ID }]; - const { header, itemHeader } = await mountAndEdit(); - const changes = await within(header).findByRole('button', { name: CHANGES }, { timeout: 4000 }); - const publish = within(header).getByRole('button', { name: PUBLISH }); + const { topLeft, itemHeader } = await mountAndEdit(); + await waitFor(() => expect(screen.getByTestId('studio-menu-overview-pending')).toHaveTextContent('1'), { timeout: 4000 }); const cancel = await within(itemHeader).findByTestId('studio-cancel'); const save = within(itemHeader).getByTestId('studio-save'); - expect(changes.compareDocumentPosition(publish) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy(); expect(cancel.compareDocumentPosition(save) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy(); - expect(within(header).queryByTestId('studio-save')).toBeNull(); + expect(within(topLeft).queryByTestId('studio-save')).toBeNull(); await act(async () => { fireEvent.click(screen.getByTestId('sheet-publish-all')); 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 f1b063a1878..4a1132b780a 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx @@ -53,10 +53,7 @@ import { import type { AppMarkApp } from '../../layout/AppMark.js'; import { STUDIO_ACCENT, - STUDIO_HEADER, STUDIO_HEADER_ICON_BUTTON, - STUDIO_HEADER_PACKAGE_COLUMN, - STUDIO_HEADER_WIDE_WORD, STUDIO_PILLARS_HOST, } from './studio-tokens.js'; import { @@ -68,14 +65,12 @@ import { StudioRefusalStrip } from './StudioRefusalStrip.js'; import { PACKAGE_LIST_TOAST_ID } from './PackageSwitcher.js'; import { studioEntryFallbackPath, useStudioEntryPermissions } from './studioEntryPermissions.js'; import { SETUP_PACKAGES_PATH } from '../metadata-admin/packageSource.js'; -import { StudioBackToApp, type StudioAppTarget } from './StudioBackToApp.js'; +import { type StudioAppTarget } from './StudioBackToApp.js'; import { StudioPackageMenu } from './StudioPackageMenu.js'; import { StudioPackageOverviewPage } from './StudioPackageOverviewPage.js'; import { useCanAuthorMetadata } from '../../hooks/useCanAuthorMetadata.js'; import { type NewFlowTrigger } from './AutomationsFlowRail.js'; import { - CreateTakenNotice, - findTakenIdentifier, type StudioBaseCustomization, StudioHeldNotice, StudioReadOnlyLink, @@ -87,16 +82,8 @@ import { cn, useIsMobile, Button, - Tooltip, - TooltipContent, - TooltipProvider, - TooltipTrigger, } from '@object-ui/components'; import { - Loader2, - Plus, - GitBranch, - Rocket, PanelRightClose, PanelRightOpen, FileQuestion, @@ -129,7 +116,7 @@ import { studioOrgScopePath, } from './studioScope.js'; import { STUDIO_METADATA_AREA, isStudioAllPackagesScope, settledAreaAddress } from './metadataArea.js'; -import { StudioMenu, StudioMenuDataProvider, StudioMenuProvider, StudioMenuTrigger } from './StudioMenu.js'; +import { StudioMenu, StudioMenuDataProvider, StudioMenuProvider } from './StudioMenu.js'; import { StudioMetadataArea } from './StudioMetadataArea.js'; import { StudioOwdOverviewPage } from './StudioOwdOverviewPage.js'; import { useMetadataRefreshNonce } from './useMetadataRefreshNonce.js'; @@ -137,14 +124,12 @@ import { type SurfaceTarget, } from './useSurfaceDeepLink.js'; import { SurfaceDeepLinkProvider } from './surfaceDeepLinkChannel.js'; -import { buildAppSkeleton, type AppNavSeed } from './skeletons.js'; import { t, tFormat, useMetadataLocale } from '../metadata-admin/i18n.js'; import { confirmUnsavedLeave, useRegisterUnsavedEdits } from '../../chrome/unsavedEdits.js'; import { CommandPalette, type StudioPaletteSurface } from '../../chrome/CommandPalette.js'; import { CommandPaletteProvider, useCommandPaletteProviderMounted } from '../../context/CommandPaletteProvider.js'; import { StudioPaletteGroups } from './StudioPaletteGroups.js'; import { openStudioPaletteAddress } from './studioPaletteModel.js'; -import { CreateItemDialog } from './CreateItemDialog.js'; // objectui#11787 — the shared draft autosave, moved to its own module unchanged. import { ensureCustomizationPackage, @@ -167,7 +152,6 @@ import { import { DraftChangesPanel, type DraftChangeEntry, - type DraftChangesPosture, type DraftPublishOptions, } from '../../preview/DraftChangesPanel.js'; import { toast } from 'sonner'; @@ -178,6 +162,9 @@ import { studioMetadataTypePath, studioPillarPath, } from './studioAddress.js'; +import { studioPackageOverviewPath } from './studioOverviewAddress.js'; +import { StudioMissingPackageStrip, StudioMobileStrip, StudioTopLeft } from './StudioTopLeft.js'; +import { StudioTitleRowFallback } from './StudioTitleRowFallback.js'; /** The batch door's `backfillApplied` receipt, by reference to what the client returns (objectui#12929). */ type PublishBackfillReceipt = NonNullable< @@ -501,9 +488,9 @@ function StudioDesignSurfaceBody({ aiSlot, area }: StudioDesignSurfaceProps): Re // (`publishSavedItem`), so it leaves no draft; Changes and Publish are for the // drafts other writers (the copilot) and the editors not yet converted leave. const [changesOpen, setChangesOpen] = React.useState(false); - // objectui#12517 — which trigger opened the sheet: Publish opens it to - // confirm (rows expanded, focus on Publish all), Changes opens it to review. - const [changesPosture, setChangesPosture] = React.useState('review'); + // objectui#12517 — the sheet opened to confirm from the top bar's Publish; + // objectstack#37456 — that Publish is gone (概览's Pending tab publishes), so + // every door left opens the sheet to review, the panel's own default. // objectui#12894 — the drawer's one way in from outside the top bar: // `?changes=review` (`studioChangesLink.ts`), written by the copilot's // applied card (查看变更并发布). Opened to review, then the param is dropped @@ -514,7 +501,6 @@ function StudioDesignSurfaceBody({ aiSlot, area }: StudioDesignSurfaceProps): Re React.useEffect(() => { if (changesRequest === null) return; if (changesRequest === STUDIO_CHANGES_REVIEW) { - setChangesPosture('review'); setChangesOpen(true); } setSearchParams( @@ -874,7 +860,6 @@ function StudioDesignSurfaceBody({ aiSlot, area }: StudioDesignSurfaceProps): Re [listedPublishRefusals], ); const shownPendingCount = behindSave ? Math.max(pendingCount ?? 0, 1) : pendingCount; - const hasPending = (shownPendingCount ?? 0) > 0; // objectui#12725 — the same ledger and number, for the pillars' item headers // (「草稿 · N 项未发布」): the rows the count above counts, so the package-less // scope offers its org-scope flow drafts only. @@ -886,13 +871,6 @@ function StudioDesignSurfaceBody({ aiSlot, area }: StudioDesignSurfaceProps): Re }), [shownPendingCount, packageId, pendingEntries, behindSave], ); - const publishReadOnlyReasonId = React.useId(); - // The reason a disabled Publish gives, or `null` when it gives none. - // objectstack#36511 — Publish is drawn only while a draft is pending, so the - // one reason left is a read-only package. - const publishDisabledReason: { id: string; text: string; testId?: string } | null = publishReadOnly - ? { id: publishReadOnlyReasonId, text: t('engine.studio.pkg.readonlyHint', locale) } - : null; // Builder → running-app bridge: the builder edits the package (the design // surface), the app is its published front-end. The header's way back to it @@ -935,87 +913,9 @@ function StudioDesignSurfaceBody({ aiSlot, area }: StudioDesignSurfaceProps): Re // app has no running front-end to open. Read off the same list as // `packageApp`. const [publishedApps, setPublishedApps] = React.useState([]); - // Create app (package has no app yet): create a draft `app` item — the - // published front-end's on-ramp. After the package publish, 「‹ Back to - // app」 names it. - const [appCreating, setAppCreating] = React.useState(false); - const [appBusy, setAppBusy] = React.useState(false); - const [appErr, setAppErr] = React.useState(null); - const [appDraftPending, setAppDraftPending] = React.useState(null); - // objectstack#26917 — a create refused because an app already holds the - // identifier (published or as a draft, in any package): the app's label, for - // the dialog's sentence. Create app is offered only to a package with no app, - // so the holder is never one this package can open instead. - const [appTaken, setAppTaken] = React.useState<{ name: string; label: string } | null>(null); - // Scaffold the new app's navigation from the package's objects (default on) — - // otherwise a fresh app has zero menu items and every object must be wired by - // hand in the app's design mode (objectui#2262). - const [appAddObjects, setAppAddObjects] = React.useState(true); - - const loadPackageObjects = React.useCallback(async (): Promise => { - // Published objects + pending DRAFT objects, merged — a fresh package's - // objects are usually still drafts (same merge the Data pillar rail does). - // Names only (objectui#11201): a seeded entry carries no label, so nothing - // here reads one. This used to hand `buildAppSkeleton` each object's label, - // and a draft's or unlabelled object's machine name in its place. - // The package-less scope creates no app (objectui#11553): nothing to seed. - if (packageId === null) return []; - const [list, draftHeaders] = await Promise.all([ - shellClient.list('object', { packageId }) as Promise>>, - shellClient.listDrafts({ packageId, type: 'object' }).catch(() => [] as Array<{ name?: string }>), - ]); - const items: AppNavSeed[] = (list || []) - .map((o) => ({ name: String(o.name ?? '') })) - .filter((o) => o.name); - const known = new Set(items.map((o) => o.name)); - for (const d of draftHeaders) { - if (d.name && !known.has(d.name)) items.push({ name: d.name }); - } - return items; - }, [shellClient, packageId]); - - const doCreateApp = React.useCallback( - async (label: string, name: string) => { - // The package-less scope offers no Create app (objectui#11553). - if (packageId === null) return; - setAppBusy(true); - setAppErr(null); - setAppTaken(null); - try { - // A name an app already holds, published or as a draft, in any - // package, is refused here and nothing is written: over a published - // app the first-write pin below would write this skeleton as its - // pending draft (`findTakenIdentifier`). - const taken = await findTakenIdentifier(shellClient, 'app', name, locale); - if (taken) { - setAppTaken(taken); - return; - } - const navObjects = appAddObjects ? await loadPackageObjects().catch(() => []) : []; - // objectui#11773 — and the door refuses a draft row too (the - // first-write pin), for one that lands between the check above and - // this save. - await shellClient.save( - 'app', - name, - buildAppSkeleton(name, label, navObjects), - { mode: 'draft', packageId, ifNoneMatch: '*', surface: 'studio' }, - ); - toast.success(tFormat('engine.studio.app.savedDraft', locale, { label })); - setAppDraftPending(label); - setAppCreating(false); - onDraftSaved(); - // objectstack#36502 — the author stays on the pillar they were on: the - // app is designed in the running app once the package is published, - // which the header's pending chip says. - } catch (e) { - setAppErr(formatMetadataError(e)); - } finally { - setAppBusy(false); - } - }, - [appAddObjects, loadPackageObjects, shellClient, packageId, locale, onDraftSaved], - ); + // objectstack#37456 — the top bar's 「create app」 button and its 「app waits + // for a publish」 label went with the bar, and have no new home (ADR-0084, + // amended 2026-11-26, `#amendment-2026-11-26-homes`, silent item 5). // objectui#5800, fixed in passing — the topbar's app detection used to // disagree with the Interfaces pillar's (published-only read, no draftNonce @@ -1300,42 +1200,6 @@ function StudioDesignSurfaceBody({ aiSlot, area }: StudioDesignSurfaceProps): Re // objectstack#37454 — the package's rename re-reads 概览's row too. const overviewRefresh = `${publishNonce}:${pkgEntry?.id === packageId ? pkgEntry.name : ''}`; - const publishButton = ( - - ); - // objectstack#37455 — the top bar's page controls, placed by the open // page's title row (`studioTitleRow.tsx`). objectstack#36511 — the page's // Cancel and Save: drawn only while the open page holds unsaved edits, @@ -1391,129 +1255,24 @@ function StudioDesignSurfaceBody({ aiSlot, area }: StudioDesignSurfaceProps): Re ) : null}
-
- {/* objectui#12459 — the way back to the app at the left, the - package actions at the right. objectstack#36899 — the pillars - that sat between them are gone: the left menu is Studio's one - navigation, and its show / hide control leads the bar. Changes - and Publish stay at the right end; objectstack#37455 — Cancel - and Save moved to the page's item header. */} -
- {showMenu && } - {/* objectstack#36501 — 「‹ Back to app」, the app's name and the - Studio mark: Studio's one way out. objectstack#36899 - (decision 5) — it names the CURRENT package's app; with none, - the package, or the scope on `~org` and `~all`. */} - -
- - {/* Package-level draft review + one atomic publish (replaces per-item Publish) */} -
- {/* objectstack#26708 — nothing to create, review or publish in a - package that is not there, nor on the cross-package leg. */} - {!pkgMissing && !allScope && (<> - {/* objectui#11553 — the package-less scope has no app to create. */} - {packageId === null || packageApp ? null : appDraftPending ? ( - - {tFormat('engine.studio.app.pending', locale, { label: appDraftPending })} - - ) : ( - - )} - {/* objectstack#36511 — Changes and Publish are for drafts, which - the copilot and the editors still on drafts (the Interfaces - pillar, the Metadata area) leave: drawn only while one is - pending. */} - {hasPending && ( - <> - {/* objectui#12459 — the pending count is a pill, not "· N" text. */} - - {/* A disabled Publish says why, to the mouse, the keyboard and - assistive tech alike — the record page's Archive pattern - (`DeclaredActionsBar`, objectui#11811), for the reason it - can be off: a read-only package (objectui#12303). A natively - disabled button fires no hover or focus, so the wrapping span - is the tooltip trigger and a tab stop, and the button and the - span both point `aria-describedby` at an `sr-only` copy of - the reason. objectstack#28562 — a read-only base with a - customization package publishes that package's drafts, so it - is not read-only here. */} - {publishDisabledReason ? ( - - - - - {publishButton} - - {publishDisabledReason.text} - - - - {publishDisabledReason.text} - - - ) : ( - publishButton - )} - - )} - {/* objectstack#37455 — the page's Cancel and Save moved to its - item header, and the AI assistant to the end of its title - row (`titleRowSave`, `titleRowAssistant` above). */} - )} -
-
+ {/* objectstack#37456 — Studio has no top bar (ADR-0084, amended + 2026-11-26, `#amendment-2026-11-26-frame`). Its tenants live on: + the way back and the menu toggle in the left column's top rows + (`StudioTopLeft`), the ⋯ menu, Changes and Publish on 概览 + Overview (its header and its Pending tab, objectstack#37454), + Save and Cancel in the item header and the assistant at the end + of the page's title row (objectstack#37455). Under 768 px the + menu is a drawer, opened from the strip below. */} + {showMenu && } + {/* …and a package that is not there, with no column, keeps its way back here. */} + {pkgMissing && ( + + )} {retiredLanding && (
- {showMenu && } + {showMenu && ( + 0 + ? { + count: shownPendingCount ?? 0, + onOpen: () => { + setChangesOpen(true); + }, + } + : null + } + /> + } + /> + )}
{ - setChangesPosture('review'); setChangesOpen(true); }} /> @@ -1674,6 +1466,8 @@ function StudioDesignSurfaceBody({ aiSlot, area }: StudioDesignSurfaceProps): Re /> )}
+ {/* objectstack#37456 — the page controls of a page with no title row. */} +
@@ -1722,50 +1516,13 @@ function StudioDesignSurfaceBody({ aiSlot, area }: StudioDesignSurfaceProps): Re include={packageId === null ? isOrgScopeDraft : undefined} onPublish={publishReadOnly ? undefined : doPublish} publishing={publishing} - posture={changesPosture} + posture="review" renderEntryNote={renderPublishRefusal} // ADR-0146 D3 — reviewing the pair's drafts, the sheet names the // base they are saved for. customizationOf={pairId !== null ? baseLabel : undefined} /> - { - setAppCreating(open); - if (!open) setAppTaken(null); - }} - title={t('engine.studio.app.create', locale)} - labelFieldLabel={t('engine.studio.app.nameLabel', locale)} - labelPlaceholder={t('engine.studio.app.namePlaceholder', locale)} - idFieldLabel={t('engine.studio.app.idLabel', locale)} - idPlaceholder={t('engine.studio.app.idPlaceholder', locale)} - submitLabel={t('engine.studio.createDraft', locale)} - submittingLabel={t('engine.studio.creating', locale)} - busy={appBusy} - error={appErr} - locale={locale} - onSubmit={({ label, name }) => void doCreateApp(label, name)} - extra={ - <> - {appTaken && ( - - )} - - - } - /> {/* objectstack#36900 — the command palette, in its `studio` scope, with this page's groups. */} {!paletteHosted && } diff --git a/ui/packages/app-shell/src/views/studio-design/StudioMenu.tsx b/ui/packages/app-shell/src/views/studio-design/StudioMenu.tsx index de447269b65..c62cbe41840 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioMenu.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioMenu.tsx @@ -146,6 +146,9 @@ import { type StudioMenuTier, } from './studioMenuModel.js'; +/** What the collapsed rail does not draw: the search and the fold's toggle. */ +const RAIL_HIDDEN = 'group-data-[state=collapsed]:group-data-[collapsible=icon]:hidden'; + /** The fold's cookie lives as long as the menu's own collapse cookie (the sidebar primitive's 7 days). */ const ADVANCED_COOKIE_MAX_AGE = 60 * 60 * 24 * 7; @@ -311,6 +314,11 @@ export interface StudioMenuProps { * `?` included); `false` keeps the author where they are. */ onReenterPillar?: (search: string) => boolean; + /** + * objectstack#37456 — what the column draws above its search: the top + * left's two rows (`StudioTopLeft`), or the rail's head while collapsed. + */ + head?: React.ReactNode; } /** @@ -335,6 +343,7 @@ function StudioMenuBody({ segment, locale, onReenterPillar, + head, data, }: StudioMenuProps & { data: StudioMenuData }): React.ReactElement { const scope = studioMenuScope(segment); @@ -389,7 +398,8 @@ function StudioMenuBody({ const Icon = studioMenuEntryIcon(entry, group); return ( - + {/* objectstack#37456 — on the collapsed rail an entry is its icon, named by its tooltip. */} + - + + {head} @@ -510,6 +523,7 @@ function StudioMenuBody({ id={searchId} type="search" data-testid="studio-menu-search" + className={RAIL_HIDDEN} placeholder={t('engine.studio.menu.search', locale)} value={query} onChange={(e) => setQuery(e.target.value)} @@ -529,7 +543,7 @@ function StudioMenuBody({ {folded && (tiers.advanced.length > 0 || allTypes) && ( <>