Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .changeset/36909-studio-pillar-addresses.md
Original file line number Diff line number Diff line change
@@ -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/<package>` and `/studio/<package>/data` open the package's object list; `/data?surface=object:<name>` opens that object's designer, and `/data?changes=review` opens the object list with the Changes drawer.
- `/studio/<package>/automations` opens the flow list; with `?surface=flow:<name>`, that flow's designer.
- `/studio/<package>/access` opens the permission set list; with `?surface=permission:<name>`, that set's matrix; with `?surface=owd:overview`, the default sharing overview.
- `/studio/<package>/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/<package>` 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`.
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,20 @@ vi.mock('@object-ui/app-shell', async (importOriginal) => ({
LoadingFallback: () => <div data-testid="loading" />,
LoadingScreen: () => <div data-testid="error-screen" />,
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: () => <div data-testid="studio-entry">entry</div>,
StudioDesignSurface: () => <div data-testid="studio-pillar-builder">pillars</div>,
// objectstack#36909 — the retired pillar addresses' redirect rides in the same module.
StudioPillarRedirect: (await vi.importActual<typeof import('@object-ui/app-shell')>('@object-ui/app-shell'))
.StudioPillarRedirect,
};
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -80,23 +80,34 @@ function SurfaceMarker({ area }: { area?: string }) {
);
}

vi.mock('./studioBuilder', () => ({
vi.mock('./studioBuilder', async () => ({
StudioEntryRedirect: () => <div data-testid="studio-entry" />,
StudioDesignSurface: SurfaceMarker,
StudioMetadataArea: ({ packageId }: { packageId: string | null }) => (
<div data-testid="studio-metadata-area" data-package={String(packageId)} />
),
// objectstack#36909 — the retired pillar addresses' redirect, real: its table is what the last describe walks.
StudioPillarRedirect: (await vi.importActual<typeof import('@object-ui/app-shell')>('@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 <div data-testid="pathname">{`${pathname}${search}`}</div>;
const here = `${pathname}${search}`;
React.useEffect(() => {
seen.push(here);
}, [here]);
return <div data-testid="pathname">{here}</div>;
}

function renderStudio(url: string) {
seen = [];
return render(
<MemoryRouter initialEntries={[url]}>
<LocationProbe />
Expand Down Expand Up @@ -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', '');
});

Expand Down Expand Up @@ -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]);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,12 @@ vi.mock('@object-ui/app-shell', async (importOriginal) => ({
useHomePath: () => '/home',
}));

vi.mock('./studioBuilder', () => ({
vi.mock('./studioBuilder', async () => ({
StudioEntryRedirect: () => <div data-testid="studio-entry">entry</div>,
StudioDesignSurface: () => <div data-testid="studio-pillar-builder">pillars</div>,
// objectstack#36909 — the retired pillar addresses' redirect, real.
StudioPillarRedirect: (await vi.importActual<typeof import('@object-ui/app-shell')>('@object-ui/app-shell'))
.StudioPillarRedirect,
}));

import { RecentItemsProvider, useRecentItems } from '@object-ui/app-shell';
Expand Down Expand Up @@ -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();
Expand All @@ -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);
Expand Down
12 changes: 7 additions & 5 deletions ui/apps/console/src/components/StudioRoute.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down
Loading
Loading