From ed33fc5293534d5b8662c073e3c02ff27cf05b44 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 25 Nov 2026 22:01:14 +0000 Subject: [PATCH 1/4] wip(studio): retired pillar addresses redirect in one hop from the route Claude-Session: https://claude.ai/code/session_01QSeKYngc1UxywCSQwtqdZz Co-authored-by: Claude --- .../console/src/components/StudioRoute.tsx | 84 +++++--- .../console/src/components/studioBuilder.ts | 7 +- ui/packages/app-shell/src/index.ts | 12 +- .../studio-design/StudioDesignSurface.tsx | 182 +++++------------- .../studio-design/StudioMetadataArea.tsx | 18 +- .../studio-design/StudioPillarRedirect.tsx | 35 ++++ .../src/views/studio-design/metadataArea.ts | 97 ++++------ .../src/views/studio-design/studioAddress.ts | 144 +++----------- .../studio-design/studioInterfacesRetired.ts | 19 +- .../views/studio-design/studioMenuModel.ts | 22 +-- .../views/studio-design/studioPaletteModel.ts | 16 +- .../studio-design/studioPillarRedirect.ts | 111 +++++++++++ .../src/views/studio-design/studioScope.ts | 9 +- .../surfaceDeepLinkChannel.test.tsx | 164 ++++------------ .../studio-design/surfaceDeepLinkChannel.ts | 84 +++----- .../studio-design/useSurfaceDeepLink.test.ts | 120 ------------ .../views/studio-design/useSurfaceDeepLink.ts | 151 ++------------- 17 files changed, 444 insertions(+), 831 deletions(-) create mode 100644 ui/packages/app-shell/src/views/studio-design/StudioPillarRedirect.tsx create mode 100644 ui/packages/app-shell/src/views/studio-design/studioPillarRedirect.ts delete mode 100644 ui/packages/app-shell/src/views/studio-design/useSurfaceDeepLink.test.ts diff --git a/ui/apps/console/src/components/StudioRoute.tsx b/ui/apps/console/src/components/StudioRoute.tsx index eb1f53509ed..148e8b9d275 100644 --- a/ui/apps/console/src/components/StudioRoute.tsx +++ b/ui/apps/console/src/components/StudioRoute.tsx @@ -1,7 +1,7 @@ // Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. /** - * `/studio/*` — the ENTRY gate for the Studio pillar builder. + * `/studio/*` — the ENTRY gate for the Studio builder. * * The policy, and why its fail direction is inverted from every other capability * gate in this app, live in `./studioEntry`. This file is only the mapping from @@ -42,12 +42,11 @@ import { LoadingFallback, LoadingScreen, STUDIO_ALL_PACKAGES_SEGMENT, - STUDIO_HOME_PILLAR, STUDIO_METADATA_AREA, - STUDIO_ORG_SCOPE_PILLAR, STUDIO_ORG_SCOPE_SEGMENT, StudioEntryPermissionsProvider, studioMetadataAreaPath, + studioOrgScopePath, studioPackagePath, useHomePath, usePhoneViewport, @@ -62,10 +61,11 @@ import { holdsStudioAccess, useStudioEntry } from './studioEntry'; /* * The builder screens load WITH THEIR ROUTE, not with the console * (objectui#11798). Imported statically, `StudioDesignSurface` (and the modules - * only it reaches, such as the pillar panels and the form designer) sat in the + * only it reaches, such as the designers and the form designer) sat in the * eager closure of every console page, for every user, on deployments where * most principals can never enter Studio. Studio's entry - * (`StudioEntryRedirect`) rides in the same chunk. + * (`StudioEntryRedirect`) and the retired pillar addresses' redirect + * (`StudioPillarRedirect`) ride in the same chunk. * * Only the builder is deferred. The gate above it (`StudioRoute` → * `RequireStudioAccess`) stays in this eager module on purpose: it decides @@ -80,6 +80,9 @@ const StudioDesignSurface = lazy(() => const StudioEntryRedirect = lazy(() => import('./studioBuilder').then((m) => ({ default: m.StudioEntryRedirect })), ); +const StudioPillarRedirect = lazy(() => + import('./studioBuilder').then((m) => ({ default: m.StudioPillarRedirect })), +); /** * What a principal without `studio.access` sees, at the Studio URL they opened @@ -204,16 +207,16 @@ function StudioEntry() { } /** - * A package's pillar builder, which records the visit as a recent `package` + * A package's builder, which records the visit as a recent `package` * entry (objectui#11863), so Studio's entry (bare `/studio`, objectstack#36908) * can open the package an author was last in. `useTrackRouteAsRecent` reads `/apps/APP` routes only, and this * module owns the `/studio` subtree, so the record is made here, behind the * entry gate: a refused principal never mounts this element. * * The entry is the package's IDENTITY — its id, and `href` its bare route, - * which lands on the Data pillar — and no label: a reader labels it from the + * which lands on its object list — and no label: a reader labels it from the * package list it loads (objectui#11678's shape). Keyed on the package, not the - * pillar, so moving between pillars of one package leaves the list as it is, + * page, so moving between pages of one package leaves the list as it is, * and the provider writes nothing. The package-less scope (`~org`) and the * cross-package leg (`~all`) are not packages and record nothing. */ @@ -240,6 +243,19 @@ function StudioPackageBuilder({ area }: { area?: typeof STUDIO_METADATA_AREA }) ); } +/** + * objectstack#36909 — a retired pillar address (the bare package address + * included) redirects to the page that replaced it in one hop; any other + * segment renders `children`. The redirect rides in the builder's chunk. + */ +function StudioPillarAddress({ children }: { children?: ReactNode }) { + return ( + }> + {children} + + ); +} + /** * The whole `/studio` subtree (ADR-0080/0084), as ONE element `App.tsx` drops * into its `` — the same shape `AppContent`'s `systemRoutes` uses. @@ -250,19 +266,19 @@ function StudioPackageBuilder({ area }: { area?: typeof STUDIO_METADATA_AREA }) * agree with itself while `App.tsx` quietly mounted the builder ungated. * * `/studio` Studio's entry: the last package, else the package list - * `/studio/~org` the package-less scope lands on its one pillar + * `/studio/~org` the package-less scope lands on its flow list * `/studio/~all/*` lands on the "All metadata" area across packages - * `/studio/:packageId` a package lands on its Data pillar + * `/studio/:packageId` a package lands on its object list * `/studio/:packageId/metadata/*` a package's "All metadata" area, in the builder - * `/studio/:packageId/:tab` the pillar builder (a recent-package visit) + * `/studio/:packageId/:tab` a retired pillar redirects; any other segment is + * the builder (the sharing overview, `owd`, or + * the not-found state) * * `~org` is the reserved segment for the organization's own, package-less * flows (objectui#11553; `studioScope.ts` in app-shell says why `~` can never - * name a package). Its pillar URL is served by the generic `:packageId/:tab` - * route — the SAME `StudioDesignSurface`, which reads the segment as "no - * package" — so only its bare leg needs a route of its own: a static segment - * outranks `:packageId`, and the generic leg would send it to a Data pillar the - * scope does not have. + * name a package). A static segment outranks `:packageId`, so its bare leg + * needs a route of its own; its other addresses reach `:packageId/:tab` and + * redirect to its flow list (objectstack#36903). * * objectstack#28561 — the "All metadata" area (ADR-0146 D1) has routes of its * own because its pages nest below it (`StudioMetadataArea` declares them), and @@ -271,33 +287,41 @@ function StudioPackageBuilder({ area }: { area?: typeof STUDIO_METADATA_AREA }) * `metadata` segment outranks `:tab`. `~all` is the area's reserved * cross-package segment (`metadataArea.ts` in app-shell says why it is not * `~org`); every `~all` URL outside the area lands on it, so none reaches the - * pillar builder as a package id. + * builder as a package id. * * objectstack#36899 — the cross-package leg (`/studio/~all/metadata/*`) is - * served by the generic area route, as `~org`'s pillar is by the generic pillar - * route: the SAME `StudioDesignSurface`, which reads `~all` as "no package" - * and draws the area alone, under the left menu every Studio page draws. It - * used to be the area in the landing's console frame, a second shell the - * author flipped into from the menu's Access group. The more specific - * `:packageId/metadata/*` outranks `~all/*` for an area URL; every other - * `~all` URL still lands on the area. + * served by the generic area route: the SAME `StudioDesignSurface`, which + * reads `~all` as "no package" and draws the area alone, under the left menu + * every Studio page draws. The more specific `:packageId/metadata/*` outranks + * `~all/*` for an area URL; every other `~all` URL still lands on the area. + * + * objectstack#36909 — no pillar draws a page any more. Each retired pillar + * address (`data`, `automations`, `access`, `interfaces`, and the bare package + * address, which used to land on `data`) reaches the page that replaced it in + * ONE redirect (`StudioPillarRedirect`; its table is `studioPillarRedirect.ts` + * in app-shell), where it used to pass through the builder and the area's own + * `?package=` redirect first. */ export const studioRoutes = ( }> } /> - } - /> + } /> } /> - } /> + } /> } /> - } /> + + + + } + /> ); diff --git a/ui/apps/console/src/components/studioBuilder.ts b/ui/apps/console/src/components/studioBuilder.ts index 6b7f7b97283..9ad7331f9bf 100644 --- a/ui/apps/console/src/components/studioBuilder.ts +++ b/ui/apps/console/src/components/studioBuilder.ts @@ -2,8 +2,9 @@ /** * The Studio builder's screens, as the ONE module the console loads them - * through (objectui#11798): Studio's entry (objectstack#36908), the pillar - * builder, and the "All metadata" area's cross-package leg (objectstack#28561). + * through (objectui#11798): Studio's entry (objectstack#36908), the builder, + * the "All metadata" area's cross-package leg (objectstack#28561), and the + * retired pillar addresses' redirect (objectstack#36909). * * `StudioRoute.tsx` (the `/studio` subtree) reaches these components through * `import('./studioBuilder')`, behind a `lazy()` boundary. Nothing in the @@ -29,4 +30,4 @@ * one, and `pnpm check:eager-closure` weighs the bytes that would come back. */ -export { StudioDesignSurface, StudioEntryRedirect, StudioMetadataArea } from '@object-ui/app-shell'; +export { StudioDesignSurface, StudioEntryRedirect, StudioMetadataArea, StudioPillarRedirect } from '@object-ui/app-shell'; diff --git a/ui/packages/app-shell/src/index.ts b/ui/packages/app-shell/src/index.ts index 8a7bb8f6f28..bba83683b59 100644 --- a/ui/packages/app-shell/src/index.ts +++ b/ui/packages/app-shell/src/index.ts @@ -617,6 +617,12 @@ export { // author was last in, else the package list. A host that declares the // `/studio` routes mounts it as their index. export { StudioEntryRedirect } from './views/studio-design/StudioEntryRedirect.js'; +// objectstack#36909 — a retired pillar address (`/studio/`, +// `/studio//data`, `/automations`, `/access`, `/interfaces`, +// `/studio/~org/...`) lands on the page that replaced it in one redirect. A +// host that declares the `/studio` routes mounts it on `:packageId` and +// `:packageId/:tab`, with the builder as its children. +export { StudioPillarRedirect } from './views/studio-design/StudioPillarRedirect.js'; // The capability set that host's Studio entry gate read, provided around the // `/studio` subtree so every Studio exit that names no package lands where the // principal may go (Setup → Packages, else the "All metadata" area). @@ -631,11 +637,10 @@ export { // `/studio` routes reads the reserved segment from here. export { STUDIO_ORG_SCOPE_SEGMENT, - STUDIO_ORG_SCOPE_PILLAR, studioOrgScopePath, } from './views/studio-design/studioScope.js'; -// Studio's "All metadata" area (objectstack ADR-0146 D1): per package beside -// the pillars, at `/studio//metadata/*`, and across packages at the +// Studio's "All metadata" area (objectstack ADR-0146 D1): per package, at +// `/studio//metadata/*`, and across packages at the // reserved `/studio/~all/metadata/*`. A host that declares the `/studio` routes // reads the segments from here, and mounts the cross-package leg's area. export { @@ -657,7 +662,6 @@ export { SETUP_PACKAGES_PATH } from './views/metadata-admin/packageSource.js'; // through these, never by hand (`studioAddress.guard.test.ts`). export { STUDIO_ROOT_PATH, - STUDIO_HOME_PILLAR, studioLandingPath, studioPackagePath, } from './views/studio-design/studioAddress.js'; 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 4a69a0730c6..a45b95dd8f7 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx @@ -3,12 +3,12 @@ /** * StudioDesignSurface — the open-source WYSIWYG design surface (ADR-0080). * - * Routed as /studio/:packageId/{data|automations|interfaces} — three pillars, - * each composed AROUND existing renderers (no new editor code): - * - Interfaces: the real App navigation tree → live canvas (getMetadataPreview) - * + inspector (getMetadataInspector), edits persisting via draft → publish. - * - Data: the package's objects → fields + record grid. - * - Automations: flows → FlowPreview (default OFF / review-then-enable). + * Routed as /studio/:packageId/metadata/* (the "All metadata" area, where + * objects, flows and permission sets open their designers full-screen) and + * /studio/:packageId/owd (the sharing overview). objectstack#36909 — the + * retired pillar addresses (`data`, `automations`, `access`, `interfaces`) + * never reach this surface: the route redirects them + * (`StudioPillarRedirect`), and any other segment draws a not-found state. * * Open-core boundary: the left AI copilot is NOT part of the open-source * surface — it is an injected slot (`aiSlot`) the cloud edition fills. @@ -73,7 +73,6 @@ import { type StudioSavedDraft, } from './StudioPillarKit.js'; import { AutomationsPillar } from './AutomationsPillar.js'; -import { automationsPillarRedirect } from './automationsPillarRedirect.js'; import { DataPillar, renderStudioGridList } from './DataPillar.js'; import { cn, @@ -100,13 +99,7 @@ import { useMetadataClient } from '../metadata-admin/useMetadata.js'; import { fetchPendingDrafts, usePendingDrafts } from '../../preview/usePendingDrafts.js'; import { emitMetadataRefresh, subscribeMetadataRefresh } from '../../assistant/assistantBus.js'; import { STUDIO_CHANGES_PARAM, STUDIO_CHANGES_REVIEW } from './studioChangesLink.js'; -import { - RETIRED_INTERFACES_SEGMENT, - STUDIO_HOME_PILLAR, - isRetiredInterfacesLanding, - retiredInterfacesState, - retiredInterfacesTarget, -} from './studioInterfacesRetired.js'; +import { STUDIO_HOME_PILLAR, isRetiredInterfacesLanding } from './studioInterfacesRetired.js'; import { StudioInterfacesRetiredNotice } from './StudioInterfacesRetiredNotice.js'; import { StudioSaveControls, @@ -122,16 +115,14 @@ import { } from './metadataError.js'; import { readEnvelopeFailureText } from '../../utils/apiErrorEnvelope.js'; import { - STUDIO_ORG_SCOPE_PILLAR, isOrgScopeDraft, isStudioOrgScope, studioOrgScopePath, } from './studioScope.js'; -import { STUDIO_METADATA_AREA, dataPillarRedirect, isStudioAllPackagesScope } from './metadataArea.js'; +import { STUDIO_METADATA_AREA, isStudioAllPackagesScope, settledAreaAddress } from './metadataArea.js'; import { StudioMenu, StudioMenuDataProvider, StudioMenuProvider, StudioMenuTrigger } from './StudioMenu.js'; import { StudioMetadataArea } from './StudioMetadataArea.js'; import { StudioOwdOverviewPage } from './StudioOwdOverviewPage.js'; -import { AccessPillarLanding } from './accessPillarLanding.js'; import { useMetadataRefreshNonce } from './useMetadataRefreshNonce.js'; import { type SurfaceTarget, @@ -143,7 +134,7 @@ import { confirmUnsavedLeave, useRegisterUnsavedEdits } from '../../chrome/unsav import { CommandPalette, type StudioPaletteSurface } from '../../chrome/CommandPalette.js'; import { CommandPaletteProvider, useCommandPaletteProviderMounted } from '../../context/CommandPaletteProvider.js'; import { StudioPaletteGroups } from './StudioPaletteGroups.js'; -import { openStudioPaletteAddress, studioSamePageSearch } from './studioPaletteModel.js'; +import { openStudioPaletteAddress } from './studioPaletteModel.js'; import { CreateItemDialog } from './CreateItemDialog.js'; // objectui#11787 — the shared draft autosave, moved to its own module unchanged. import { @@ -171,7 +162,7 @@ import { type DraftPublishOptions, } from '../../preview/DraftChangesPanel.js'; import { toast } from 'sonner'; -import { STUDIO_OWD_SECTION, studioItemPath, studioPillarItemAddress, studioPillarPath } from './studioAddress.js'; +import { STUDIO_OWD_SECTION, studioItemPath, studioMetadataTypePath, studioPillarPath } from './studioAddress.js'; /** The batch door's `backfillApplied` receipt, by reference to what the client returns (objectui#12929). */ type PublishBackfillReceipt = NonNullable< @@ -197,37 +188,9 @@ function formatBackfillReceipt(receipt: PublishBackfillReceipt, locale: string): .join(' · '); } -// The pillar segments `/studio//` serves. objectstack#36899 -// (ADR-0084, amended) — they are no longer a navigation: Studio's one -// navigation is the left menu (`StudioMenu`), and these pages are where a -// flow or a permission set opens until each becomes a full-screen item page. -// objectstack#36904 — the Data pillar is retired: an object opens its designer -// on its metadata address, and `/data` redirects (`dataPillarRedirect`). -// objectstack#36502 — the Interfaces pillar is retired -// (`studioInterfacesRetired.tsx`). The "All metadata" area -// (`/studio//metadata/…`, `metadataArea.ts`) is not a pillar, so the -// not-found check does not hold it. -// -// objectstack#36903 — the Automations pillar is retired too: a flow opens its -// designer on its metadata address, and `/automations` redirects -// (`automationsPillarRedirect`) before this page draws. -const PILLARS: readonly string[] = ['access']; // objectstack#29988 — the pillar kit moved to its own module; re-exported for its pins. export { StudioHeldNotice, StudioReadOnlyLink, type StudioBaseCustomization }; -/** - * Which pillar owns a surface type — the routing half of a live surface - * request (see surfaceDeepLinkChannel). Only the types a pillar actually - * RESOLVES are listed, mirroring the `resolveSurfaceDeepLink` call sites - * below; an unlisted type is delivered in place rather than guessed at, - * because navigating to the wrong pillar costs the author their position and - * buys nothing. - */ -const PILLAR_FOR_SURFACE_TYPE: Readonly> = { - permission: 'access', -}; - - // objectstack#29148 — the strip moved to its own module; re-exported for its pins. export { StudioRefusalStrip }; @@ -254,37 +217,22 @@ export interface StudioDesignSurfaceProps { } /** - * objectstack#28572 (ADR-0146 D3) — a pillar URL of a base's paired - * `.custom` lands on the base's surface, which lists, edits and - * publishes the pair's items: the pair has no surface of its own. The pillar - * and the query (a `?surface=` deep link) are kept. + * objectstack#28572 (ADR-0146 D3) — a URL of a base's paired `.custom` + * outside the area (its sharing overview, or a segment no page has) lands on + * the base's surface, which lists, edits and publishes the pair's items: the + * pair has no surface of its own. The segment and the query are kept. * * ⛔ Not the "All metadata" area (`area`): its list links an item of the pair * to the pair's own area (`?package=`, which the area re-roots onto * that package), so landing that URL on the base would send it straight back. + * + * objectstack#36909 — a retired pillar's address (`data`, `automations`, + * `access`, `interfaces`) is redirected by the route (`StudioPillarRedirect`) + * before this surface mounts, so none is handled here. */ export function StudioDesignSurface(props: StudioDesignSurfaceProps): React.ReactElement { const params = useParams<{ packageId?: string; tab?: string }>(); const location = useLocation(); - // objectstack#36502 — an old Interfaces URL lands on the Studio home and - // says where interface editing went (`studioInterfacesRetired.tsx`). - if (!props.area && params.tab === RETIRED_INTERFACES_SEGMENT) { - const scope = customizationPairBaseOf(params.packageId ?? null) ?? params.packageId ?? 'com.example.showcase'; - return ; - } - // objectstack#36903 — the retired Automations pillar (and the package-less - // scope's) lands on the flow list or the flow's designer, a pair's in its - // own area (`automationsPillarRedirect`). - if (!props.area && params.tab === STUDIO_ORG_SCOPE_PILLAR && params.packageId && !isStudioAllPackagesScope(params.packageId)) { - return ; - } - // objectstack#36904 — the retired Data pillar (Studio's old home, and the - // old object address) lands on the object list or the object's designer, a - // pair's in its own area (`dataPillarRedirect`). - const segment = params.packageId ?? ''; - if (!props.area && params.tab === STUDIO_HOME_PILLAR && segment && !isStudioOrgScope(segment) && !isStudioAllPackagesScope(segment)) { - return ; - } const pairBase = props.area ? null : customizationPairBaseOf(params.packageId ?? null); if (pairBase !== null) { const tab = params.tab ?? STUDIO_HOME_PILLAR; @@ -307,9 +255,6 @@ function StudioDesignSurfaceBody({ aiSlot, area }: StudioDesignSurfaceProps): Re // of them can be handed a reserved segment as though it named a package. const packageId: string | null = isStudioOrgScope(scopeSegment) || allScope ? null : scopeSegment; const tab = area ?? params.tab ?? STUDIO_HOME_PILLAR; - // objectstack#26708 — a segment no pillar has is a not-found state, never - // a pillar it falls through to. - const pillarKnown = PILLARS.includes(tab); const locale = useMetadataLocale(); // objectstack#36502 — a landing from an old Interfaces URL says once where // interface editing went. The landing's history state is read once and @@ -643,7 +588,7 @@ function StudioDesignSurfaceBody({ aiSlot, area }: StudioDesignSurfaceProps): Re return new Map([...publishRefusals].filter(([key]) => listed.has(key))); }, [feedCount, pendingEntries, publishRefusals]); - // The publish toast's way to the Access pillar; set once the router's + // The publish toast's way to the package's permission sets; set once the router's // navigate is in hand below. const openAccessRef = React.useRef<() => void>(() => {}); @@ -944,8 +889,10 @@ function StudioDesignSurfaceBody({ aiSlot, area }: StudioDesignSurfaceProps): Re // for a Studio-only author (the same choice as Studio's entry). const notFoundExit = studioEntryFallbackPath(useStudioEntryPermissions()); React.useEffect(() => { + // objectstack#36909 — the package's permission sets, where the retired + // Access pillar's bare address lands, without the hop through it. openAccessRef.current = () => { - if (confirmLeavePillar()) shellNavigate(studioPillarPath(scopeSegment, 'access', { segmentEncoding: 'verbatim' })); + if (confirmLeavePillar()) shellNavigate(settledAreaAddress(studioMetadataTypePath(scopeSegment, 'permission'))); }; }); // objectui#11181 — `label` is the app's own `I18nLabel` (a plain string or an @@ -1215,15 +1162,10 @@ function StudioDesignSurfaceBody({ aiSlot, area }: StudioDesignSurfaceProps): Re * Host side of the live `?surface=` channel. Producers below the provider — * today the pending-changes sheet's security block, which names a draft the * publish door would refuse — hand us a surface identity and we put the - * author in front of it: - * - * - ANOTHER pillar's surface still travels through the URL, because that - * pillar is unmounted and its mount-time capture is the mechanism built - * for exactly this. Vetoed (`false`) when the author declines to abandon - * unsaved edits, so a request never outlives the navigation it needed. - * - THIS pillar's surface is the case the capture cannot serve at all — - * nothing remounts — so the channel carries it and the pillar applies it - * once. + * author in front of it: the item's own address, vetoed (`false`) when the + * author declines to abandon unsaved edits, so a request never outlives the + * navigation it needed. A type with no designer page of its own moves + * nothing. * * Either way the sheet closes: a selection nobody can see is not navigation. */ @@ -1233,9 +1175,11 @@ function StudioDesignSurfaceBody({ aiSlot, area }: StudioDesignSurfaceProps): Re // objectstack#36904 — an object is its designer's own address, in the // package that holds the draft the sheet names (`draftScope`): on a // read-only base, the `.custom` pair, where an object the pair adds - // resolves and the base's address does not. - if (target.type === 'object' && draftScope !== null) { - const to = studioItemPath(draftScope, 'object', target.name); + // resolves and the base's address does not. objectstack#36909 — a + // permission set the same way: its matrix's address, in that package + // (it used to go through the retired Access pillar's address). + if ((target.type === 'object' || target.type === 'permission') && draftScope !== null) { + const to = studioItemPath(draftScope, target.type, target.name); if (to !== currentPathname) { if (!confirmLeavePillar()) return false; shellNavigate(to); @@ -1254,47 +1198,18 @@ function StudioDesignSurfaceBody({ aiSlot, area }: StudioDesignSurfaceProps): Re setChangesOpen(false); return; } - const pillar = PILLAR_FOR_SURFACE_TYPE[target.type]; - // objectui#11553 — the package-less scope has one pillar; a surface - // owned by another is not in this scope, so nothing to navigate to. - const reachable = !allScope && (packageId !== null || pillar === STUDIO_ORG_SCOPE_PILLAR); - if (pillar && pillar !== tab && reachable) { - if (!confirmLeavePillar()) return false; - shellNavigate(studioPillarItemAddress(scopeSegment, pillar, target, { segmentEncoding: 'verbatim' })); - } setChangesOpen(false); }, - [tab, allScope, packageId, draftScope, scopeSegment, confirmLeavePillar, shellNavigate, currentPathname], + [allScope, packageId, draftScope, confirmLeavePillar, shellNavigate, currentPathname], ); - // objectstack#36899 — a menu entry that re-enters the open pillar on another - // `?surface=` (the default sharing overview, on the Access pillar) opens the - // pillar afresh, as arriving from any other page does: a pillar reads its - // deep link once, at mount (`useSurfaceDeepLink`). The shell's link guard - // lets a link to the page already shown through, so this asks first. The - // remount waits for the new query to be the router's: the router may apply - // a navigation in a later render than the click's own state updates, and a - // pillar remounted before it would capture the old deep link. - // objectstack#36900 — it waits for the query it was asked for, not for the - // next query change: the command palette closes itself (its `?palette=` - // goes) before the pick navigates, and that first change must not remount - // the pillar on the old deep link. - const [pillarEntry, setPillarEntry] = React.useState(0); - const reentryPending = React.useRef(null); + // objectstack#36899 — a menu entry or a palette pick that is the page + // already shown, on another query, asks about unsaved work first: the + // shell's link guard lets a link to the page already shown through. + // objectstack#36909 — it used to remount the open pillar too, so the pillar + // read the new deep link at mount; no pillar draws a page any more, and the + // area's pages read their own query. const currentSearch = useLocation().search; - const reenterPillar = React.useCallback( - (search: string): boolean => { - if (!confirmLeavePillar()) return false; - reentryPending.current = search; - return true; - }, - [confirmLeavePillar], - ); - React.useLayoutEffect(() => { - const expected = reentryPending.current; - if (expected === null || !studioSamePageSearch(currentSearch, expected)) return; - reentryPending.current = null; - setPillarEntry((n) => n + 1); - }, [currentSearch]); + const reenterPillar = React.useCallback((_search: string): boolean => confirmLeavePillar(), [confirmLeavePillar]); // objectstack#26708 — a package that is not there has no menu. const showMenu = !pkgMissing; @@ -1654,23 +1569,15 @@ function StudioDesignSurfaceBody({ aiSlot, area }: StudioDesignSurfaceProps): Re readOnly={readOnly} onDirtyChange={setPillarDirty} /> - ) : !pillarKnown ? ( + ) : ( + // objectstack#26708 — a segment no page has is a not-found + // state. objectstack#36909 — the retired pillars' segments never + // reach here: the route redirects them (`StudioPillarRedirect`). - ) : ( - // objectstack#36905 — the Access pillar draws no page: a set opens - // at its metadata address (a set the base's pair adds at the - // pair's), the sharing overview on its own route, and the bare - // pillar on the list of sets. - )} @@ -1781,7 +1688,8 @@ function StudioDesignSurfaceBody({ aiSlot, area }: StudioDesignSurfaceProps): Re export { type NewFlowTrigger }; // objectstack#36893 — the Automations pillar moved to its own module; re-exported for its pins. -// objectstack#36905 — the Access pillar is gone: its addresses redirect (`accessPillarRedirect.ts`). +// objectstack#36905 — the Access pillar is gone: its addresses redirect (`accessPillarRedirect.ts`, reached +// through `StudioPillarRedirect`, objectstack#36909). export { AutomationsPillar }; // objectstack#36893 — the Data pillar moved to its own module; re-exported for its pins. diff --git a/ui/packages/app-shell/src/views/studio-design/StudioMetadataArea.tsx b/ui/packages/app-shell/src/views/studio-design/StudioMetadataArea.tsx index 997eb4d8106..99cb0af9de7 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioMetadataArea.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioMetadataArea.tsx @@ -53,7 +53,6 @@ import { areaItemAsksGenericPage, areaItemOpensDesignerPage, areaItemOpensFormEditor, - areaItemPillarPath, areaLocationRedirect, studioMetadataAreaPath, } from './metadataArea.js'; @@ -154,15 +153,15 @@ interface AreaEditorProps { } /** - * `/:type/:name`: a pillar type opens its pillar, an object, a flow or - * a permission set its designer full-screen (`areaItemOpensDesignerPage`), an email template or a + * `/:type/:name`: an object, a flow or a permission set opens its + * designer full-screen (`areaItemOpensDesignerPage`), an email template or a * translation the form editor (`areaItemOpensFormEditor`), every other type - * the generic item page (`areaItemPillarPath` lists when). + * the generic item page. * * Decided once per item, when it opens (the item is the key below): the item * page itself rewrites the query it opened with (it drops `?review=1` once the - * review sheet is open), and that must not send an open review on to the - * pillar. + * review sheet is open), and that must not move an open review to the + * designer. */ function AreaItem({ editor }: { editor: AreaEditorProps }): React.ReactElement { const { type = '', name = '' } = useParams<{ type: string; name: string }>(); @@ -201,11 +200,10 @@ function AreaItemOpen({ const genericPage = areaItemAsksGenericPage(search) && !getMetadataResource(type)?.EditPage; const designer = (areaItemOpensDesignerPage(at) || (editor.orgScope === true && type === STUDIO_ORG_SCOPE_TYPE)) && !genericPage; - if (designer) return { designer: true, formEditor: false, pillarPath: null }; - if (areaItemOpensFormEditor({ ...at, readOnly: host?.readOnly === true })) return { designer: false, formEditor: true, pillarPath: null }; - return { designer: false, formEditor: false, pillarPath: areaItemPillarPath({ ...at, name }) }; + if (designer) return { designer: true, formEditor: false }; + if (areaItemOpensFormEditor({ ...at, readOnly: host?.readOnly === true })) return { designer: false, formEditor: true }; + return { designer: false, formEditor: false }; }); - if (opens.pillarPath) return ; if (opens.designer && host?.packageId && type === 'object') { // objectstack#36904 — the object designer, full-screen on the object's address. return ( diff --git a/ui/packages/app-shell/src/views/studio-design/StudioPillarRedirect.tsx b/ui/packages/app-shell/src/views/studio-design/StudioPillarRedirect.tsx new file mode 100644 index 00000000000..11ebf4164a2 --- /dev/null +++ b/ui/packages/app-shell/src/views/studio-design/StudioPillarRedirect.tsx @@ -0,0 +1,35 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * objectstack#36909 — the route element for `/studio/:packageId` and + * `/studio/:packageId/:tab`: a retired pillar address redirects, in one hop, + * to the page that replaced it (`studioPillarRedirect.ts` holds the table); + * any other segment renders `children`, the page that answers to it (the + * builder, which draws the sharing overview or the not-found state). + * + * The router state the address arrived with travels with it, except where + * the redirect writes its own (the retired Interfaces landing's notice). + */ + +import * as React from 'react'; +import { Navigate, useLocation, useParams } from 'react-router-dom'; +import { AccessPillarLanding } from './accessPillarLanding.js'; +import { studioPillarRedirect } from './studioPillarRedirect.js'; + +export function StudioPillarRedirect({ children }: { children?: React.ReactNode }): React.ReactElement | null { + const { packageId, tab } = useParams<{ packageId?: string; tab?: string }>(); + const location = useLocation(); + const target = studioPillarRedirect(packageId, tab, location.search); + if (target === null) return <>{children}; + if (target.kind === 'access') { + return ( + + ); + } + return ; +} diff --git a/ui/packages/app-shell/src/views/studio-design/metadataArea.ts b/ui/packages/app-shell/src/views/studio-design/metadataArea.ts index 9d334012e88..2cb068ef3bb 100644 --- a/ui/packages/app-shell/src/views/studio-design/metadataArea.ts +++ b/ui/packages/app-shell/src/views/studio-design/metadataArea.ts @@ -2,13 +2,14 @@ /** * The addresses of Studio's "All metadata" area (objectstack ADR-0146 D1, - * #28561): its routes, the one reserved segment it adds, and the pillar each - * pillar type opens in. Pure, so the routing rules are pinned without a render. + * #28561): its routes, the one reserved segment it adds, and where a retired + * pillar address lands in it. Pure, so the routing rules are pinned without a + * render. * * ## Two legs * - * - Per package: `/studio//metadata/...`, beside the pillars of - * that package. The metadata-admin pages, mounted unchanged, scoped to it. + * - Per package: `/studio//metadata/...`. The metadata-admin pages, + * mounted unchanged, scoped to it. * - Across packages: `/studio/~all/metadata/...`. The environment catalog * (positions, capabilities, permission sets, sharing rules), whose items * have one name per deployment and may belong to no package (ADR-0131 D3), @@ -39,18 +40,16 @@ import { LIST_SOURCE_PARAM } from '../metadata-admin/metadataListState.js'; import { DESIGNER_SURFACE_PARAM, parseSurfaceParam } from '../metadata-admin/nav-selection.js'; import { STUDIO_ALL_PACKAGES_SEGMENT, - STUDIO_ITEM_PILLAR, STUDIO_ITEM_REVIEW_PARAM, STUDIO_ITEM_REVIEW_VALUE, + STUDIO_METADATA_AREA, STUDIO_ORG_SCOPE_SEGMENT, STUDIO_ORG_SCOPE_TYPE, - studioItemPillar, + STUDIO_ROOT_PATH, studioMetadataAreaAddress, studioMetadataAreaRoot, studioMetadataItemAddress, studioMetadataTypePath, - studioPillarItemAddress, - type StudioPillarKey, } from './studioAddress.js'; import { DESIGNER_SURFACE_NAV_PARAM, DESIGNER_SURFACE_VIEW_PARAM } from './useSurfaceDeepLink.js'; import { STUDIO_ORG_SCOPE_SOURCE, isStudioOrgScope, studioOrgScopePath } from './studioScope.js'; @@ -58,7 +57,6 @@ import { STUDIO_ORG_SCOPE_SOURCE, isStudioOrgScope, studioOrgScopePath } from '. // objectstack#36895 — the area's segments are Studio address vocabulary, owned // by `studioAddress.ts`; re-exported under their names here. export { STUDIO_METADATA_AREA, STUDIO_ALL_PACKAGES_SEGMENT } from './studioAddress.js'; -export type { StudioPillarKey } from './studioAddress.js'; /** Whether a `/studio/:packageId` route segment names the cross-package leg. */ export function isStudioAllPackagesScope(segment: string | null | undefined): boolean { @@ -70,53 +68,11 @@ export function studioMetadataAreaPath(segment: string): string { return studioMetadataAreaRoot(segment); } -/** - * ADR-0146 D1 — "A pillar type opened from the directory opens its pillar". - * The types each pillar designs; every other type opens the area's generic - * item page. - * - * objectstack#36502 — pages, dashboards, reports and views have no pillar - * since the Interfaces pillar retired: they are designed in the running app, - * and this area's generic item page is where they are read and, as a - * fallback, edited as metadata. - */ -export const AREA_PILLAR_FOR_TYPE: Readonly> = STUDIO_ITEM_PILLAR; - /** The area's generic item page of one item of a package. */ export function studioMetadataItemPath(packageId: string, item: { type: string; name: string }): string { return studioMetadataItemAddress(packageId, item.type, item.name); } -/** A pillar of a package, opened on one item through its `?surface=` deep link. */ -export function studioPillarItemPath( - packageId: string, - pillar: StudioPillarKey, - item: { type: string; name: string }, -): string { - return studioPillarItemAddress(packageId, pillar, item); -} - -/** - * The pillar an item of the area opens in, as a path, or `null` when the - * area's generic item page is where it opens: - * - a type no pillar designs; - * - the cross-package leg, which names no package to open a pillar of; - * - the environment scope, whose catalog item is the environment's, by name; - * - `?review=1`, which opens the draft review on the generic page, as it does - * on Setup's (the console's draft-review links name that page). - */ -export function areaItemPillarPath(input: { - packageId: string | null; - type: string; - name: string; - search: URLSearchParams; -}): string | null { - const pillar = studioItemPillar(input.type); - if (!pillar || !input.packageId) return null; - if (areaItemAsksGenericPage(input.search)) return null; - return studioPillarItemPath(input.packageId, pillar, { type: input.type, name: input.name }); -} - /** * The query that asks an item's generic page on a package's leg, whatever its * type opens otherwise: the environment scope (its catalog item is the @@ -133,8 +89,7 @@ export function areaItemAsksGenericPage(search: URLSearchParams): boolean { * full-screen in the area rather than the generic item page: the permission * set's matrix (`StudioPermissionSetPage`), the object designer (`DataPillar` * on one object) and the flow designer (`AutomationsPillar`, fixed on one - * flow). A designer card adds its type here in the PR that deletes the type's - * row from `STUDIO_ITEM_PILLAR`. + * flow). A type that gains a full-screen designer is added here. */ export const AREA_DESIGNER_PAGE_TYPES: readonly string[] = Object.freeze(['permission', 'object', 'flow']); @@ -202,7 +157,9 @@ export function orgScopeFlowOf(pathname: string, segment: string | null | undefi * `?action=` (the designer opens its Actions tab on it) and `?changes=review` * (the server's draft review link, `studioChangesReviewLink`). * - * `search` is the URL's query, with or without its `?`. + * `search` is the URL's query, with or without its `?`. The address is the + * pillar's mapping alone: the route lands it through + * {@link settledAreaAddress}, which adds the `?package=` the area would. */ export function dataPillarRedirect(packageId: string, search: string): string { const params = new URLSearchParams(search); @@ -241,10 +198,9 @@ export const AREA_CUSTOMIZE_EDITOR_TYPES: readonly string[] = ['dataset', 'view' /** * Whether an item of the area opens the form editor rather than the generic * item page: a form-editor type, or on a read-only package a customize-editor - * type, on a package's leg, under the same exceptions as - * {@link areaItemPillarPath} (the cross-package leg and the environment scope - * name no package to write, and `?review=1` opens the generic page's draft - * review). + * type, on a package's leg, except where {@link areaItemAsksGenericPage} asks + * the generic page (the cross-package leg and the environment scope name no + * package to write, and `?review=1` opens the generic page's draft review). */ export function areaItemOpensFormEditor(input: { packageId: string | null; @@ -353,3 +309,28 @@ function orgScopeAreaRedirect(segment: string, rest: string, params: URLSearchPa if (settled) return null; return studioMetadataAreaAddress(STUDIO_ORG_SCOPE_SEGMENT, rest.replace(/\/+$/, ''), { query: next, segmentEncoding: 'verbatim' }); } + +/** + * objectstack#36909 — an area address put on the leg its query names, as the + * area would put it ({@link areaLocationRedirect}), so a redirect INTO the + * area lands in one hop: the area finds nothing to change and redirects no + * further. Any other address comes back as it is. + * + * Idempotent: a settled address settles to itself. + */ +export function settledAreaAddress(address: string): string { + const queryAt = address.indexOf('?'); + const path = queryAt >= 0 ? address.slice(0, queryAt) : address; + const search = queryAt >= 0 ? address.slice(queryAt) : ''; + const prefix = `${STUDIO_ROOT_PATH}/`; + if (!path.startsWith(prefix)) return address; + const [rawSegment = '', section, ...rest] = path.slice(prefix.length).split('/'); + if (!rawSegment || section !== STUDIO_METADATA_AREA) return address; + let segment: string; + try { + segment = decodeURIComponent(rawSegment); + } catch { + return address; + } + return areaLocationRedirect(segment, rest.join('/'), search) ?? address; +} diff --git a/ui/packages/app-shell/src/views/studio-design/studioAddress.ts b/ui/packages/app-shell/src/views/studio-design/studioAddress.ts index 9f0f38d06d6..253ba2f0d85 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioAddress.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioAddress.ts @@ -8,26 +8,22 @@ * * ## Why one builder first * - * The epic moves objects, flows and permission sets from their pillar + * The epic moved objects, flows and permission sets from their pillar * addresses (`/studio//data?surface=object:`) to metadata - * addresses (`/studio//metadata//`). Today the "All - * metadata" area sends a pillar type back to its pillar - * (`areaItemPillarPath`, read through {@link STUDIO_ITEM_PILLAR}), so - * redirecting the pillar address to the metadata one first would make the two - * rules bounce off each other. With every producer on this builder, a designer - * card switches its type in ONE place, {@link STUDIO_ITEM_PILLAR}, in the same - * PR that ships its full-screen designer: the producers and the area's - * redirect move together, so there is never a loop. + * addresses (`/studio//metadata//`), one designer card at + * a time, each switching every producer here in the PR that shipped its + * designer. objectstack#36909 — every type has moved, so an item address is + * always the metadata one ({@link studioItemPath}); the retired pillar + * addresses only redirect (`studioPillarRedirect.ts`). * * ## Today's addresses, byte for byte * - * This module changes no address. The producers it replaced did not agree on - * how to spell a `?surface=` value, and each spelling is kept, named by - * {@link StudioSurfaceSpelling}, because a changed byte is a changed address - * (a bookmark, a test pin, a link an AI was handed). The mapping table + * The producers this module replaced did not agree on how to spell a + * `?surface=` value; each spelling is named by {@link StudioSurfaceSpelling}, + * because a changed byte is a changed address (a bookmark, a test pin, a link + * an AI was handed), and the redirects still read every one. The mapping table * (`studioAddressTable.ts`) lists every address family, every `?surface=` - * spelling and every parameter carried verbatim, and is what the designer - * cards switch from. + * spelling and every parameter, and what each became. * * ## The server's two addresses * @@ -41,8 +37,6 @@ * Pure: no React, no router, so every rule is pinned without a render. */ -import { DESIGNER_SURFACE_PARAM, formatSurfaceParam } from '../metadata-admin/nav-selection.js'; - // --------------------------------------------------------------------------- // The vocabulary // --------------------------------------------------------------------------- @@ -62,13 +56,6 @@ export const STUDIO_ALL_PACKAGES_SEGMENT = '~all'; /** The reserved `/studio/` value for the package-less scope (`studioScope.ts`). */ export const STUDIO_ORG_SCOPE_SEGMENT = '~org'; -/** - * The package-less scope's retired pillar segment. objectstack#36903 — the - * scope's flows are listed and opened in its "All metadata" area - * (`studioOrgScopePath`); this segment only redirects there. - */ -export const STUDIO_ORG_SCOPE_PILLAR = 'automations'; - /** * objectstack#36903 — the one type the package-less scope's area serves: its * flows, the items that belong to no package (`studioScope.ts`). @@ -100,41 +87,11 @@ export const STUDIO_OWD_SECTION = 'owd'; /** The query key that names the object the overview scrolls to and marks (`?object=`). */ export const STUDIO_OWD_OBJECT_PARAM = 'object'; -/** The pillar keys (`StudioDesignSurface`'s `PILLARS`). */ -export type StudioPillarKey = 'data' | 'automations' | 'access'; - /** - * ADR-0146 D1 — "A pillar type opened from the directory opens its pillar". - * Where an item of each type opens TODAY: the pillar that designs it. Every - * type not listed opens the area's generic item page. - * - * ⭐ This is the per-type switch of the Studio redesign. A designer card that - * moves a type to its metadata address deletes that type's row here, in the - * PR that ships the designer: every producer that calls - * {@link studioItemPath}, and the area's own pillar redirect - * (`areaItemPillarPath`), then open the metadata address together. - * - * objectstack#36502 — pages, dashboards, reports and views have no pillar - * since the Interfaces pillar retired. - * - * objectstack#36904 — an object opens its designer on its metadata address; - * the old `/data?surface=object:` redirects there (`dataPillarRedirect`). - * objectstack#36905 — a permission set opens its metadata address, where the - * area draws its matrix full-screen; the Access pillar's addresses redirect - * (`accessPillarRedirect.ts`). - * - * objectstack#36903 — a flow opens its designer full-screen on its metadata - * address; the old `/automations?surface=flow:` redirects there - * (`automationsPillarRedirect.ts`). + * The retired pillars' route segments. objectstack#36909 — no pillar draws a + * page any more: each address only redirects (`studioPillarRedirect.ts`). */ -export const STUDIO_ITEM_PILLAR: Readonly> = Object.freeze({ - // objectstack#36903 — the last pillar type left: every item opens its designer or the generic page. -}); - -/** The pillar an item of `type` opens in today, or `null` when it opens the area's generic item page. */ -export function studioItemPillar(type: string): StudioPillarKey | null { - return Object.prototype.hasOwnProperty.call(STUDIO_ITEM_PILLAR, type) ? STUDIO_ITEM_PILLAR[type] : null; -} +export type StudioPillarKey = 'data' | 'automations' | 'access'; // --------------------------------------------------------------------------- // The one path builder @@ -232,12 +189,13 @@ export function studioOwdOverviewPath( } // --------------------------------------------------------------------------- -// The `?surface=` deep link +// The retired `?surface=` deep link // --------------------------------------------------------------------------- /** - * How a producer writes a `?surface=:` value. Three spellings - * reach the same surface today, and each is kept byte for byte: + * How a producer wrote a retired pillar's `?surface=:` value. + * Three spellings reached the same surface, and every one still redirects + * (`studioPillarRedirect.ts` reads them all through `parseSurfaceParam`): * * - `'component'`: the whole value through `encodeURIComponent`, * `surface=object%3Aaccount`. The default; most producers. @@ -251,53 +209,6 @@ export function studioOwdOverviewPath( */ export type StudioSurfaceSpelling = 'component' | 'name' | 'form'; -/** The `?surface=` query of one item, in one {@link StudioSurfaceSpelling}, with optional qualifiers (`action`, `view`, `nav`). */ -export function studioSurfaceQuery( - item: { type: string; name: string }, - spelling: StudioSurfaceSpelling = 'component', - qualifiers?: Readonly>, -): string { - if (spelling === 'form') { - return new URLSearchParams({ [DESIGNER_SURFACE_PARAM]: formatSurfaceParam(item), ...qualifiers }).toString(); - } - const value = - spelling === 'name' - ? `${item.type}:${encodeURIComponent(item.name)}` - : encodeURIComponent(formatSurfaceParam(item)); - let query = `${DESIGNER_SURFACE_PARAM}=${value}`; - for (const [key, qualifier] of Object.entries(qualifiers ?? {})) { - query += `&${encodeURIComponent(key)}=${encodeURIComponent(qualifier)}`; - } - return query; -} - -/** Options of an item address. */ -export interface StudioItemOptions { - /** How the `?surface=` value is written, when the item opens a pillar. Default `'component'`. */ - spelling?: StudioSurfaceSpelling; - /** - * Qualifiers after `?surface=`, when the item opens a pillar: `action`, - * `view`, `nav`. On the metadata address they are its query - * (objectstack#36904: `?action=` opens the object designer's Actions tab on it). - */ - qualifiers?: Readonly>; - /** How the scope segment is written. Default `'component'`. */ - segmentEncoding?: StudioSegmentEncoding; -} - -/** A pillar of a scope, opened on one item through its `?surface=` deep link. */ -export function studioPillarItemAddress( - segment: string, - pillar: string, - item: { type: string; name: string }, - options: StudioItemOptions = {}, -): string { - return studioPath(segment, pillar, null, { - query: studioSurfaceQuery(item, options.spelling, options.qualifiers), - segmentEncoding: options.segmentEncoding, - }); -} - // --------------------------------------------------------------------------- // The "All metadata" area // --------------------------------------------------------------------------- @@ -326,18 +237,23 @@ export function studioMetadataItemAddress(segment: string, type: string, name: s } // --------------------------------------------------------------------------- -// The item address — what the designer cards switch +// The item address // --------------------------------------------------------------------------- +/** Options of an item address ({@link studioItemPath}). */ +export interface StudioItemOptions { + /** The metadata address's query (objectstack#36904: `?action=` opens the object designer's Actions tab on it). */ + qualifiers?: Readonly>; + /** How the scope segment is written. Default `'component'`. */ + segmentEncoding?: StudioSegmentEncoding; +} + /** - * Where one item of a package opens today: its pillar on a `?surface=` deep - * link when {@link STUDIO_ITEM_PILLAR} names one for its type, otherwise its - * page in the "All metadata" area. `spelling` applies to the pillar address - * only; `qualifiers` are the metadata address's query. + * Where one item of a package opens: its page in the "All metadata" area, + * where an object, a flow and a permission set open their designers + * full-screen. `qualifiers` are the address's query. */ export function studioItemPath(packageId: string, type: string, name: string, options: StudioItemOptions = {}): string { - const pillar = studioItemPillar(type); - if (pillar) return studioPillarItemAddress(packageId, pillar, { type, name }, options); return studioMetadataItemAddress(packageId, type, name, { segmentEncoding: options.segmentEncoding, query: options.qualifiers ? new URLSearchParams(options.qualifiers as Record) : null, diff --git a/ui/packages/app-shell/src/views/studio-design/studioInterfacesRetired.ts b/ui/packages/app-shell/src/views/studio-design/studioInterfacesRetired.ts index 743d640a374..2b7b6c21e79 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioInterfacesRetired.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioInterfacesRetired.ts @@ -8,16 +8,16 @@ * "All metadata" area, in code or through the AI). * * An old Interfaces URL — `/studio//interfaces`, with or without a - * `?surface=` deep link — still opens: it lands on the package's Studio home - * (the retired Data pillar's address, which redirects to the package's object - * list, objectstack#36904) and says once, there, where interface editing went, with a - * link back to the app. A `?changes=review` request travels with it, because + * `?surface=` deep link — still opens: it lands on the package's Studio home, + * its object list (objectstack#36904; objectstack#36909 — in one hop, not + * through the retired Data pillar's address), and says once, there, where + * interface editing went, with a link back to the app. A `?changes=review` request travels with it, because * the Changes drawer it opens is the surface's, not the pillar's * (`studioChangesLink.ts`); the retired pillar's own parameters are dropped. * The sentence is `StudioInterfacesRetiredNotice`. */ -import { STUDIO_HOME_PILLAR, studioPillarPath } from './studioAddress.js'; +import { dataPillarRedirect, settledAreaAddress } from './metadataArea.js'; import { STUDIO_RETIRED_INTERFACES_KEPT_PARAMS } from './studioAddressTable.js'; // objectstack#36895 — the retired segment and the Studio home are Studio @@ -29,12 +29,13 @@ export { RETIRED_INTERFACES_SEGMENT, STUDIO_HOME_PILLAR } from './studioAddress. /** The navigation state a retired-URL landing carries, read once by the surface. */ export const INTERFACES_RETIRED_STATE = 'studioInterfacesRetired'; -/** The query keys an old Interfaces URL may carry that still mean something on the home pillar (`studioAddressTable.ts`). */ +/** The query keys an old Interfaces URL may carry that still mean something on the Studio home (`studioAddressTable.ts`). */ const KEPT_PARAMS: readonly string[] = STUDIO_RETIRED_INTERFACES_KEPT_PARAMS; /** - * Where an old Interfaces URL lands: the scope's home pillar, with only the - * parameters the surface itself reads. + * Where an old Interfaces URL lands: the scope's Studio home, its object list + * on the area's settled address, with only the parameters the surface itself + * reads. */ export function retiredInterfacesTarget(scopeSegment: string, search: string): string { const from = new URLSearchParams(search); @@ -42,7 +43,7 @@ export function retiredInterfacesTarget(scopeSegment: string, search: string): s for (const key of KEPT_PARAMS) { for (const value of from.getAll(key)) kept.append(key, value); } - return studioPillarPath(scopeSegment, STUDIO_HOME_PILLAR, { query: kept }); + return settledAreaAddress(dataPillarRedirect(scopeSegment, kept.toString())); } /** The navigation state that marks a landing from an old Interfaces URL. */ diff --git a/ui/packages/app-shell/src/views/studio-design/studioMenuModel.ts b/ui/packages/app-shell/src/views/studio-design/studioMenuModel.ts index ae4086dd66e..f072441eff9 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioMenuModel.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioMenuModel.ts @@ -57,10 +57,9 @@ import { ENVIRONMENT_SCOPE_QUERY } from '../metadata-admin/catalog-scope.js'; import { SETUP_DATASOURCES_PATH } from '../metadata-admin/metadataAreaHost.js'; -import { AREA_PILLAR_FOR_TYPE, isStudioAllPackagesScope } from './metadataArea.js'; +import { isStudioAllPackagesScope } from './metadataArea.js'; import { STUDIO_ALL_PACKAGES_SEGMENT, - STUDIO_METADATA_AREA, STUDIO_OWD_SECTION, studioMetadataAreaAddress, studioMetadataAreaRoot, @@ -223,20 +222,17 @@ export function studioMenuTiers(menu: readonly StudioMenuGroupModel[]): Record> = Object.fromEntries( - Object.entries(AREA_PILLAR_FOR_TYPE).map(([type, pillar]) => [pillar, type]), -); - /** * The entry the open page is (`aria-current`), or `null` when it is none of - * them (the area's type directory, a not-found pillar). + * them (the area's type directory, a not-found page). * * - the package-less scope: its flows; * - an area URL: its type, diagnostics, or on the cross-package leg's root * the environment catalog; - * - the sharing overview's route: the OWD overview; - * - a pillar page: the type the pillar designs. + * - the sharing overview's route: the OWD overview. + * + * objectstack#36909 — a retired pillar's address draws no page (it redirects, + * `studioPillarRedirect.ts`), so no entry is current on one. */ export function studioMenuCurrentKey(input: { segment: string; pathname: string; search: string }): string | null { const { segment, pathname } = input; @@ -250,11 +246,7 @@ export function studioMenuCurrentKey(input: { segment: string; pathname: string; } const prefix = `${studioPackagePath(segment)}/`; const raw = pathname.startsWith(prefix) ? pathname.slice(prefix.length) : ''; - const pillar = raw.split('/')[0]; - if (pillar === STUDIO_METADATA_AREA) return null; - if (pillar === STUDIO_OWD_SECTION) return 'owd'; - const type = PILLAR_TYPE[pillar]; - return type ? `type:${type}` : null; + return raw.split('/')[0] === STUDIO_OWD_SECTION ? 'owd' : null; } /** Whether `entry` matches a menu search, by its label or its type's machine name. */ diff --git a/ui/packages/app-shell/src/views/studio-design/studioPaletteModel.ts b/ui/packages/app-shell/src/views/studio-design/studioPaletteModel.ts index 120ab2ef967..9fb7ad92cc0 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioPaletteModel.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioPaletteModel.ts @@ -20,19 +20,17 @@ * ## Where an item opens * * Through the one Studio address builder (`studioAddress.ts`, #36895), never a - * hand-built path: a type a pillar still designs opens that pillar through - * {@link studioItemPath}, and every other type opens its page in the "All - * metadata" area with the owning package on `?package=`, the address the - * type's list links the row to (ADR-0048). A designer card that moves its type - * to a full-screen page deletes the type's `STUDIO_ITEM_PILLAR` row, and the - * palette follows with no edit here. + * hand-built path: every type opens its page in the "All metadata" area with + * the owning package on `?package=`, the address the type's list links the row + * to (ADR-0048), where an object, a flow and a permission set open their + * designers full-screen. */ import { customizationPackageId } from '@objectstack/spec/kernel'; import { COMMAND_PALETTE_PARAM } from '../../urlParams.js'; import { confirmUnsavedLeave } from '../../chrome/unsavedEdits.js'; import { scopeListRows } from '../metadata-admin/metadataListState.js'; -import { studioItemPath, studioItemPillar, studioMetadataItemAddress } from './studioAddress.js'; +import { studioMetadataItemAddress } from './studioAddress.js'; import type { StudioMenuEntry, StudioMenuGroup, StudioMenuGroupModel } from './studioMenuModel.js'; /** One item a package's palette lists. */ @@ -114,11 +112,9 @@ export function studioPaletteItemsOf( /** * Where an item the palette lists opens, from the `/studio/:segment` it was - * listed on: its pillar while one designs its type, else its page in the - * area, scoped to the package that owns it. + * listed on: its page in the area, scoped to the package that owns it. */ export function studioPaletteItemAddress(segment: string, item: Pick): string { - if (studioItemPillar(item.type)) return studioItemPath(segment, item.type, item.name); return studioMetadataItemAddress(segment, item.type, item.name, { query: `package=${encodeURIComponent(item.packageId)}`, }); diff --git a/ui/packages/app-shell/src/views/studio-design/studioPillarRedirect.ts b/ui/packages/app-shell/src/views/studio-design/studioPillarRedirect.ts new file mode 100644 index 00000000000..85ed9932ab4 --- /dev/null +++ b/ui/packages/app-shell/src/views/studio-design/studioPillarRedirect.ts @@ -0,0 +1,111 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * objectstack#36909 (Studio redesign epic #36890) — where every retired pillar + * address lands. No pillar draws a page any more: objects, flows and + * permission sets open their designers full-screen on their metadata + * addresses, the Interfaces pillar retired with objectstack#36502, and the + * sharing overview has its own route. The pillar addresses are bookmarks, test + * pins, links an AI was handed and the server's draft review link + * (`studioChangesReviewLink` in `@objectstack/types`, `/data?changes=review`), + * so each still opens what it named, through ONE table: + * + * | address | lands on | + * |-------------------------------------------|-------------------------------------------------| + * | `/studio/` (bare) | the package's home, as `/data` below | + * | `/studio//data[?surface=object:]`| the object list, or that object's designer | + * | `/studio//automations[?surface=flow:]` | the flow list, or that flow's designer | + * | `/studio//access[?surface=…]` | the permission set list, a set's matrix, or the sharing overview (`AccessPillarLanding`) | + * | `/studio//interfaces[?…]` | the package's home, saying where interface editing went | + * | `/studio/~org/automations[?surface=flow:]`| the package-less scope's flow list, or that flow | + * | `/studio/~org/` | the package-less scope's flow list | + * + * Each mapping lives beside its pillar (`dataPillarRedirect`, + * `automationsPillarRedirect`, `accessPillarRedirect`, + * `retiredInterfacesTarget`); this module is the one place that picks it. A + * target in the "All metadata" area is put on its settled address + * ({@link settledAreaAddress}), so the old address reaches it in ONE redirect: + * the area finds nothing to change and redirects no further. + * + * A base's `.custom` pair keeps the rule each pillar had: its Data and + * Automations addresses land in the pair's own area, its Access and + * Interfaces addresses on the base (the base's Studio lists and edits the + * pair's items, ADR-0146 D3). + * + * Every other segment is no retired pillar: `null`, and the route draws the + * page that answers to it (the sharing overview, or the not-found state). + * + * Pure, so the whole table is pinned without a render. + */ + +import { customizationBasePackageId } from '@objectstack/spec/kernel'; +import { automationsPillarRedirect } from './automationsPillarRedirect.js'; +import { dataPillarRedirect, isStudioAllPackagesScope, settledAreaAddress } from './metadataArea.js'; +import { RETIRED_INTERFACES_SEGMENT, STUDIO_HOME_PILLAR, type StudioPillarKey } from './studioAddress.js'; +import { retiredInterfacesState, retiredInterfacesTarget } from './studioInterfacesRetired.js'; +import { isStudioOrgScope, studioOrgScopePath } from './studioScope.js'; + +/** A retired pillar's route segment: the three pillars, and the Interfaces pillar retired before them. */ +export type StudioRetiredPillarSegment = StudioPillarKey | typeof RETIRED_INTERFACES_SEGMENT; + +/** Every retired pillar segment, in the order the pillars were drawn. */ +export const STUDIO_RETIRED_PILLAR_SEGMENTS: readonly StudioRetiredPillarSegment[] = Object.freeze([ + 'data', + 'automations', + 'access', + RETIRED_INTERFACES_SEGMENT, +]); + +/** The retired Automations pillar's segment, the one the package-less scope had. */ +const AUTOMATIONS_SEGMENT: StudioRetiredPillarSegment = 'automations'; + +/** The retired Access pillar's segment. */ +const ACCESS_SEGMENT: StudioRetiredPillarSegment = 'access'; + +/** Where a retired pillar address goes. */ +export type StudioPillarRedirectTarget = + /** Straight to `to`, with `state` as the navigation's state when given. */ + | { kind: 'navigate'; to: string; state?: Record } + /** + * The Access pillar, of `packageId`: where it lands depends on which of the + * base's and its pair's permission sets holds the set it names, a read + * (`AccessPillarLanding`, `accessPillarRedirect.ts`). + */ + | { kind: 'access'; packageId: string }; + +/** + * Where `/studio/[/]` lands, or `null` when that is + * no retired pillar address. `segment` is the route segment as read (a + * package id, `~org`); `pillar` the next segment, absent for the bare + * package address; `search` the URL's query, with or without its `?`. + */ +export function studioPillarRedirect( + segment: string | null | undefined, + pillar: string | null | undefined, + search: string, +): StudioPillarRedirectTarget | null { + if (!segment || isStudioAllPackagesScope(segment)) return null; + const section = pillar ?? STUDIO_HOME_PILLAR; + if (isStudioOrgScope(segment)) { + // objectstack#36903 — the scope's one pillar was Automations; it has an + // area of its flows alone, so every other address of it lands on that list. + const to = section === AUTOMATIONS_SEGMENT ? automationsPillarRedirect(segment, search) : studioOrgScopePath(); + return { kind: 'navigate', to }; + } + switch (section) { + case STUDIO_HOME_PILLAR: + return { kind: 'navigate', to: settledAreaAddress(dataPillarRedirect(segment, search)) }; + case AUTOMATIONS_SEGMENT: + return { kind: 'navigate', to: settledAreaAddress(automationsPillarRedirect(segment, search)) }; + case ACCESS_SEGMENT: + return { kind: 'access', packageId: customizationBasePackageId(segment) ?? segment }; + case RETIRED_INTERFACES_SEGMENT: + return { + kind: 'navigate', + to: retiredInterfacesTarget(customizationBasePackageId(segment) ?? segment, search), + state: retiredInterfacesState(), + }; + default: + return null; + } +} diff --git a/ui/packages/app-shell/src/views/studio-design/studioScope.ts b/ui/packages/app-shell/src/views/studio-design/studioScope.ts index 85639ce967e..90cc0e8baae 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioScope.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioScope.ts @@ -7,7 +7,7 @@ * ADR-0126 §7.1 makes a clone of a packaged flow "an ordinary org/install-owned * flow", and the clone door strips the package envelope on purpose, so the * stored row names no package. Studio was routed per package - * (`/studio/:packageId/:tab`) and every rail read a package-scoped list, so + * (`/studio/:packageId/`) and every rail read a package-scoped list, so * such a flow matched no route and no rail: Setup's Packaged automation page * says "Editing happens in Studio", and Studio could not reach the copy. * @@ -43,7 +43,8 @@ * source (`classifyProvenance`, the reading {@link isPackageLessItem} gives * it), so the list shows the scope's flows and the designer's ‹ › walk them * and nothing else. The old `/studio/~org/automations` address redirects here - * (`automationsPillarRedirect.ts`). + * (`automationsPillarRedirect.ts`), and every other `/studio/~org/...` URL to + * the list (`studioPillarRedirect.ts`). */ import { canonicalMetaUrlType } from '@objectstack/spec/shared'; @@ -55,9 +56,9 @@ import { studioMetadataItemAddress, } from './studioAddress.js'; -// objectstack#36895 — the scope's reserved segment and its one pillar are +// objectstack#36895 — the scope's reserved segment and its one type are // Studio address vocabulary, owned by `studioAddress.ts`; re-exported here. -export { STUDIO_ORG_SCOPE_SEGMENT, STUDIO_ORG_SCOPE_PILLAR, STUDIO_ORG_SCOPE_TYPE } from './studioAddress.js'; +export { STUDIO_ORG_SCOPE_SEGMENT, STUDIO_ORG_SCOPE_TYPE } from './studioAddress.js'; /** * objectstack#36903 — the list source the scope's addresses carry: the items diff --git a/ui/packages/app-shell/src/views/studio-design/surfaceDeepLinkChannel.test.tsx b/ui/packages/app-shell/src/views/studio-design/surfaceDeepLinkChannel.test.tsx index e05ec265e5d..078397f301c 100644 --- a/ui/packages/app-shell/src/views/studio-design/surfaceDeepLinkChannel.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/surfaceDeepLinkChannel.test.tsx @@ -1,78 +1,32 @@ // Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. /** - * The live half of the `?surface=:` plumbing — objectui#5476. + * The live `?surface=:` request — objectui#5476. * * Studio's pre-publish security block names the draft the publish door would - * refuse (`object/crmext_visit`) and could not navigate to it: the block is - * rendered from a sheet opened over an ALREADY-MOUNTED pillar, and the - * capture half of the deep-link reads the URL exactly once, at mount. + * refuse (`object/crmext_visit`) from a sheet opened over a mounted page, and + * asks the host to put the author in front of it. Pinned here: * - * Two claims are pinned here, and they have to hold TOGETHER — the point of - * the card is a capability ADDED, not one swapped for another: + * - the producer gets `null` wherever no host is listening (the degradation + * the Home / draft-preview bar depends on); + * - every request reaches the host's `onRequest`, a repeat of the same + * target included: clicking the same offending object twice has to move + * the author twice. * - * - CONTROL: `useSurfaceDeepLink` still captures at mount and nothing after - * it — a later URL change (its own mirror writes one on every selection) - * must not move the captured value. That ref is why in-pillar selections - * don't re-trigger a restore. - * - NEW: a request published on the channel reaches subscribers after mount, - * exactly once per request, and is `null` for producers wherever no host - * is listening (the degradation the Home / draft-preview bar depends on). + * objectstack#36909 — the half that published the request to mounted pillars + * (`useRequestedSurface`) went with the pillars; the host navigates instead. */ import '@testing-library/jest-dom/vitest'; import * as React from 'react'; import { describe, it, expect, vi, afterEach } from 'vitest'; -import { render, renderHook, act, cleanup, screen, fireEvent } from '@testing-library/react'; -import { MemoryRouter, useSearchParams } from 'react-router-dom'; +import { renderHook, act, cleanup } from '@testing-library/react'; -import { useSurfaceDeepLink, type SurfaceTarget } from './useSurfaceDeepLink'; -import { - SurfaceDeepLinkProvider, - useSurfaceNavigator, - useRequestedSurface, -} from './surfaceDeepLinkChannel'; +import { SurfaceDeepLinkProvider, useSurfaceNavigator } from './surfaceDeepLinkChannel'; afterEach(cleanup); -describe('useSurfaceDeepLink — the mount-time capture (control)', () => { - it('captures the URL target at mount and ignores every later URL change', () => { - // The pillar's own mirror rewrites `?surface=` on each selection; a - // capture that followed the URL would restore on every one of them. - const seen: Array = []; - function Probe(): React.ReactElement { - const [, setParams] = useSearchParams(); - const [current, setCurrent] = React.useState(null); - seen.push(useSurfaceDeepLink(current)); - return ( - - ); - } - render( - - - , - ); - expect(seen[0]).toEqual({ type: 'object', name: 'crmext_visit' }); - fireEvent.click(screen.getByRole('button', { name: 'pick' })); - // Every render since — still the mount-time value, never `later_pick`. - for (const value of seen) expect(value).toEqual({ type: 'object', name: 'crmext_visit' }); - }); -}); - -describe('surfaceDeepLinkChannel — the live half (objectui#5476)', () => { - const wrapper = ({ children }: { children: React.ReactNode }) => ( - {children} - ); - +describe('surfaceDeepLinkChannel — the live request (objectui#5476)', () => { it('degrades to null for producers with no host listening', () => { // Rendered by the Home / draft-preview bar, the Studio designer is not a // destination at all. Producers branch on this null and render prose. @@ -80,71 +34,35 @@ describe('surfaceDeepLinkChannel — the live half (objectui#5476)', () => { expect(result.current).toBeNull(); }); - it('delivers a request to subscribers after mount', () => { - const { result } = renderHook( - () => ({ open: useSurfaceNavigator(), requested: useRequestedSurface() }), - { wrapper }, - ); - expect(result.current.requested).toBeNull(); - act(() => result.current.open!({ type: 'object', name: 'crmext_visit' })); - expect(result.current.requested?.target).toEqual({ type: 'object', name: 'crmext_visit' }); - }); - - it('stamps each request with a fresh id, so a repeat of the same target is a new request', () => { - // Clicking the same offending object twice has to move the author twice, - // even though the target is identical. - const { result } = renderHook( - () => ({ open: useSurfaceNavigator(), requested: useRequestedSurface() }), - { wrapper }, - ); - act(() => result.current.open!({ type: 'object', name: 'crmext_visit' })); - const first = result.current.requested!.id; - act(() => result.current.open!({ type: 'object', name: 'crmext_visit' })); - expect(result.current.requested!.id).toBeGreaterThan(first); - }); - - it('publishes nothing when the host vetoes — a declined navigation leaves no standing request', () => { - // The host asks about unsaved pillar edits; the author says no. If the - // request were published anyway it would fire later, when that pillar - // finally mounts, and move them somewhere they already refused to go. - const onRequest = vi.fn(() => false as const); - const { result } = renderHook( - () => ({ open: useSurfaceNavigator(), requested: useRequestedSurface() }), - { - wrapper: ({ children }: { children: React.ReactNode }) => ( - {children} - ), - }, - ); - act(() => result.current.open!({ type: 'object', name: 'crmext_visit' })); - expect(onRequest).toHaveBeenCalledWith({ type: 'object', name: 'crmext_visit' }); - expect(result.current.requested).toBeNull(); + it('hands every request to the host, a repeat of the same target included', () => { + const onRequest = vi.fn(); + const { result } = renderHook(() => useSurfaceNavigator(), { + wrapper: ({ children }: { children: React.ReactNode }) => ( + {children} + ), + }); + act(() => result.current!({ type: 'object', name: 'crmext_visit' })); + act(() => result.current!({ type: 'object', name: 'crmext_visit' })); + expect(onRequest).toHaveBeenCalledTimes(2); + expect(onRequest).toHaveBeenLastCalledWith({ type: 'object', name: 'crmext_visit' }); }); - it('leaves the mount-time capture alone — the two halves are independent', () => { - // The regression this card must not author: a live channel that also - // moved the captured value would re-arm the restore the ref suppresses. - function Probe(): React.ReactElement { - const open = useSurfaceNavigator(); - const captured = useSurfaceDeepLink(null); - return ( - <> - - {captured ? `${captured.type}:${captured.name}` : 'none'} - - ); - } - render( - - - - - , - ); - expect(screen.getByTestId('captured')).toHaveTextContent('object:crmext_visit'); - fireEvent.click(screen.getByRole('button', { name: 'request' })); - expect(screen.getByTestId('captured')).toHaveTextContent('object:crmext_visit'); + it('keeps one producer handle while the host rebuilds its handler each render', () => { + // Producers pass the handle straight into effect deps. + const first = vi.fn(); + const second = vi.fn(); + let handler = first; + const { result, rerender } = renderHook(() => useSurfaceNavigator(), { + wrapper: ({ children }: { children: React.ReactNode }) => ( + {children} + ), + }); + const handle = result.current; + handler = second; + rerender(); + expect(result.current).toBe(handle); + act(() => result.current!({ type: 'permission', name: 'sales_rep' })); + expect(first).not.toHaveBeenCalled(); + expect(second).toHaveBeenCalledWith({ type: 'permission', name: 'sales_rep' }); }); }); diff --git a/ui/packages/app-shell/src/views/studio-design/surfaceDeepLinkChannel.ts b/ui/packages/app-shell/src/views/studio-design/surfaceDeepLinkChannel.ts index f098878198b..ac2b7bf6358 100644 --- a/ui/packages/app-shell/src/views/studio-design/surfaceDeepLinkChannel.ts +++ b/ui/packages/app-shell/src/views/studio-design/surfaceDeepLinkChannel.ts @@ -1,54 +1,37 @@ // Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license. /** - * The LIVE half of the `?surface=:` deep-link plumbing — the half - * {@link file://./useSurfaceDeepLink.ts} describes and never had. - * - * That module captures the URL target ONCE, at mount, and that is deliberate: - * a pillar that re-read the param would re-trigger its restore on every - * in-pillar selection, because the MIRROR half writes the param back on each - * one. The consequence is that a producer already inside a mounted pillar — - * the pending-changes sheet's pre-publish security block, which names the - * draft the publish door would refuse as `object/crmext_visit` — can write the - * param and move nothing at all. - * - * So the live target travels BESIDE the URL rather than through it, which is - * what keeps the mount-time ref intact instead of replacing it: + * The LIVE `?surface=:` request: a producer already inside a + * mounted Studio page — the pending-changes sheet's pre-publish security + * block, which names the draft the publish door would refuse as + * `object/crmext_visit` — asks the host to put the author in front of that + * item, and the host navigates to it (`StudioDesignSurface`'s + * `requestSurface`). * * - PRODUCERS call {@link useSurfaceNavigator}. It returns `null` wherever no * host is listening, and that null IS the degradation contract: the sheet * is shared with the Home / draft-preview bar, where the Studio object * editor is not a reachable destination at all, and a dead link there is * worse than the prose it would replace. `null` means "render the prose". - * - SUBSCRIBERS (the pillars) read {@link useRequestedSurface}. Every request - * carries a monotonic `id` and must be applied AT MOST ONCE: a pillar that - * kept re-resolving a standing request would yank the author off their own - * selection on the next rail reload — precisely the regression the - * mount-time ref exists to prevent. + * - The HOST mounts {@link SurfaceDeepLinkProvider} with its `onRequest`. * - * Deliberately its own module rather than more of `useSurfaceDeepLink.ts`: a - * producer subscribes with React alone, while that module pulls in - * `nav-selection.js` (and through it the App-nav inspector) for its - * parse/format pair. The sheet reaches this file from the console's eager - * graph, so the import it does not make is the point. + * objectstack#36909 — the request used to be published to the mounted + * pillars too (a `requested` value each applied at most once, read through + * `useRequestedSurface`), because a pillar captured its deep link at mount + * and mirrored its selection back to the URL. Every pillar retired, so that + * half had no reader left and went: an item opens on its own address now. + * + * Deliberately its own module rather than more of `useSurfaceDeepLink.ts`: the + * sheet reaches this file from the console's eager graph, and a producer + * subscribes with React alone. */ import * as React from 'react'; import type { SurfaceTarget } from './useSurfaceDeepLink.js'; -/** A surface asked for AFTER mount, stamped so subscribers apply it once. */ -export interface SurfaceRequest { - target: SurfaceTarget; - /** Monotonic within one provider. Compare against the last id you applied. */ - id: number; -} - -interface SurfaceDeepLinkChannel { - requested: SurfaceRequest | null; - request: (target: SurfaceTarget) => void; -} +type SurfaceRequestHandler = (target: SurfaceTarget) => void; -const SurfaceDeepLinkContext = React.createContext(null); +const SurfaceDeepLinkContext = React.createContext(null); /** * Publishes the channel to a host's subtree — mounting this is what makes @@ -61,32 +44,24 @@ export function SurfaceDeepLinkProvider({ children, }: { /** - * Host-side effects of a request — switching pillars, closing the surface - * the producer lives in. Return `false` to VETO it (the host asked about - * unsaved edits and the author declined): the request is then never - * published, so no pillar can act on it later either. + * Host-side effects of a request — navigating to the item, closing the + * surface the producer lives in. It may return `false` when the author + * declines to abandon unsaved edits; the host then stays where it is. */ onRequest?: (target: SurfaceTarget) => boolean | void; children: React.ReactNode; }): React.ReactElement { - const [requested, setRequested] = React.useState(null); - const idRef = React.useRef(0); // Held in a ref so a host that rebuilds its handler each render does not // churn `request`'s identity — producers pass it straight into effect deps. const onRequestRef = React.useRef(onRequest); React.useEffect(() => { onRequestRef.current = onRequest; }); - const request = React.useCallback((target: SurfaceTarget) => { - if (onRequestRef.current?.(target) === false) return; - idRef.current += 1; - setRequested({ target, id: idRef.current }); + const request = React.useCallback((target) => { + onRequestRef.current?.(target); }, []); - const value = React.useMemo(() => ({ requested, request }), [requested, request]); - // `createElement` rather than JSX so this stays a `.ts` module alongside the - // hook it completes, instead of forcing a rename of a file four pillars and - // their tests import. - return React.createElement(SurfaceDeepLinkContext.Provider, { value }, children); + // `createElement` rather than JSX so this stays a `.ts` module. + return React.createElement(SurfaceDeepLinkContext.Provider, { value: request }, children); } /** @@ -94,11 +69,6 @@ export function SurfaceDeepLinkProvider({ * listening. Callers MUST branch on the null and render prose instead of a * link — the null is the documented degradation, not a failure. */ -export function useSurfaceNavigator(): ((target: SurfaceTarget) => void) | null { - return React.useContext(SurfaceDeepLinkContext)?.request ?? null; -} - -/** Subscriber side: the standing request, or `null` outside a provider. */ -export function useRequestedSurface(): SurfaceRequest | null { - return React.useContext(SurfaceDeepLinkContext)?.requested ?? null; +export function useSurfaceNavigator(): SurfaceRequestHandler | null { + return React.useContext(SurfaceDeepLinkContext); } diff --git a/ui/packages/app-shell/src/views/studio-design/useSurfaceDeepLink.test.ts b/ui/packages/app-shell/src/views/studio-design/useSurfaceDeepLink.test.ts deleted file mode 100644 index 3374601f68f..00000000000 --- a/ui/packages/app-shell/src/views/studio-design/useSurfaceDeepLink.test.ts +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license. - -import { describe, it, expect } from 'vitest'; -import { - resolveSurfaceDeepLink, - parseSurfaceTarget, - DESIGNER_SURFACE_NAV_PARAM, - DESIGNER_SURFACE_VIEW_PARAM, -} from './useSurfaceDeepLink'; - -/** - * Pure half of the shared `?surface=` deep-link plumbing — the rail-restore - * resolution each pillar applies to its loaded list (the hook half is thin - * URL glue over the same nav-selection parse/format, tested separately). - */ -describe('resolveSurfaceDeepLink', () => { - const objects = [ - { name: 'showcase_project', label: '项目' }, - { name: 'showcase_task', label: '任务' }, - ]; - - it('resolves a matching-type deep-link to its rail item', () => { - expect( - resolveSurfaceDeepLink(objects, { type: 'object', name: 'showcase_task' }, 'object'), - ).toBe(objects[1]); - }); - - it('returns undefined when there is no deep-link (first-item default applies)', () => { - expect(resolveSurfaceDeepLink(objects, null, 'object')).toBeUndefined(); - }); - - it("ignores a deep-link of another pillar's surface type", () => { - // e.g. `?surface=page:crm_workbench` reaching the Data pillar after a - // pillar-tab switch must not accidentally match an object named like it. - expect( - resolveSurfaceDeepLink(objects, { type: 'page', name: 'showcase_task' }, 'object'), - ).toBeUndefined(); - }); - - it('ignores a deep-link naming an item the rail does not have', () => { - expect( - resolveSurfaceDeepLink(objects, { type: 'object', name: 'deleted_object' }, 'object'), - ).toBeUndefined(); - }); - - it('works for the Access pillar shape (name-keyed permission sets)', () => { - const perms = [{ name: 'member_default' }, { name: 'sales_manager' }]; - expect( - resolveSurfaceDeepLink(perms, { type: 'permission', name: 'sales_manager' }, 'permission'), - ).toBe(perms[1]); - }); -}); - -/** - * objectui#11774 — the capture half's parse: `?surface=` plus the Interfaces - * entry id in its own `?nav=` key. A separate key, so every `:` - * parser of `?surface=` (each pillar's restore, the app→Studio bridge, the - * copilot's surface context) reads the same value it always read. - */ -describe('parseSurfaceTarget (objectui#11774)', () => { - it('the entry id travels in a key of its own, `nav`', () => { - expect(DESIGNER_SURFACE_NAV_PARAM).toBe('nav'); - }); - - it('reads the entry id beside the target', () => { - expect(parseSurfaceTarget('object:showcase_task', 'nav_slice_urgent')).toEqual({ - type: 'object', - name: 'showcase_task', - navId: 'nav_slice_urgent', - }); - }); - - it('BACK-COMPAT: a link with no `nav` parses exactly as `?surface=` alone always did', () => { - expect(parseSurfaceTarget('object:showcase_task', null)).toEqual({ type: 'object', name: 'showcase_task' }); - expect(parseSurfaceTarget('object:showcase_task', '')).toEqual({ type: 'object', name: 'showcase_task' }); - }); - - it('`nav` alone names nothing: it only ever qualifies a target', () => { - expect(parseSurfaceTarget(null, 'nav_slice_urgent')).toBeNull(); - expect(parseSurfaceTarget('object', 'nav_slice_urgent')).toBeNull(); - }); - - it("another pillar's restore ignores the id: it matches on its own type and name", () => { - const objects = [{ name: 'showcase_project' }, { name: 'showcase_task' }]; - expect( - resolveSurfaceDeepLink(objects, parseSurfaceTarget('object:showcase_task', 'nav_slice_urgent'), 'object'), - ).toBe(objects[1]); - }); -}); - -/** - * objectstack#30046 — the list view an Interfaces `object` entry shows rides - * in a key of its own, `view`, beside `surface` and `nav`. - */ -describe('parseSurfaceTarget — the open list view (objectstack#30046)', () => { - it('the view travels in a key of its own, `view`', () => { - expect(DESIGNER_SURFACE_VIEW_PARAM).toBe('view'); - }); - - it('reads the view beside the target and the entry', () => { - expect(parseSurfaceTarget('object:crm_opportunity', 'nav_opps', 'crm_opportunity.pipeline')).toEqual({ - type: 'object', - name: 'crm_opportunity', - navId: 'nav_opps', - viewId: 'crm_opportunity.pipeline', - }); - }); - - it('BACK-COMPAT: a link with no `view` parses as it did', () => { - expect(parseSurfaceTarget('object:crm_opportunity', 'nav_opps', null)).toEqual({ - type: 'object', - name: 'crm_opportunity', - navId: 'nav_opps', - }); - }); - - it('`view` alone names nothing', () => { - expect(parseSurfaceTarget(null, null, 'crm_opportunity.pipeline')).toBeNull(); - }); -}); diff --git a/ui/packages/app-shell/src/views/studio-design/useSurfaceDeepLink.ts b/ui/packages/app-shell/src/views/studio-design/useSurfaceDeepLink.ts index 27c80c09a4e..9ee61acf9d8 100644 --- a/ui/packages/app-shell/src/views/studio-design/useSurfaceDeepLink.ts +++ b/ui/packages/app-shell/src/views/studio-design/useSurfaceDeepLink.ts @@ -1,49 +1,25 @@ // Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license. /** - * Shared `?surface=:` deep-link plumbing for the Studio pillars. + * The `?surface=:` deep link's vocabulary, from the Studio pillars. * - * Every pillar rail (Data / Interfaces / Automations / Access) opens ONE - * surface at a time and used to hand-roll the same two halves — or skip them: + * Every pillar rail (Data / Interfaces / Automations / Access) opened ONE + * surface at a time, captured the `?surface=` target once at mount, and + * mirrored the open surface back to the URL. objectstack#36909 — every pillar + * retired: an item opens its designer on its own metadata address, and the + * pillar addresses only redirect (`studioPillarRedirect.ts`), so the capture + * and mirror hooks had no reader left and went. What stays: * - * 1. CAPTURE: read the `?surface=` target once, at mount, so the pillar's - * list-load effect can open it instead of auto-picking the first item. - * Captured in a ref so later in-pillar selections don't re-trigger the - * restore, and kept out of that effect's deps (which are keyed on the - * package, not the URL). - * 2. MIRROR: write the open surface back to `?surface=` (replace) whenever it - * changes, so the selection is shareable and reload-stable — the inverse - * of the capture. Only written once a surface is open: the first render - * has no selection yet, and clearing the param there would strip an - * incoming deep-link before it is applied. - * - * The Interfaces pillar's surfaces are nav ENTRIES, and several can open one - * target, so there both halves also carry the entry's id in a `?nav=` key - * beside `?surface=` ({@link DESIGNER_SURFACE_NAV_PARAM}, objectui#11774). A - * pillar whose surfaces carry no entry id reads and writes `?surface=` alone, - * as before. - * - * InterfacesPillar pioneered the pattern (#code-block-menu-nav); the Data - * pillar grew the capture half for the app→Studio object bridge (#2446); - * Automations/Access had neither, so their deep-links snapped back to the - * first item. This hook is the single canonical implementation. - * - * Both halves above are URL-shaped, which is exactly why a producer that is - * ALREADY INSIDE a mounted pillar cannot use them: writing `?surface=` moves - * nothing (capture is over) and the mirror overwrites it on the next - * selection. The third half — a live target delivered beside the URL, applied - * once — lives in {@link file://./surfaceDeepLinkChannel.ts}. It is additive: - * nothing here observes it, so the mount-time ref keeps meaning exactly what - * it meant. + * - the qualifier keys the redirects drop and the address table names + * (`?nav=`, `?view=`, `?action=`); + * - {@link SurfaceTarget}, the identity the live channel + * (`surfaceDeepLinkChannel.ts`) carries; + * - {@link useSurfaceActionDeepLink}, the object designer's mount-time + * `?action=`. */ import * as React from 'react'; import { useSearchParams } from 'react-router-dom'; -import { - DESIGNER_SURFACE_PARAM, - parseSurfaceParam, - formatSurfaceParam, -} from '../metadata-admin/nav-selection.js'; /** * The nav-entry qualifier of a `?surface=` deep-link (objectui#11774): the @@ -76,8 +52,7 @@ export const DESIGNER_SURFACE_VIEW_PARAM = 'view'; * with that action selected. Studio's landing links a switched-off action * that lives in its object's `actions[]` here, since such an action has no * item page of its own and its switch is on the object's Actions view. A key - * of its own, for the reason `nav` is one. Never written by the mirror, and - * dropped by it once another surface opens. + * of its own, for the reason `nav` is one. */ export const DESIGNER_SURFACE_ACTION_PARAM = 'action'; @@ -93,104 +68,6 @@ export interface SurfaceTarget { viewId?: string; } -/** - * Capture the mount-time `?surface=` target (returned) and mirror `current` - * back to the URL as it changes. Pass the pillar's open surface — `null` - * while nothing is selected yet. - */ -export function useSurfaceDeepLink(current: SurfaceTarget | null | undefined): SurfaceTarget | null { - const initial = useSurfaceDeepLinkCapture(); - useSurfaceDeepLinkMirror(current); - return initial; -} - -/** The capture half of {@link useSurfaceDeepLink} alone: the mount-time target. */ -export function useSurfaceDeepLinkCapture(): SurfaceTarget | null { - const [searchParams] = useSearchParams(); - const initialRef = React.useRef( - parseSurfaceTarget( - searchParams.get(DESIGNER_SURFACE_PARAM), - searchParams.get(DESIGNER_SURFACE_NAV_PARAM), - searchParams.get(DESIGNER_SURFACE_VIEW_PARAM), - ), - ); - return initialRef.current; -} - -/** - * The mirror half of {@link useSurfaceDeepLink} alone. A pillar whose surface - * shows a list view passes it as `viewId` (`null` while the surface's own - * view shows), so one write carries the surface and its view; one that passes - * nothing leaves `?view=` as it is. - */ -export function useSurfaceDeepLinkMirror(current: SurfaceTarget | null | undefined, viewId?: string | null): void { - const [, setSearchParams] = useSearchParams(); - // Keyed on the identity, not the object — pillars recreate their Surface - // objects on list reload, and a same-surface rewrite is a wasted render. - const type = current?.type; - const name = current?.name; - const navId = current?.navId; - React.useEffect(() => { - if (!type || !name) return; - setSearchParams( - (prev) => { - const next = new URLSearchParams(prev); - const surface = formatSurfaceParam({ type, name }); - // objectstack#34724 — `?action=` was written for the surface it came - // with: once another surface opens, it is dropped, so a reload or a - // shared copy never opens the new surface on an action view. The - // first write after a deep link names that same surface and keeps it. - if (prev.get(DESIGNER_SURFACE_PARAM) !== surface) next.delete(DESIGNER_SURFACE_ACTION_PARAM); - next.set(DESIGNER_SURFACE_PARAM, surface); - // objectui#11774 — the entry travels with its target, and a surface - // with no entry id clears it, so a `nav` left by an earlier selection - // never qualifies a target it was not written for. - if (navId) next.set(DESIGNER_SURFACE_NAV_PARAM, navId); - else next.delete(DESIGNER_SURFACE_NAV_PARAM); - // objectstack#30046 — the same for the view the surface shows. - if (viewId !== undefined) { - if (viewId) next.set(DESIGNER_SURFACE_VIEW_PARAM, viewId); - else next.delete(DESIGNER_SURFACE_VIEW_PARAM); - } - return next; - }, - { replace: true }, - ); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [type, name, navId, viewId]); -} - -/** - * The deep-link target in a `?surface=` value, a `?nav=` value and a - * `?view=` value — the capture half's parse, pure for the tests. `nav` and - * `view` only ever qualify a surface: alone (no parsable `?surface=`) they - * name nothing, since the mirror above never writes one without it. - */ -export function parseSurfaceTarget( - surface: string | null | undefined, - nav: string | null | undefined, - view?: string | null, -): SurfaceTarget | null { - const parsed = parseSurfaceParam(surface); - if (!parsed) return null; - return { ...parsed, ...(nav ? { navId: nav } : {}), ...(view ? { viewId: view } : {}) }; -} - -/** - * Resolve a captured deep-link against the pillar's loaded rail: the matching - * item when the target is of this pillar's surface type AND actually exists in - * the list, else `undefined` so the caller falls back to its first-item - * default. Pure — unit-tested without rendering a pillar. - */ -export function resolveSurfaceDeepLink( - items: readonly T[], - initial: SurfaceTarget | null, - expectedType: string, -): T | undefined { - if (!initial || initial.type !== expectedType) return undefined; - return items.find((item) => item.name === initial.name); -} - /** * objectstack#34724 — the mount-time `?action=` beside a `?surface=object:` * deep link: once the deep-linked object is the open one, `open(name)` runs, From 3a7bc226eae2ba66cf424b37173df5fe0cbb4d9b Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 25 Nov 2026 22:17:15 +0000 Subject: [PATCH 2/4] refactor(studio): drop the pillar-era helpers with no reader; pin the one-hop redirect table Claude-Session: https://claude.ai/code/session_01QSeKYngc1UxywCSQwtqdZz Co-authored-by: Claude --- .changeset/36909-studio-pillar-addresses.md | 21 +++ .../StudioRoute.lazyBuilder-11798.test.tsx | 6 +- .../StudioRoute.metadataArea-28561.test.tsx | 76 ++++++++- .../StudioRoute.recentPackage-11863.test.tsx | 14 +- .../src/components/StudioRoute.test.tsx | 12 +- .../console/src/components/StudioRoute.tsx | 2 +- ...ackageFormDialog.newAppStep-36748.test.tsx | 5 +- .../CreateItemDialog.labels-13128.test.tsx | 3 +- ...esignSurface.accessPairCopy-29674.test.tsx | 3 +- ...DesignSurface.accessSegment-12452.test.tsx | 3 +- .../StudioDesignSurface.aiChipLabel.test.tsx | 3 +- ...udioDesignSurface.backToApp-36501.test.tsx | 3 +- ...oDesignSurface.changesCount-11787.test.tsx | 3 +- ...oDesignSurface.copilotDoors-12894.test.tsx | 5 +- ...gnSurface.copilotDraftBadge-12725.test.tsx | 3 +- ...gnSurface.createAppAccessibleName.test.tsx | 3 +- ...ioDesignSurface.createTaken-26917.test.tsx | 3 +- ...ignSurface.customizePublish-28562.test.tsx | 3 +- ...ioDesignSurface.desktopHint-11795.test.tsx | 3 +- ...esignSurface.entryReadsOnce-11797.test.tsx | 3 +- ...esignSurface.heldDataCreate-26845.test.tsx | 3 +- ...esignSurface.heldFlowCreate-26845.test.tsx | 3 +- ...DesignSurface.heldFlowLeave-26705.test.tsx | 3 +- ...ioDesignSurface.heldPublish-11786.test.tsx | 3 +- ...tudioDesignSurface.homeLoop-12513.test.tsx | 3 +- ...gnSurface.interfacesRetired-36502.test.tsx | 3 +- ...DesignSurface.itemDraftLine-12725.test.tsx | 5 +- ...esignSurface.kernelReadOnly-29567.test.tsx | 3 +- ...oDesignSurface.metadataArea-28561.test.tsx | 3 +- ...tudioDesignSurface.notFound-26708.test.tsx | 3 +- ...dioDesignSurface.oneSurface-28572.test.tsx | 3 +- ...ignSurface.packageLessFlows-11553.test.tsx | 3 +- ...gnSurface.packageListErrorPosture.test.tsx | 3 +- ...tudioDesignSurface.pillarNavGuard.test.tsx | 3 +- ...ignSurface.pillarsClaimSlot-12725.test.tsx | 3 +- ...face.publishAdvisoryReachesAuthor.test.tsx | 3 +- ...signSurface.publishBackfill-12929.test.tsx | 3 +- ...oDesignSurface.publishCount-11807.test.tsx | 15 +- ...esignSurface.publishPosture-12517.test.tsx | 3 +- ...rface.publishReadOnlyReason-12303.test.tsx | 3 +- ...esignSurface.publishRefusal-26730.test.tsx | 3 +- ...signSurface.readOnlyPosture-12453.test.tsx | 3 +- ...udioDesignSurface.rightSlot-12725.test.tsx | 3 +- ...StudioDesignSurface.saveBar-36511.test.tsx | 3 +- .../studio-design/StudioPillarRedirect.tsx | 4 +- .../views/studio-design/metadataArea.test.ts | 42 ++--- .../views/studio-design/studioAddress.test.ts | 85 +++------- .../src/views/studio-design/studioAddress.ts | 6 +- .../views/studio-design/studioAddressTable.ts | 76 +++++---- .../studioInterfacesRetired.test.ts | 25 +-- .../views/studio-design/studioMenuModel.ts | 2 +- .../studioPaletteModel-36900.test.ts | 7 +- .../studioPillarRedirectModel.test.ts | 156 ++++++++++++++++++ ...direct.ts => studioPillarRedirectModel.ts} | 0 .../views/studio-design/studioScope.test.ts | 3 - .../src/views/studio-design/studioScope.ts | 2 +- .../views/studio-design/useSurfaceDeepLink.ts | 2 +- 57 files changed, 463 insertions(+), 210 deletions(-) create mode 100644 .changeset/36909-studio-pillar-addresses.md create mode 100644 ui/packages/app-shell/src/views/studio-design/studioPillarRedirectModel.test.ts rename ui/packages/app-shell/src/views/studio-design/{studioPillarRedirect.ts => studioPillarRedirectModel.ts} (100%) diff --git a/.changeset/36909-studio-pillar-addresses.md b/.changeset/36909-studio-pillar-addresses.md new file mode 100644 index 00000000000..fcdcdf578a3 --- /dev/null +++ b/.changeset/36909-studio-pillar-addresses.md @@ -0,0 +1,21 @@ +--- +'@object-ui/app-shell': patch +'@object-ui/console': patch +--- + +fix(studio): every old Studio address still opens what it named, now in one redirect + +Clause-②: no +Metadata-protocol: none + +Studio no longer has pillars (Data, Automations, Access, Interfaces): objects, flows and permission sets open their designers full-screen on their own addresses. The old pillar addresses are bookmarks, links an AI was handed and the server's draft review link, so each still lands on the page that replaced it: + +- `/studio/` and `/studio//data` open the package's object list; `/data?surface=object:` opens that object's designer, and `/data?changes=review` opens the object list with the Changes drawer. +- `/studio//automations` opens the flow list; with `?surface=flow:`, that flow's designer. +- `/studio//access` opens the permission set list; with `?surface=permission:`, that set's matrix; with `?surface=owd:overview`, the default sharing overview. +- `/studio//interfaces` opens the object list and says where interface editing went. +- `/studio/~org` and every `/studio/~org/...` address open the organization's own flows. + +Each of these now arrives in one redirect. Before, `/data` passed through two (`/studio/` through three) before the page settled. The "Open Access" button on a publish toast and the Changes sheet's link to a permission set open the set's page directly. + +Removed internals of `@object-ui/app-shell` that nothing read any more: `STUDIO_ORG_SCOPE_PILLAR`, `STUDIO_HOME_PILLAR` (from the package entry), `AREA_PILLAR_FOR_TYPE`, `areaItemPillarPath`, `STUDIO_ITEM_PILLAR`, `studioItemPillar`, `studioPillarItemAddress`, `studioSurfaceQuery`, the `?surface=` capture and mirror hooks (`useSurfaceDeepLink` and its halves, `parseSurfaceTarget`, `resolveSurfaceDeepLink`) and `useRequestedSurface`. The package is private, so nothing published changes shape. A host that declares the `/studio` routes mounts the new `StudioPillarRedirect` on `:packageId` and `:packageId/:tab`. diff --git a/ui/apps/console/src/components/StudioRoute.lazyBuilder-11798.test.tsx b/ui/apps/console/src/components/StudioRoute.lazyBuilder-11798.test.tsx index 50869996f89..a727a667d39 100644 --- a/ui/apps/console/src/components/StudioRoute.lazyBuilder-11798.test.tsx +++ b/ui/apps/console/src/components/StudioRoute.lazyBuilder-11798.test.tsx @@ -88,18 +88,20 @@ vi.mock('@object-ui/app-shell', async (importOriginal) => ({ LoadingFallback: () =>
, LoadingScreen: () =>
, STUDIO_ORG_SCOPE_SEGMENT: '~org', - STUDIO_ORG_SCOPE_PILLAR: 'automations', getProductName: () => 'ObjectOS', useHomePath: () => '/home', })); const { builderModuleLoads } = vi.hoisted(() => ({ builderModuleLoads: { count: 0 } })); -vi.mock('./studioBuilder', () => { +vi.mock('./studioBuilder', async () => { builderModuleLoads.count += 1; return { StudioEntryRedirect: () =>
entry
, StudioDesignSurface: () =>
pillars
, + // objectstack#36909 — the retired pillar addresses' redirect rides in the same module. + StudioPillarRedirect: (await vi.importActual('@object-ui/app-shell')) + .StudioPillarRedirect, }; }); diff --git a/ui/apps/console/src/components/StudioRoute.metadataArea-28561.test.tsx b/ui/apps/console/src/components/StudioRoute.metadataArea-28561.test.tsx index 5ea120f9d77..a35d5abad73 100644 --- a/ui/apps/console/src/components/StudioRoute.metadataArea-28561.test.tsx +++ b/ui/apps/console/src/components/StudioRoute.metadataArea-28561.test.tsx @@ -23,7 +23,7 @@ import '@testing-library/jest-dom/vitest'; import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'; -import { cleanup, render, screen } from '@testing-library/react'; +import { cleanup, render, screen, waitFor } from '@testing-library/react'; import React from 'react'; import { MemoryRouter, Routes, Route, useLocation, useParams } from 'react-router-dom'; @@ -80,23 +80,34 @@ function SurfaceMarker({ area }: { area?: string }) { ); } -vi.mock('./studioBuilder', () => ({ +vi.mock('./studioBuilder', async () => ({ StudioEntryRedirect: () =>
, StudioDesignSurface: SurfaceMarker, StudioMetadataArea: ({ packageId }: { packageId: string | null }) => (
), + // objectstack#36909 — the retired pillar addresses' redirect, real: its table is what the last describe walks. + StudioPillarRedirect: (await vi.importActual('@object-ui/app-shell')) + .StudioPillarRedirect, })); import { STUDIO_ENTRY_CAPABILITY } from './studioEntry'; import { studioRoutes } from './StudioRoute'; +/** Every location the router showed, in order: one redirect is two entries. */ +let seen: string[] = []; + function LocationProbe() { const { pathname, search } = useLocation(); - return
{`${pathname}${search}`}
; + const here = `${pathname}${search}`; + React.useEffect(() => { + seen.push(here); + }, [here]); + return
{here}
; } function renderStudio(url: string) { + seen = []; return render( @@ -134,10 +145,10 @@ describe('/studio — the "All metadata" area\'s routes (objectstack#28561)', () expect(screen.queryByTestId('barrel-builder')).toBeNull(); }); - it('CONTROL — a pillar is the pillar builder with no area', async () => { - renderStudio('/studio/com.example.crm/data'); + it('CONTROL — the sharing overview\'s own route is the builder with no area', async () => { + renderStudio('/studio/com.example.crm/owd'); const surface = await screen.findByTestId('studio-pillar-builder'); - expect(surface).toHaveAttribute('data-tab', 'data'); + expect(surface).toHaveAttribute('data-tab', 'owd'); expect(surface).toHaveAttribute('data-area', ''); }); @@ -188,3 +199,56 @@ describe('/studio — the "All metadata" area\'s routes (objectstack#28561)', () }, ); }); + +/** + * objectstack#36909 — the retired pillar addresses, on the REAL routes and the + * real redirect: every old address reaches the page that replaced it in ONE + * redirect (the probe sees the old address and the new one, nothing between), + * and a current address is not redirected at all. The redirect's full table, + * every query spelling included, is `studioPillarRedirectModel.test.ts`. + */ +describe('/studio — every retired pillar address redirects once, to its new address (objectstack#36909)', () => { + const PKG = 'com.example.crm'; + const PAIR = 'com.example.crm.custom'; + + it.each([ + [`/studio/${PKG}`, `/studio/${PKG}/metadata/object?package=${PKG}`], + [`/studio/${PKG}/data`, `/studio/${PKG}/metadata/object?package=${PKG}`], + [`/studio/${PKG}/data?surface=object%3Aaccount`, `/studio/${PKG}/metadata/object/account?package=${PKG}`], + // The server's draft review link (`studioChangesReviewLink`). + [`/studio/${PKG}/data?changes=review`, `/studio/${PKG}/metadata/object?changes=review&package=${PKG}`], + [`/studio/${PKG}/automations`, `/studio/${PKG}/metadata/flow?package=${PKG}`], + [`/studio/${PKG}/automations?surface=flow%3Anotify`, `/studio/${PKG}/metadata/flow/notify?package=${PKG}`], + // A package with no pair names its sets without a read. + [`/studio/${PKG}/access`, `/studio/${PKG}/metadata/permission?package=${PKG}`], + [`/studio/${PKG}/access?surface=owd%3Aoverview`, `/studio/${PKG}/owd`], + // A pair's Access pillar is its base's (a set the pair holds is read for: + // `StudioDesignSurface.accessPairCopy-29674.test.tsx`). + [`/studio/${PAIR}/access`, `/studio/${PKG}/metadata/permission?package=${PKG}`], + [`/studio/${PKG}/interfaces?surface=page%3Ahome`, `/studio/${PKG}/metadata/object?package=${PKG}`], + [`/studio/${PAIR}/interfaces`, `/studio/${PKG}/metadata/object?package=${PKG}`], + // The package-less scope: its bare leg and its one pillar. + ['/studio/~org', '/studio/~org/metadata/flow?source=runtime'], + ['/studio/~org/automations', '/studio/~org/metadata/flow?source=runtime'], + ['/studio/~org/automations?surface=flow%3Aclone_1', '/studio/~org/metadata/flow/clone_1?source=runtime'], + ])('%s → %s, in one redirect', async (from, to) => { + renderStudio(from); + await waitFor(() => expect(location()).toBe(to)); + await screen.findByTestId('studio-pillar-builder'); + expect(seen).toEqual([from, to]); + }); + + it.each([ + `/studio/${PKG}/owd`, + `/studio/${PKG}/owd?object=account`, + `/studio/${PKG}/metadata/object?package=${PKG}`, + `/studio/${PKG}/metadata/flow/notify?package=${PKG}`, + // A segment no page has: the builder, which draws its not-found state. + `/studio/${PKG}/bogus_pillar`, + ])('CONTROL — the current address %s is not redirected', async (url) => { + renderStudio(url); + await screen.findByTestId('studio-pillar-builder'); + expect(location()).toBe(url); + expect(seen).toEqual([url]); + }); +}); diff --git a/ui/apps/console/src/components/StudioRoute.recentPackage-11863.test.tsx b/ui/apps/console/src/components/StudioRoute.recentPackage-11863.test.tsx index 83668fe49aa..48da3124f6e 100644 --- a/ui/apps/console/src/components/StudioRoute.recentPackage-11863.test.tsx +++ b/ui/apps/console/src/components/StudioRoute.recentPackage-11863.test.tsx @@ -74,9 +74,12 @@ vi.mock('@object-ui/app-shell', async (importOriginal) => ({ useHomePath: () => '/home', })); -vi.mock('./studioBuilder', () => ({ +vi.mock('./studioBuilder', async () => ({ StudioEntryRedirect: () =>
entry
, StudioDesignSurface: () =>
pillars
, + // objectstack#36909 — the retired pillar addresses' redirect, real. + StudioPillarRedirect: (await vi.importActual('@object-ui/app-shell')) + .StudioPillarRedirect, })); import { RecentItemsProvider, useRecentItems } from '@object-ui/app-shell'; @@ -166,13 +169,13 @@ describe('/studio/PKG/TAB records the package as a recent entry (objectui#11863) expect(JSON.parse(localStorage.getItem(STORAGE_KEY) ?? '[]')).toEqual([entry]); }); - it('the bare package route records it too, once it lands on the Data pillar', async () => { + it('the bare package route records it too, once it lands on the object list', async () => { renderStudio('/studio/com.acme.crm'); - await waitFor(() => expect(screen.getByTestId('pathname')).toHaveTextContent('/studio/com.acme.crm/data')); + await waitFor(() => expect(screen.getByTestId('pathname')).toHaveTextContent('/studio/com.acme.crm/metadata/object')); await waitFor(() => expect(recent().map((r) => r.id)).toEqual(['package:com.acme.crm'])); }); - it('switching pillars inside the same package changes nothing, so it writes nothing', async () => { + it('switching pages inside the same package changes nothing, so it writes nothing', async () => { renderStudio('/studio/com.acme.crm/data'); await waitFor(() => expect(recent()).toHaveLength(1)); const before = persisted(); @@ -181,7 +184,8 @@ describe('/studio/PKG/TAB records the package as a recent entry (objectui#11863) await new Promise((r) => setTimeout(r, 20)); act(() => screen.getByTestId('go:/studio/com.acme.crm/automations').click()); - await waitFor(() => expect(screen.getByTestId('pathname')).toHaveTextContent('/studio/com.acme.crm/automations')); + // objectstack#36909 — the retired Automations address lands on the flow list. + await waitFor(() => expect(screen.getByTestId('pathname')).toHaveTextContent('/studio/com.acme.crm/metadata/flow')); await screen.findByTestId('studio-pillar-builder'); expect(persisted()).toBe(before); diff --git a/ui/apps/console/src/components/StudioRoute.test.tsx b/ui/apps/console/src/components/StudioRoute.test.tsx index 5e1317095e2..baeed3c2061 100644 --- a/ui/apps/console/src/components/StudioRoute.test.tsx +++ b/ui/apps/console/src/components/StudioRoute.test.tsx @@ -368,24 +368,26 @@ describe('/studio/* — the entry decision, both ways', () => { expect(screen.queryByTestId('studio-access-required')).not.toBeInTheDocument(); }); - it('NEGATIVE CONTROL: a holder still gets the pillar builder, unchanged', async () => { + it('NEGATIVE CONTROL: a holder still gets the builder, on the page the old pillar address names', async () => { answerWith(OPERATOR_CAPS); renderStudioDeepLink('/studio/hotcrm/data'); await waitFor(() => expect(screen.getByTestId('studio-pillar-builder')).toBeInTheDocument()); expect(designSurface).toHaveBeenCalled(); - expect(pathname()).toBe('/studio/hotcrm/data'); + // objectstack#36909 — the retired Data pillar's address lands on the object list. + expect(pathname()).toBe('/studio/hotcrm/metadata/object?package=hotcrm'); expect(screen.queryByText(NOTICE)).not.toBeInTheDocument(); }); - it('the package-less scope\'s bare leg lands on its one pillar, the builder mounted (objectui#11553)', async () => { + it('the package-less scope\'s bare leg lands on its flow list, the builder mounted (objectui#11553)', async () => { // `~org` is the reserved segment for the organization's own, package-less // flows. Without its own leg it falls to `:packageId`, whose redirect - // targets a Data pillar that scope does not have. + // targets an object list that scope does not have. objectstack#36909 — in + // one hop, not through the retired Automations pillar's address. answerWith(OPERATOR_CAPS); renderStudioDeepLink('/studio/~org'); - await waitFor(() => expect(pathname()).toBe('/studio/~org/automations')); + await waitFor(() => expect(pathname()).toBe('/studio/~org/metadata/flow?source=runtime')); await waitFor(() => expect(screen.getByTestId('studio-pillar-builder')).toBeInTheDocument()); expect(designSurface).toHaveBeenCalled(); }); diff --git a/ui/apps/console/src/components/StudioRoute.tsx b/ui/apps/console/src/components/StudioRoute.tsx index 148e8b9d275..5f61e5f1a5f 100644 --- a/ui/apps/console/src/components/StudioRoute.tsx +++ b/ui/apps/console/src/components/StudioRoute.tsx @@ -298,7 +298,7 @@ function StudioPillarAddress({ children }: { children?: ReactNode }) { * objectstack#36909 — no pillar draws a page any more. Each retired pillar * address (`data`, `automations`, `access`, `interfaces`, and the bare package * address, which used to land on `data`) reaches the page that replaced it in - * ONE redirect (`StudioPillarRedirect`; its table is `studioPillarRedirect.ts` + * ONE redirect (`StudioPillarRedirect`; its table is `studioPillarRedirectModel.ts` * in app-shell), where it used to pass through the builder and the area's own * `?package=` redirect first. */ 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 c6954003d2e..38b1a637eaf 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 @@ -77,6 +77,7 @@ import { t, useMetadataLocale } from './i18n'; import { newAppStep } from '../studio-design/newAppDoor'; import { studioHomePath } from '../studio-design/studioAddress'; import { StudioDesignSurface } from '../studio-design/StudioDesignSurface'; +import { StudioPillarRedirect } from '../studio-design/StudioPillarRedirect'; window.matchMedia = ((query: string) => ({ matches: false, @@ -201,7 +202,7 @@ function renderDoor() { } /> } /> - } /> + } /> } />
, @@ -324,7 +325,7 @@ function renderCreatePackage() { } /> } /> - } /> + } /> } /> , 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 d3e2d956c9f..a092e165a80 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 @@ -48,6 +48,7 @@ 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'; @@ -119,7 +120,7 @@ describe('Studio create dialogs bind each label to its input (objectui#13128)', render( - } /> + } /> , ); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.accessPairCopy-29674.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.accessPairCopy-29674.test.tsx index 00081c5d2ac..ccce5dcfa15 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.accessPairCopy-29674.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.accessPairCopy-29674.test.tsx @@ -98,6 +98,7 @@ vi.mock('./StudioAiCopilot', () => ({ StudioChatDock: () => null })); vi.mock('../../preview/DraftChangesPanel', () => ({ DraftChangesPanel: () => null })); import { StudioDesignSurface } from './StudioDesignSurface'; +import { StudioPillarRedirect } from './StudioPillarRedirect'; import { pressStudioSave } from './__tests__/studioSaveHarness'; import { t, tFormat } from '../metadata-admin/i18n'; @@ -240,7 +241,7 @@ function renderPillarAddress(set: string, extra = '') { } /> - } /> + } /> , 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 5a67993e531..ca7a60bb009 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 @@ -128,6 +128,7 @@ vi.mock('./StudioAiCopilot', () => ({ StudioChatDock: () => null })); vi.mock('../../preview/DraftChangesPanel', () => ({ DraftChangesPanel: () => null })); import { StudioDesignSurface } from './StudioDesignSurface'; +import { StudioPillarRedirect } from './StudioPillarRedirect'; import { translateMetadataDomain } from '../metadata-admin/i18n'; // The source under test reaches dynamic imports of `@objectstack/lint`; their first // load is paid here, at collection, never inside a case's clock (`check:test-source-alias`). @@ -196,7 +197,7 @@ function renderAt(path: string) { } /> - } /> + } /> } /> diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.aiChipLabel.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.aiChipLabel.test.tsx index 09043e1f780..ccdd722ae8e 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.aiChipLabel.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.aiChipLabel.test.tsx @@ -114,6 +114,7 @@ import '@objectstack/lint'; // 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'; // The source under test reaches these dynamic imports (the command palette's // record preview, the drafts panel's lint, the code editor): their first load // is paid here, at collection, never inside a case's clock (`check:test-source-alias`). @@ -196,7 +197,7 @@ function renderStudio(entry = `/studio/${PACKAGE_ID}/interfaces`) { } /> - } /> + } /> {/* objectstack#36905 — a permission set opens at its metadata address. */} } /> 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 1b9bc8be040..3f571bede1f 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 @@ -58,6 +58,7 @@ vi.mock('./StudioAiCopilot', () => ({ StudioChatDock: () => null })); vi.mock('../../preview/DraftChangesPanel', () => ({ DraftChangesPanel: () => null })); import { StudioDesignSurface } from './StudioDesignSurface'; +import { StudioPillarRedirect } from './StudioPillarRedirect'; import { studioBackTarget } from './StudioBackToApp'; import { rememberAppReturnPage, resetAppReturnPageForTests } from '../../utils/appReturnPage'; import { parsePackages } from './packages-io'; @@ -145,7 +146,7 @@ function renderAt(entry: string) { } /> - } /> + } /> } /> } /> 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 index a3bdd58be04..e6682606e22 100644 --- 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 @@ -66,6 +66,7 @@ import '@objectstack/lint'; // 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) => ({ @@ -148,7 +149,7 @@ describe('the Changes count after a draft save (objectui#11787)', () => { render( - } /> + } /> , ); 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 3c902fb886d..0f037b41f50 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 @@ -133,6 +133,7 @@ import { I18nProvider } from '@object-ui/i18n'; import '@objectstack/lint'; import '@object-ui/plugin-detail'; import { StudioDesignSurface } from './StudioDesignSurface'; +import { StudioPillarRedirect } from './StudioPillarRedirect'; import { subscribeMetadataRefresh } from '../../assistant/assistantBus'; window.matchMedia = ((query: string) => ({ @@ -260,7 +261,7 @@ function renderStudio(entry = `/studio/${PACKAGE_ID}/data?surface=object%3Ahcpl_ } /> - } /> + } /> , ); @@ -329,7 +330,7 @@ describe('the Studio copilot\'s composer (objectui#12725 Target item 4)', () => } /> - } /> + } /> , 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 bb967bd4b23..c898fe9bcd6 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 @@ -128,6 +128,7 @@ import '@objectstack/lint'; // 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 { subscribeMetadataRefresh } from '../../assistant/assistantBus'; window.matchMedia = ((query: string) => ({ @@ -256,7 +257,7 @@ function renderStudio() { - } /> + } /> , ); 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 index 3ee139d8a7b..542a03793fb 100644 --- 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 @@ -77,6 +77,7 @@ 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. @@ -129,7 +130,7 @@ async function renderSurface() { } /> - } /> + } /> , ); 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 3bf974b5487..635299657d2 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 @@ -125,6 +125,7 @@ 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'; @@ -350,7 +351,7 @@ describe('objectstack#26917 — Create app over a taken identifier', () => { render( - } /> + } /> , ); 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 8f5ae092580..812798c3050 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 @@ -118,6 +118,7 @@ vi.mock('../../preview/DraftChangesPanel', () => ({ import '@objectstack/lint'; import '@object-ui/plugin-detail'; import { StudioDesignSurface } from './StudioDesignSurface'; +import { StudioPillarRedirect } from './StudioPillarRedirect'; import { registerMetadataPreview } from '../metadata-admin/preview-registry'; window.matchMedia = ((query: string) => ({ @@ -253,7 +254,7 @@ function renderWorkbench() { } /> - } /> + } /> , ); 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 3fb60349efb..c9e1de70f47 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 @@ -54,6 +54,7 @@ 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'; const answer = (body: unknown) => ({ ok: true, status: 200, json: async () => body }); @@ -102,7 +103,7 @@ function renderSurfaceAt(width: number) { } /> - } /> + } /> , ); 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 d3d348b8e49..dde19dfe9f1 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 @@ -67,6 +67,7 @@ import '@objectstack/lint'; // `lazy()` detail entry: its first load is paid here too, not in a test's clock. import '@object-ui/plugin-detail'; import { StudioDesignSurface } from './StudioDesignSurface'; +import { StudioPillarRedirect } from './StudioPillarRedirect'; window.matchMedia = ((query: string) => ({ matches: false, @@ -146,7 +147,7 @@ describe('StudioDesignSurface — entry reads each question once (objectui#11797 } /> - } /> + } /> , ); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataCreate-26845.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataCreate-26845.test.tsx index 2fa013329a4..4644587c0a6 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataCreate-26845.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataCreate-26845.test.tsx @@ -107,6 +107,7 @@ vi.mock('../../preview/DraftChangesPanel', async () => { import '@objectstack/lint'; import '@object-ui/plugin-detail'; import { StudioDesignSurface } from './StudioDesignSurface'; +import { StudioPillarRedirect } from './StudioPillarRedirect'; import { fetchListedPackageManifests } from './packages-io'; import { addFieldFromFormToolbar } from './__tests__/dataPillarAddField'; import { createEmptyDataSource } from './__tests__/emptyDataSource'; @@ -185,7 +186,7 @@ async function openTask(): Promise { {/* objectstack#36904 — the pair's own object address (the request's landing on a read-only base). */} } /> } /> - } /> + } /> , ); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldFlowCreate-26845.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldFlowCreate-26845.test.tsx index 75d586e8b5c..3b56fde81d7 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldFlowCreate-26845.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldFlowCreate-26845.test.tsx @@ -103,6 +103,7 @@ vi.mock('../../preview/DraftChangesPanel', async () => { import '@objectstack/lint'; import '@object-ui/plugin-detail'; import { StudioDesignSurface } from './StudioDesignSurface'; +import { StudioPillarRedirect } from './StudioPillarRedirect'; import { createEmptyDataSource } from './__tests__/emptyDataSource'; import { registerMetadataPreview } from '../metadata-admin/preview-registry'; import { registerMetadataInspector } from '../metadata-admin/inspector-registry'; @@ -187,7 +188,7 @@ async function openFlow(): Promise { } /> - } /> + } /> , ); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldFlowLeave-26705.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldFlowLeave-26705.test.tsx index 6847066ad9d..675c7f0b789 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldFlowLeave-26705.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldFlowLeave-26705.test.tsx @@ -111,6 +111,7 @@ vi.mock('../../preview/DraftChangesPanel', async () => { // load is paid here, at collection, never inside a case's clock (`check:test-source-alias`). import '@objectstack/lint'; import { StudioDesignSurface } from './StudioDesignSurface'; +import { StudioPillarRedirect } from './StudioPillarRedirect'; import { createEmptyDataSource } from './__tests__/emptyDataSource'; import { registerMetadataPreview } from '../metadata-admin/preview-registry'; import { registerMetadataInspector } from '../metadata-admin/inspector-registry'; @@ -195,7 +196,7 @@ async function openFlow(): Promise { } /> - } /> + } /> , ); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldPublish-11786.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldPublish-11786.test.tsx index 85062102a94..aba7de32794 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldPublish-11786.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldPublish-11786.test.tsx @@ -91,6 +91,7 @@ vi.mock('sonner', () => ({ toast: { success: vi.fn(), error: vi.fn(), info: vi.f // The source reaches a dynamic `import('@objectstack/lint')`: its first load is paid at collection (`check:test-source-alias`). import '@objectstack/lint'; import { StudioDesignSurface } from './StudioDesignSurface'; +import { StudioPillarRedirect } from './StudioPillarRedirect'; import { pressStudioSave } from './__tests__/studioSaveHarness'; import { createEmptyDataSource } from './__tests__/emptyDataSource'; import { registerMetadataPreview } from '../metadata-admin/preview-registry'; @@ -166,7 +167,7 @@ function renderAt(url: string) { {/* objectstack#36903 — the flow designer, full-screen on the flow's address. */} } /> - } /> + } /> , ); 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 9fb10ae0234..ba2228d7158 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 @@ -127,6 +127,7 @@ vi.mock('sonner', () => ({ toast: { success: vi.fn(), error: vi.fn(), info: vi.f // warmed here so its first load is paid at import, not inside a test's clock. import '@objectstack/lint'; import { StudioDesignSurface } from './StudioDesignSurface'; +import { StudioPillarRedirect } from './StudioPillarRedirect'; import { createEmptyDataSource, failOnAbsorbedFetchError } from './__tests__/emptyDataSource'; import { registerMetadataPreview } from '../metadata-admin/preview-registry'; import { registerMetadataInspector } from '../metadata-admin/inspector-registry'; @@ -209,7 +210,7 @@ function renderAt(url: string) { } /> - } /> + } /> , ); 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 35cf2811468..4a48e76ad49 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 @@ -120,6 +120,7 @@ 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'; // The notice's sentence lives in `@object-ui/i18n`'s `studio` namespace, whose @@ -193,7 +194,7 @@ function renderAt(path: string) { render( - } /> + } /> } /> {/* objectstack#36899 — a menu type entry opens that type's area list; this stand-in links back to Data. */} } /> - } /> + } /> , ); @@ -250,7 +251,7 @@ describe('the item header\'s draft line after the copilot\'s undo, the object op } /> - } /> + } /> , ); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.kernelReadOnly-29567.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.kernelReadOnly-29567.test.tsx index 65393799232..f4ad4e3baa6 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.kernelReadOnly-29567.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.kernelReadOnly-29567.test.tsx @@ -89,6 +89,7 @@ vi.mock('../../preview/DraftChangesPanel', () => ({ })); import { StudioDesignSurface } from './StudioDesignSurface'; +import { StudioPillarRedirect } from './StudioPillarRedirect'; import { registerMetadataPreview } from '../metadata-admin/preview-registry'; window.matchMedia = ((query: string) => ({ @@ -200,7 +201,7 @@ function renderAt(packageId: string) { } /> - } /> + } /> , ); 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 e52440c27ad..cf44fdf8d6b 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 @@ -112,6 +112,7 @@ vi.mock('./StudioBundleItemEditor.js', () => ({ })); import { StudioDesignSurface } from './StudioDesignSurface'; +import { StudioPillarRedirect } from './StudioPillarRedirect'; // The source under test reaches dynamic imports of `@objectstack/lint`; their first // load is paid here, at collection, never inside a case's clock (`check:test-source-alias`). import '@objectstack/lint'; @@ -171,7 +172,7 @@ function renderAt(path: string) { } /> } /> - } /> + } /> , ); 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 45b7519ce71..d388cbfc9a8 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 @@ -81,6 +81,7 @@ vi.mock('./StudioAiCopilot', () => ({ StudioChatDock: () =>
} /> {/* objectstack#36904, objectstack#36903 — `/data` and `/automations` land on the area's object and flow lists. */} , { area: 'metadata' })} /> - + {surface}} /> , diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.oneSurface-28572.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.oneSurface-28572.test.tsx index d501a81367c..1c3a1529a66 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.oneSurface-28572.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.oneSurface-28572.test.tsx @@ -87,6 +87,7 @@ vi.mock('../../preview/DraftChangesPanel', () => ({ DraftChangesPanel: () => nul import '@objectstack/lint'; import '@object-ui/plugin-detail'; import { StudioDesignSurface } from './StudioDesignSurface'; +import { StudioPillarRedirect } from './StudioPillarRedirect'; import { registerMetadataPreview } from '../metadata-admin/preview-registry'; import { t, tFormat } from '../metadata-admin/i18n'; // The source under test reaches these dynamic imports (the command palette's @@ -361,7 +362,7 @@ function renderAt(path: string) { } /> - } /> + } /> , 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 b04548592ba..5df16edbe0e 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 @@ -165,6 +165,7 @@ vi.mock('sonner', () => ({ toast: { success: vi.fn(), error: vi.fn(), info: vi.f // warmed here so its first load is paid at import, not inside a test's clock. import '@objectstack/lint'; import { StudioDesignSurface } from './StudioDesignSurface'; +import { StudioPillarRedirect } from './StudioPillarRedirect'; import { createEmptyDataSource, failOnAbsorbedFetchError } from './__tests__/emptyDataSource'; import { getMetadataPreview, registerMetadataPreview } from '../metadata-admin/preview-registry'; import { registerMetadataInspector } from '../metadata-admin/inspector-registry'; @@ -256,7 +257,7 @@ function renderAt(url: string) { } /> - } /> + } /> , ); 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 50a493e6f3e..a086c76a187 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 @@ -77,6 +77,7 @@ vi.mock('./StudioAiCopilot', () => ({ StudioChatDock: () => null })); vi.mock('../../preview/DraftChangesPanel', () => ({ DraftChangesPanel: () => null })); import { StudioDesignSurface } from './StudioDesignSurface'; +import { StudioPillarRedirect } from './StudioPillarRedirect'; // jsdom ships neither of these; useIsMobile / useIsWideViewport and the Radix // popover's floating-ui measurement need them. @@ -118,7 +119,7 @@ function renderSurface(tab = 'data') { } /> - } /> + } /> } /> , 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 470371fd531..fe5c8a7d1b9 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 @@ -107,6 +107,7 @@ vi.mock('../metadata-admin/index.js', () => ({ import { t } from '../metadata-admin/i18n'; import { StudioDesignSurface } from './StudioDesignSurface'; +import { StudioPillarRedirect } from './StudioPillarRedirect'; import { confirmUnsavedLeave } from '../../chrome/unsavedEdits'; // jsdom has no matchMedia — useIsMobile / useIsWideViewport need a stub. @@ -216,7 +217,7 @@ async function renderSurfaceAt(url: string) { render( - } /> + } /> {/* objectstack#36899 — a menu type entry opens that type's area list. */} } /> } /> 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 c4d024cc430..54c8fc9b957 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 @@ -121,6 +121,7 @@ import '@objectstack/lint'; // 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'; import { registerMetadataPreview } from '../metadata-admin/preview-registry'; import { registerMetadataInspector } from '../metadata-admin/inspector-registry'; @@ -208,7 +209,7 @@ function renderAt(tab: string) { } /> - } /> + } /> , ); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishAdvisoryReachesAuthor.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishAdvisoryReachesAuthor.test.tsx index 968bb3596a8..cd22f857721 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishAdvisoryReachesAuthor.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishAdvisoryReachesAuthor.test.tsx @@ -79,6 +79,7 @@ vi.mock('../../preview/DraftChangesPanel', () => ({ import { toast } from 'sonner'; import { StudioDesignSurface } from './StudioDesignSurface'; +import { StudioPillarRedirect } from './StudioPillarRedirect'; // jsdom/happy-dom ship neither; useIsMobile / useIsWideViewport and the Radix // popover's floating-ui measurement need them. @@ -178,7 +179,7 @@ async function publishFromTheWorkbench(): Promise { } /> - } /> + } /> , ); 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 4abbe28e48a..1c419ad5ab7 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 @@ -69,6 +69,7 @@ vi.mock('./StudioAiCopilot', () => ({ StudioChatDock: () => null })); import { toast } from 'sonner'; import { StudioDesignSurface } from './StudioDesignSurface'; +import { StudioPillarRedirect } from './StudioPillarRedirect'; import { t, tFormat } from '../metadata-admin/i18n'; window.matchMedia = ((query: string) => ({ @@ -179,7 +180,7 @@ async function openSheet(): Promise { } /> - } /> + } /> , ); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishCount-11807.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishCount-11807.test.tsx index a3e221371fe..63151356b0b 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishCount-11807.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishCount-11807.test.tsx @@ -85,6 +85,7 @@ import { toast } from 'sonner'; import '@objectstack/lint'; import '@object-ui/plugin-detail'; import { StudioDesignSurface } from './StudioDesignSurface'; +import { StudioPillarRedirect } from './StudioPillarRedirect'; import { t, tFormat } from '../metadata-admin/i18n'; // The source under test reaches these dynamic imports (the command palette's // record preview, the drafts panel's lint, the code editor): their first load @@ -163,7 +164,7 @@ async function publishAt(path: string, expectPosts: number): Promise { } /> - } /> + } /> , ); @@ -304,10 +305,11 @@ describe('the package-less publish names its count, and its zero is no success ( // the way to Access. describe('a publish that put an app or object live points the author to Access (objectstack#27521)', () => { function LocationProbe() { - return
{useLocation().pathname}
; + const { pathname, search } = useLocation(); + return
{`${pathname}${search}`}
; } - it('an object went live: the hint, and "Open Access" leads to the Access pillar', async () => { + it('an object went live: the hint, and "Open Access" leads to the package\'s permission sets', async () => { batchBody = batch({ outcome: 'published', publishedCount: 1, @@ -319,7 +321,7 @@ describe('a publish that put an app or object live points the author to Access ( } /> - } /> + } /> , ); @@ -333,7 +335,10 @@ describe('a publish that put an app or object live points the author to Access ( expect(options.description).toBe(t('engine.studio.publishedAccessHint', 'en')); expect(options.action?.label).toBe(t('engine.studio.publishedOpenAccess', 'en')); options.action!.onClick(); - await waitFor(() => expect(screen.getByTestId('location')).toHaveTextContent(`/studio/${PACKAGE_ID}/access`)); + // objectstack#36909 — the package's permission sets, in one hop: not the retired Access pillar's address. + await waitFor(() => + expect(screen.getByTestId('location')).toHaveTextContent(`/studio/${PACKAGE_ID}/metadata/permission?package=${PACKAGE_ID}`), + ); }); it('CONTROL — only a flow went live: the plain toast, no Access hint', async () => { 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 index f1435dcb67f..666e8a3d538 100644 --- 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 @@ -71,6 +71,7 @@ import '@objectstack/lint'; // 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) => ({ @@ -121,7 +122,7 @@ function renderSurface() { render( - } /> + } /> , ); 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 index 657b358ed3e..8fd210900c7 100644 --- 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 @@ -62,6 +62,7 @@ vi.mock('../metadata-admin/AccessExplainPanel', () => ({ AccessExplainPanel: () vi.mock('./StudioAiCopilot', () => ({ StudioChatDock: () => null })); import { StudioDesignSurface } from './StudioDesignSurface'; +import { StudioPillarRedirect } from './StudioPillarRedirect'; import { fetchPackages } from './packages-io'; import { t } from '../metadata-admin/i18n'; @@ -120,7 +121,7 @@ function renderWorkbench() { } /> - } /> + } /> , diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishRefusal-26730.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishRefusal-26730.test.tsx index 7c8a38deb7e..ee74224b334 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishRefusal-26730.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishRefusal-26730.test.tsx @@ -121,6 +121,7 @@ vi.mock('sonner', () => ({ toast: { success: vi.fn(), error: vi.fn(), info: vi.f // The source reaches a dynamic `import('@objectstack/lint')`: its first load is paid at collection (`check:test-source-alias`). import '@objectstack/lint'; import { StudioDesignSurface } from './StudioDesignSurface'; +import { StudioPillarRedirect } from './StudioPillarRedirect'; import { createEmptyDataSource } from './__tests__/emptyDataSource'; import { registerMetadataPreview } from '../metadata-admin/preview-registry'; import { registerMetadataInspector } from '../metadata-admin/inspector-registry'; @@ -228,7 +229,7 @@ async function openFlow(): Promise { {/* objectstack#36903 — the flow designer, full-screen on the flow's address. */} } /> - } /> + } />
, ); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.readOnlyPosture-12453.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.readOnlyPosture-12453.test.tsx index e1d6e29db2d..8ab5b7b7102 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.readOnlyPosture-12453.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.readOnlyPosture-12453.test.tsx @@ -61,6 +61,7 @@ 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'; // The source under test reaches these dynamic imports (the command palette's // record preview, the drafts panel's lint, the code editor): their first load @@ -93,7 +94,7 @@ function renderPillar(pillar: (typeof PILLARS)[number]) { } /> - } /> + } /> , ); 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 f3edd0df8a9..e01eb0b7829 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 @@ -91,6 +91,7 @@ import '@objectstack/lint'; // 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'; import { registerMetadataPreview } from '../metadata-admin/preview-registry'; import { registerMetadataInspector } from '../metadata-admin/inspector-registry'; @@ -152,7 +153,7 @@ function renderAt(tab: string, props: { aiSlot?: React.ReactNode } = {}) { } /> - } /> + } /> , ); 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 759e14dfd20..23c739df421 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 @@ -81,6 +81,7 @@ import { toast } from 'sonner'; import '@objectstack/lint'; import '@object-ui/plugin-detail'; import { StudioDesignSurface } from './StudioDesignSurface'; +import { StudioPillarRedirect } from './StudioPillarRedirect'; import { addFieldFromFormToolbar } from './__tests__/dataPillarAddField'; import { createEmptyDataSource } from './__tests__/emptyDataSource'; import { registerBuiltinInspectors } from '../metadata-admin/inspectors'; @@ -134,7 +135,7 @@ async function mountAndEdit(): Promise { } /> - } /> + } /> , ); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioPillarRedirect.tsx b/ui/packages/app-shell/src/views/studio-design/StudioPillarRedirect.tsx index 11ebf4164a2..f4a7a62f56e 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioPillarRedirect.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioPillarRedirect.tsx @@ -3,7 +3,7 @@ /** * objectstack#36909 — the route element for `/studio/:packageId` and * `/studio/:packageId/:tab`: a retired pillar address redirects, in one hop, - * to the page that replaced it (`studioPillarRedirect.ts` holds the table); + * to the page that replaced it (`studioPillarRedirectModel.ts` holds the table); * any other segment renders `children`, the page that answers to it (the * builder, which draws the sharing overview or the not-found state). * @@ -14,7 +14,7 @@ import * as React from 'react'; import { Navigate, useLocation, useParams } from 'react-router-dom'; import { AccessPillarLanding } from './accessPillarLanding.js'; -import { studioPillarRedirect } from './studioPillarRedirect.js'; +import { studioPillarRedirect } from './studioPillarRedirectModel.js'; export function StudioPillarRedirect({ children }: { children?: React.ReactNode }): React.ReactElement | null { const { packageId, tab } = useParams<{ packageId?: string; tab?: string }>(); diff --git a/ui/packages/app-shell/src/views/studio-design/metadataArea.test.ts b/ui/packages/app-shell/src/views/studio-design/metadataArea.test.ts index d5f9ce8ec75..23fe1d2825f 100644 --- a/ui/packages/app-shell/src/views/studio-design/metadataArea.test.ts +++ b/ui/packages/app-shell/src/views/studio-design/metadataArea.test.ts @@ -12,17 +12,16 @@ import { describe, it, expect } from 'vitest'; import { AREA_DESIGNER_PAGE_TYPES, - AREA_PILLAR_FOR_TYPE, STUDIO_ALL_PACKAGES_SEGMENT, areaDesignerItemOf, areaItemAsksGenericPage, areaItemOpensDesignerPage, orgScopeFlowOf, areaItemOpensFormEditor, - areaItemPillarPath, areaLocationRedirect, dataPillarRedirect, isStudioAllPackagesScope, + settledAreaAddress, studioMetadataAreaPath, } from './metadataArea'; import { STUDIO_ORG_SCOPE_SEGMENT } from './studioScope'; @@ -108,33 +107,28 @@ describe('areaLocationRedirect — the query names the leg', () => { }); }); -describe('areaItemPillarPath — a pillar type opens its pillar', () => { - const search = (q = '') => new URLSearchParams(q); - const open = (type: string, q = '', packageId: string | null = PKG) => - areaItemPillarPath({ packageId, type, name: 'n_1', search: search(q) }); - - it('no type opens a pillar any more', () => { - // objectstack#36905, objectstack#36904, objectstack#36903 — the permission - // set, the object and the flow open their designer page instead - // (`areaItemOpensDesignerPage`). - expect(AREA_PILLAR_FOR_TYPE).toEqual({}); - for (const type of ['object', 'flow', 'permission']) expect(open(type), type).toBeNull(); +describe('settledAreaAddress — an area address where the area would put it (objectstack#36909)', () => { + it('adds what the area would add, and nothing to an address already there', () => { + expect(settledAreaAddress(`/studio/${PKG}/metadata/object`)).toBe(`/studio/${PKG}/metadata/object?package=${PKG}`); + expect(settledAreaAddress(`/studio/${PKG}/metadata/object?package=${PKG}`)).toBe(`/studio/${PKG}/metadata/object?package=${PKG}`); + expect(settledAreaAddress(`/studio/${PKG}/metadata/flow/f?package=com.example.hr`)).toBe( + '/studio/com.example.hr/metadata/flow/f?package=com.example.hr', + ); + expect(settledAreaAddress(`/studio/${PKG}/metadata/object?scope=environment`)).toBe('/studio/~all/metadata/object?scope=environment'); + expect(settledAreaAddress('/studio/~org/metadata/object')).toBe('/studio/~org/metadata/flow?source=runtime'); }); - it('every other type opens the generic item page', () => { - // objectstack#36502 — page, dashboard, report and view lost their pillar with Interfaces. - // objectstack#36905, objectstack#36904, objectstack#36903 — the designer types open their designer page instead. - for (const type of ['flow', 'permission', 'object', 'translation', 'email_template', 'agent', 'position', 'sharing_rule', 'app', 'page', 'dashboard', 'report', 'view']) { - expect(open(type), type).toBeNull(); + it('leaves every address outside the area as it is', () => { + for (const address of [`/studio/${PKG}/owd`, `/studio/${PKG}/data`, '/studio', `/apps/crm/metadata/object`, '/studio/%E0%A4%A/metadata']) { + expect(settledAreaAddress(address), address).toBe(address); } }); - it('the cross-package leg, the environment scope and `?review=1` open the generic page', () => { - expect(open('object', '', null)).toBeNull(); - expect(open('object', '?scope=environment')).toBeNull(); - expect(open('object', '?review=1')).toBeNull(); - // objectstack#36903 — no type opens a pillar, with or without them. - expect(open('object', '?review=0')).toBeNull(); + it('is idempotent', () => { + for (const address of [`/studio/${PKG}/metadata/object`, '/studio/~all/metadata/flow', '/studio/~org/metadata/flow/a']) { + const once = settledAreaAddress(address); + expect(settledAreaAddress(once), address).toBe(once); + } }); }); diff --git a/ui/packages/app-shell/src/views/studio-design/studioAddress.test.ts b/ui/packages/app-shell/src/views/studio-design/studioAddress.test.ts index adef9f2b428..4b64c1f58e4 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioAddress.test.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioAddress.test.ts @@ -12,7 +12,6 @@ import { describe, expect, it } from 'vitest'; import { RESERVED_URL_PARAMS } from '../../urlParams.js'; import { - STUDIO_ITEM_PILLAR, STUDIO_RETURN_PARAM, readStudioReturn, withStudioReturn, @@ -28,9 +27,7 @@ import { studioOwdOverviewPath, studioPackagePath, studioPath, - studioPillarItemAddress, studioPillarPath, - studioSurfaceQuery, } from './studioAddress.js'; import { STUDIO_ADDRESS_FAMILIES, @@ -49,8 +46,9 @@ import { STUDIO_CHANGES_PARAM, STUDIO_CHANGES_REVIEW } from './studioChangesLink import { STUDIO_NEW_PACKAGE_VALUE, STUDIO_NEW_PARAM } from './studioNewPackage.js'; import { retiredInterfacesTarget } from './studioInterfacesRetired.js'; import { studioOrgScopePath } from './studioScope.js'; -import { AREA_PILLAR_FOR_TYPE, areaItemPillarPath, studioMetadataItemPath, studioPillarItemPath } from './metadataArea.js'; +import { studioMetadataItemPath } from './metadataArea.js'; import { accessPillarRedirect } from './accessPillarRedirect.js'; +import { studioPillarRedirect } from './studioPillarRedirectModel.js'; describe('studioPath — the one path builder (objectstack#36895)', () => { it('builds from the left, encoding the scope segment', () => { @@ -89,20 +87,7 @@ describe("today's addresses, byte for byte", () => { expect(studioHomePath('com.acme.crm')).toBe('/studio/com.acme.crm/data'); }); - it('the three `?surface=` spellings stay distinct', () => { - const item = { type: 'object', name: "o'k (x)" }; - expect(studioSurfaceQuery(item)).toBe("surface=object%3Ao'k%20(x)"); - expect(studioSurfaceQuery(item, 'name')).toBe("surface=object:o'k%20(x)"); - expect(studioSurfaceQuery(item, 'form')).toBe('surface=object%3Ao%27k+%28x%29'); - expect(studioSurfaceQuery({ type: 'object', name: 'a' }, 'form', { action: 'approve' })).toBe( - 'surface=object%3Aa&action=approve', - ); - expect(studioSurfaceQuery({ type: 'object', name: 'a' }, 'component', { view: 'a.all' })).toBe( - 'surface=object%3Aa&view=a.all', - ); - }); - - it('an item opens its pillar today when the table names one, else its "All metadata" page', () => { + it('an item opens its "All metadata" page, where its designer is (objectstack#36909: no item opens a pillar)', () => { // objectstack#36904, objectstack#36903 — an object and a flow open their designer on their metadata address. expect(studioItemPath('crm', 'object', 'account')).toBe('/studio/crm/metadata/object/account'); expect(studioItemPath('crm', 'flow', 'notify')).toBe('/studio/crm/metadata/flow/notify'); @@ -114,16 +99,9 @@ describe("today's addresses, byte for byte", () => { expect(studioItemPath('crm', 'object', 'account', { qualifiers: { action: 'approve' } })).toBe( '/studio/crm/metadata/object/account?action=approve', ); - // A name that is an Object.prototype member is not a pillar type. expect(studioItemPath('crm', 'constructor', 'x')).toBe('/studio/crm/metadata/constructor/x'); }); - it('a pillar item at a verbatim segment', () => { - expect(studioPillarItemAddress('~org', 'automations', { type: 'flow', name: 'f' }, { segmentEncoding: 'verbatim' })).toBe( - '/studio/~org/automations?surface=flow%3Af', - ); - }); - it('the "All metadata" area', () => { expect(studioMetadataAreaRoot('~all')).toBe('/studio/~all/metadata'); expect(studioMetadataAreaRoot('com.acme.crm')).toBe('/studio/com.acme.crm/metadata'); @@ -148,15 +126,7 @@ describe("today's addresses, byte for byte", () => { // objectstack#36903 — the package-less scope's flows, on its leg of the area. expect(studioOrgScopePath()).toBe('/studio/~org/metadata/flow?source=runtime'); expect(studioOrgScopePath({ type: 'flow', name: 'a:b' })).toBe('/studio/~org/metadata/flow/a%3Ab?source=runtime'); - expect(studioPillarItemPath('crm', 'access', { type: 'permission', name: 'p' })).toBe('/studio/crm/access?surface=permission%3Ap'); expect(studioMetadataItemPath('crm', { type: 'object', name: 'account' })).toBe('/studio/crm/metadata/object/account'); - // objectstack#36903 — the flow was the last pillar type: no item opens a pillar. - expect( - areaItemPillarPath({ packageId: 'crm', type: 'flow', name: 'notify', search: new URLSearchParams() }), - ).toBeNull(); - expect( - areaItemPillarPath({ packageId: 'crm', type: 'flow', name: 'notify', search: new URLSearchParams('review=1') }), - ).toBeNull(); }); }); @@ -169,26 +139,23 @@ describe('studioOwdOverviewPath — the sharing overview\'s own route (objectsta }); describe('the mapping table agrees with the code (objectstack#36895)', () => { - it("the area's pillar redirect and the item address read ONE type map", () => { - expect(AREA_PILLAR_FOR_TYPE).toBe(STUDIO_ITEM_PILLAR); - }); - - it('every item type the map names has its row, on the same pillar', () => { - for (const [type, pillar] of Object.entries(STUDIO_ITEM_PILLAR)) { - const row = STUDIO_ITEM_TYPES.find((r) => r.type === type); - expect(row, type).toBeDefined(); - expect(row?.pillar).toBe(pillar); - expect(row?.onMetadataAddress).toBe(`/studio//metadata/${type}/`); - } - }); - - it('every `?surface=` row instantiates to what the builder writes', () => { + it('every `?surface=` row redirects from its pillar address to where the row says, in one hop (objectstack#36909)', () => { + // Every type has moved: each row names its redirect, and the ONE redirect + // table lands every spelling of the row's pillar address there. + expect(STUDIO_ITEM_TYPES.map((row) => row.type)).toEqual(['object', 'flow', 'permission', 'owd']); for (const row of STUDIO_ITEM_TYPES) { + expect(row.redirectsTo, row.type).toBeDefined(); const [type, name] = row.surface.split(':'); const value = name === '' ? 'n' : name; - expect(studioPillarItemAddress('p', row.pillar, { type, name: value })).toBe( - `/studio/p/${row.pillar}?surface=${encodeURIComponent(`${type}:${value}`)}`, - ); + const want = row.redirectsTo!.split('').join('p').replace('', value); + const surface = `${type}:${value}`; + const spellings = [`surface=${encodeURIComponent(surface)}`, `surface=${type}:${value}`, new URLSearchParams({ surface }).toString()]; + for (const query of spellings) { + const target = studioPillarRedirect('p', row.pillar, `?${query}`); + // The Access pillar's target waits on a read for a base's pair; `p` has none, so its mapping is the answer. + const to = target?.kind === 'access' ? accessPillarRedirect(target.packageId, query) : target?.to; + expect(to, `${row.type} ${query}`).toBe(want); + } } }); @@ -213,7 +180,7 @@ describe('the mapping table agrees with the code (objectstack#36895)', () => { const ids = STUDIO_ADDRESS_FAMILIES.map((f) => f.id); expect(new Set(ids).size).toBe(ids.length); const builders = new Set([ - 'studioLandingPath', 'studioPackagePath', 'studioPillarPath', 'studioItemPath', 'studioOrgScopePath', + 'studioLandingPath', 'studioPackagePath', 'studioPillarPath', 'studioOrgScopePath', 'studioMetadataAreaRoot', 'studioMetadataTypePath', 'studioMetadataItemAddress', 'studioChangesReviewPath', 'studioItemReviewPath', 'retiredInterfacesTarget', 'studioOwdOverviewPath', ]); @@ -222,24 +189,24 @@ describe('the mapping table agrees with the code (objectstack#36895)', () => { it('a moved type\'s row names where its pillar address redirects, as the redirect does (objectstack#36905)', () => { const moved = STUDIO_ITEM_TYPES.filter((row) => row.redirectsTo !== undefined); - expect(moved.map((row) => row.type)).toEqual(['permission', 'owd']); - for (const row of moved) { + const access = moved.filter((row) => row.pillar === 'access'); + expect(access.map((row) => row.type)).toEqual(['permission', 'owd']); + for (const row of access) { const [type, name] = row.surface.split(':'); const value = name === '' ? 'n' : name; expect(accessPillarRedirect('p', `?surface=${encodeURIComponent(`${type}:${value}`)}`), row.type).toBe( row.redirectsTo!.split('').join('p').replace('', value), ); } - // A type still in the pillar map has not moved. - for (const type of Object.keys(STUDIO_ITEM_PILLAR)) { - expect(STUDIO_ITEM_TYPES.find((r) => r.type === type)?.redirectsTo, type).toBeUndefined(); - } }); it('the retired `/interfaces` redirect keeps exactly what the table marks', () => { expect(STUDIO_RETIRED_INTERFACES_KEPT_PARAMS).toEqual([STUDIO_CHANGES_PARAM]); - expect(retiredInterfacesTarget('crm', '?surface=page%3Ahome&changes=review&nav=n1')).toBe('/studio/crm/data?changes=review'); - expect(retiredInterfacesTarget('crm', '?surface=page%3Ahome')).toBe('/studio/crm/data'); + // objectstack#36909 — on the package's object list, its settled address: no hop through `/data`. + expect(retiredInterfacesTarget('crm', '?surface=page%3Ahome&changes=review&nav=n1')).toBe( + '/studio/crm/metadata/object?changes=review&package=crm', + ); + expect(retiredInterfacesTarget('crm', '?surface=page%3Ahome')).toBe('/studio/crm/metadata/object?package=crm'); }); }); diff --git a/ui/packages/app-shell/src/views/studio-design/studioAddress.ts b/ui/packages/app-shell/src/views/studio-design/studioAddress.ts index 253ba2f0d85..34e76b0c70a 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioAddress.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioAddress.ts @@ -14,7 +14,7 @@ * a time, each switching every producer here in the PR that shipped its * designer. objectstack#36909 — every type has moved, so an item address is * always the metadata one ({@link studioItemPath}); the retired pillar - * addresses only redirect (`studioPillarRedirect.ts`). + * addresses only redirect (`studioPillarRedirectModel.ts`). * * ## Today's addresses, byte for byte * @@ -89,7 +89,7 @@ export const STUDIO_OWD_OBJECT_PARAM = 'object'; /** * The retired pillars' route segments. objectstack#36909 — no pillar draws a - * page any more: each address only redirects (`studioPillarRedirect.ts`). + * page any more: each address only redirects (`studioPillarRedirectModel.ts`). */ export type StudioPillarKey = 'data' | 'automations' | 'access'; @@ -195,7 +195,7 @@ export function studioOwdOverviewPath( /** * How a producer wrote a retired pillar's `?surface=:` value. * Three spellings reached the same surface, and every one still redirects - * (`studioPillarRedirect.ts` reads them all through `parseSurfaceParam`): + * (`studioPillarRedirectModel.ts` reads them all through `parseSurfaceParam`): * * - `'component'`: the whole value through `encodeURIComponent`, * `surface=object%3Aaccount`. The default; most producers. diff --git a/ui/packages/app-shell/src/views/studio-design/studioAddressTable.ts b/ui/packages/app-shell/src/views/studio-design/studioAddressTable.ts index e24388b9027..3f389cb43db 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioAddressTable.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioAddressTable.ts @@ -2,29 +2,22 @@ /** * The Studio address mapping table (objectstack#36895, Studio redesign epic - * #36890): every address family Studio answers to today, every `?surface=` - * spelling, and every query parameter, with what each one becomes when a - * designer card moves its type to the metadata address. + * #36890): every address family Studio answers to, every `?surface=` + * spelling, and every query parameter, with what each pillar address became + * when its type moved to the metadata address. * - * The builders are in `studioAddress.ts`; this is their map. It is data a - * card reads before it switches a type, and data the code reads where the - * table decides something: the retired `/interfaces` redirect keeps exactly - * the parameters this table marks as surviving it + * The builders are in `studioAddress.ts`; this is their map. It is data the + * code reads where the table decides something: the retired `/interfaces` + * redirect keeps exactly the parameters this table marks as surviving it * ({@link STUDIO_RETIRED_INTERFACES_KEPT_PARAMS}). * - * ## How a designer card switches its type + * objectstack#36909 — every type has moved and every pillar retired: each + * `?surface=` row names where its pillar address now redirects, in one hop + * (`studioPillarRedirectModel.ts`). * - * 1. Delete the type's row from `STUDIO_ITEM_PILLAR` (`studioAddress.ts`). - * Every producer calling `studioItemPath`, and the "All metadata" area's - * pillar redirect (`areaItemPillarPath`), then open the metadata address - * together, so the two never bounce. - * 2. Carry each qualifier its row below lists onto the metadata address, or - * drop it, as the row's `onMetadataAddress` says. - * 3. Add the redirect from the pillar address in that same PR. - * 4. Update the type's row here: `today` becomes the metadata address. - * - * `studioAddressTable.test.ts` holds each row's example equal to its - * builder's output, so the table cannot drift from the code. + * `studioAddress.test.ts` holds each row's example equal to its builder's + * output, and each row's redirect equal to the redirect's, so the table + * cannot drift from the code. */ import { DESIGNER_SURFACE_PARAM } from '../metadata-admin/nav-selection.js'; @@ -77,13 +70,23 @@ export const STUDIO_ADDRESS_FAMILIES: readonly StudioAddressFamily[] = Object.fr builder: 'studioLandingPath', meaning: "A retired bookmark: Studio's entry forwards it to Setup → Packages with New Package open.", }, - { id: 'package', today: '/studio/', builder: 'studioPackagePath', meaning: `A package's Studio; the route lands it on its home, \`${STUDIO_HOME_PILLAR}\`, which redirects to the package's object list (objectstack#36904).` }, - { id: 'pillar', today: '/studio//', builder: 'studioPillarPath', meaning: 'One pillar of a package: data, automations or access.' }, + { + id: 'package', + today: '/studio/', + builder: 'studioPackagePath', + meaning: "A package's Studio; the route lands it on the package's object list in one redirect (objectstack#36904, objectstack#36909).", + }, + { + id: 'pillar', + today: '/studio//', + builder: 'studioPillarPath', + meaning: `A retired pillar of a package (\`${STUDIO_HOME_PILLAR}\`, automations, access, interfaces): no page of its own; the route redirects it in one hop (objectstack#36909, studioPillarRedirectModel.ts).`, + }, { id: 'pillar-item', today: `/studio//?${DESIGNER_SURFACE_PARAM}=:`, - builder: 'studioItemPath', - meaning: 'A pillar opened on one item. The family the designer cards move, one type at a time (STUDIO_ITEM_TYPES).', + builder: 'studioPillarPath', + meaning: "A retired pillar opened on one item: redirects to the item's own address (STUDIO_ITEM_TYPES, redirectsTo).", }, { id: 'owd', @@ -117,7 +120,8 @@ export const STUDIO_ADDRESS_FAMILIES: readonly StudioAddressFamily[] = Object.fr id: 'changes-review', today: `/studio//${STUDIO_HOME_PILLAR}?${STUDIO_CHANGES_PARAM}=${STUDIO_CHANGES_REVIEW}`, builder: 'studioChangesReviewPath', - meaning: "A package's Changes drawer, opened from outside its Studio. The server's draft review link (studioChangesReviewLink in @objectstack/types) spells the same address.", + meaning: + "A package's Changes drawer, opened from outside its Studio. The server's draft review link (studioChangesReviewLink in @objectstack/types) spells the same address; it redirects, with `changes=review` kept, to the package's object list, where the drawer opens (objectstack#36909).", }, { id: 'item-review', @@ -129,7 +133,8 @@ export const STUDIO_ADDRESS_FAMILIES: readonly StudioAddressFamily[] = Object.fr id: 'retired-interfaces', today: `/studio//${RETIRED_INTERFACES_SEGMENT}[?…]`, builder: 'retiredInterfacesTarget', - meaning: `The retired Interfaces pillar (objectstack#36502). Redirects to the package's home, \`${STUDIO_HOME_PILLAR}\` (and from there to its object list, objectstack#36904), keeping only STUDIO_RETIRED_INTERFACES_KEPT_PARAMS.`, + meaning: + "The retired Interfaces pillar (objectstack#36502). Redirects to the package's object list in one hop (objectstack#36909), keeping only STUDIO_RETIRED_INTERFACES_KEPT_PARAMS.", }, ]); @@ -137,25 +142,22 @@ export const STUDIO_ADDRESS_FAMILIES: readonly StudioAddressFamily[] = Object.fr // Item types: where each opens today, and what it switches to // --------------------------------------------------------------------------- -/** One `?surface=` type: the pillar it opens today and the metadata address it moves to. */ +/** One `?surface=` type: the pillar that opened it, and where that pillar address redirects now. */ export interface StudioItemTypeRow { /** The `?surface=` type. */ readonly type: string; - /** The pillar that opens it today. */ + /** The retired pillar that opened it. */ readonly pillar: StudioPillarKey; - /** Today's `?surface=` value. */ + /** The pillar address's `?surface=` value. */ readonly surface: string; - /** The qualifiers that ride beside `?surface=` for this type today. */ + /** The qualifiers that rode beside `?surface=` for this type. */ readonly qualifiers: readonly string[]; - /** The `?surface=` spellings producers write today (`StudioSurfaceSpelling`). */ + /** The `?surface=` spellings producers wrote (`StudioSurfaceSpelling`); the redirect reads each. */ readonly spellings: readonly StudioSurfaceSpelling[]; - /** The metadata address it moves to, or `null` when it is a pillar page with no item of its own. */ + /** The metadata address it moved to, or `null` when it is a page with no item of its own. */ readonly onMetadataAddress: string | null; - /** - * Set once the type has moved: the address its pillar address now redirects - * to (step 3 above). Absent while the pillar still opens it. - */ - readonly redirectsTo?: string; + /** The settled address its pillar address redirects to, in one hop (objectstack#36909). */ + readonly redirectsTo: string; } export const STUDIO_ITEM_TYPES: readonly StudioItemTypeRow[] = Object.freeze([ @@ -169,6 +171,7 @@ export const STUDIO_ITEM_TYPES: readonly StudioItemTypeRow[] = Object.freeze([ qualifiers: [DESIGNER_SURFACE_VIEW_PARAM, DESIGNER_SURFACE_ACTION_PARAM, DESIGNER_SURFACE_NAV_PARAM], spellings: ['component', 'name', 'form'], onMetadataAddress: '/studio//metadata/object/', + redirectsTo: '/studio//metadata/object/?package=', }, { // objectstack#36903 — switched: a flow opens its designer on its metadata @@ -180,6 +183,7 @@ export const STUDIO_ITEM_TYPES: readonly StudioItemTypeRow[] = Object.freeze([ qualifiers: [], spellings: ['component'], onMetadataAddress: '/studio//metadata/flow/', + redirectsTo: '/studio//metadata/flow/?package=', }, { type: 'permission', diff --git a/ui/packages/app-shell/src/views/studio-design/studioInterfacesRetired.test.ts b/ui/packages/app-shell/src/views/studio-design/studioInterfacesRetired.test.ts index a02341edf1a..9274db57fa7 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioInterfacesRetired.test.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioInterfacesRetired.test.ts @@ -2,8 +2,9 @@ /** * objectstack#36502 — where an old Interfaces URL lands, as data: the scope's - * Studio home (the Data pillar), carrying `?changes=` and nothing else of the - * retired pillar's query, and the state that tells the home to say why. + * Studio home (its object list; objectstack#36909 — on the area's settled + * address, in one hop), carrying `?changes=` and nothing else of the retired + * pillar's query, and the state that tells the home to say why. * The render (the redirect through the real surface, the notice, its link * back to the app) is `StudioDesignSurface.interfacesRetired-36502`. */ @@ -20,30 +21,32 @@ import { import { STUDIO_CHANGES_PARAM, STUDIO_CHANGES_REVIEW } from './studioChangesLink'; describe('retiredInterfacesTarget (objectstack#36502)', () => { - it('lands a bare old URL on the scope’s Data pillar', () => { + it('lands a bare old URL on the scope’s object list', () => { expect(STUDIO_HOME_PILLAR).toBe('data'); expect(RETIRED_INTERFACES_SEGMENT).toBe('interfaces'); - expect(retiredInterfacesTarget('com.acme.app', '')).toBe('/studio/com.acme.app/data'); + expect(retiredInterfacesTarget('com.acme.app', '')).toBe('/studio/com.acme.app/metadata/object?package=com.acme.app'); }); it('drops the retired pillar’s own deep link', () => { - expect(retiredInterfacesTarget('com.acme.app', '?surface=dashboard%3Aops_board')).toBe('/studio/com.acme.app/data'); - expect(retiredInterfacesTarget('com.acme.app', 'surface=view%3Atask.all&canvas=run')).toBe('/studio/com.acme.app/data'); + expect(retiredInterfacesTarget('com.acme.app', '?surface=dashboard%3Aops_board')).toBe('/studio/com.acme.app/metadata/object?package=com.acme.app'); + expect(retiredInterfacesTarget('com.acme.app', 'surface=view%3Atask.all&canvas=run')).toBe( + '/studio/com.acme.app/metadata/object?package=com.acme.app', + ); }); it('keeps the Changes drawer request, which is the surface’s, not the pillar’s', () => { expect(STUDIO_CHANGES_PARAM).toBe('changes'); expect(retiredInterfacesTarget('com.acme.app', `?${STUDIO_CHANGES_PARAM}=${STUDIO_CHANGES_REVIEW}`)).toBe( - '/studio/com.acme.app/data?changes=review', + '/studio/com.acme.app/metadata/object?changes=review&package=com.acme.app', ); expect( retiredInterfacesTarget('com.acme.app', `?surface=page%3Ahome&${STUDIO_CHANGES_PARAM}=${STUDIO_CHANGES_REVIEW}`), - ).toBe('/studio/com.acme.app/data?changes=review'); + ).toBe('/studio/com.acme.app/metadata/object?changes=review&package=com.acme.app'); }); - it('encodes the scope segment as the route spells it', () => { - expect(retiredInterfacesTarget('~org', '')).toBe('/studio/~org/data'); - expect(retiredInterfacesTarget('a b', '')).toBe('/studio/a%20b/data'); + it('encodes the scope segment as the route spells it, and lands the package-less scope on its flows', () => { + expect(retiredInterfacesTarget('~org', '')).toBe('/studio/~org/metadata/flow?source=runtime'); + expect(retiredInterfacesTarget('a b', '')).toBe('/studio/a%20b/metadata/object?package=a+b'); }); }); diff --git a/ui/packages/app-shell/src/views/studio-design/studioMenuModel.ts b/ui/packages/app-shell/src/views/studio-design/studioMenuModel.ts index f072441eff9..c92c510764c 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioMenuModel.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioMenuModel.ts @@ -232,7 +232,7 @@ export function studioMenuTiers(menu: readonly StudioMenuGroupModel[]): Record { - it('opens a type a pillar designs in that pillar, as studioItemPath does', () => { - for (const type of Object.keys(STUDIO_ITEM_PILLAR)) { - expect(studioPaletteItemAddress(PKG, { type, name: 'x', packageId: PAIR })).toBe(studioItemPath(PKG, type, 'x')); - } + it('opens an object on its designer\'s address, scoped to its owner (no pillar, objectstack#36909)', () => { // objectstack#36904 — an object opens its designer on its own address, scoped to its owner. expect(studioPaletteItemAddress(PKG, { type: 'object', name: 'crm_account', packageId: PKG })).toBe( '/studio/com.acme.crm/metadata/object/crm_account?package=com.acme.crm', diff --git a/ui/packages/app-shell/src/views/studio-design/studioPillarRedirectModel.test.ts b/ui/packages/app-shell/src/views/studio-design/studioPillarRedirectModel.test.ts new file mode 100644 index 00000000000..3382cfc5f84 --- /dev/null +++ b/ui/packages/app-shell/src/views/studio-design/studioPillarRedirectModel.test.ts @@ -0,0 +1,156 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * objectstack#36909 — every retired pillar address lands on the page that + * replaced it, in ONE redirect. + * + * - The table walks every old pillar address — each package pillar (`data`, + * `automations`, `access`, `interfaces`), the bare package address, a + * base's `.custom` pair, and the package-less scope's (`~org`) — to the + * address it lands on. Every expected value is a literal. + * - One hop: a target in the "All metadata" area is already where the area + * would put it (`areaLocationRedirect` answers `null`), so the area does + * not redirect a second time. The old `/data` address — the server's draft + * review link included — went through two redirects before this. + * - CONTROL: a current address (the sharing overview, the area, a segment + * no page has, the cross-package leg) is no retired pillar address and + * does not redirect. + */ + +import { describe, expect, it } from 'vitest'; +import { areaLocationRedirect } from './metadataArea.js'; +import { accessPillarRedirect } from './accessPillarRedirect.js'; +import { INTERFACES_RETIRED_STATE } from './studioInterfacesRetired.js'; +import { STUDIO_RETIRED_PILLAR_SEGMENTS, studioPillarRedirect } from './studioPillarRedirectModel.js'; + +/** Splits `/studio/[/][?query]` the way the route reads it. */ +function redirectOf(address: string) { + const queryAt = address.indexOf('?'); + const path = queryAt >= 0 ? address.slice(0, queryAt) : address; + const search = queryAt >= 0 ? address.slice(queryAt) : ''; + const [, , segment, pillar] = path.split('/'); + return studioPillarRedirect(decodeURIComponent(segment), pillar === undefined ? undefined : decodeURIComponent(pillar), search); +} + +/** Whether the area would redirect `address` again: `false` for any address outside the area. */ +function areaRedirectsAgain(address: string): boolean { + const queryAt = address.indexOf('?'); + const path = queryAt >= 0 ? address.slice(0, queryAt) : address; + const search = queryAt >= 0 ? address.slice(queryAt) : ''; + const [, , segment, section, ...rest] = path.split('/'); + if (section !== 'metadata') return false; + return areaLocationRedirect(decodeURIComponent(segment), rest.join('/'), search) !== null; +} + +const P = 'com.acme.crm'; +const PAIR = 'com.acme.crm.custom'; + +/** Old address → where it lands. */ +const NAVIGATE_TABLE: ReadonlyArray = [ + // The bare package address landed on `data`. + [`/studio/${P}`, `/studio/${P}/metadata/object?package=${P}`], + // Data (objectstack#36904): the object list, or one object's designer. + [`/studio/${P}/data`, `/studio/${P}/metadata/object?package=${P}`], + [`/studio/${P}/data?surface=object%3Aaccount`, `/studio/${P}/metadata/object/account?package=${P}`], + [`/studio/${P}/data?surface=object:account`, `/studio/${P}/metadata/object/account?package=${P}`], + [ + `/studio/${P}/data?surface=object%3Aaccount&action=approve&view=account.all&nav=n1`, + `/studio/${P}/metadata/object/account?action=approve&package=${P}`, + ], + // The server's draft review link (`studioChangesReviewLink`): the drawer opens on the object list. + [`/studio/${P}/data?changes=review`, `/studio/${P}/metadata/object?changes=review&package=${P}`], + // A `?package=` naming another package re-roots, as the area would. + [`/studio/${P}/data?package=com.acme.hr`, `/studio/com.acme.hr/metadata/object?package=com.acme.hr`], + // Automations (objectstack#36903): the flow list, or one flow's designer. + [`/studio/${P}/automations`, `/studio/${P}/metadata/flow?package=${P}`], + [`/studio/${P}/automations?surface=flow%3Anotify`, `/studio/${P}/metadata/flow/notify?package=${P}`], + [`/studio/${P}/automations?surface=flow%3Anotify&changes=review`, `/studio/${P}/metadata/flow/notify?changes=review&package=${P}`], + // Interfaces (objectstack#36502): the package's object list, only `?changes=` kept. + [`/studio/${P}/interfaces`, `/studio/${P}/metadata/object?package=${P}`], + [`/studio/${P}/interfaces?surface=page%3Ahome&changes=review&nav=n1`, `/studio/${P}/metadata/object?changes=review&package=${P}`], + // A base's `.custom` pair: Data and Automations in the pair's own area, Interfaces on the base. + [`/studio/${PAIR}`, `/studio/${PAIR}/metadata/object?package=${PAIR}`], + [`/studio/${PAIR}/data?surface=object%3Avisit`, `/studio/${PAIR}/metadata/object/visit?package=${PAIR}`], + [`/studio/${PAIR}/automations?surface=flow%3Anotify`, `/studio/${PAIR}/metadata/flow/notify?package=${PAIR}`], + [`/studio/${PAIR}/interfaces`, `/studio/${P}/metadata/object?package=${P}`], + // The package-less scope (objectstack#36903): its one pillar, and every other address of it. + ['/studio/~org/automations', '/studio/~org/metadata/flow?source=runtime'], + ['/studio/~org/automations?surface=flow%3Aclone_1', '/studio/~org/metadata/flow/clone_1?source=runtime'], + ['/studio/~org/automations?surface=flow%3Aclone_1&package=~org', '/studio/~org/metadata/flow/clone_1?source=runtime'], + ['/studio/~org/data', '/studio/~org/metadata/flow?source=runtime'], + ['/studio/~org/access', '/studio/~org/metadata/flow?source=runtime'], + ['/studio/~org/interfaces', '/studio/~org/metadata/flow?source=runtime'], + ['/studio/~org/owd', '/studio/~org/metadata/flow?source=runtime'], +]; + +describe('every retired pillar address lands on the page that replaced it (objectstack#36909)', () => { + it.each(NAVIGATE_TABLE)('%s → %s', (from, to) => { + expect(redirectOf(from)).toEqual( + from.includes('/interfaces') && !from.includes('~org') + ? { kind: 'navigate', to, state: { [INTERFACES_RETIRED_STATE]: true } } + : { kind: 'navigate', to }, + ); + }); + + it('the Access pillar lands through its reads, on the base, its targets settled', () => { + // Which package holds a named set is a read (`AccessPillarLanding`); the + // table picks the package whose sets are read, the base for its pair. + expect(redirectOf(`/studio/${P}/access?surface=permission%3Asales_rep`)).toEqual({ kind: 'access', packageId: P }); + expect(redirectOf(`/studio/${PAIR}/access`)).toEqual({ kind: 'access', packageId: P }); + expect(accessPillarRedirect(P, '?surface=permission%3Asales_rep')).toBe( + `/studio/${P}/metadata/permission/sales_rep?package=${P}`, + ); + expect(accessPillarRedirect(P, '?surface=permission%3Asales_rep', { setHeldIn: PAIR })).toBe( + `/studio/${PAIR}/metadata/permission/sales_rep?package=${PAIR}`, + ); + expect(accessPillarRedirect(P, '')).toBe(`/studio/${P}/metadata/permission?package=${P}`); + expect(accessPillarRedirect(P, '?surface=owd%3Aoverview')).toBe(`/studio/${P}/owd`); + }); + + it('the table covers every retired pillar segment, on a package and on the package-less scope', () => { + for (const segment of STUDIO_RETIRED_PILLAR_SEGMENTS) { + expect(redirectOf(`/studio/${P}/${segment}`), segment).not.toBeNull(); + expect(redirectOf(`/studio/~org/${segment}`), `~org ${segment}`).not.toBeNull(); + if (segment === 'access') continue; + expect(NAVIGATE_TABLE.some(([from]) => from.startsWith(`/studio/${P}/${segment}`)), segment).toBe(true); + } + }); +}); + +describe('one hop: the area redirects none of the targets again (objectstack#36909)', () => { + it('the old `/data` address reaches the object list in one redirect', () => { + for (const from of [`/studio/${P}/data`, `/studio/${P}/data?changes=review`, `/studio/${P}/data?surface=object%3Aaccount`]) { + const target = redirectOf(from); + expect(target?.kind, from).toBe('navigate'); + const to = (target as { to: string }).to; + expect(to.startsWith(`/studio/${P}/metadata/object`), from).toBe(true); + expect(areaRedirectsAgain(to), to).toBe(false); + } + }); + + it('every target in the table, and every Access target, is where the area would put it', () => { + for (const [, to] of NAVIGATE_TABLE) expect(areaRedirectsAgain(to), to).toBe(false); + for (const search of ['', '?surface=permission%3Asales_rep', '?changes=review']) { + const to = accessPillarRedirect(P, search); + expect(areaRedirectsAgain(to), to).toBe(false); + } + }); +}); + +describe('CONTROL — a current address does not redirect', () => { + it.each([ + // The sharing overview's own route (objectstack#36905). + [P, 'owd', '?object=account'], + // A segment no page has: the builder draws its not-found state (objectstack#26708). + [P, 'bogus_pillar', ''], + // The area's segment, should a host route it here. + [P, 'metadata', ''], + // The cross-package leg is the area's. + ['~all', 'data', ''], + ['~all', undefined, ''], + // No package at all. + ['', 'data', ''], + ] as const)('/studio/%s/%s%s', (segment, pillar, search) => { + expect(studioPillarRedirect(segment, pillar, search)).toBeNull(); + }); +}); diff --git a/ui/packages/app-shell/src/views/studio-design/studioPillarRedirect.ts b/ui/packages/app-shell/src/views/studio-design/studioPillarRedirectModel.ts similarity index 100% rename from ui/packages/app-shell/src/views/studio-design/studioPillarRedirect.ts rename to ui/packages/app-shell/src/views/studio-design/studioPillarRedirectModel.ts diff --git a/ui/packages/app-shell/src/views/studio-design/studioScope.test.ts b/ui/packages/app-shell/src/views/studio-design/studioScope.test.ts index fa1faf6d791..df9ab68a7e6 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioScope.test.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioScope.test.ts @@ -13,7 +13,6 @@ import { describe, expect, it } from 'vitest'; import { MANIFEST_ID_PATTERN } from '@objectstack/spec/kernel'; import { - STUDIO_ORG_SCOPE_PILLAR, STUDIO_ORG_SCOPE_SEGMENT, isOrgScopeDraft, isPackageLessDraft, @@ -47,8 +46,6 @@ describe('the reserved segment cannot name a package (objectui#11553)', () => { describe('studioOrgScopePath (objectstack#36903: the scope\'s leg of the area)', () => { it('lands on the scope’s flow list, filtered to the items of no package', () => { expect(studioOrgScopePath()).toBe(`/studio/${STUDIO_ORG_SCOPE_SEGMENT}/metadata/flow?source=runtime`); - // The retired pillar segment only redirects now. - expect(STUDIO_ORG_SCOPE_PILLAR).toBe('automations'); }); it('opens a flow full-screen on its address, round-tripping its name', () => { diff --git a/ui/packages/app-shell/src/views/studio-design/studioScope.ts b/ui/packages/app-shell/src/views/studio-design/studioScope.ts index 90cc0e8baae..cea1e5993a4 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioScope.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioScope.ts @@ -44,7 +44,7 @@ * it), so the list shows the scope's flows and the designer's ‹ › walk them * and nothing else. The old `/studio/~org/automations` address redirects here * (`automationsPillarRedirect.ts`), and every other `/studio/~org/...` URL to - * the list (`studioPillarRedirect.ts`). + * the list (`studioPillarRedirectModel.ts`). */ import { canonicalMetaUrlType } from '@objectstack/spec/shared'; diff --git a/ui/packages/app-shell/src/views/studio-design/useSurfaceDeepLink.ts b/ui/packages/app-shell/src/views/studio-design/useSurfaceDeepLink.ts index 9ee61acf9d8..25e489bda66 100644 --- a/ui/packages/app-shell/src/views/studio-design/useSurfaceDeepLink.ts +++ b/ui/packages/app-shell/src/views/studio-design/useSurfaceDeepLink.ts @@ -7,7 +7,7 @@ * surface at a time, captured the `?surface=` target once at mount, and * mirrored the open surface back to the URL. objectstack#36909 — every pillar * retired: an item opens its designer on its own metadata address, and the - * pillar addresses only redirect (`studioPillarRedirect.ts`), so the capture + * pillar addresses only redirect (`studioPillarRedirectModel.ts`), so the capture * and mirror hooks had no reader left and went. What stays: * * - the qualifier keys the redirects drop and the address table names From ac5c285f10b96f6fccacb0476ed01c3ef5b0eb9d Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 25 Nov 2026 23:36:31 +0000 Subject: [PATCH 3/4] fix(studio): settle area addresses through the address builder's parser Claude-Session: https://claude.ai/code/session_01QSeKYngc1UxywCSQwtqdZz Co-authored-by: Claude --- .../src/views/studio-design/metadataArea.ts | 19 +++-------- .../views/studio-design/studioAddress.test.ts | 25 ++++++++++++++ .../src/views/studio-design/studioAddress.ts | 34 +++++++++++++++++++ 3 files changed, 63 insertions(+), 15 deletions(-) diff --git a/ui/packages/app-shell/src/views/studio-design/metadataArea.ts b/ui/packages/app-shell/src/views/studio-design/metadataArea.ts index 2cb068ef3bb..8faffdc2818 100644 --- a/ui/packages/app-shell/src/views/studio-design/metadataArea.ts +++ b/ui/packages/app-shell/src/views/studio-design/metadataArea.ts @@ -45,7 +45,7 @@ import { STUDIO_METADATA_AREA, STUDIO_ORG_SCOPE_SEGMENT, STUDIO_ORG_SCOPE_TYPE, - STUDIO_ROOT_PATH, + studioAddressParts, studioMetadataAreaAddress, studioMetadataAreaRoot, studioMetadataItemAddress, @@ -319,18 +319,7 @@ function orgScopeAreaRedirect(segment: string, rest: string, params: URLSearchPa * Idempotent: a settled address settles to itself. */ export function settledAreaAddress(address: string): string { - const queryAt = address.indexOf('?'); - const path = queryAt >= 0 ? address.slice(0, queryAt) : address; - const search = queryAt >= 0 ? address.slice(queryAt) : ''; - const prefix = `${STUDIO_ROOT_PATH}/`; - if (!path.startsWith(prefix)) return address; - const [rawSegment = '', section, ...rest] = path.slice(prefix.length).split('/'); - if (!rawSegment || section !== STUDIO_METADATA_AREA) return address; - let segment: string; - try { - segment = decodeURIComponent(rawSegment); - } catch { - return address; - } - return areaLocationRedirect(segment, rest.join('/'), search) ?? address; + const parts = studioAddressParts(address); + if (!parts || parts.section !== STUDIO_METADATA_AREA) return address; + return areaLocationRedirect(parts.segment, parts.rest, parts.search) ?? address; } diff --git a/ui/packages/app-shell/src/views/studio-design/studioAddress.test.ts b/ui/packages/app-shell/src/views/studio-design/studioAddress.test.ts index 4b64c1f58e4..a842377d91c 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioAddress.test.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioAddress.test.ts @@ -26,6 +26,7 @@ import { studioMetadataTypePath, studioOwdOverviewPath, studioPackagePath, + studioAddressParts, studioPath, studioPillarPath, } from './studioAddress.js'; @@ -130,6 +131,30 @@ describe("today's addresses, byte for byte", () => { }); }); +describe('studioAddressParts — an address read back into its parts (objectstack#36909)', () => { + it('inverts the builder for an address with a scope segment', () => { + expect(studioAddressParts(studioMetadataItemAddress('a b', 'flow', 'f', { query: 'package=x' }))).toEqual({ + segment: 'a b', + section: 'metadata', + rest: 'flow/f', + search: '?package=x', + }); + expect(studioAddressParts(studioPackagePath('crm'))).toEqual({ segment: 'crm', section: null, rest: '', search: '' }); + expect(studioAddressParts(studioPillarPath('~org', 'automations', { hash: '#x' }))).toEqual({ + segment: '~org', + section: 'automations', + rest: '', + search: '', + }); + }); + + it('answers null for anything else', () => { + for (const address of [studioLandingPath(), '/studio/', '/studios/crm', '/apps/crm/metadata', '/studio/%E0%A4%A/metadata']) { + expect(studioAddressParts(address), address).toBeNull(); + } + }); +}); + describe('studioOwdOverviewPath — the sharing overview\'s own route (objectstack#36905)', () => { it('is the package\'s `owd` section, optionally on one object', () => { expect(studioOwdOverviewPath('crm')).toBe('/studio/crm/owd'); diff --git a/ui/packages/app-shell/src/views/studio-design/studioAddress.ts b/ui/packages/app-shell/src/views/studio-design/studioAddress.ts index 34e76b0c70a..bbd38fc6625 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioAddress.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioAddress.ts @@ -151,6 +151,40 @@ export function studioPath( return path; } +/** The parts of a Studio address, as {@link studioPath} composes them. */ +export interface StudioAddressParts { + /** The scope segment, decoded: a package id, `~org`, `~all`. */ + segment: string; + /** The section after it (a pillar segment, `metadata`, `owd`), or `null` when the address ends at the scope. */ + section: string | null; + /** The path below the section, in its URL form (`object/account`), `''` when there is none. */ + rest: string; + /** The query, `?` included, or `''`. */ + search: string; +} + +/** + * objectstack#36909 — a Studio address read back into its parts, the inverse + * of {@link studioPath} for an address with a scope segment; `null` for any + * other address, or one whose segment does not decode. The fragment is not + * read. + */ +export function studioAddressParts(address: string): StudioAddressParts | null { + const hashAt = address.indexOf('#'); + const beforeHash = hashAt >= 0 ? address.slice(0, hashAt) : address; + const queryAt = beforeHash.indexOf('?'); + const path = queryAt >= 0 ? beforeHash.slice(0, queryAt) : beforeHash; + const search = queryAt >= 0 ? beforeHash.slice(queryAt) : ''; + if (!path.startsWith(STUDIO_ROOT_PATH) || path.charAt(STUDIO_ROOT_PATH.length) !== '/') return null; + const [rawSegment = '', section, ...rest] = path.slice(STUDIO_ROOT_PATH.length + 1).split('/'); + if (!rawSegment) return null; + try { + return { segment: decodeURIComponent(rawSegment), section: section ?? null, rest: rest.join('/'), search }; + } catch { + return null; + } +} + // --------------------------------------------------------------------------- // Landing, package, pillar // --------------------------------------------------------------------------- From 2322b4028217d500b3f2aa328abbe5babb91a8a9 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 00:37:03 +0000 Subject: [PATCH 4/4] docs(studio): the menu's current-entry note names the retired pillar address in its own bullet Claude-Session: https://claude.ai/code/session_01QSeKYngc1UxywCSQwtqdZz Co-authored-by: Claude --- .../app-shell/src/views/studio-design/studioMenuModel.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ui/packages/app-shell/src/views/studio-design/studioMenuModel.ts b/ui/packages/app-shell/src/views/studio-design/studioMenuModel.ts index c92c510764c..9105ee28199 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioMenuModel.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioMenuModel.ts @@ -224,15 +224,14 @@ export function studioMenuTiers(menu: readonly StudioMenuGroupModel[]): Record