From 7029459c5862c4459b23f2553f541287b0b7c35a Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Nov 2026 05:08:08 +0000 Subject: [PATCH 1/3] fix(app-shell): every door into a package's Studio opens its overview The command palette's package entries, an app's Design in Studio, the empty menu's Open in App Studio, and Setup -> Packages' Open in Studio, create landing and Customize link now build studioPackageOverviewPath instead of the object list address. Claude-Session: https://claude.ai/code/session_01FEkQ5orhB2g5mxU6E4fciu Co-Authored-By: Claude --- .../app-shell/src/chrome/CommandPalette.tsx | 8 +++++--- .../src/console/AppNoAccessEmptyState.tsx | 7 ++++--- ui/packages/app-shell/src/utils/appRoute.ts | 17 +++++++++-------- .../src/views/metadata-admin/PackagesPage.tsx | 16 +++++----------- .../PackageCustomizationsPanel.tsx | 7 ++++--- .../src/views/studio-design/studioAddress.ts | 7 ++++++- 6 files changed, 33 insertions(+), 29 deletions(-) diff --git a/ui/packages/app-shell/src/chrome/CommandPalette.tsx b/ui/packages/app-shell/src/chrome/CommandPalette.tsx index f6ac95f3f48..e928315fac4 100644 --- a/ui/packages/app-shell/src/chrome/CommandPalette.tsx +++ b/ui/packages/app-shell/src/chrome/CommandPalette.tsx @@ -84,7 +84,8 @@ import { useAuth } from '@object-ui/auth'; import { matchesPaletteQuery } from './paletteMatch.js'; import { fetchPackages, type PkgEntry } from '../views/studio-design/packages-io.js'; import { isPackageLessItem, studioOrgScopePath } from '../views/studio-design/studioScope.js'; -import { studioHomePath, studioItemPath } from '../views/studio-design/studioAddress.js'; +import { studioItemPath } from '../views/studio-design/studioAddress.js'; +import { studioPackageOverviewPath } from '../views/studio-design/studioOverviewAddress.js'; import { flattenNavigation, useAppReportEntries } from '../views/appReportIndex.js'; import { useServedApps } from '../hooks/useLauncherApps.js'; import { servedObjectLabel } from '../hooks/servedObjectLabel.js'; @@ -1093,7 +1094,8 @@ const NO_STUDIO_ENTRIES: StudioPaletteEntries = { packages: [], objects: [], flo * * - **Packages** come from `fetchPackages`, the list the Studio landing and its * package switcher read; kernel packages are already left out there. Each - * opens its Data pillar, as a landing card does. + * opens its 概览 Overview, where every door into a package lands + * (objectstack#38392). * - **Objects** come from the metadata cache (`useMetadata().objects`), each * listed under the package it declares (`_packageId`) and opened in that * package's Data pillar. One whose package is not in the list has no Studio @@ -1196,7 +1198,7 @@ function useStudioPaletteEntries(enabled: boolean, crossPackageItems = true): St key: pkg.id, label: pkg.name, name: pkg.id, - href: studioHomePath(pkg.id), + href: studioPackageOverviewPath(pkg.id), })), objects, flows, diff --git a/ui/packages/app-shell/src/console/AppNoAccessEmptyState.tsx b/ui/packages/app-shell/src/console/AppNoAccessEmptyState.tsx index 8d7ac8ca7a6..44896354599 100644 --- a/ui/packages/app-shell/src/console/AppNoAccessEmptyState.tsx +++ b/ui/packages/app-shell/src/console/AppNoAccessEmptyState.tsx @@ -38,7 +38,8 @@ * (the only one who can also fill the menu), the no-navigation answer first * reads the app's stored menu (`/layers`, the read the design mode's menu * editor makes); when it is empty too, the screen says the menu is empty and - * opens the app's package in Studio. Everyone else, and a stored menu that + * opens the app's package in Studio, on its 概览 Overview, where every door + * into a package lands (objectstack#38392). Everyone else, and a stored menu that * holds entries this caller is not shown, keep the access answer. */ @@ -54,7 +55,7 @@ import { Button, DataEmptyState } from '@object-ui/components'; import { useObjectTranslation } from '@object-ui/i18n'; import { useServedAppLabel } from '../hooks/useServedAppLabel.js'; import { useCanAuthorMetadata } from '../hooks/useCanAuthorMetadata.js'; -import { studioHomePath } from '../views/studio-design/studioAddress.js'; +import { studioPackageOverviewPath } from '../views/studio-design/studioOverviewAddress.js'; import { createAuthenticatedFetch } from '@object-ui/auth'; /** The console's authenticated fetch: the stored bearer token beside the session cookie. */ @@ -154,7 +155,7 @@ export function AppNoAccessEmptyState({ app, setupPath, reason = 'no-navigation' })} action={ diff --git a/ui/packages/app-shell/src/utils/appRoute.ts b/ui/packages/app-shell/src/utils/appRoute.ts index e69d601fae8..dc2d48a0e51 100644 --- a/ui/packages/app-shell/src/utils/appRoute.ts +++ b/ui/packages/app-shell/src/utils/appRoute.ts @@ -15,7 +15,8 @@ * framework-owned, app-independent page for this user (see below). */ -import { studioHomePath, studioItemPath, studioMetadataItemAddress } from '../views/studio-design/studioAddress.js'; +import { studioItemPath, studioMetadataItemAddress } from '../views/studio-design/studioAddress.js'; +import { studioPackageOverviewPath } from '../views/studio-design/studioOverviewAddress.js'; /** * The minimal app shape THESE ROUTE HELPERS read. @@ -243,8 +244,8 @@ export function isApprovalsInboxLink(actionUrl: string | null | undefined): bool /** * App → Studio reverse bridge (ADR-0080). Resolves a running app to its owning - * package's design surface (`/studio/:packageId/data`), or `null` when there is - * nothing to open: + * package's 概览 Overview (`/studio/:packageId/overview`, where every door into + * a package lands, objectstack#38392), or `null` when there is nothing to open: * - the viewer is not a workspace admin (designing mutates shared package * metadata, so the entry point is admin-only — mirrors the runtime editors); * - the app has no owning package (runtime/DB apps), or its container is the @@ -262,7 +263,7 @@ export function appStudioDesignPath( if (!isWorkspaceAdmin) return null; const packageId = studioPackageId(app); if (!packageId) return null; - return studioHomePath(packageId); + return studioPackageOverviewPath(packageId); } /** @@ -322,8 +323,8 @@ const INTERFACE_SURFACE_ROUTE_TYPES = new Set(['dashboard', 'page', 'report']); * Console `/apps/:pkg/` route types that are NOT object records — the * interface surfaces (handled above) plus the `system` settings area. Any other * route type IS the object name (see `AppHeader`'s breadcrumb switch: the - * `else if (routeType)` branch treats it as an object), so it deep-links the - * Data pillar to that object. + * `else if (routeType)` branch treats it as an object), so it deep-links that + * object's designer ({@link appStudioObjectPath}). */ const NON_OBJECT_ROUTE_TYPES = new Set([...INTERFACE_SURFACE_ROUTE_TYPES, 'system']); @@ -333,9 +334,9 @@ const NON_OBJECT_ROUTE_TYPES = new Set([...INTERFACE_SURFACE_ROUTE_TYPES, 'syste * {@link INTERFACE_SURFACE_ROUTE_TYPES}), deep-link straight to THAT item in * Studio's "All metadata" area via {@link appStudioSurfacePath}. When it names an * object record page (the route type IS the object name), deep-link that object - * in the Data pillar via {@link appStudioObjectPath}. Otherwise (bare app root, + * in its designer via {@link appStudioObjectPath}. Otherwise (bare app root, * a `system` route, or an interface list route with no surface name) fall back - * to the package's generic Data tab via {@link appStudioDesignPath}. Returns + * to the package's 概览 Overview via {@link appStudioDesignPath}. Returns * null when the bridge should not render (non-admin / no owning package). * Centralizes the route-type → surface-type mapping so `AppHeader` stays * declarative and the decision is unit-tested here. diff --git a/ui/packages/app-shell/src/views/metadata-admin/PackagesPage.tsx b/ui/packages/app-shell/src/views/metadata-admin/PackagesPage.tsx index 6f52037de24..91d8d1a6351 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/PackagesPage.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/PackagesPage.tsx @@ -138,7 +138,7 @@ import { useProtocolCheckSkippedText } from '../../console/marketplace/protocolC import { ProtocolCheckSkippedNote } from '../../console/marketplace/ProtocolCheckSkippedNote.js'; import type { InstalledPackageAtEitherStage } from '@objectstack/spec/api-assembled'; import type { PackagePublishResult } from '@objectstack/spec/system'; -import { studioHomePath } from '../studio-design/studioAddress.js'; +import { studioPackageOverviewPath } from '../studio-design/studioOverviewAddress.js'; import { PackageCustomizationsPanel } from '../studio-design/PackageCustomizationsPanel.js'; import { isCustomizationPackage } from '@objectstack/spec/kernel'; import { @@ -590,13 +590,6 @@ function InstalledAppUpdateCell({ rowId, read }: { rowId: string; read: UpdateRe ); } -/** - * A package's Studio address: the builder on the package's Data pillar. The - * administration face's create lands here, and its "Open in Studio" link - * points here (objectstack#36834). - */ -const studioPackagePath = (packageId: string) => studioHomePath(packageId); - /* -------------------------------------------------------------------------- */ /* Create-package dialog */ /* -------------------------------------------------------------------------- */ @@ -1174,7 +1167,7 @@ export function PackageDetailSheet({ <> onOpenChange(false)} data-testid="pkg-detail-open-in-studio" @@ -2367,12 +2360,13 @@ export function PackagesPage() { onOpenChange={setCreateOpen} onCreated={async (id) => { // objectstack#36834 — created from Setup, the empty package is - // designed next: straight into Studio on it, on its Data pillar. + // designed next: straight into Studio on it, on its 概览 Overview, + // where every door into a package lands (objectstack#38392). // The development surface stays // where it is and shows the new row. if (adminFace) { forgetPackageListReads(); - navigate(studioPackagePath(id)); + navigate(studioPackageOverviewPath(id)); return; } await load(); diff --git a/ui/packages/app-shell/src/views/studio-design/PackageCustomizationsPanel.tsx b/ui/packages/app-shell/src/views/studio-design/PackageCustomizationsPanel.tsx index 2d78c7f86c1..2d0a3077d00 100644 --- a/ui/packages/app-shell/src/views/studio-design/PackageCustomizationsPanel.tsx +++ b/ui/packages/app-shell/src/views/studio-design/PackageCustomizationsPanel.tsx @@ -23,7 +23,8 @@ * gives one), what kind of item it is and how it changed, and opens the item * in Studio. Tabs narrow by kind and a search by text; the first rows show, * the rest behind "Show all". A read that fails says so, never "0". - * "Customize in Studio" opens the app there, the home card's Customize door. + * "Customize in Studio" opens the app there, on its 概览 Overview, where every + * door into a package lands (objectstack#38392). */ import * as React from 'react'; @@ -39,7 +40,7 @@ import { loadCustomizationLabels, type CustomizationRow, } from './packageCustomizationRows.js'; -import { studioHomePath } from './studioAddress.js'; +import { studioPackageOverviewPath } from './studioOverviewAddress.js'; /** How many rows the section shows before "Show all". */ export const PACKAGE_CUSTOMIZATION_ROWS_SHOWN = 6; @@ -163,7 +164,7 @@ export function PackageCustomizationsPanel({

{t(`${K}.heading`, locale)}

/data`: the route lands it on the object list. */ +/** + * A package's old Data pillar address, `/studio//data`: the route lands + * it on the object list, and it stays a working address for anyone who wants + * that list. objectstack#38392 — the doors that open a package do not build + * it: they land on its 概览 Overview (`studioPackageOverviewPath`). + */ export function studioHomePath(packageId: string, options: StudioPathOptions = {}): string { return studioPillarPath(packageId, STUDIO_HOME_PILLAR, options); } From 04f16efaa19e0fc0b944e06b68692ea2eb3ef05c Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Nov 2026 05:09:55 +0000 Subject: [PATCH 2/3] test(app-shell): pin every Studio door on the package overview Re-point the tests that pinned the object list address and add a census that refuses studioHomePath outside the files that mean the object list. Claude-Session: https://claude.ai/code/session_01FEkQ5orhB2g5mxU6E4fciu Co-Authored-By: Claude --- .../CommandPalette.studioScope-11863.test.tsx | 4 +- ...oAccessEmptyState.emptyMenu-36748.test.tsx | 2 +- .../src/utils/__tests__/appRoute.test.ts | 18 +- ...ackageFormDialog.newAppStep-36748.test.tsx | 8 +- ...esPage.installedAppsUpdates-34722.test.tsx | 10 +- .../PackageCustomizationsPanel.test.tsx | 2 +- ...oPaletteGroups.surfaceScope-36900.test.tsx | 2 +- .../studioDoorsOverview-38392.test.ts | 200 ++++++++++++++++++ 8 files changed, 223 insertions(+), 23 deletions(-) create mode 100644 ui/packages/app-shell/src/views/studio-design/studioDoorsOverview-38392.test.ts diff --git a/ui/packages/app-shell/src/chrome/CommandPalette.studioScope-11863.test.tsx b/ui/packages/app-shell/src/chrome/CommandPalette.studioScope-11863.test.tsx index 9282aa0b4cf..47f5374bf95 100644 --- a/ui/packages/app-shell/src/chrome/CommandPalette.studioScope-11863.test.tsx +++ b/ui/packages/app-shell/src/chrome/CommandPalette.studioScope-11863.test.tsx @@ -195,11 +195,11 @@ describe('the palette in the `studio` scope lists the Studio, not an app (object expect(shown('studio-flow')).toEqual(['Onboard AccountAcme CRM', 'Nightly Cleanup']); }); - it('opens a package on its Data pillar', async () => { + it('opens a package on its 概览 Overview (objectstack#38392)', async () => { mountStudio(); await studioListed(); pick('studio-package People '); - await waitFor(() => expect(locationNow()).toBe('/studio/com.acme.hr/data')); + await waitFor(() => expect(locationNow()).toBe('/studio/com.acme.hr/overview')); }); it("opens an object in its package's Data pillar, on that object", async () => { diff --git a/ui/packages/app-shell/src/console/__tests__/AppNoAccessEmptyState.emptyMenu-36748.test.tsx b/ui/packages/app-shell/src/console/__tests__/AppNoAccessEmptyState.emptyMenu-36748.test.tsx index 98ce4cc308b..3d2168eddae 100644 --- a/ui/packages/app-shell/src/console/__tests__/AppNoAccessEmptyState.emptyMenu-36748.test.tsx +++ b/ui/packages/app-shell/src/console/__tests__/AppNoAccessEmptyState.emptyMenu-36748.test.tsx @@ -66,7 +66,7 @@ describe('an empty stored menu is said as such, not as missing access (objectsta expect(status).toHaveAttribute('data-reason', 'empty-menu'); expect(status).toHaveTextContent('has nothing in its menu yet'); expect(status).not.toHaveTextContent(/grant access/i); - expect(screen.getByTestId('app-empty-menu-open-studio')).toHaveAttribute('href', `/studio/${PKG}/data`); + expect(screen.getByTestId('app-empty-menu-open-studio')).toHaveAttribute('href', `/studio/${PKG}/overview`); expect(screen.queryByTestId('app-no-access-open-setup')).toBeNull(); expect(String(fetchMock.mock.calls[0]?.[0])).toBe(`/api/v1/meta/app/visits/layers?package=${encodeURIComponent(PKG)}`); }); diff --git a/ui/packages/app-shell/src/utils/__tests__/appRoute.test.ts b/ui/packages/app-shell/src/utils/__tests__/appRoute.test.ts index ccb2cbef718..5ba1f3054f0 100644 --- a/ui/packages/app-shell/src/utils/__tests__/appRoute.test.ts +++ b/ui/packages/app-shell/src/utils/__tests__/appRoute.test.ts @@ -259,12 +259,12 @@ describe('isApprovalsInboxLink (objectstack#35505)', () => { describe('appStudioDesignPath', () => { const crm = { name: 'crm', _packageId: 'com.acme.crm' }; - it('resolves an admin viewing a packaged app to its design surface', () => { - expect(appStudioDesignPath(crm, true)).toBe('/studio/com.acme.crm/data'); + it("resolves an admin viewing a packaged app to its package's 概览 Overview (objectstack#38392)", () => { + expect(appStudioDesignPath(crm, true)).toBe('/studio/com.acme.crm/overview'); }); it('URL-encodes the package id', () => { expect(appStudioDesignPath({ _packageId: 'com.acme/crm' }, true)).toBe( - '/studio/com.acme%2Fcrm/data', + '/studio/com.acme%2Fcrm/overview', ); }); it('returns null for non-admins', () => { @@ -377,16 +377,16 @@ describe('appStudioRoutePath', () => { ); }); - it('falls back to the plain Data tab for the app root and the system area', () => { - // No route type at all (bare /apps/:pkg) → Data tab. - expect(appStudioRoutePath(crm, true, { type: undefined, name: undefined })).toBe('/studio/com.acme.crm/data'); + it("falls back to the package's 概览 Overview for the app root and the system area (objectstack#38392)", () => { + // No route type at all (bare /apps/:pkg) → 概览. + expect(appStudioRoutePath(crm, true, { type: undefined, name: undefined })).toBe('/studio/com.acme.crm/overview'); // The system settings area is not an object. - expect(appStudioRoutePath(crm, true, { type: 'system', name: 'members' })).toBe('/studio/com.acme.crm/data'); + expect(appStudioRoutePath(crm, true, { type: 'system', name: 'members' })).toBe('/studio/com.acme.crm/overview'); }); - it('falls back to the Data tab for an interface list route (no surface name)', () => { + it("falls back to the package's 概览 Overview for an interface list route (no surface name)", () => { // e.g. /apps/:pkg/page with no specific page selected. - expect(appStudioRoutePath(crm, true, { type: 'page', name: undefined })).toBe('/studio/com.acme.crm/data'); + expect(appStudioRoutePath(crm, true, { type: 'page', name: undefined })).toBe('/studio/com.acme.crm/overview'); }); it('returns null for non-admins (bridge hidden), for both surface and Data targets', () => { 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 51872f0bdc9..bf9fa2e2d9c 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 @@ -74,7 +74,7 @@ import { CreatePackageDialog } from './PackagesPage'; import { useMetadataClient } from './useMetadata'; import { t, useMetadataLocale } from './i18n'; import { newAppStep } from '../studio-design/newAppDoor'; -import { studioHomePath } from '../studio-design/studioAddress'; +import { studioPackageOverviewPath } from '../studio-design/studioOverviewAddress'; import { StudioDesignSurface } from '../studio-design/StudioDesignSurface'; import { StudioPillarRedirect } from '../studio-design/StudioPillarRedirect'; @@ -189,7 +189,7 @@ function NewAppHost() { open={open} onOpenChange={setOpen} newApp={step} - onSaved={(r) => navigate(studioHomePath(r.id))} + onSaved={(r) => navigate(studioPackageOverviewPath(r.id))} /> ); @@ -306,7 +306,7 @@ describe('PackageFormDialog with a new-app step: one confirm creates the package // (`CreatePackageDialog`) offers 「同时创建应用」, ticked by default. // --------------------------------------------------------------------------- -/** `CreatePackageDialog` as Setup → Packages mounts it: Studio on the new package after create. */ +/** `CreatePackageDialog` as Setup → Packages mounts it: Studio on the new package's 概览 Overview after create (objectstack#38392). */ function CreatePackageHost() { const navigate = useNavigate(); const [open, setOpen] = React.useState(false); @@ -315,7 +315,7 @@ function CreatePackageHost() { - navigate(studioHomePath(id))} /> + navigate(studioPackageOverviewPath(id))} /> ); } diff --git a/ui/packages/app-shell/src/views/metadata-admin/PackagesPage.installedAppsUpdates-34722.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/PackagesPage.installedAppsUpdates-34722.test.tsx index f770ea46cde..bc526f4cd16 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/PackagesPage.installedAppsUpdates-34722.test.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/PackagesPage.installedAppsUpdates-34722.test.tsx @@ -675,7 +675,7 @@ describe('Setup → Packages: the administration face (objectstack#36834)', () = // are authoring: not on this face, though the package has a draft. expect(within(sheet).queryByText(row('engine.packages.detail.pendingChanges'))).toBeNull(); expect(within(sheet).queryByText(row('engine.packages.detail.browseMetadata'))).toBeNull(); - expect(within(sheet).getByTestId('pkg-detail-open-in-studio')).toHaveAttribute('href', '/studio/app.b2r4/data'); + expect(within(sheet).getByTestId('pkg-detail-open-in-studio')).toHaveAttribute('href', '/studio/app.b2r4/overview'); }); it('CONTROL: the same package on the development surface keeps every authoring action', async () => { @@ -737,7 +737,7 @@ describe('Setup → Packages: the administration face (objectstack#36834)', () = fireEvent.click(screen.getByRole('button', { name: row('engine.packages.new') })); fireEvent.click(await screen.findByTestId('stub-create-save')); - expect(await screen.findByTestId('where')).toHaveTextContent('/studio/app.fresh/data'); + expect(await screen.findByTestId('where')).toHaveTextContent('/studio/app.fresh/overview'); }); it('CONTROL: New Package on the development surface stays on the list', async () => { @@ -786,7 +786,7 @@ describe('Setup → Packages: the new-package deep link (objectstack#36908)', () // The create lands in Studio on the new package, as New Package does. fireEvent.click(screen.getByTestId('stub-create-save')); - expect(await screen.findByTestId('where')).toHaveTextContent('/studio/app.fresh/data'); + expect(await screen.findByTestId('where')).toHaveTextContent('/studio/app.fresh/overview'); }); it('CONTROL: the face without the param opens no dialog', async () => { @@ -821,7 +821,7 @@ describe('Setup → Packages: New Package offers 「同时创建应用」 (objec const save = await screen.findByTestId('stub-create-save'); expect(save).toHaveAttribute('data-new-app', 'step'); fireEvent.click(save); - expect(await screen.findByTestId('where')).toHaveTextContent('/studio/app.fresh/data'); + expect(await screen.findByTestId('where')).toHaveTextContent('/studio/app.fresh/overview'); }); it('the `?new=package` door opens the dialog with the app step', async () => { @@ -882,7 +882,7 @@ describe('Setup → Packages: a read-only base’s customizations in its detail await waitFor(() => expect(within(section).getByTestId('pkg-detail-customizations-summary')).toHaveTextContent('0 customized, 1 rearranged, 0 switched off'), ); - expect(within(section).getByTestId('pkg-detail-customize')).toHaveAttribute('href', '/studio/com.acme.code/data'); + expect(within(section).getByTestId('pkg-detail-customize')).toHaveAttribute('href', '/studio/com.acme.code/overview'); }); it('an authored package’s detail draws no customizations section: it is changed in place', async () => { diff --git a/ui/packages/app-shell/src/views/studio-design/PackageCustomizationsPanel.test.tsx b/ui/packages/app-shell/src/views/studio-design/PackageCustomizationsPanel.test.tsx index 87d2fea463d..c6f3798b4f1 100644 --- a/ui/packages/app-shell/src/views/studio-design/PackageCustomizationsPanel.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/PackageCustomizationsPanel.test.tsx @@ -192,7 +192,7 @@ describe('Setup → Packages: an installed app’s customizations (objectstack#3 stubWire(200, served({ extensions: [{ object: 'account', kind: 'field', name: 'region' }] })); const { onNavigate } = renderPanel(); - expect(screen.getByTestId('pkg-detail-customize')).toHaveAttribute('href', `/studio/${APP}/data`); + expect(screen.getByTestId('pkg-detail-customize')).toHaveAttribute('href', `/studio/${APP}/overview`); await waitFor(() => expect(rows()).toHaveLength(1)); fireEvent.click(within(rows()[0]).getByRole('link')); expect(await screen.findByTestId('where')).toHaveTextContent(`/studio/${APP}/metadata/object/account`); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioPaletteGroups.surfaceScope-36900.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioPaletteGroups.surfaceScope-36900.test.tsx index 2640af68d9f..999598cf630 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioPaletteGroups.surfaceScope-36900.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioPaletteGroups.surfaceScope-36900.test.tsx @@ -340,7 +340,7 @@ describe("on a package, the palette lists the left menu and the package's items const { open } = mount(PKG); await itemsListed(); pick(values('studio-package People')[0]); - expect(open).toHaveBeenLastCalledWith('/studio/com.acme.hr/data'); + expect(open).toHaveBeenLastCalledWith('/studio/com.acme.hr/overview'); }); it('matches an item by label, name or type, and a menu entry by label, type or group', async () => { diff --git a/ui/packages/app-shell/src/views/studio-design/studioDoorsOverview-38392.test.ts b/ui/packages/app-shell/src/views/studio-design/studioDoorsOverview-38392.test.ts new file mode 100644 index 00000000000..9400d7d6aaf --- /dev/null +++ b/ui/packages/app-shell/src/views/studio-design/studioDoorsOverview-38392.test.ts @@ -0,0 +1,200 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * objectstack#38392 — every door that opens a package's Studio lands on its + * 概览 Overview, `/studio//overview` (ruling record 7247357556 on + * objectstack#37958), not on the object list, `/studio//data`. + * + * Each door's landing is pinned in its own component's test, where it is + * clicked or read off the rendered link. This file holds the census those + * pins cannot: it parses every non-test source of `@object-ui/app-shell` + * (comments are not code, so prose may still name the old address) and + * + * 1. refuses any reference to `studioHomePath`, the object list's builder, + * outside the files listed below with the reason each keeps it — so a new + * door that reaches for it goes red here, and a local alias of it (the + * shape Setup → Packages carried) is a reference too; + * 2. finds each named door's own `studioPackageOverviewPath(...)` call, inside + * the element, function or handler that is the door. + * + * `/studio//data` stays a working address for anyone who wants the + * object list (`studioAddress.test.ts` pins the builder and the route). + */ + +import { describe, expect, it } from 'vitest'; +import { readdirSync, readFileSync, statSync } from 'node:fs'; +import { dirname, join, relative, resolve } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import ts from 'typescript'; + +const HERE = dirname(fileURLToPath(import.meta.url)); +const SRC = resolve(HERE, '../..'); + +/** The files that may still build the object list address, and why. */ +const KEEPS_OBJECT_LIST: Readonly> = { + 'views/studio-design/studioAddress.ts': 'declares the builder, and the Changes drawer review link is spelled on it', + 'views/studio-design/setupMetadataRedirect.ts': 'a retired Setup bookmark, not a door: it lands on the objects it named', +}; + +const SKIP_DIRS = new Set(['node_modules', 'dist', '__tests__', '__mocks__']); +const SOURCE = /\.(?:ts|tsx)$/; +const NOT_SOURCE = /(?:\.test|\.spec|\.stories|\.d)\.(?:ts|tsx)$/; + +function sourcesUnder(dir: string): string[] { + const out: string[] = []; + for (const entry of readdirSync(dir)) { + const full = join(dir, entry); + if (statSync(full).isDirectory()) { + if (!SKIP_DIRS.has(entry)) out.push(...sourcesUnder(full)); + } else if (SOURCE.test(entry) && !NOT_SOURCE.test(entry)) { + out.push(full); + } + } + return out; +} + +function parse(rel: string): ts.SourceFile { + const file = resolve(SRC, rel); + return ts.createSourceFile(file, readFileSync(file, 'utf8'), ts.ScriptTarget.Latest, true, ts.ScriptKind.TSX); +} + +function walk(node: ts.Node, visit: (n: ts.Node) => void): void { + visit(node); + node.forEachChild((child) => walk(child, visit)); +} + +/** Every identifier in `sf` spelled `name`. */ +function identifiers(sf: ts.SourceFile, name: string): ts.Identifier[] { + const out: ts.Identifier[] = []; + walk(sf, (n) => { + if (ts.isIdentifier(n) && n.text === name) out.push(n); + }); + return out; +} + +/** Every call of `name(...)` in `sf`. */ +function callsOf(sf: ts.SourceFile, name: string): ts.CallExpression[] { + const out: ts.CallExpression[] = []; + walk(sf, (n) => { + if (ts.isCallExpression(n) && ts.isIdentifier(n.expression) && n.expression.text === name) out.push(n); + }); + return out; +} + +function ancestors(node: ts.Node): ts.Node[] { + const out: ts.Node[] = []; + for (let at = node.parent; at; at = at.parent) out.push(at); + return out; +} + +/** A JSX element (or self-closing one) that carries `data-testid=""`. */ +function hasTestId(node: ts.Node, id: string): boolean { + const attrs = ts.isJsxElement(node) + ? node.openingElement.attributes + : ts.isJsxSelfClosingElement(node) + ? node.attributes + : null; + return !!attrs?.properties.some( + (p) => + ts.isJsxAttribute(p) && + p.name.getText() === 'data-testid' && + !!p.initializer && + ts.isStringLiteral(p.initializer) && + p.initializer.text === id, + ); +} + +function isFunctionNamed(node: ts.Node, name: string): boolean { + return ts.isFunctionDeclaration(node) && node.name?.text === name; +} + +/** The `onCreated={...}` attribute of a ``. */ +function isCreateDialogLanding(node: ts.Node): boolean { + if (!ts.isJsxAttribute(node) || node.name.getText() !== 'onCreated') return false; + const element = node.parent.parent; + return (ts.isJsxSelfClosingElement(element) || ts.isJsxOpeningElement(element)) && element.tagName.getText() === 'CreatePackageDialog'; +} + +/** The `href: ...` of a package entry: a property assignment inside the `packages` map. */ +function isPackageEntryHref(node: ts.Node): boolean { + if (!ts.isPropertyAssignment(node) || node.name.getText() !== 'href') return false; + return ancestors(node).some((a) => ts.isPropertyAssignment(a) && a.name.getText() === 'packages'); +} + +interface Door { + door: string; + file: string; + /** The node that is the door: the overview call sits inside it. */ + is: (node: ts.Node) => boolean; + /** When the door is a property, the call must be that property's whole value. */ + within?: (node: ts.Node) => boolean; +} + +const DOORS: readonly Door[] = [ + { + door: '⌘K: a package entry of the Studio scope', + file: 'chrome/CommandPalette.tsx', + is: (n) => isFunctionNamed(n, 'useStudioPaletteEntries'), + within: isPackageEntryHref, + }, + { + door: "an app's Design in Studio (and the bare-app fallback of appStudioRoutePath)", + file: 'utils/appRoute.ts', + is: (n) => isFunctionNamed(n, 'appStudioDesignPath'), + }, + { + door: 'the empty menu: Open in App Studio', + file: 'console/AppNoAccessEmptyState.tsx', + is: (n) => hasTestId(n, 'app-empty-menu-open-studio'), + }, + { + door: 'Setup → Packages: the detail sheet’s Open in Studio', + file: 'views/metadata-admin/PackagesPage.tsx', + is: (n) => hasTestId(n, 'pkg-detail-open-in-studio'), + }, + { + door: 'Setup → Packages: the landing after New Package', + file: 'views/metadata-admin/PackagesPage.tsx', + is: isCreateDialogLanding, + }, + { + door: 'Setup → Packages: the customizations section’s Customize in Studio', + file: 'views/studio-design/PackageCustomizationsPanel.tsx', + is: (n) => hasTestId(n, 'pkg-detail-customize'), + }, +]; + +describe('no door builds the object list address (objectstack#38392)', () => { + it('studioHomePath is referenced only where the object list is meant', () => { + const offenders: string[] = []; + for (const file of sourcesUnder(SRC)) { + const rel = relative(SRC, file).split('\\').join('/'); + if (rel in KEEPS_OBJECT_LIST) continue; + const sf = parse(rel); + for (const id of identifiers(sf, 'studioHomePath')) { + const { line } = sf.getLineAndCharacterOfPosition(id.getStart()); + offenders.push(`${rel}:${line + 1}`); + } + } + expect(offenders, 'a door into a package lands on studioPackageOverviewPath, not the object list').toEqual([]); + }); + + it('CONTROL: the census sees the files it spares', () => { + for (const rel of Object.keys(KEEPS_OBJECT_LIST)) { + expect(identifiers(parse(rel), 'studioHomePath').length, rel).toBeGreaterThan(0); + } + }); +}); + +describe('each door builds the package’s 概览 Overview (objectstack#38392)', () => { + it.each(DOORS.map((d) => [d.door, d] as const))('%s', (_name, door) => { + const calls = callsOf(parse(door.file), 'studioPackageOverviewPath').filter((call) => { + const up = ancestors(call); + if (!up.some(door.is)) return false; + if (!door.within) return true; + const holder = up.find(door.within); + return !!holder && ts.isPropertyAssignment(holder) && holder.initializer === call; + }); + expect(calls.length, `${door.file}: the door's own studioPackageOverviewPath call`).toBe(1); + }); +}); From 7be2d5f1d9e148fcdc5ee73ded4c3900d978ede6 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Nov 2026 05:10:50 +0000 Subject: [PATCH 3/3] chore(changeset): studio doors open the overview Claude-Session: https://claude.ai/code/session_01FEkQ5orhB2g5mxU6E4fciu Co-Authored-By: Claude --- .changeset/38392-studio-doors-overview.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .changeset/38392-studio-doors-overview.md diff --git a/.changeset/38392-studio-doors-overview.md b/.changeset/38392-studio-doors-overview.md new file mode 100644 index 00000000000..02b599caec6 --- /dev/null +++ b/.changeset/38392-studio-doors-overview.md @@ -0,0 +1,10 @@ +--- +'@object-ui/app-shell': patch +--- + +fix(app-shell): every door into a package's Studio opens its 概览 Overview + +Clause-②: no +Metadata-protocol: none + +Opening a package's Studio now lands on its 概览 Overview page from every door, the way the bare package address and Studio's own entry already did. The doors that still opened the object list now open the Overview: the command palette's (⌘K) package entries, an app's Design in Studio (the app header's bridge where the page is the app's root, a system page or an interface list with none chosen), the "Open in App Studio" of an app whose menu is empty, and in Setup → Packages the detail sheet's "Open in Studio", the landing after New Package and the customizations section's "Customize in Studio". The object list keeps its address, `/studio//data`, for anyone who wants it.