From db6e4a61c897c49588aa61efeaea47f31d0bb0d0 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Nov 2026 10:02:51 +0000 Subject: [PATCH 1/9] feat(app-shell)!: retire Studio's package-less scope Studio's `~org` scope (`/studio/~org/...`) listed the flows that belong to no package. Those items are listed on the cross-package leg's "Loose" source value now, where they are selected and moved into a package, so the scope has no page left. - Every address of the scope lands on the Loose list of flows, `/studio/~all/metadata/flow?source=loose`, keeping the list's search and sort. One function maps them (`retiredOrgScopeTarget`); the console's routes, the design surface, the pillar redirect and the area's leg redirect call it. The segment stays reserved. - The left menu's organization-flows row, the scope's area mode, its Changes row and its flow-by-flow batch publish are removed. A draft of no package publishes from Home's Publish all and from its item page. - A flow that belongs to no package opens on its item page on the cross-package leg; the flow designer is a package's. - Studio's entry and the new-package doors send a principal who may not open Setup's Packages page to the same Loose list. - Nine `@object-ui/i18n` studio keys that only the scope read are removed, and the not-found state's way out is renamed for where it leads. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01FEkQ5onqzpaipgzBKwyCbm --- .../StudioRoute.lazyBuilder-11798.test.tsx | 1 - .../StudioRoute.metadataArea-28561.test.tsx | 22 +- .../StudioRoute.recentPackage-11863.test.tsx | 5 +- .../src/components/StudioRoute.test.tsx | 15 +- .../console/src/components/StudioRoute.tsx | 50 +- ui/packages/app-shell/README.md | 43 +- .../CommandPalette.studioScope-11863.test.tsx | 7 +- .../app-shell/src/chrome/CommandPalette.tsx | 15 +- .../HomePage.noAgentsBuildChip-26614.test.tsx | 10 +- ui/packages/app-shell/src/index.ts | 21 +- .../__tests__/SidebarAppMenu-36112.test.tsx | 12 +- .../views/metadata-admin/ResourceListPage.tsx | 6 +- .../studio-locale.i18n.test.tsx | 3 +- .../src/views/setup/accessDirectory.test.ts | 3 + ...utomationsPillar.newSimilar-28567.test.tsx | 19 +- .../views/studio-design/AutomationsPillar.tsx | 72 ++- .../studio-design/ObjectActionsPanel.tsx | 4 +- .../views/studio-design/StudioBackToApp.tsx | 7 +- ...gnSurface.designerRegistryMissing.test.tsx | 8 +- ...oDesignSurface.metadataArea-28561.test.tsx | 9 +- ...tudioDesignSurface.notFound-26708.test.tsx | 28 +- ...ignSurface.packageLessFlows-11553.test.tsx | 447 +++++++++--------- ...oDesignSurface.publishCount-11807.test.tsx | 65 +-- .../studio-design/StudioDesignSurface.tsx | 14 +- .../StudioEntryRedirect.test.tsx | 50 +- .../studio-design/StudioEntryRedirect.tsx | 5 +- .../StudioMenu.overview-37454.test.tsx | 5 +- .../views/studio-design/StudioMenu.test.tsx | 29 +- .../src/views/studio-design/StudioMenu.tsx | 8 +- .../studio-design/StudioMetadataArea.tsx | 42 +- .../StudioPackageMenu-37139.test.tsx | 5 +- .../views/studio-design/StudioPackageMenu.tsx | 2 +- .../StudioPackageOverview-37454.test.tsx | 12 +- .../studio-design/StudioPackageSwitcher.tsx | 16 +- ...oPaletteGroups.surfaceScope-36900.test.tsx | 7 +- .../studio-design/StudioPaletteGroups.tsx | 5 +- .../studio-design/StudioSurfaceFrame.tsx | 56 +-- .../views/studio-design/StudioSurfacePage.tsx | 35 +- .../StudioTopLeft-37456.test.tsx | 42 +- .../src/views/studio-design/StudioTopLeft.tsx | 64 +-- .../automationsPillarRedirect.test.ts | 16 +- .../automationsPillarRedirect.ts | 36 +- .../views/studio-design/metadataArea.test.ts | 61 ++- .../src/views/studio-design/metadataArea.ts | 101 +--- .../views/studio-design/packageSurfaces.ts | 2 +- .../views/studio-design/studioAddress.test.ts | 12 +- .../src/views/studio-design/studioAddress.ts | 23 +- .../views/studio-design/studioAddressTable.ts | 16 +- .../studio-design/studioEntryPermissions.ts | 26 +- .../studioInterfacesRetired.test.ts | 4 +- .../src/views/studio-design/studioMenuData.ts | 1 - .../studio-design/studioMenuModel.test.ts | 53 ++- .../views/studio-design/studioMenuModel.ts | 39 +- .../studioOrgScopeRetired.test.ts | 128 +++++ .../studio-design/studioOrgScopeRetired.ts | 72 +++ .../studioPillarRedirectModel.test.ts | 34 +- .../studioPillarRedirectModel.ts | 22 +- .../views/studio-design/studioScope.test.ts | 69 +-- .../src/views/studio-design/studioScope.ts | 106 +---- .../studio-design/studioSurfaceDrafts.tsx | 26 +- .../studio-design/studioSurfaceNavigation.tsx | 11 +- .../studio-design/studioSurfacePublish.ts | 72 +-- .../studio-design/studioSurfaceRightSlot.tsx | 3 +- .../views/studio-design/studioSurfaceScope.ts | 29 +- .../studioZhPillarNames-11801.test.ts | 14 +- ui/packages/i18n/src/namespaces/studio/en.ts | 23 +- ui/packages/i18n/src/namespaces/studio/zh.ts | 14 +- 67 files changed, 1094 insertions(+), 1188 deletions(-) create mode 100644 ui/packages/app-shell/src/views/studio-design/studioOrgScopeRetired.test.ts create mode 100644 ui/packages/app-shell/src/views/studio-design/studioOrgScopeRetired.ts 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 a727a667d39..6f62194f661 100644 --- a/ui/apps/console/src/components/StudioRoute.lazyBuilder-11798.test.tsx +++ b/ui/apps/console/src/components/StudioRoute.lazyBuilder-11798.test.tsx @@ -87,7 +87,6 @@ vi.mock('@object-ui/app-shell', async (importOriginal) => ({ RedirectWithSplash: () =>
, LoadingFallback: () =>
, LoadingScreen: () =>
, - STUDIO_ORG_SCOPE_SEGMENT: '~org', getProductName: () => 'ObjectOS', useHomePath: () => '/home', })); 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 6c17ff90218..0e46ab55275 100644 --- a/ui/apps/console/src/components/StudioRoute.metadataArea-28561.test.tsx +++ b/ui/apps/console/src/components/StudioRoute.metadataArea-28561.test.tsx @@ -204,8 +204,9 @@ describe('/studio — the "All metadata" area\'s routes (objectstack#28561)', () it.each([ '/studio/~all/metadata', '/studio/com.example.crm/metadata', - // objectstack#36899 — the left menu's targets that are not an area list. + // objectstack#38150 — the retired package-less scope's addresses redirect, and only past the gate. '/studio/~org/automations', + '/studio/~org/metadata/flow?source=runtime', // objectstack#36905 — the sharing overview's own route, and the old address that redirects to it. '/studio/com.example.crm/owd', '/studio/com.example.crm/access?surface=owd%3Aoverview', @@ -255,10 +256,21 @@ describe('/studio — every retired pillar address redirects once, to its new ad [`/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'], + // objectstack#38150 — the retired package-less scope: its bare leg, the pillar it had, a + // flow that pillar named, its leg of the area (the list, a flow, a flow's history), and an + // address with other query keys. One target, the Loose list of flows; the list's search kept. + ['/studio/~org', '/studio/~all/metadata/flow?source=loose'], + ['/studio/~org/automations', '/studio/~all/metadata/flow?source=loose'], + ['/studio/~org/automations?surface=flow%3Aclone_1', '/studio/~all/metadata/flow?source=loose'], + ['/studio/~org/data', '/studio/~all/metadata/flow?source=loose'], + ['/studio/~org/metadata', '/studio/~all/metadata/flow?source=loose'], + ['/studio/~org/metadata/flow?source=runtime', '/studio/~all/metadata/flow?source=loose'], + ['/studio/~org/metadata/flow/clone_1?source=runtime', '/studio/~all/metadata/flow?source=loose'], + ['/studio/~org/metadata/flow/clone_1/history?source=runtime', '/studio/~all/metadata/flow?source=loose'], + [ + '/studio/~org/metadata/flow?source=runtime&q=clone&sort=label.desc&changes=review&package=~org', + '/studio/~all/metadata/flow?source=loose&q=clone&sort=label.desc', + ], ])('%s → %s, in one redirect', async (from, to) => { renderStudio(from); await waitFor(() => expect(location()).toBe(to)); 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 b6ffba0a0f5..cda401b6792 100644 --- a/ui/apps/console/src/components/StudioRoute.recentPackage-11863.test.tsx +++ b/ui/apps/console/src/components/StudioRoute.recentPackage-11863.test.tsx @@ -193,9 +193,12 @@ describe('/studio/PKG/TAB records the package as a recent entry (objectui#11863) expect(recent()).toEqual(JSON.parse(before ?? '[]')); }); - it("the package-less scope is not a package, and Studio's entry is not a visit: neither records anything", async () => { + // objectstack#38150 — the package-less scope is retired: its address redirects to the Loose + // list of flows on the cross-package leg, which is no package either and records nothing. + it("the retired package-less scope's address is not a package, and Studio's entry is not a visit: neither records anything", async () => { renderStudio('/studio/~org/automations'); await screen.findByTestId('studio-pillar-builder'); + expect(screen.getByTestId('pathname').textContent).toBe('/studio/~all/metadata/flow'); cleanup(); renderStudio('/studio'); diff --git a/ui/apps/console/src/components/StudioRoute.test.tsx b/ui/apps/console/src/components/StudioRoute.test.tsx index d6eb4391b5c..ee509e21a9d 100644 --- a/ui/apps/console/src/components/StudioRoute.test.tsx +++ b/ui/apps/console/src/components/StudioRoute.test.tsx @@ -379,20 +379,21 @@ describe('/studio/* — the entry decision, both ways', () => { expect(screen.queryByText(NOTICE)).not.toBeInTheDocument(); }); - 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 an object list that scope does not have. objectstack#36909 — in - // one hop, not through the retired Automations pillar's address. + // objectstack#38150 — rewritten on purpose: the package-less scope is retired. It landed on + // `/studio/~org/metadata/flow?source=runtime`, that scope's own flow list. + it('the retired package-less scope\'s bare leg lands on the Loose list of flows, the builder mounted (objectui#11553)', async () => { + // `~org` was the segment of the organization's own, package-less flows and + // stays reserved. Without its own leg it falls to `:packageId`, which would + // read it as a package id and open that package's overview. answerWith(OPERATOR_CAPS); renderStudioDeepLink('/studio/~org'); - await waitFor(() => expect(pathname()).toBe('/studio/~org/metadata/flow?source=runtime')); + await waitFor(() => expect(pathname()).toBe('/studio/~all/metadata/flow?source=loose')); await waitFor(() => expect(screen.getByTestId('studio-pillar-builder')).toBeInTheDocument()); expect(designSurface).toHaveBeenCalled(); }); - it('the package-less scope is behind the same entry gate (objectui#11553)', async () => { + it('the retired package-less scope\'s addresses are behind the same entry gate (objectui#11553)', async () => { renderStudioDeepLink('/studio/~org/automations'); await expectRefusedAt('/studio/~org/automations', '/home'); diff --git a/ui/apps/console/src/components/StudioRoute.tsx b/ui/apps/console/src/components/StudioRoute.tsx index 290cfbfcbe3..bb6fec0339c 100644 --- a/ui/apps/console/src/components/StudioRoute.tsx +++ b/ui/apps/console/src/components/StudioRoute.tsx @@ -35,20 +35,20 @@ */ import { lazy, Suspense, useEffect, type ReactNode } from 'react'; -import { Link, Navigate, Outlet, Route, useParams } from 'react-router-dom'; +import { Link, Navigate, Outlet, Route, useLocation, useParams } from 'react-router-dom'; import { Lock } from 'lucide-react'; import { Button, Empty, EmptyTitle } from '@object-ui/components'; import { ACCESS_DIRECTORY_PATH, LoadingFallback, LoadingScreen, + RETIRED_ORG_SCOPE_SEGMENT, STUDIO_ALL_PACKAGES_SEGMENT, STUDIO_METADATA_AREA, - STUDIO_ORG_SCOPE_SEGMENT, StudioEntryPermissionsProvider, holdsSetupAccess, + retiredOrgScopeTarget, studioMetadataAreaPath, - studioOrgScopePath, studioPackagePath, useHomePath, usePhoneViewport, @@ -194,8 +194,8 @@ export function StudioRoute() { /** * Bare `/studio` (objectstack#36908, epic #36890 decision 9): Studio's entry, * which draws no page. It opens the package the author was last in, else the - * package list: Setup → Packages for a principal who may open it, the "All - * metadata" area across packages otherwise (`StudioEntryRedirect` in + * package list: Setup → Packages for a principal who may open it, the Loose + * list of flows on the cross-package leg otherwise (`StudioEntryRedirect` in * app-shell). The package-card home it used to draw was removed; Studio is * entered from an app or from Setup → Packages. */ @@ -219,14 +219,15 @@ function StudioEntry() { * which lands on its 概览 Overview (`/studio/PKG/overview`) — and no label: a reader labels it from the * package list it loads (objectui#11678's shape). Keyed on the package, not the * 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. + * and the provider writes nothing. The cross-package leg (`~all`) is not a + * package and records nothing; the retired `~org` segment never reaches this + * element (`StudioOrgScopeRetired`). */ function StudioPackageBuilder({ area }: { area?: typeof STUDIO_METADATA_AREA }) { const { packageId } = useParams(); const { addRecentItem } = useRecentItems(); useEffect(() => { - if (!packageId || packageId === STUDIO_ORG_SCOPE_SEGMENT || packageId === STUDIO_ALL_PACKAGES_SEGMENT) return; + if (!packageId || packageId === STUDIO_ALL_PACKAGES_SEGMENT) return; addRecentItem({ id: `package:${packageId}`, type: 'package', @@ -261,6 +262,17 @@ function StudioAllLegAddress() { return ; } +/** + * objectstack#38150 — the retired package-less scope (`/studio/~org/...`): + * every address of it lands on the Loose list of flows on the cross-package + * leg, keeping its search and sort (`retiredOrgScopeTarget` in app-shell). + * Decided here, before the builder's chunk is requested. + */ +function StudioOrgScopeRetired() { + const { search } = useLocation(); + return ; +} + function StudioPillarAddress({ children }: { children?: ReactNode }) { return ( }> @@ -279,7 +291,8 @@ function StudioPillarAddress({ children }: { children?: ReactNode }) { * 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 flow list + * `/studio/~org/*` the retired package-less scope: every address of it lands + * on the Loose list of flows (objectstack#38150) * `/studio/~all/*` lands on Setup's environment directory (objectstack#37565), * or the cross-package area for one who may not open Setup * `/studio/:packageId` a package lands on its 概览 Overview (a pair's, its base's) @@ -288,19 +301,21 @@ function StudioPillarAddress({ children }: { children?: ReactNode }) { * 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). 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). + * `~org` was the segment of the organization's own, package-less flows + * (objectui#11553), retired by objectstack#38150; it stays reserved + * (`studioOrgScopeRetired.ts` in app-shell says why `~` can never name a + * package). It has two routes on one element, because the router ranks a + * route by its segments: `~org/*` outranks `:packageId` and `:packageId/:tab`, + * and only `~org/metadata/*` outranks `:packageId/metadata/*`, which would + * otherwise hand an old area address to the builder as a package id. * * objectstack#28561 — the "All metadata" area (ADR-0146 D1) has routes of its * own because its pages nest below it (`StudioMetadataArea` declares them), and * `:packageId/:tab` matches one segment: an area URL such as * `/studio/crm/metadata/flow` would match no route at all. The static * `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 Setup's environment + * cross-package segment (`metadataArea.ts` in app-shell says why it is + * reserved); every `~all` URL outside the area lands on Setup's environment * directory, the leg's root's page since it moved out of Studio * (objectstack#37565), so none reaches the builder as a package id. * @@ -321,7 +336,8 @@ function StudioPillarAddress({ children }: { children?: ReactNode }) { export const studioRoutes = ( }> } /> - } /> + } /> + } /> } diff --git a/ui/packages/app-shell/README.md b/ui/packages/app-shell/README.md index 16ace9c028c..cdc4ecfb11c 100644 --- a/ui/packages/app-shell/README.md +++ b/ui/packages/app-shell/README.md @@ -793,26 +793,29 @@ On the declared page: rule already switched off has no served projection, so its clone continues in the pre-filled New form, which asks for the criteria. -### Package-less flows (`/studio/~org/metadata/flow`) - -A flow that belongs to no package — a clone of a packaged flow is one, by -ADR-0126 §7.1 — matches no package scope, so Studio gives it one scope of its -own, segment `STUDIO_ORG_SCOPE_SEGMENT` (`~org`): its own leg of the "All -metadata" area. The list is `/studio/~org/metadata/flow?source=runtime` and a -flow opens full-screen in the flow designer at -`/studio/~org/metadata/flow/?source=runtime` (`studioOrgScopePath()`, -`orgScopeFlowOf()`). It is the same `StudioDesignSurface` with no package under -it, reached from the Studio home and the left menu. The list holds every flow -whose served `_packageId` names no package and offers no create; each flow opens -editable and saves package-less drafts. An empty list says how a packaged flow -is changed instead (in its package, with New similar). Publish promotes the -scope's drafts one by one through the single-item publish door, because the -package batch publish cannot reach a draft bound to no package. `~` is outside -every package-id alphabet, so the segment can never name a package. A package's -address naming a package-less flow opens it in this scope; one naming a flow -nowhere held says so and opens no other flow. The retired -`/studio/~org/automations` addresses (with or without `?surface=flow:`) -redirect to the list or the flow (objectstack#36903). +### Items that belong to no package (the "Loose" list) + +A metadata item that belongs to no package — a clone of a packaged flow is one, +by ADR-0126 §7.1 — is in no package's list. A type's list on the "All metadata" +area's cross-package leg holds every package's items and those of none, and its +source filter's "Loose" value narrows it to the latter +(`/studio/~all/metadata/?source=loose`, `looseListPath()`). There a +person who may author metadata selects loose items and moves them into a +package (objectstack#38150). A loose row opens the item's page on the same leg +(`/studio/~all/metadata//`, `packageLessItemPath()`), where its +draft is published or discarded; Home's Publish all publishes it too. A +package's address naming a flow that belongs to no package opens that flow's +page there; one naming a flow nowhere held says so and opens no other flow. The +flow designer opens a package's flows only. + +Studio's package-less scope, which listed the flows among these items at +`/studio/~org/metadata/flow`, is retired. Every `/studio/~org/...` address — +the list, a flow, the old `/studio/~org/automations` deep links, and a +`?package=~org` link — lands on the Loose list of flows, +`/studio/~all/metadata/flow?source=loose`, keeping the address's search (`q`) +and sort (`sort`) (`retiredOrgScopeTarget()`, segment +`RETIRED_ORG_SCOPE_SEGMENT`). `~` is outside every package-id alphabet, so the +segment can never name a package. ### Access matrix (package-scoped) diff --git a/ui/packages/app-shell/src/chrome/CommandPalette.studioScope-11863.test.tsx b/ui/packages/app-shell/src/chrome/CommandPalette.studioScope-11863.test.tsx index 47f5374bf95..c56998cacc2 100644 --- a/ui/packages/app-shell/src/chrome/CommandPalette.studioScope-11863.test.tsx +++ b/ui/packages/app-shell/src/chrome/CommandPalette.studioScope-11863.test.tsx @@ -218,11 +218,14 @@ describe('the palette in the `studio` scope lists the Studio, not an app (object ); }); - it('opens a package-less flow in the package-less scope (objectui#11553)', async () => { + // objectstack#38150 — rewritten on purpose: the package-less scope is retired, so the flow opens + // on its item page on the cross-package leg, the page its row of the Loose list opens. It opened + // `/studio/~org/metadata/flow/org_cleanup?source=runtime`. + it('opens a package-less flow on its item page on the cross-package leg (objectui#11553)', async () => { mountStudio(); await studioListed(); pick('studio-flow Nightly Cleanup '); - await waitFor(() => expect(locationNow()).toBe('/studio/~org/metadata/flow/org_cleanup?source=runtime')); + await waitFor(() => expect(locationNow()).toBe('/studio/~all/metadata/flow/org_cleanup')); }); it('matches an entry by its label or its machine name', async () => { diff --git a/ui/packages/app-shell/src/chrome/CommandPalette.tsx b/ui/packages/app-shell/src/chrome/CommandPalette.tsx index e928315fac4..a1bcdc16a27 100644 --- a/ui/packages/app-shell/src/chrome/CommandPalette.tsx +++ b/ui/packages/app-shell/src/chrome/CommandPalette.tsx @@ -83,7 +83,7 @@ import { useNavTargetColor } from '../hooks/useNavTargetIcon.js'; import { useAuth } from '@object-ui/auth'; import { matchesPaletteQuery } from './paletteMatch.js'; import { fetchPackages, type PkgEntry } from '../views/studio-design/packages-io.js'; -import { isPackageLessItem, studioOrgScopePath } from '../views/studio-design/studioScope.js'; +import { isPackageLessItem, packageLessItemPath } from '../views/studio-design/studioScope.js'; import { studioItemPath } from '../views/studio-design/studioAddress.js'; import { studioPackageOverviewPath } from '../views/studio-design/studioOverviewAddress.js'; import { flattenNavigation, useAppReportEntries } from '../views/appReportIndex.js'; @@ -1101,10 +1101,10 @@ const NO_STUDIO_ENTRIES: StudioPaletteEntries = { packages: [], objects: [], flo * package's Data pillar. One whose package is not in the list has no Studio * page to open, and is left out. * - **Flows** come from the same cache's `flow` list, the unscoped read that - * carries every package's flows (the read the package-less scope narrows, - * see `loadPackageLessSurfaces`). A packaged flow opens in its package's - * Automations pillar; a flow that belongs to no package opens in the - * package-less scope (objectui#11553). + * carries every package's flows and the flows of none. A packaged flow + * opens in its package's flow designer; a flow that belongs to no package + * opens its item page on the cross-package leg (`packageLessItemPath`, + * objectui#11553, objectstack#38150). * * The published items only: an item that is still a draft is not in either * cache list. Until the package list answers nothing is listed, so no entry @@ -1175,10 +1175,11 @@ function useStudioPaletteEntries(enabled: boolean, crossPackageItems = true): St const label = resolveKeyedI18nLabel(item.label, t) || item.name; if (isPackageLessItem(item)) { flows.push({ - key: `~org:${item.name}`, + // `~` is outside every package-id alphabet, so the key meets no packaged entry's. + key: `~loose:${item.name}`, label, name: item.name, - href: studioOrgScopePath({ type: 'flow', name: item.name }), + href: packageLessItemPath({ type: 'flow', name: item.name }), }); continue; } diff --git a/ui/packages/app-shell/src/console/home/__tests__/HomePage.noAgentsBuildChip-26614.test.tsx b/ui/packages/app-shell/src/console/home/__tests__/HomePage.noAgentsBuildChip-26614.test.tsx index 01b82477f44..b50e700b22b 100644 --- a/ui/packages/app-shell/src/console/home/__tests__/HomePage.noAgentsBuildChip-26614.test.tsx +++ b/ui/packages/app-shell/src/console/home/__tests__/HomePage.noAgentsBuildChip-26614.test.tsx @@ -249,13 +249,15 @@ describe('with no agent in the catalog (objectstack#26614)', () => { expect(SETUP_NEW_PACKAGE_PATH).toBe('/apps/setup/component/developer/packages?face=admin&new=package'); }); - // objectstack#37565 — the package-less scope: the "All metadata" area across packages it went to is Setup's now. - it('an author who may enter Studio but not Setup → Packages is sent to the package-less scope, never Setup (objectstack#36908)', async () => { + // objectstack#37565 — the "All metadata" area across packages it went to is Setup's now. + // objectstack#38150 — and the package-less scope it went to next is retired: the Loose list of + // flows, where that scope's addresses land. + it('an author who may enter Studio but not Setup → Packages is sent to the Loose list of flows, never Setup (objectstack#36908)', async () => { state.setupPair = false; const user = userEvent.setup(); render(); await user.click(await screen.findByTestId('home-build-in-studio')); - expect(navigateMock).toHaveBeenCalledWith('/studio/~org/metadata/flow?source=runtime'); + expect(navigateMock).toHaveBeenCalledWith('/studio/~all/metadata/flow?source=loose'); expect(navigateMock).not.toHaveBeenCalledWith(SETUP_NEW_PACKAGE_PATH); }); @@ -269,7 +271,7 @@ describe('with no agent in the catalog (objectstack#26614)', () => { */ it.each([ ['an unreported set (no `systemPermissions`) fails open, to Setup\'s New Package', undefined, SETUP_NEW_PACKAGE_PATH], - ['control: a reported set without the pair goes to the package-less scope', ['manage_metadata'], '/studio/~org/metadata/flow?source=runtime'], + ['control: a reported set without the pair goes to the Loose list of flows', ['manage_metadata'], '/studio/~all/metadata/flow?source=loose'], ])('%s', async (_case, systemPermissions, to) => { state.setupPair = 'unreported'; const answer: MePermissionsAuthenticatedResponse = { diff --git a/ui/packages/app-shell/src/index.ts b/ui/packages/app-shell/src/index.ts index 7bb4bf78f63..a0820b13e6d 100644 --- a/ui/packages/app-shell/src/index.ts +++ b/ui/packages/app-shell/src/index.ts @@ -617,8 +617,8 @@ export { // `/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 +// `/studio//data`, `/automations`, `/access`, `/interfaces`, and +// every `/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'; @@ -629,15 +629,16 @@ export { StudioEntryPermissionsProvider, useStudioEntryPermissions, } from './views/studio-design/studioEntryPermissions.js'; -// The one Studio scope that is not a package (objectui#11553): the -// organization's own package-less flows, listed at -// `/studio/~org/metadata/flow?source=runtime` (objectstack#36903; the old -// `/studio/~org/automations` redirects there). A host that declares the -// `/studio` routes reads the reserved segment from here. +// objectstack#38150 — Studio's package-less scope (`/studio/~org/...`) is +// retired: every address of it lands on the Loose list of flows on the +// cross-package leg, `/studio/~all/metadata/flow?source=loose`. The surface +// and `StudioPillarRedirect` redirect the addresses they mount on; a host +// that declares the `/studio` routes reads the reserved segment and the +// target from here, to answer those addresses on a route of its own. export { - STUDIO_ORG_SCOPE_SEGMENT, - studioOrgScopePath, -} from './views/studio-design/studioScope.js'; + RETIRED_ORG_SCOPE_SEGMENT, + retiredOrgScopeTarget, +} from './views/studio-design/studioOrgScopeRetired.js'; // 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 diff --git a/ui/packages/app-shell/src/layout/__tests__/SidebarAppMenu-36112.test.tsx b/ui/packages/app-shell/src/layout/__tests__/SidebarAppMenu-36112.test.tsx index 503b4862f60..76dab385653 100644 --- a/ui/packages/app-shell/src/layout/__tests__/SidebarAppMenu-36112.test.tsx +++ b/ui/packages/app-shell/src/layout/__tests__/SidebarAppMenu-36112.test.tsx @@ -318,11 +318,13 @@ describe('「Add app」 offers 「New blank app」 whatever the catalog serves, ]); }); - // objectstack#37565 — the cross-package directory moved to Setup; the door is Studio's package-less scope, for now. - it('an author who may enter Studio but not Setup → Packages is sent to Studio\'s package-less scope, never Setup (objectstack#36908)', () => { + // objectstack#37565 — the cross-package directory moved to Setup. objectstack#38150 — the + // package-less scope the door opened next is retired: Studio's Loose list of flows, where + // that scope's addresses land. + it('an author who may enter Studio but not Setup → Packages is sent to Studio\'s Loose list of flows, never Setup (objectstack#36908)', () => { setupPair = false; const choices = addChoices(); - expect(choices.getByTestId('sidebar-app-menu-add-new-in-studio')).toHaveAttribute('href', '/studio/~org/metadata/flow?source=runtime'); + expect(choices.getByTestId('sidebar-app-menu-add-new-in-studio')).toHaveAttribute('href', '/studio/~all/metadata/flow?source=loose'); }); it.each([ @@ -686,14 +688,14 @@ describe('the docs portal\'s head names no app and only switches apps (objectsta expect(choices.queryByText('Build with AI')).toBeNull(); }); - it('an author who may not open Setup → Packages gets 「New blank app」 to Studio\'s package-less scope (objectstack#37565)', () => { + it('an author who may not open Setup → Packages gets 「New blank app」 to Studio\'s Loose list of flows (objectstack#37565, objectstack#38150)', () => { setupPair = false; apps = [CRM]; admin = true; renderPortalMenu(); expect( within(screen.getByTestId('add-app-choices')).getByTestId('sidebar-app-menu-add-new-in-studio'), - ).toHaveAttribute('href', '/studio/~org/metadata/flow?source=runtime'); + ).toHaveAttribute('href', '/studio/~all/metadata/flow?source=loose'); }); it('guard: handed no entries, it draws no 「Add app」 and no separator for it', () => { diff --git a/ui/packages/app-shell/src/views/metadata-admin/ResourceListPage.tsx b/ui/packages/app-shell/src/views/metadata-admin/ResourceListPage.tsx index 6188e1050da..f5c405b7bf3 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/ResourceListPage.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/ResourceListPage.tsx @@ -841,10 +841,8 @@ function DefaultMetadataList({ type, appName }: { type: string; appName?: string
); } - if (opens.designer && type === 'flow') { - // objectstack#36903 — the flow designer, full-screen on the flow's - // address. The package-less scope's flows are the organization's own and - // open writable (its area is read-only to the list's create alone). + if (opens.designer && host?.packageId && type === 'flow') { + // objectstack#36903 — the flow designer, full-screen on the flow's address. return (
StudioRefusal | null; - /** - * objectstack#36903 — the area of the package-less scope (`~org`, with no - * `packageId`): its flows, listed and opened full-screen. It creates nothing - * (`studioScope.ts`), so its host is read-only to the list's create. - */ - orgScope?: boolean; /** objectstack#36904, objectstack#36903 — handed to the object and flow designers (`AreaEditorProps`). */ onHeldEditChange?: (clause: string | null) => void; onReviewChanges?: () => void; @@ -424,7 +409,6 @@ export function StudioMetadataArea({ publishNonce = 0, onDraftSaved, publishRefusalFor, - orgScope = false, onHeldEditChange, onReviewChanges, }: StudioMetadataAreaProps): React.ReactElement { @@ -432,39 +416,31 @@ export function StudioMetadataArea({ const locale = useMetadataLocale(); // objectstack#37565 — whoever may open Setup has the leg's directory there. const toSetup = holdsSetupAccess(useStudioEntryPermissions()); - const segment = packageId ?? (orgScope ? STUDIO_ORG_SCOPE_SEGMENT : STUDIO_ALL_PACKAGES_SEGMENT); + const segment = packageId ?? STUDIO_ALL_PACKAGES_SEGMENT; const basePath = studioMetadataAreaPath(segment); // The courtesy gate the pillars apply, read for the area from the listed // manifests (see the hook). Unknown stays ungated, as on the pillars: the // server's write gate is the authority, and a failed probe must not lock an // author out of a writable package. const { writable, kernel } = useListedPackageWritable(packageId); - // objectstack#36903 — the package-less scope creates nothing: read-only to - // the list's create (its designer opens writable, `AreaItemOpen`). - const readOnly = orgScope || (packageId !== null && writable === false); + const readOnly = packageId !== null && writable === false; // objectstack#36897 — the list offers a create exactly where `AreaCreate` // opens one in the pair; never on a kernel package, which has none. const pairCreate = readOnly && !kernel && !!customization && !customization.walled; - // objectstack#36903 — the scope's empty flow list keeps the guidance its - // pillar's empty state gave: a packaged flow is changed in its package, with - // New similar (ADR-0146 D11). - const emptyListHint = orgScope ? t('engine.studio.org.none', locale) : undefined; const host = React.useMemo( () => ({ packageId, readOnly, basePath, ...(pairCreate ? { pairCreate } : {}), - ...(emptyListHint ? { emptyListHint } : {}), }), - [packageId, readOnly, basePath, pairCreate, emptyListHint], + [packageId, readOnly, basePath, pairCreate], ); const editor: AreaEditorProps = { customization, publishNonce, onDraftSaved, publishRefusalFor, - orgScope, onHeldEditChange, onReviewChanges, }; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioPackageMenu-37139.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioPackageMenu-37139.test.tsx index 86b10801b65..8fcf49634b9 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioPackageMenu-37139.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioPackageMenu-37139.test.tsx @@ -330,10 +330,13 @@ describe('no 「⋯」 without a current package or without manage_metadata (obj // check asks for the overview's own address on the two scopes: neither draws // it, so neither draws the menu. (Asked on their other pages it would pass // whatever the scopes did, the overview being absent there anyway.) + // objectstack#38150 — `~org` is retired: its overview address redirects to + // the Loose list of flows on the cross-package leg, which the leg's + // switcher names; the page it used to draw is gone. it.each(['en-US', 'zh-CN'] as const)('%s: none on ~org/overview and none on ~all/overview', async (locale) => { localeFixture = locale; renderAt('/studio/~org/overview'); - await waitFor(() => expect(within(header()).getByTestId('studio-pkg-switcher-name')).toHaveTextContent(t('engine.studio.pkg.orgScope', locale)), { + await waitFor(() => expect(within(header()).getByTestId('studio-pkg-switcher-name')).toHaveTextContent(t('engine.studio.menu.environment', locale)), { timeout: 8000, }); expect(screen.queryByTestId('studio-package-overview')).toBeNull(); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioPackageMenu.tsx b/ui/packages/app-shell/src/views/studio-design/StudioPackageMenu.tsx index 6357edf4f4b..67083656f8e 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioPackageMenu.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioPackageMenu.tsx @@ -33,7 +33,7 @@ * B), reached by Manage in Setup…. * * The host draws the menu only where there is a current package (never on - * `~org` or `~all`) and only for a `manage_metadata` holder + * `~all`) and only for a `manage_metadata` holder * (`useCanAuthorMetadata`). Writability the host has not learned yet (still * reading, or the read failed) greys nothing: the server's write gate stays the * authority, the same courtesy posture as the rest of Studio. diff --git a/ui/packages/app-shell/src/views/studio-design/StudioPackageOverview-37454.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioPackageOverview-37454.test.tsx index dce3223253b..b97e08b5bab 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioPackageOverview-37454.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioPackageOverview-37454.test.tsx @@ -98,7 +98,7 @@ import { t, tFormat } from '../metadata-admin/i18n'; import { formatChangedAt } from '../metadata-admin/listChangedAt'; import { STUDIO_PACKAGE_MENU_ITEMS } from './StudioPackageMenu'; import { StudioPackageOverviewPage, type StudioPackageOverviewPageProps } from './StudioPackageOverviewPage'; -import { studioOrgScopePath } from './studioScope'; +import { retiredOrgScopeTarget } from './studioOrgScopeRetired'; const OWN = 'com.example.sales'; const INSTALLED = 'com.vendor.crm'; @@ -522,14 +522,16 @@ describe('the overview\'s branch order (objectstack#37454)', () => { }); // Two doors stand in front of it: the pillar redirect, which sends every - // `~org` address but Automations to the scope's area, and the surface's own - // guard behind it. Each is read on its own. + // address of the retired package-less scope to the Loose list of flows + // (objectstack#38150), and the surface's own guard behind it. Each is read + // on its own. it.each([ ['through the route as the console mounts it', false], ['the surface alone: its own guard', true], - ])('the package-less scope has no overview: ~org/overview redirects to its area (%s)', async (_door, bare) => { + ])('the retired package-less scope has no overview: ~org/overview redirects to the Loose list of flows (%s)', async (_door, bare) => { renderSurfaceAt('/studio/~org/overview', { bare }); - await waitFor(() => expect(screen.getByTestId('where')).toHaveTextContent(studioOrgScopePath()), { timeout: 8000 }); + await waitFor(() => expect(screen.getByTestId('where').textContent).toBe(retiredOrgScopeTarget()), { timeout: 8000 }); + expect(retiredOrgScopeTarget()).toBe('/studio/~all/metadata/flow?source=loose'); expect(screen.queryByTestId('studio-package-overview')).toBeNull(); expect(screen.queryByTestId('studio-package-menu')).toBeNull(); }); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioPackageSwitcher.tsx b/ui/packages/app-shell/src/views/studio-design/StudioPackageSwitcher.tsx index aab9affd5f4..05c43a0224f 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioPackageSwitcher.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioPackageSwitcher.tsx @@ -12,8 +12,8 @@ * in the reader's language where the package's translation bundle carries * one (`packages..name`, objectstack#35513), else `manifest.name` — with the * app's logo, or a neutral tile, before the name. The rows are named the - * same way. The package-less scope (`~org`) and the cross-package leg - * (`~all`) name the scope; they are not rows of the list (item 3). + * same way. The cross-package leg (`~all`) names the leg; it is not a row + * of the list (item 3). * - **Read-only** (decision 8). A package the person cannot write to shows a * lock beside its name, and its row says so; the lock's tooltip is the * reason. No list carries a banner for it. The reason is not the tooltip's @@ -45,7 +45,7 @@ import { PopoverTrigger, } from '@object-ui/components'; import { useMetadata } from '@object-ui/react'; -import { Boxes, Building2, Check, ChevronsUpDown, KeyRound, Lock, Plus, Search } from 'lucide-react'; +import { Boxes, Check, ChevronsUpDown, KeyRound, Lock, Plus, Search } from 'lucide-react'; import { toast } from 'sonner'; import type { I18nLabel } from '@objectstack/spec/ui'; import { AppMark, type AppMarkApp } from '../../layout/AppMark.js'; @@ -115,10 +115,8 @@ export function studioSwitcherRowMatches(row: StudioSwitcherRow, query: string): } export interface StudioPackageSwitcherProps { - /** The open package, or `null` in the package-less scope and on the cross-package leg. */ + /** The open package, or `null` on the cross-package leg (`~all`), which the trigger then names. */ packageId: string | null; - /** The scope the row names when there is no package: `~org` or `~all`. */ - scope?: 'org' | 'all'; /** The surface's own entry for the open package: names it while the list loads, or when the list leaves it out. */ openEntry?: PkgEntry | null; /** The open package cannot be written to: the lock is drawn beside its name. */ @@ -137,7 +135,6 @@ export interface StudioPackageSwitcherProps { export function StudioPackageSwitcher({ packageId, - scope, openEntry = null, readOnly = false, canCreate = false, @@ -187,12 +184,11 @@ export function StudioPackageSwitcher({ const openApp = packageId === null ? null : (listed?.app ?? studioPackageApp(packageId, apps)); const openLabel = packageId === null - ? t(scope === 'all' ? 'engine.studio.menu.environment' : 'engine.studio.pkg.orgScope', locale) + ? t('engine.studio.menu.environment', locale) : (listed?.label ?? (openApp ? navItemLabelText(openApp.label, locale) || openApp.name : null) ?? (openEntry?.id === packageId ? packageName(openEntry) : null) ?? packageId); - const ScopeIcon = scope === 'all' ? KeyRound : Building2; const readOnlyHint = t('engine.studio.pkg.readonlyHint', locale); const openReadOnly = packageId !== null && readOnly; const readOnlyReasonId = React.useId(); @@ -207,7 +203,7 @@ export function StudioPackageSwitcher({ const mark = packageId === null ? ( ) : openApp ? ( diff --git a/ui/packages/app-shell/src/views/studio-design/StudioPaletteGroups.surfaceScope-36900.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioPaletteGroups.surfaceScope-36900.test.tsx index 999598cf630..451ff4a8033 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioPaletteGroups.surfaceScope-36900.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioPaletteGroups.surfaceScope-36900.test.tsx @@ -259,7 +259,7 @@ describe("on a package, the palette lists the left menu and the package's items 'studio-entry type:hook', 'studio-entry type:dashboard', 'studio-entry type:flow', - 'studio-entry orgFlows', + // objectstack#38150 — the organization's flows left the menu with their scope, so no entry here. // objectstack#37920 — the menu draws no datasource row, so neither does the palette. 'studio-entry diagnostics', 'studio-entry type:permission', @@ -326,7 +326,6 @@ describe("on a package, the palette lists the left menu and the package's items it('opens a menu entry where the menu entry goes, and the palette closes', async () => { expect(await openedBy('studio-entry type:hook')).toBe('/studio/com.acme.crm/metadata/hook?package=com.acme.crm'); - expect(await openedBy('studio-entry orgFlows')).toBe('/studio/~org/metadata/flow?source=runtime'); expect(await openedBy('studio-entry owd')).toBe('/studio/com.acme.crm/owd'); expect(await openedBy('studio-entry diagnostics')).toBe('/studio/com.acme.crm/metadata/_diagnostics'); @@ -359,7 +358,7 @@ describe("on a package, the palette lists the left menu and the package's items expect(values('studio-item ')).toEqual([`studio-item hook ${PAIR} on_lead_created`]); type(group('automation')); - expect(values('studio-entry ')).toEqual(['studio-entry type:flow', 'studio-entry orgFlows']); + expect(values('studio-entry ')).toEqual(['studio-entry type:flow']); expect(headings()).toEqual([group('automation')]); }); @@ -419,8 +418,8 @@ describe('on the cross-package leg, the menu joins every package\'s objects and const { cacheReads } = mount('~all', { at: '/studio/~all/metadata/permission/admin?scope=environment&palette=1', packageScope: false }); await waitFor(() => expect(values('studio-object ').length).toBeGreaterThan(0)); + // objectstack#38150 — no entry for the retired package-less scope: the environment catalog's types alone. expect(values('studio-entry ')).toEqual([ - 'studio-entry orgFlows', 'studio-entry type:permission', 'studio-entry type:position', ]); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioPaletteGroups.tsx b/ui/packages/app-shell/src/views/studio-design/StudioPaletteGroups.tsx index fe2eac674c0..786a46b23fd 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioPaletteGroups.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioPaletteGroups.tsx @@ -28,7 +28,7 @@ */ import * as React from 'react'; -import { List, Building2, Share2, Activity, LayoutGrid, type LucideIcon } from 'lucide-react'; +import { List, Share2, Activity, LayoutGrid, type LucideIcon } from 'lucide-react'; import { CommandGroup, CommandItem } from '@object-ui/components'; import { useObjectTranslation } from '@object-ui/i18n'; import { matchesPaletteQuery } from '../../chrome/paletteMatch.js'; @@ -52,7 +52,6 @@ import { /** The icon each menu entry draws in the palette: a type's list, or the page it opens. */ const ENTRY_ICONS: Record = { type: List, - orgFlows: Building2, owd: Share2, diagnostics: Activity, // objectstack#37360 — the menu's 全部类型 row; the palette lists only the menu's groups, so it draws none today. @@ -115,7 +114,7 @@ function useStudioPaletteItems( } export interface StudioPaletteGroupsComponentProps extends StudioPaletteGroupsProps { - /** The `/studio/:segment` the palette is open on: a package id, `~org` or `~all`. */ + /** The `/studio/:segment` the palette is open on: a package id or `~all`. */ segment: string; /** The open package's name, as the header shows it; its `.custom` items are named "Customization of" it. */ packageLabel?: string; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioSurfaceFrame.tsx b/ui/packages/app-shell/src/views/studio-design/StudioSurfaceFrame.tsx index 88ab0c75494..0988198429d 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioSurfaceFrame.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioSurfaceFrame.tsx @@ -20,7 +20,6 @@ import { STUDIO_ACCENT, STUDIO_PILLARS_HOST } from './studio-tokens.js'; import { StudioPendingDraftsContext } from './studioItemDraftStatus.js'; import { StudioInterfacesRetiredNotice } from './StudioInterfacesRetiredNotice.js'; import { StudioSaveProvider } from './studioSaveBar.js'; -import { isOrgScopeDraft } from './studioScope.js'; import { StudioMenu, StudioMenuDataProvider, StudioMenuProvider } from './StudioMenu.js'; import { SurfaceDeepLinkProvider } from './surfaceDeepLinkChannel.js'; import { t, type SupportedLocale } from '../metadata-admin/i18n.js'; @@ -39,7 +38,7 @@ import type { useRetiredInterfacesLanding, useStudioSurfaceNavigation } from './ export type StudioSurfaceFrameProps = Pick< ReturnType, - 'scopeSegment' | 'allScope' | 'packageId' + 'scopeSegment' | 'packageId' > & Pick< ReturnType, @@ -49,7 +48,7 @@ export type StudioSurfaceFrameProps = Pick< Pick, 'changesOpen' | 'setChangesOpen' | 'publishing'> & Pick< ReturnType, - 'shownPendingCount' | 'renderPublishRefusal' | 'pillarPendingDrafts' + 'renderPublishRefusal' | 'pillarPendingDrafts' > & Pick, 'doPublish'> & Pick, 'publishedApps'> & @@ -76,7 +75,6 @@ export type StudioSurfaceFrameProps = Pick< /** The surface's providers and columns, with the page in the pillars host. */ export function StudioSurfaceFrame({ scopeSegment, - allScope, packageId, pkgMissing, pkgEntry, @@ -90,7 +88,6 @@ export function StudioSurfaceFrame({ changesOpen, setChangesOpen, publishing, - shownPendingCount, renderPublishRefusal, pillarPendingDrafts, doPublish, @@ -196,7 +193,6 @@ export function StudioSurfaceFrame({ head={ 0 - ? { - count: shownPendingCount ?? 0, - onOpen: () => { - setChangesOpen(true); - }, - } - : null - } /> } /> @@ -237,23 +221,25 @@ export function StudioSurfaceFrame({ {/* objectui#12725 — the one right slot: the open item's properties. */} {rightSlot} - {/* objectui#11553 — the package-less scope reviews exactly what its - * Publish ships: package-less flow drafts, read off the env-wide - * feed (`packageId` null) and narrowed by `include`. */} - + {/* The Pending changes sheet is a package's: it reviews and publishes + * that package's drafts. The cross-package leg has none: a + * package-less draft is published or discarded on its item page, or + * with Home's Publish all (objectstack#38150). */} + {packageId !== null && ( + + )} {/* objectstack#36900 — the command palette, in its `studio` scope, with this page's groups. */} diff --git a/ui/packages/app-shell/src/views/studio-design/StudioSurfacePage.tsx b/ui/packages/app-shell/src/views/studio-design/StudioSurfacePage.tsx index c145b6961cd..23b5d2c3326 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioSurfacePage.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioSurfacePage.tsx @@ -3,21 +3,19 @@ /** * The page the design surface draws beside its menu, moved out of * `StudioDesignSurface.tsx` unchanged by objectstack#37553 (a move-only - * split): the "All metadata" area in a package, in the package-less scope or - * on the cross-package leg, 概览 Overview with its Pending tab, the sharing - * overview, and the not-found states. It holds no state: every value is the - * surface's. + * split): the "All metadata" area in a package or on the cross-package leg, + * 概览 Overview with its Pending tab, the sharing overview, and the not-found + * states. It holds no state: every value is the surface's. */ import * as React from 'react'; -import { Navigate, type NavigateFunction } from 'react-router-dom'; +import type { NavigateFunction } from 'react-router-dom'; import { Button } from '@object-ui/components'; import { FileQuestion, PackageX } from 'lucide-react'; import { StudioEmptyState } from './StudioEmptyState.js'; import { SETUP_PACKAGES_PATH } from '../metadata-admin/packageSource.js'; import { StudioPackageOverviewPage } from './StudioPackageOverviewPage.js'; import type { StudioBaseCustomization } from './StudioPillarKit.js'; -import { studioOrgScopePath } from './studioScope.js'; import { STUDIO_METADATA_AREA } from './metadataArea.js'; import { StudioMetadataArea } from './StudioMetadataArea.js'; import { StudioOwdOverviewPage } from './StudioOwdOverviewPage.js'; @@ -102,28 +100,11 @@ export function StudioSurfacePage({ each list effect kept the open item (it keeps the current one on a re-read of the same package, a publish or a copilot pulse, as it must), its load did not re-run, and an edit saved - the previous package's item into the next package. - objectui#11553 — the package-less scope is keyed the same way, - by its segment, and serves its one pillar: another pillar's - URL lands on it rather than on a package pillar with no - package under it. */ - return allScope ? ( + the previous package's item into the next package. The + cross-package leg is keyed the same way, by its segment; no + package is open there (`packageId` is `null` on that leg alone). */ + return allScope || packageId === null ? ( - ) : packageId === null ? ( - // objectstack#36903 — the package-less scope's area: its flows, - // listed and opened full-screen (`studioScope.ts`). - tab === STUDIO_METADATA_AREA ? ( - - ) : ( - - ) ) : pkgMissing ? ( void } | null; packageId?: string | null; readOnly?: boolean; canCreate?: boolean; @@ -105,7 +110,6 @@ function renderTopLeft(opts: Opts = {}) { `/studio/${id}`} - scopePending={opts.scopePending ?? null} /> , @@ -234,9 +237,12 @@ describe('Studio top left — the package switcher (objectstack#37456)', () => { expect(within(menu).queryByTestId('studio-pkg-switcher-new')).toBeNull(); }); - it('names the scope in the package-less scope', () => { + // objectstack#38150 — rewritten on purpose: with no package open the row names the cross-package + // leg, the one scope left that names none. It read "Organization metadata", the retired + // package-less scope's name. + it('names the leg where no package is open', () => { renderTopLeft({ packageId: null }); - expect(screen.getByTestId('studio-pkg-switcher-name')).toHaveTextContent(/^Organization metadata$/); + expect(screen.getByTestId('studio-pkg-switcher-name').textContent).toBe(t('engine.studio.menu.environment', 'en')); expect(screen.getByTestId('studio-pkg-switcher')).not.toHaveAttribute('data-package'); }); }); @@ -254,24 +260,18 @@ describe('Studio top left — the collapsed rail (objectstack#37456)', () => { }); }); -describe('Studio top left — the package-less scope keeps its Changes (objectstack#37456)', () => { - it('~org with drafts pending: a Changes row with the count under the package row, which opens the sheet', () => { - const onOpen = vi.fn(); - renderTopLeft({ packageId: null, scopePending: { count: 2, onOpen } }); +describe('Studio top left — no scope draws a Changes row (objectstack#38150)', () => { + // The row was the retired package-less scope's one door to its changes sheet (objectstack#37456). + it.each([[SALES], [null]])('package %s: no Changes row, expanded or as a rail', (packageId) => { + renderTopLeft({ packageId }); const top = screen.getByTestId('studio-top-left'); - const changes = within(top).getByRole('button', { name: /^Changes · 2$/ }); - expect(changes).toHaveAttribute('data-testid', 'studio-scope-changes'); - expect(within(top).getByTestId('studio-package-row').compareDocumentPosition(changes) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy(); - fireEvent.click(changes); - expect(onOpen).toHaveBeenCalledTimes(1); - // The rail keeps it, as an icon that still names the count. + expect(within(top).getByTestId('studio-package-row')).toBeInTheDocument(); + expect(screen.queryByTestId('studio-scope-changes')).toBeNull(); + expect(screen.queryByTestId('studio-changes-count')).toBeNull(); + expect(within(top).queryByRole('button', { name: /^Changes/ })).toBeNull(); fireEvent.click(screen.getByTestId('studio-menu-toggle')); - expect(within(screen.getByTestId('studio-rail-head')).getByRole('button', { name: /^Changes · 2$/ })).toBeInTheDocument(); - }); - - it('CONTROL: none passed (a package, or nothing pending): no Changes row', () => { - renderTopLeft({ packageId: null }); expect(screen.queryByTestId('studio-scope-changes')).toBeNull(); + expect(within(screen.getByTestId('studio-rail-head')).queryByRole('button', { name: /^Changes/ })).toBeNull(); }); }); @@ -344,7 +344,7 @@ describe('Studio top left — the read-only reason is announced (objectstack#376 expect(trigger).not.toHaveAccessibleDescription(t('engine.studio.pkg.readonlyHint', 'en')); }); - it('CONTROL: the package-less scope is not a read-only package: no lock, no description', () => { + it('CONTROL: the cross-package leg is not a read-only package: no lock, no description', () => { renderTopLeft({ packageId: null, readOnly: true }); expect(screen.queryByTestId('studio-pkg-readonly')).toBeNull(); expect(screen.getByTestId('studio-pkg-switcher')).not.toHaveAttribute('aria-describedby'); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioTopLeft.tsx b/ui/packages/app-shell/src/views/studio-design/StudioTopLeft.tsx index 99ee3ccb713..8ad308ebde2 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioTopLeft.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioTopLeft.tsx @@ -24,7 +24,7 @@ import * as React from 'react'; import { cn, useSidebar } from '@object-ui/components'; -import { Blocks, GitBranch } from 'lucide-react'; +import { Blocks } from 'lucide-react'; import { t } from '../metadata-admin/i18n.js'; import { StudioMenuTrigger } from './StudioMenu.js'; import { StudioBackButton, type StudioAppTarget } from './StudioBackToApp.js'; @@ -60,66 +60,10 @@ export interface StudioPackageRowProps extends Omit { /** The open package's published apps, where the way back may lead. */ apps: readonly StudioAppTarget[]; - /** - * The package-less scope's pending drafts and the door to review and publish - * them, or `null`. Only `~org` passes one: a package's live on 概览's - * Pending tab, and `~org` has no 概览 (see {@link StudioScopePendingRow}). - */ - scopePending?: StudioScopePending | null; -} - -export interface StudioScopePending { - /** Drafts pending, above zero. */ - count: number; - /** Opens the changes sheet, whose Publish publishes them. */ - onOpen: () => void; -} - -/** - * The package-less scope's Changes (objectstack#37456). The top bar's Changes - * and Publish moved to 概览's Pending tab (ADR-0084, amended 2026-11-26), and - * `~org` names no package, so it has no 概览: this row keeps its one door to - * the changes sheet, with the count, drawn while something is pending. - */ -export function StudioScopePendingRow({ - pending, - locale, - compact = false, -}: { - pending: StudioScopePending; - locale: string; - compact?: boolean; -}): React.ReactElement { - const label = t('engine.studio.changes', locale); - return ( - - ); } /** Row 2: the way back, then the package switcher. */ -export function StudioPackageRow({ apps, scopePending: _scopePending, ...switcher }: StudioPackageRowProps): React.ReactElement { +export function StudioPackageRow({ apps, ...switcher }: StudioPackageRowProps): React.ReactElement { return (
- {props.scopePending && }
); } @@ -166,7 +109,6 @@ export function StudioTopLeft(props: StudioPackageRowProps): React.ReactElement ); } diff --git a/ui/packages/app-shell/src/views/studio-design/automationsPillarRedirect.test.ts b/ui/packages/app-shell/src/views/studio-design/automationsPillarRedirect.test.ts index c3e497cc57b..b9b56f04083 100644 --- a/ui/packages/app-shell/src/views/studio-design/automationsPillarRedirect.test.ts +++ b/ui/packages/app-shell/src/views/studio-design/automationsPillarRedirect.test.ts @@ -2,8 +2,12 @@ /** * objectstack#36903 — the retired Automations pillar's addresses land on the - * flow's designer or the flow list, of the package or of the package-less - * scope, their own qualifiers dropped and everything else kept verbatim. + * package's flow designer or its flow list, their own qualifiers dropped and + * everything else kept verbatim. + * + * The retired package-less scope's `/studio/~org/automations` never reaches + * this mapping: `studioPillarRedirect` answers it first, and its rows are in + * `studioPillarRedirectModel.test.ts` (objectstack#38150). */ import { describe, it, expect } from 'vitest'; @@ -28,14 +32,6 @@ describe('automationsPillarRedirect', () => { ); }); - it('the package-less scope lands on its own leg, with no package and its source filter once', () => { - expect(automationsPillarRedirect('~org', '')).toBe('/studio/~org/metadata/flow?source=runtime'); - expect(automationsPillarRedirect('~org', '?surface=flow%3Aqa_clone')).toBe('/studio/~org/metadata/flow/qa_clone?source=runtime'); - expect(automationsPillarRedirect('~org', '?surface=flow%3Aqa_clone&package=x&source=artifact&changes=review')).toBe( - '/studio/~org/metadata/flow/qa_clone?source=runtime&changes=review', - ); - }); - it('a name with reserved characters round-trips', () => { const to = automationsPillarRedirect(PKG, `?surface=${encodeURIComponent('flow:a b')}`); expect(to).toBe(`/studio/${PKG}/metadata/flow/a%20b`); diff --git a/ui/packages/app-shell/src/views/studio-design/automationsPillarRedirect.ts b/ui/packages/app-shell/src/views/studio-design/automationsPillarRedirect.ts index 7cec5f2ce9d..7812b547957 100644 --- a/ui/packages/app-shell/src/views/studio-design/automationsPillarRedirect.ts +++ b/ui/packages/app-shell/src/views/studio-design/automationsPillarRedirect.ts @@ -5,28 +5,29 @@ * table's switch) — where the retired Automations pillar's address lands. * * A flow opens its designer full-screen on its metadata address - * (`/studio//metadata/flow/`), and the package-less scope's - * flows on that scope's own leg (`/studio/~org/metadata/flow/`, - * `studioScope.ts`). The pillar's addresses are bookmarks, test pins and links - * an AI was handed, so each still opens what it named: + * (`/studio//metadata/flow/`). The pillar's addresses are + * bookmarks, test pins and links an AI was handed, so each still opens what it + * named: * * - `/automations?surface=flow:` → that flow's designer; - * - `/automations` with no flow named, or naming another type → the flow - * list of the same scope (the pillar opened its first flow; the list is - * where a flow is chosen now, decision 7). + * - `/automations` with no flow named, or naming another type → the + * package's flow list (the pillar opened its first flow; the list is where + * a flow is chosen now, decision 7). * * The pillar's own qualifiers go (`?surface=`, and `?view=` and `?nav=`, which * opened nothing on a flow); everything else is kept verbatim, `?changes=review` - * (the server's draft review link, `studioChangesReviewLink`) included. On a - * package's leg the area adds `?package=` itself (`areaLocationRedirect`). + * (the server's draft review link, `studioChangesReviewLink`) included. The + * area adds `?package=` itself (`areaLocationRedirect`). + * + * The retired package-less scope's `/studio/~org/automations` is not this + * mapping's: `studioPillarRedirectModel.ts` sends every address of that scope + * to the Loose list of flows before it reaches here. * * Pure, so the mapping is pinned without a render. */ -import { LIST_SOURCE_PARAM } from '../metadata-admin/metadataListState.js'; import { DESIGNER_SURFACE_PARAM, parseSurfaceParam } from '../metadata-admin/nav-selection.js'; import { studioMetadataItemAddress, studioMetadataTypePath } from './studioAddress.js'; -import { isStudioOrgScope, studioOrgScopePath } from './studioScope.js'; import { DESIGNER_SURFACE_NAV_PARAM, DESIGNER_SURFACE_VIEW_PARAM } from './useSurfaceDeepLink.js'; /** The pillar's qualifiers that do not travel to the metadata address. */ @@ -39,22 +40,15 @@ function withQuery(path: string, params: URLSearchParams): string { } /** - * Where `/studio//automations` lands. `segment` is the route - * segment as read (a package id, or `~org`); `search` is the URL's query, with - * or without its `?`. + * Where `/studio//automations` lands. `segment` is the route + * segment as read, a package id; `search` is the URL's query, with or without + * its `?`. */ export function automationsPillarRedirect(segment: string, search: string): string { const params = new URLSearchParams(search); const target = parseSurfaceParam(params.get(DESIGNER_SURFACE_PARAM)); const flow = target?.type === 'flow' && target.name ? target.name : null; for (const key of PILLAR_ONLY_PARAMS) params.delete(key); - if (isStudioOrgScope(segment)) { - // The scope names no package: a `?package=` it was handed is not carried, - // and its own address already carries the scope's source filter. - params.delete('package'); - params.delete(LIST_SOURCE_PARAM); - return withQuery(studioOrgScopePath(flow ? { type: 'flow', name: flow } : undefined), params); - } if (flow) return studioMetadataItemAddress(segment, 'flow', flow, { query: params }); return withQuery(studioMetadataTypePath(segment, 'flow'), params); } 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 23fe1d2825f..71d100d1567 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 @@ -16,7 +16,6 @@ import { areaDesignerItemOf, areaItemAsksGenericPage, areaItemOpensDesignerPage, - orgScopeFlowOf, areaItemOpensFormEditor, areaLocationRedirect, dataPillarRedirect, @@ -24,7 +23,7 @@ import { settledAreaAddress, studioMetadataAreaPath, } from './metadataArea'; -import { STUDIO_ORG_SCOPE_SEGMENT } from './studioScope'; +import { RETIRED_ORG_SCOPE_SEGMENT } from './studioOrgScopeRetired'; const PKG = 'com.example.crm'; @@ -35,8 +34,8 @@ describe('the area legs (objectstack#28561)', () => { expect(isStudioAllPackagesScope('~all')).toBe(true); // A package may be called `metadata`; the leg is not `/studio/metadata`. expect(isStudioAllPackagesScope('metadata')).toBe(false); - // And it is not the package-less flows scope. - expect(STUDIO_ALL_PACKAGES_SEGMENT).not.toBe(STUDIO_ORG_SCOPE_SEGMENT); + // And it is not the retired package-less scope's segment, which redirects. + expect(STUDIO_ALL_PACKAGES_SEGMENT).not.toBe(RETIRED_ORG_SCOPE_SEGMENT); }); }); @@ -83,27 +82,30 @@ describe('areaLocationRedirect — the query names the leg', () => { expect(areaLocationRedirect(STUDIO_ALL_PACKAGES_SEGMENT, 'flow/f1', '?review=1')).toBeNull(); }); - it('the package-less scope is never written into `?package=`: it lands on its flows (objectstack#36899)', () => { - // objectstack#36903 — on its own leg of the area, with the scope's source filter. - const LIST = '/studio/~org/metadata/flow?source=runtime'; - expect(areaLocationRedirect('~org', '', '')).toBe(LIST); - expect(areaLocationRedirect('~org', 'flow', '')).toBe(LIST); - expect(areaLocationRedirect('~org', 'object', '?source=runtime')).toBe(LIST); - expect(areaLocationRedirect('~org', 'flow/new', '?source=runtime')).toBe(LIST); - expect(areaLocationRedirect(STUDIO_ALL_PACKAGES_SEGMENT, 'flow', '?package=~org')).toBe(LIST); - expect(areaLocationRedirect(PKG, 'flow', '?package=~org')).toBe(LIST); - expect(areaLocationRedirect(PKG, 'flow/f1', '?package=~org&tab=history')).toBe('/studio/~org/metadata/flow/f1?tab=history&source=runtime'); + it('the retired package-less scope is never written into `?package=`: it lands on the Loose list of flows (objectstack#38150)', () => { + const LOOSE = '/studio/~all/metadata/flow?source=loose'; + // As the segment: the scope's root, its list, a type it never listed, a create address. + expect(areaLocationRedirect('~org', '', '')).toBe(LOOSE); + expect(areaLocationRedirect('~org', 'flow', '')).toBe(LOOSE); + expect(areaLocationRedirect('~org', 'flow', '?source=runtime')).toBe(LOOSE); + expect(areaLocationRedirect('~org', 'object', '?source=runtime')).toBe(LOOSE); + expect(areaLocationRedirect('~org', 'flow/new', '?source=runtime')).toBe(LOOSE); + // As `?package=`, from either other leg. + expect(areaLocationRedirect(STUDIO_ALL_PACKAGES_SEGMENT, 'flow', '?package=~org')).toBe(LOOSE); + expect(areaLocationRedirect(PKG, 'flow', '?package=~org')).toBe(LOOSE); }); - it('objectstack#36903 — the scope\'s leg settles on its flows, and re-roots a link naming a package', () => { - expect(areaLocationRedirect('~org', 'flow', '?source=runtime')).toBeNull(); - expect(areaLocationRedirect('~org', 'flow/f1', '?source=runtime&tab=source')).toBeNull(); - expect(areaLocationRedirect('~org', 'flow/f1/history', '?source=runtime')).toBeNull(); - // The filter is the scope's meaning: a URL without it gets it. - expect(areaLocationRedirect('~org', 'flow/f1', '')).toBe('/studio/~org/metadata/flow/f1?source=runtime'); - // A packaged row reached by clearing the filter opens in its package. - expect(areaLocationRedirect('~org', 'flow/f1', `?package=${PKG}`)).toBe(`/studio/${PKG}/metadata/flow/f1?package=${PKG}`); - expect(areaLocationRedirect('~org', 'flow', '?package=all')).toBe('/studio/~all/metadata/flow?package=all'); + it('objectstack#38150 — a flow of the retired scope lands on the list, not on the flow, and the list keeps no tab', () => { + const LOOSE = '/studio/~all/metadata/flow?source=loose'; + expect(areaLocationRedirect('~org', 'flow/f1', '')).toBe(LOOSE); + expect(areaLocationRedirect('~org', 'flow/f1', '?source=runtime&tab=source')).toBe(LOOSE); + expect(areaLocationRedirect('~org', 'flow/f1/history', '?source=runtime')).toBe(LOOSE); + expect(areaLocationRedirect(PKG, 'flow/f1', '?package=~org&tab=history')).toBe(LOOSE); + // The scope's addresses have one target, a `?package=` they carried included. + expect(areaLocationRedirect('~org', 'flow/f1', `?package=${PKG}`)).toBe(LOOSE); + expect(areaLocationRedirect('~org', 'flow', '?package=all')).toBe(LOOSE); + // The target is settled: the cross-package leg changes nothing on it. + expect(areaLocationRedirect(STUDIO_ALL_PACKAGES_SEGMENT, 'flow', '?source=loose')).toBeNull(); }); }); @@ -115,7 +117,7 @@ describe('settledAreaAddress — an area address where the area would put it (ob '/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'); + expect(settledAreaAddress('/studio/~org/metadata/object')).toBe('/studio/~all/metadata/flow?source=loose'); }); it('leaves every address outside the area as it is', () => { @@ -237,18 +239,9 @@ describe('areaDesignerItemOf — the copilot reads the open flow off its address expect(areaDesignerItemOf('/studio/~all/metadata/flow/f_1', '~all')).toBeNull(); expect(areaDesignerItemOf(`/studio/${PKG}/data`, PKG)).toBeNull(); expect(areaDesignerItemOf(`/studio/${PKG}/metadata/flow/f_1`, undefined)).toBeNull(); - // The package-less scope is not a package's leg: orgScopeFlowOf answers for it. + // The retired package-less scope's segment names no package: it has no designer address. expect(areaDesignerItemOf('/studio/~org/metadata/flow/f_1', '~org')).toBeNull(); }); - - it('orgScopeFlowOf names the package-less scope\'s flow, and nothing on any other leg', () => { - expect(orgScopeFlowOf('/studio/~org/metadata/flow/a%3Ab', '~org')).toEqual({ type: 'flow', name: 'a:b' }); - expect(orgScopeFlowOf('/studio/~org/metadata/flow/a/history', '~org')).toEqual({ type: 'flow', name: 'a' }); - expect(orgScopeFlowOf('/studio/~org/metadata/flow', '~org')).toBeNull(); - expect(orgScopeFlowOf('/studio/~org/metadata/flow/new', '~org')).toBeNull(); - expect(orgScopeFlowOf('/studio/~org/metadata/object/o', '~org')).toBeNull(); - expect(orgScopeFlowOf(`/studio/${PKG}/metadata/flow/f_1`, PKG)).toBeNull(); - }); }); describe('the object designer on its address, and the retired Data pillar (objectstack#36904)', () => { 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 8faffdc2818..fde3d540cd7 100644 --- a/ui/packages/app-shell/src/views/studio-design/metadataArea.ts +++ b/ui/packages/app-shell/src/views/studio-design/metadataArea.ts @@ -17,16 +17,17 @@ * serves it today. Outside that scope, a type's list here is the list * across every package, each row opening its owning package (#29566). * - * ## Why `~all` and not `~org` + * ## Why a reserved `~all` * - * `~org` (`studioScope.ts`) is the scope of the flows that belong to NO - * package; this leg is the registry of EVERY package plus the environment's - * own items. Two different reads, so two names: folding this leg into `~org` - * would make the package-less scope mean "all packages" too, and its header, - * switcher entry and drafts filter (`isOrgScopeDraft`) are the flows' alone. - * `~` is outside every package-id alphabet (`studioScope.ts` says why), so - * `~all` cannot name a package either. `metadata` could: it is a legal package - * id, which is why the cross-package leg is not a bare `/studio/metadata`. + * `~` is outside every package-id alphabet (`studioOrgScopeRetired.ts` says + * why), so `~all` cannot name a package. `metadata` could: it is a legal + * package id, which is why the cross-package leg is not a bare + * `/studio/metadata`. + * + * The items that belong to NO package are on this leg too: a type's list here + * narrows to them under its "Loose" source value (objectstack#38150). The + * package-less scope that used to list the flows among them (`~org`) is + * retired, and its addresses land on that list ({@link areaLocationRedirect}). * * ## The query keeps its meaning * @@ -36,15 +37,12 @@ */ import { CATALOG_SCOPE_PARAM, ENVIRONMENT_SCOPE } from '../metadata-admin/catalog-scope.js'; -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_REVIEW_PARAM, STUDIO_ITEM_REVIEW_VALUE, STUDIO_METADATA_AREA, - STUDIO_ORG_SCOPE_SEGMENT, - STUDIO_ORG_SCOPE_TYPE, studioAddressParts, studioMetadataAreaAddress, studioMetadataAreaRoot, @@ -52,7 +50,7 @@ import { studioMetadataTypePath, } 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'; +import { isRetiredOrgScope, retiredOrgScopeTarget } from './studioOrgScopeRetired.js'; // objectstack#36895 — the area's segments are Studio address vocabulary, owned // by `studioAddress.ts`; re-exported under their names here. @@ -111,7 +109,7 @@ export function areaItemOpensDesignerPage(input: { packageId: string | null; typ * designer that left its pillar keeps the context the pillar gave it. */ export function areaDesignerItemOf(pathname: string, segment: string | null | undefined): { type: string; name: string } | null { - if (!segment || isStudioAllPackagesScope(segment) || isStudioOrgScope(segment)) return null; + if (!segment || isStudioAllPackagesScope(segment) || isRetiredOrgScope(segment)) return null; const root = `${studioMetadataAreaRoot(segment)}/`; if (!pathname.startsWith(root)) return null; const [rawType, rawName] = pathname.slice(root.length).split('/'); @@ -127,27 +125,6 @@ export function areaDesignerItemOf(pathname: string, segment: string | null | un } } -/** - * objectstack#36903 — the flow the package-less scope's area opens in the flow - * designer, read off its address (`/studio/~org/metadata/flow/[/…]`), or - * `null` for any other URL. The scope's area holds its flows alone - * ({@link orgScopeAreaRedirect}) and names no package, so the shared - * {@link areaDesignerItemOf} (a package's leg) never answers for it. - */ -export function orgScopeFlowOf(pathname: string, segment: string | null | undefined): { type: string; name: string } | null { - if (!isStudioOrgScope(segment)) return null; - const root = `${studioMetadataAreaRoot(STUDIO_ORG_SCOPE_SEGMENT)}/`; - if (!pathname.startsWith(root)) return null; - const [rawType, rawName] = pathname.slice(root.length).split('/'); - if (!rawType || !rawName || rawName === 'new') return null; - try { - const type = decodeURIComponent(rawType); - return type === STUDIO_ORG_SCOPE_TYPE ? { type, name: decodeURIComponent(rawName) } : null; - } catch { - return null; - } -} - /** * objectstack#36904 — where the retired Data pillar's address lands * (`/studio//data`, Studio's old home): the object designer of the @@ -236,17 +213,17 @@ const ALL_PACKAGES_VALUE = 'all'; * - the cross-package leg with no `?package=` stays as it is: a URL that * names no package lists across packages, and no page repairs one in * (#29566); - * - the package-less scope (`~org`, as the segment or as `?package=`) names - * no package, so it is never written into `?package=` (#36899). - * objectstack#36903 — it has an area of one type, its flows - * ({@link orgScopeAreaRedirect}). + * - the retired package-less scope (`~org`, as the segment or as + * `?package=`) names no package and has no leg: its addresses land on the + * Loose list of flows on the cross-package leg (objectstack#38150, + * `studioOrgScopeRetired.ts`), whatever path they name. * * `rest` is the path below the area's root as the URL spells it (encoded), * `''` at the root; `search` is the URL's query, with or without its `?`. */ export function areaLocationRedirect(segment: string, rest: string, search: string): string | null { const params = new URLSearchParams(search); - if (isStudioOrgScope(segment) || isStudioOrgScope(params.get('package'))) return orgScopeAreaRedirect(segment, rest, params); + if (isRetiredOrgScope(segment) || isRetiredOrgScope(params.get('package'))) return retiredOrgScopeTarget(search); const allLeg = isStudioAllPackagesScope(segment); const at = (leg: string) => studioMetadataAreaAddress(leg, rest, { query: params }); @@ -266,50 +243,6 @@ export function areaLocationRedirect(segment: string, rest: string, search: stri return pkg === segment ? null : at(pkg); } -/** - * objectstack#36903 — where a URL of the package-less scope's area belongs, - * or `null` when it is already there. The scope's area serves its flows alone - * (`studioScope.ts`): the list, a flow, and a flow's `/history`, each with the - * scope's source filter (`?source=runtime`) and no `?package=`. - * - * - a link on the scope's leg that names a real package (a packaged row the - * author reached by clearing the list's source filter) re-roots onto that - * package's leg, as a package's own leg does (`?package=all`, the - * cross-package leg); - * - a `?package=~org` link from another leg lands on the scope's leg, on the - * same flow; - * - any other path (the directory, another type, a create — the scope - * creates nothing) lands on the scope's list. - */ -function orgScopeAreaRedirect(segment: string, rest: string, params: URLSearchParams): string | null { - const pkg = params.get('package'); - const onScope = isStudioOrgScope(segment); - if (onScope && pkg && !isStudioOrgScope(pkg)) { - return studioMetadataAreaAddress(pkg === ALL_PACKAGES_VALUE ? STUDIO_ALL_PACKAGES_SEGMENT : pkg, rest, { query: params }); - } - const [rawType = '', rawName = '', ...below] = rest.split('/'); - let type: string; - try { - type = decodeURIComponent(rawType); - } catch { - type = ''; - } - const flowPath = - type === STUDIO_ORG_SCOPE_TYPE && rawName !== 'new' && (below.length === 0 || (below.length === 1 && below[0] === 'history')); - if (!flowPath) return studioOrgScopePath(); - const next = new URLSearchParams(params); - next.delete('package'); - next.delete(CATALOG_SCOPE_PARAM); - next.set(LIST_SOURCE_PARAM, STUDIO_ORG_SCOPE_SOURCE); - const settled = - onScope && - !params.has('package') && - !params.has(CATALOG_SCOPE_PARAM) && - params.get(LIST_SOURCE_PARAM) === STUDIO_ORG_SCOPE_SOURCE; - 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 diff --git a/ui/packages/app-shell/src/views/studio-design/packageSurfaces.ts b/ui/packages/app-shell/src/views/studio-design/packageSurfaces.ts index 0112874cfb0..f9abf284825 100644 --- a/ui/packages/app-shell/src/views/studio-design/packageSurfaces.ts +++ b/ui/packages/app-shell/src/views/studio-design/packageSurfaces.ts @@ -106,7 +106,7 @@ export async function loadPackageSurfaces( } /** - * The rail entries for one metadata type in the PACKAGE-LESS scope + * The entries of one metadata type that belong to NO package * (objectui#11553): the published items that belong to no package, unioned * with the pending drafts that belong to no package, by the same merge. * 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 eaafbe9f9c1..20d80a9f198 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 @@ -47,7 +47,8 @@ import { import { STUDIO_CHANGES_PARAM, STUDIO_CHANGES_REVIEW } from './studioChangesLink.js'; import { STUDIO_NEW_PACKAGE_VALUE, STUDIO_NEW_PARAM } from './studioNewPackage.js'; import { retiredInterfacesTarget } from './studioInterfacesRetired.js'; -import { studioOrgScopePath } from './studioScope.js'; +import { packageLessItemPath } from './studioScope.js'; +import { retiredOrgScopeTarget } from './studioOrgScopeRetired.js'; import { studioMetadataItemPath } from './metadataArea.js'; import { accessPillarRedirect } from './accessPillarRedirect.js'; import { studioPillarRedirect } from './studioPillarRedirectModel.js'; @@ -125,9 +126,10 @@ describe("today's addresses, byte for byte", () => { }); it('the repointed module builders keep their addresses', () => { - // 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'); + // objectstack#38150 — the retired package-less scope's addresses land on the Loose list of + // flows; an item of no package opens on the cross-package leg. + expect(retiredOrgScopeTarget()).toBe('/studio/~all/metadata/flow?source=loose'); + expect(packageLessItemPath({ type: 'flow', name: 'a:b' })).toBe('/studio/~all/metadata/flow/a%3Ab'); expect(studioMetadataItemPath('crm', { type: 'object', name: 'account' })).toBe('/studio/crm/metadata/object/account'); }); }); @@ -238,7 +240,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', 'studioOrgScopePath', + 'studioLandingPath', 'studioPackagePath', 'studioPillarPath', 'retiredOrgScopeTarget', 'studioMetadataAreaRoot', 'studioMetadataTypePath', 'studioMetadataItemAddress', 'studioChangesReviewPath', 'studioItemReviewPath', 'retiredInterfacesTarget', 'studioOwdOverviewPath', 'studioPackageOverviewPath', ]); 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 fcead365e32..36c76f8d4ac 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioAddress.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioAddress.ts @@ -58,14 +58,13 @@ export const STUDIO_METADATA_AREA = 'metadata'; /** The reserved `/studio/` value for the "All metadata" area's cross-package leg. */ 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'; - /** - * objectstack#36903 — the one type the package-less scope's area serves: its - * flows, the items that belong to no package (`studioScope.ts`). + * The retired package-less scope's `/studio/` value (objectstack#38150). + * No page answers to it any more: every address under it redirects + * (`studioOrgScopeRetired.ts`). It stays reserved, so it is never read as a + * package id. */ -export const STUDIO_ORG_SCOPE_TYPE = 'flow'; +export const RETIRED_ORG_SCOPE_SEGMENT = '~org'; /** The retired Interfaces pillar's route segment (objectstack#36502). No pillar answers to it any more. */ export const RETIRED_INTERFACES_SEGMENT = 'interfaces'; @@ -133,11 +132,11 @@ export interface StudioPathOptions { } /** - * A Studio address: `/studio`, then the scope segment (a package id, `~org`, - * `~all`), then a section (a pillar key, `metadata`), then a rest path already - * in its URL form (`object/account`), then the query and the fragment. Every - * part is optional from the right; a part after an absent one is not allowed - * (a section names nothing without its scope). + * A Studio address: `/studio`, then the scope segment (a package id, `~all`), + * then a section (a pillar key, `metadata`), then a rest path already in its + * URL form (`object/account`), then the query and the fragment. Every part is + * optional from the right; a part after an absent one is not allowed (a + * section names nothing without its scope). * * An empty segment counts as absent and drops the section and rest with it, so * `studioHomePath('')` is `/studio`, not `/studio//data`. Callers guard a @@ -166,7 +165,7 @@ export function studioPath( /** The parts of a Studio address, as {@link studioPath} composes them. */ export interface StudioAddressParts { - /** The scope segment, decoded: a package id, `~org`, `~all`. */ + /** The scope segment, decoded: a package id, `~all`, or a retired address's `~org`. */ segment: string; /** The section after it (a pillar segment, `metadata`, `owd`), or `null` when the address ends at the scope. */ section: string | null; 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 e9bb59b3f0b..d3d0d304b77 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioAddressTable.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioAddressTable.ts @@ -31,6 +31,7 @@ import { import { STUDIO_NEW_PACKAGE_VALUE, STUDIO_NEW_PARAM } from './studioNewPackage.js'; import { RETIRED_INTERFACES_SEGMENT, + RETIRED_ORG_SCOPE_SEGMENT, STUDIO_CHANGES_PARAM, STUDIO_CHANGES_REVIEW, STUDIO_HOME_PILLAR, @@ -104,18 +105,11 @@ export const STUDIO_ADDRESS_FAMILIES: readonly StudioAddressFamily[] = Object.fr "A package's own page, 概览 Overview (objectstack#37454, ADR-0084 as amended 2026-11-26): the menu's first entry and where opening a package lands (objectstack#37958), on its Info, Pending or Publish history tab. Not a metadata item: there is no package type. Its builder is in `studioOverviewAddress.ts`, beside this module's others in all but file: it reads the console's `tab` key from `urlParams.ts`, which `studioAddress.ts` cannot import.", }, { - id: 'org-scope', - today: '/studio/~org/metadata/flow?source=runtime', - builder: 'studioOrgScopePath', + id: 'retired-org-scope', + today: `/studio/${RETIRED_ORG_SCOPE_SEGMENT}[/…][?…]`, + builder: 'retiredOrgScopeTarget', meaning: - "The package-less scope: the organization's own flows, listed in its own leg of the area (objectstack#36903). The old /studio/~org/automations redirects here.", - }, - { - id: 'org-scope-item', - today: '/studio/~org/metadata/flow/?source=runtime', - builder: 'studioOrgScopePath', - meaning: - 'A package-less flow, full-screen in the scope\'s leg of the area (objectstack#36903). The old /studio/~org/automations?surface=flow: redirects here.', + 'The retired package-less scope (objectstack#38150): its list, a flow, and the old /automations deep links. Every address of it redirects to the Loose list of flows on the cross-package leg (/studio/~all/metadata/flow?source=loose), keeping only RETIRED_ORG_SCOPE_KEPT_PARAMS.', }, { id: 'area-root', today: '/studio//metadata', builder: 'studioMetadataAreaRoot', meaning: 'The "All metadata" area of a package, or across packages.' }, { id: 'area-type', today: '/studio//metadata/', builder: 'studioMetadataTypePath', meaning: "A type's list in the area." }, diff --git a/ui/packages/app-shell/src/views/studio-design/studioEntryPermissions.ts b/ui/packages/app-shell/src/views/studio-design/studioEntryPermissions.ts index f571b956f3e..646a56be46d 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioEntryPermissions.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioEntryPermissions.ts @@ -7,12 +7,13 @@ * Every exit from Studio that names no package — bare `/studio` with nothing * remembered, the retired `/studio?new=package` bookmark, the package-not-found * state's way out — lands on Setup → Packages for a principal who may open - * that page, and on the package-less scope (`~org`, its flows) for one who may - * enter Studio and not that Setup page (`studioEntryFallbackPath`). That - * fallback was the cross-package directory until it moved to Setup - * (objectstack#37565), which such a principal may not open; it holds until the - * package-less scope retires with the door that moves loose items into a - * package (ADR-0084, amended 2026-11-26), when its next home is decided. The host + * that page, and on the Loose list of flows on the cross-package leg for one + * who may enter Studio and not that Setup page (`studioEntryFallbackPath`). + * That list is where every address of the retired package-less scope lands + * (`studioOrgScopeRetired.ts`, objectstack#38150), the scope this fallback + * opened before; the cross-package directory, the fallback before that, is + * Setup's (objectstack#37565), which such a principal may not open. No ruling + * gives that principal another landing. The host * that gates `/studio` (the console's `RequireStudioAccess`) provides the set * it read; a screen outside that provider reads `undefined`, which holds * nothing, so it never sends anyone to a page they may not open. @@ -20,7 +21,7 @@ import * as React from 'react'; import { SETUP_NEW_PACKAGE_PATH, SETUP_PACKAGES_PATH } from '../metadata-admin/packageSource.js'; -import { studioOrgScopePath } from './studioScope.js'; +import { retiredOrgScopeTarget } from './studioOrgScopeRetired.js'; const StudioEntryPermissionsContext = React.createContext(undefined); @@ -47,14 +48,15 @@ export function holdsSetupPackages(systemPermissions: readonly string[] | undefi /** * Where Studio's entry goes when no remembered package opens: Setup → Packages - * for a holder of {@link SETUP_PACKAGES_CAPABILITIES}, else the package-less - * scope (`~org`), which every principal who may enter Studio may open. - * `undefined` (no answer reported) holds nothing. + * for a holder of {@link SETUP_PACKAGES_CAPABILITIES}, else the Loose list of + * flows on the cross-package leg ({@link retiredOrgScopeTarget}), which every + * principal who may enter Studio may open. `undefined` (no answer reported) + * holds nothing. */ export function studioEntryFallbackPath(systemPermissions: readonly string[] | undefined): string { return holdsSetupPackages(systemPermissions) ? SETUP_PACKAGES_PATH - : studioOrgScopePath(); + : retiredOrgScopeTarget(); } /** @@ -77,5 +79,5 @@ export function studioNewPackageEntryPath(systemPermissions: readonly string[] | * non-holder (objectstack#36908). */ export function newPackageDoorPath(holdsSetupPackagesPair: boolean): string { - return holdsSetupPackagesPair ? SETUP_NEW_PACKAGE_PATH : studioOrgScopePath(); + return holdsSetupPackagesPair ? SETUP_NEW_PACKAGE_PATH : retiredOrgScopeTarget(); } 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 9274db57fa7..73b9c409045 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 @@ -44,8 +44,8 @@ describe('retiredInterfacesTarget (objectstack#36502)', () => { ).toBe('/studio/com.acme.app/metadata/object?changes=review&package=com.acme.app'); }); - 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'); + it('encodes the scope segment as the route spells it, and lands the retired package-less scope on the Loose list of flows', () => { + expect(retiredInterfacesTarget('~org', '')).toBe('/studio/~all/metadata/flow?source=loose'); expect(retiredInterfacesTarget('a b', '')).toBe('/studio/a%20b/metadata/object?package=a+b'); }); }); diff --git a/ui/packages/app-shell/src/views/studio-design/studioMenuData.ts b/ui/packages/app-shell/src/views/studio-design/studioMenuData.ts index d35d22266ae..ab78e5a744b 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioMenuData.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioMenuData.ts @@ -36,7 +36,6 @@ export const STUDIO_MENU_GROUP_ICONS: Readonly, string>> = { - orgFlows: 'engine.studio.menu.orgFlows', owd: 'engine.studio.menu.owd', diagnostics: 'engine.studio.menu.diagnostics', allTypes: 'engine.studio.menu.allTypes', diff --git a/ui/packages/app-shell/src/views/studio-design/studioMenuModel.test.ts b/ui/packages/app-shell/src/views/studio-design/studioMenuModel.test.ts index 35e09479a59..e1b09892531 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioMenuModel.test.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioMenuModel.test.ts @@ -15,6 +15,12 @@ * package's entry under no group, opening the area's type directory, which is * now its current entry; CONTROL: the fold's rule still leaves out a 高级 type * the package holds none of. + * + * objectstack#38150 — the organization's own flows left the menu with their + * scope (ADR-0084, amended 2026-11-26, `#amendment-2026-11-26-org`): two + * entries that are not a type remain, and no menu holds a row for the items + * of no package. Every case below that listed that row is rewritten on + * purpose, and the cases that ran on the scope's segment keep their `~all` leg. */ import { describe, expect, it } from 'vitest'; @@ -64,12 +70,14 @@ describe('the menu groups (objectstack#36899, ADR-0084 amended)', () => { // objectstack#37920 — rewritten on purpose: the served `datasource` draws no row, so 平台 Platform // holds diagnostics alone here (ADR-0084, amended 2026-11-26, decision 12). It was `type:datasource` // first, opening Setup's Datasources page. - it('a package: every type in its domain\'s group but datasource, and the three entries that are not a type', () => { + // objectstack#38150 — rewritten on purpose: the organization's flows left 自动化 Automation with + // their scope, so two entries that are not a type remain. It listed `orgFlows` after `type:flow`. + it('a package: every type in its domain\'s group but datasource, and the two entries that are not a type', () => { const menu = buildStudioMenu({ scope: studioMenuScope(PKG), types: TYPES, counts: { object: 4 } }); expect(keysOf(menu)).toEqual({ data: ['type:object'], ui: ['type:view'], - automation: ['type:flow', 'orgFlows'], + automation: ['type:flow'], system: ['diagnostics'], security: ['type:permission', 'owd'], ai: ['type:agent'], @@ -77,7 +85,9 @@ describe('the menu groups (objectstack#36899, ADR-0084 amended)', () => { const entry = (key: string) => menu.flatMap((g) => g.entries).find((e) => e.key === key)!; expect(entry('type:object')).toMatchObject({ to: `/studio/${PKG}/metadata/object?package=${PKG}`, count: 4 }); expect(entry('type:view').count).toBeUndefined(); - expect(entry('orgFlows').to).toBe('/studio/~org/metadata/flow?source=runtime'); + // objectstack#38150 — no entry of any kind opens the retired package-less scope. + expect(menu.flatMap((g) => g.entries).map((e) => e.key)).not.toContain('orgFlows'); + expect(menu.flatMap((g) => g.entries).some((e) => e.to.startsWith('/studio/~org'))).toBe(false); expect(entry('diagnostics').to).toBe(`/studio/${PKG}/metadata/_diagnostics`); // objectstack#36905 — the overview's own route. expect(entry('owd').to).toBe(`/studio/${PKG}/owd`); @@ -91,21 +101,20 @@ describe('the menu groups (objectstack#36899, ADR-0084 amended)', () => { it('a package draws a group only where it holds an entry: with no type served, the groups of the entries that are not a type', () => { const menu = buildStudioMenu({ scope: studioMenuScope(PKG), types: [], counts: {} }); expect(keysOf(menu)).toEqual({ - automation: ['orgFlows'], system: ['diagnostics'], security: ['owd'], }); }); - it.each(['~org', '~all'])('%s: the environment\'s menu, only the groups that hold an entry', (segment) => { + it.each(['~all'])('%s: the environment\'s menu, only the groups that hold an entry', (segment) => { const types = [ { type: 'position', domain: 'security' }, { type: 'permission', domain: 'security' }, ]; const menu = buildStudioMenu({ scope: studioMenuScope(segment), types, counts: {}, setupDirectory: true }); // objectstack#37201 — the table's order, not the served one: permission set, then position. + // objectstack#38150 — and no 自动化 Automation group: the row it held alone is retired. expect(keysOf(menu)).toEqual({ - automation: ['orgFlows'], security: ['type:permission', 'type:position'], }); // objectstack#37565 — the environment catalog's lists are Setup's page now: the row opens it there. @@ -116,9 +125,8 @@ describe('the menu groups (objectstack#36899, ADR-0084 amended)', () => { // objectstack#37565 — a principal who may not open Setup keeps the list on Studio's cross-package leg. it.each([ - ['~org', false, '/studio/~all/metadata/position?scope=environment'], ['~all', false, '/studio/~all/metadata/position?scope=environment'], - ['~org', undefined, '/studio/~all/metadata/position?scope=environment'], + ['~all', undefined, '/studio/~all/metadata/position?scope=environment'], ['~all', true, '/apps/setup/component/security/access-directory/position?scope=environment'], ] as const)('%s, may open Setup: %s → the catalog row opens %s', (segment, setupDirectory, to) => { const menu = buildStudioMenu({ @@ -144,7 +152,7 @@ describe('the menu draws no datasource row (objectstack#37920)', () => { expect(STUDIO_MENU_PLACEMENT.map((row) => row.type)).not.toContain('datasource'); }); - it.each([PKG, '~org', '~all'])('%s: served, counted and settled, datasource draws no row; its neighbours do', (segment) => { + it.each([PKG, '~all'])('%s: served, counted and settled, datasource draws no row; its neighbours do', (segment) => { for (const setupDirectory of [true, false]) { const menu = buildStudioMenu({ scope: studioMenuScope(segment), @@ -169,8 +177,8 @@ describe('the menu draws no datasource row (objectstack#37920)', () => { expect(studioMenuTiers(menu).common.map((g) => g.group)).not.toContain('system'); }); - it('on ~org and ~all, a datasource alone leaves no 平台 Platform group', () => { - for (const segment of ['~org', '~all']) { + it('on ~all, a datasource alone leaves no 平台 Platform group', () => { + for (const segment of ['~all']) { const menu = buildStudioMenu({ scope: studioMenuScope(segment), types: [{ type: 'datasource', domain: 'system' }], counts: {} }); expect(menu.map((g) => g.group), segment).not.toContain('system'); } @@ -212,7 +220,7 @@ describe('the menu reads the placement table (objectstack#37201, ADR-0084 amende expect(keysOf(menu)).toEqual({ data: ['type:object', 'type:dataset', 'type:picklist', 'type:hook', 'type:mapping', 'type:zz_unplaced'], ui: ['type:app', 'type:page', 'type:dashboard', 'type:report', 'type:view', 'type:action'], - automation: ['type:flow', 'type:job', 'orgFlows'], + automation: ['type:flow', 'type:job'], system: ['type:doc', 'type:book', 'type:email_template', 'diagnostics'], security: ['type:permission', 'type:position', 'type:assignment_rule', 'owd'], ai: ['type:agent', 'type:tool', 'type:skill'], @@ -231,8 +239,8 @@ describe('the menu reads the placement table (objectstack#37201, ADR-0084 amende expect(entries.find((e) => e.key === 'type:position')!.tier).toBe('common'); }); - it('the three entries that are not a type are 高级 on a package', () => { - for (const key of ['orgFlows', 'diagnostics', 'owd']) { + it('the two entries that are not a type are 高级 on a package', () => { + for (const key of ['diagnostics', 'owd']) { expect(entries.find((e) => e.key === key)!.tier, key).toBe('advanced'); } }); @@ -312,10 +320,9 @@ describe('an empty 常用 type means the sweep answered none, not "not answered expect(empty({ counts: {} })).toEqual([]); }); - it('a 高级 type is never marked empty, nor anything on ~org or ~all', () => { + it('a 高级 type is never marked empty, nor anything on ~all', () => { expect(empty({ settled: true })).not.toContain('type:hook'); expect(empty({ settled: true, segment: '~all' })).toEqual([]); - expect(empty({ settled: true, segment: '~org' })).toEqual([]); }); }); @@ -362,11 +369,13 @@ describe('the current entry (aria-current)', () => { }); // objectstack#37565 — rewritten on purpose: the leg's root redirects to Setup's directory, so no entry is it. - it('the package-less scope is its flows; the cross-package leg\'s root is no entry', () => { - expect(current('~org', '/studio/~org/metadata/flow')).toBe('orgFlows'); - expect(current('~org', '/studio/~org/metadata/flow/f')).toBe('orgFlows'); + // objectstack#38150 — rewritten on purpose: the package-less scope is retired, so no entry is "its + // flows". The Loose list of flows it redirects to is the flow type's list on the cross-package leg. + it('the cross-package leg\'s root is no entry; a type\'s list there is that type, the Loose list of flows included', () => { expect(current('~all', '/studio/~all/metadata')).toBeNull(); expect(current('~all', '/studio/~all/metadata/position')).toBe('type:position'); + expect(current('~all', '/studio/~all/metadata/flow')).toBe('type:flow'); + expect(current('~all', '/studio/~all/metadata/flow/nightly_digest')).toBe('type:flow'); }); }); @@ -405,8 +414,7 @@ describe('全部类型 All types: the 高级 fold\'s last row, under no group (o }); }); - it('~org and ~all, which draw no fold, have none', () => { - expect(studioMenuAllTypesEntry(studioMenuScope('~org'))).toBeNull(); + it('~all, which draws no fold, has none', () => { expect(studioMenuAllTypesEntry(studioMenuScope('~all'))).toBeNull(); }); @@ -436,13 +444,12 @@ describe('全部类型 All types: the 高级 fold\'s last row, under no group (o }); describe('概览 Overview: the package\'s own page, the menu\'s first row (objectstack#37454)', () => { - it('is a package\'s, opening its overview on Info; none on ~org or ~all', () => { + it('is a package\'s, opening its overview on Info; none on ~all', () => { expect(studioMenuOverviewEntry(studioMenuScope(PKG), null)).toEqual({ key: STUDIO_MENU_OVERVIEW_KEY, to: `/studio/${PKG}/overview`, pendingTo: `/studio/${PKG}/overview?tab=pending`, }); - expect(studioMenuOverviewEntry(studioMenuScope('~org'), 3)).toBeNull(); expect(studioMenuOverviewEntry(studioMenuScope('~all'), 3)).toBeNull(); }); 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 175317380d9..7e1a09e6540 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioMenuModel.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioMenuModel.ts @@ -27,15 +27,17 @@ * full-screen (objectstack#36903-36905; objectstack#36909 retired the last of * the pillar redirects). * - * And three entries that open no type's list, each in the group of what it + * And two entries that open no type's list, each in the group of what it * holds (the amendment's "Entries that are not a type"): - * - the organization's own flows (`~org`), under Automation; * - the organization-wide default sharing overview, under Access, on its own * route (`/studio//owd`, objectstack#36905); * - diagnostics, under Platform. - * The fourth, the cross-package environment directory, left the menu for + * Two more left the menu. The cross-package environment directory went to * Setup → Access control (ADR-0084, amended 2026-11-26, question 5; - * objectstack#37565): `views/setup/accessDirectory.ts`. + * objectstack#37565): `views/setup/accessDirectory.ts`. The organization's own + * flows (`~org`) retired with their scope (ADR-0084, amended 2026-11-26, + * `#amendment-2026-11-26-org`; objectstack#38150): the items of no package are + * the cross-package leg's "Loose" list, opened from Setup → Packages. * * And on a package one entry under no group, 全部类型 All types * ({@link studioMenuAllTypesEntry}; ADR-0084, amended 2026-11-25, @@ -71,13 +73,13 @@ * * On a package, a group is drawn in a tier only where it holds an entry of * that tier: the 常用 groups first, then one 高级 fold (`StudioMenu.tsx`). - * The package-less scope (`~org`) and the cross-package leg (`~all`) name no - * package: their menu is the environment's — the organization's flows and the - * environment catalog's types — drawn flat, in the same order, with no fold; - * only the groups that hold an entry are drawn. A catalog type's entry there - * opens its list on Setup's directory page, where the list now lives, for a - * principal who may open Setup (`setupDirectory`); for one who may not, it - * keeps the list on the cross-package leg, in the environment scope. + * The cross-package leg (`~all`) names no package: its menu is the + * environment's — the environment catalog's types — drawn flat, in the same + * order, with no fold; only the groups that hold an entry are drawn. A catalog + * type's entry there opens its list on Setup's directory page, where the list + * now lives, for a principal who may open Setup (`setupDirectory`); for one + * who may not, it keeps the list on the cross-package leg, in the environment + * scope. */ import { ENVIRONMENT_SCOPE_QUERY } from '../metadata-admin/catalog-scope.js'; @@ -93,7 +95,6 @@ import { studioPackagePath, } from './studioAddress.js'; import { studioPackageOverviewPath } from './studioOverviewAddress.js'; -import { isStudioOrgScope, studioOrgScopePath } from './studioScope.js'; import { STUDIO_MENU_NO_ROW_TYPES, STUDIO_MENU_PLACEMENT, type StudioMenuTier } from './studioMenuPlacement.js'; export type { StudioMenuTier } from './studioMenuPlacement.js'; @@ -135,7 +136,7 @@ export const STUDIO_MENU_ALWAYS_TYPES: readonly string[] = Object.freeze( STUDIO_MENU_PLACEMENT.filter((row) => row.tier === 'common').map((row) => row.type), ); -export type StudioMenuEntryKind = 'type' | 'orgFlows' | 'owd' | 'diagnostics' | 'allTypes'; +export type StudioMenuEntryKind = 'type' | 'owd' | 'diagnostics' | 'allTypes'; export interface StudioMenuEntry { /** Unique within the menu: `type:` for a type, the kind otherwise. */ @@ -161,10 +162,9 @@ export interface StudioMenuGroupModel { } /** Which scope the menu is drawn for, from the `/studio/:segment` route segment. */ -export type StudioMenuScope = { kind: 'package'; packageId: string } | { kind: 'org' } | { kind: 'all' }; +export type StudioMenuScope = { kind: 'package'; packageId: string } | { kind: 'all' }; export function studioMenuScope(segment: string): StudioMenuScope { - if (isStudioOrgScope(segment)) return { kind: 'org' }; if (isStudioAllPackagesScope(segment)) return { kind: 'all' }; return { kind: 'package', packageId: segment }; } @@ -217,7 +217,6 @@ export function buildStudioMenu(input: { if (scope.kind === 'package' && tier === 'common' && settled && !((count ?? 0) > 0)) entry.empty = true; entries.push(entry); } - groups.get('automation')!.push({ key: 'orgFlows', kind: 'orgFlows', to: studioOrgScopePath(), tier: 'advanced' }); if (scope.kind === 'package') { groups.get('system')!.push({ key: 'diagnostics', @@ -238,7 +237,7 @@ export function buildStudioMenu(input: { /** * The 高级 fold's last row on a package, 全部类型 All types, which sits under no * group (objectstack#37360): it opens the area's type directory. `null` on - * `~org` and `~all`, which draw no fold. + * `~all`, which draws no fold. */ export function studioMenuAllTypesEntry(scope: StudioMenuScope): StudioMenuEntry | null { if (scope.kind !== 'package') return null; @@ -267,8 +266,8 @@ export interface StudioMenuOverviewEntry { } /** - * 概览 Overview's row on a package, or `null` on `~org` and `~all`, which name - * no package (ADR-0084, amended 2026-11-26). `pending` is the open package's + * 概览 Overview's row on a package, or `null` on `~all`, which names no + * package (ADR-0084, amended 2026-11-26). `pending` is the open package's * pending-draft count as the surface reads it (`null` while unknown): the badge * is drawn only while it is above zero. */ @@ -300,7 +299,6 @@ export function studioMenuTiers(menu: readonly StudioMenuGroupModel[]): Record { + it('is refused by the spec manifest-id rule and by the predicate this app judges ids by', () => { + expect(RETIRED_ORG_SCOPE_SEGMENT).toBe('~org'); + expect(MANIFEST_ID_PATTERN.test(RETIRED_ORG_SCOPE_SEGMENT)).toBe(false); + expect(isSpecPackageId(RETIRED_ORG_SCOPE_SEGMENT)).toBe(false); + // Control: both accept a real reverse-domain id. + expect(MANIFEST_ID_PATTERN.test('com.example.showcase')).toBe(true); + expect(isSpecPackageId('com.example.showcase')).toBe(true); + }); + + it('cannot be typed into a package id: the sanitizer drops its first character', () => { + expect(sanitizePackageId(RETIRED_ORG_SCOPE_SEGMENT)).toEqual({ value: 'org', stripped: true }); + }); + + it('is told apart from a package segment', () => { + expect(isRetiredOrgScope(RETIRED_ORG_SCOPE_SEGMENT)).toBe(true); + expect(isRetiredOrgScope('com.example.showcase')).toBe(false); + expect(isRetiredOrgScope('org')).toBe(false); + expect(isRetiredOrgScope('~all')).toBe(false); + expect(isRetiredOrgScope(undefined)).toBe(false); + expect(isRetiredOrgScope(null)).toBe(false); + }); +}); + +describe('retiredOrgScopeTarget: where every address of the scope lands', () => { + it('is the Loose list of flows, the address the Setup → Packages banner links to', () => { + expect(retiredOrgScopeTarget()).toBe(LOOSE_FLOWS); + expect(retiredOrgScopeTarget('')).toBe(LOOSE_FLOWS); + // One address, two builders: the banner's link and this redirect cannot drift apart. + expect(retiredOrgScopeTarget()).toBe(looseListPath('flow')); + }); + + it('is an address the list reads as its Loose source value', () => { + const url = new URL(retiredOrgScopeTarget(), 'http://x'); + expect(url.pathname).toBe('/studio/~all/metadata/flow'); + expect(decodeListState(url.searchParams).source).toBe('loose'); + }); + + it('drops the scope’s own source value: `source=runtime` does not survive', () => { + expect(retiredOrgScopeTarget('?source=runtime')).toBe(LOOSE_FLOWS); + expect(retiredOrgScopeTarget('source=runtime')).toBe(LOOSE_FLOWS); + }); + + it('keeps the list’s search and its sort, and nothing else', () => { + expect(RETIRED_ORG_SCOPE_KEPT_PARAMS).toEqual(['q', 'sort']); + const target = retiredOrgScopeTarget( + '?source=runtime&q=digest&sort=label.desc&package=~org&scope=package&flow=nightly&surface=flow:nightly&changes=review&page=3', + ); + const url = new URL(target, 'http://x'); + expect(url.pathname).toBe('/studio/~all/metadata/flow'); + expect([...url.searchParams.keys()].sort()).toEqual(['q', 'sort', 'source']); + expect(url.searchParams.get('source')).toBe('loose'); + expect(url.searchParams.get('q')).toBe('digest'); + expect(url.searchParams.get('sort')).toBe('label.desc'); + }); + + it('drops an empty search or sort instead of carrying an empty key', () => { + expect(retiredOrgScopeTarget('?q=&sort=')).toBe(LOOSE_FLOWS); + }); +}); + +describe('the old addresses, read by the redirects that answer them', () => { + /** A retired pillar address of the scope, as `studioPillarRedirect` reads it. */ + const pillar = (name: string | undefined, search = '') => + studioPillarRedirect(RETIRED_ORG_SCOPE_SEGMENT, name, search); + + it('the scope’s root, and its old Automations deep links, land on the Loose list', () => { + expect(pillar(undefined)).toEqual({ kind: 'navigate', to: LOOSE_FLOWS }); + expect(pillar('automations')).toEqual({ kind: 'navigate', to: LOOSE_FLOWS }); + expect(pillar('automations', '?flow=nightly_digest')).toEqual({ kind: 'navigate', to: LOOSE_FLOWS }); + expect(pillar('automations', '?surface=flow:nightly_digest')).toEqual({ kind: 'navigate', to: LOOSE_FLOWS }); + // A pillar the scope never had (`/studio/~org/data` used to bounce to Automations). + expect(pillar('data')).toEqual({ kind: 'navigate', to: LOOSE_FLOWS }); + }); + + it('the scope’s leg of the area lands on the Loose list: its list, a flow, and a flow’s history', () => { + const area = (rest: string, search = '') => areaLocationRedirect(RETIRED_ORG_SCOPE_SEGMENT, rest, search); + expect(area('', '')).toBe(LOOSE_FLOWS); + expect(area('flow', '?source=runtime')).toBe(LOOSE_FLOWS); + // An item's address lands on the list, not on the item. + expect(area('flow/nightly_digest', '?source=runtime')).toBe(LOOSE_FLOWS); + expect(area('flow/nightly_digest/history', '')).toBe(LOOSE_FLOWS); + // A type the scope never listed has no other place either. + expect(area('object/account', '')).toBe(LOOSE_FLOWS); + // The list's search survives the move. + expect(area('flow', '?source=runtime&q=digest')).toBe('/studio/~all/metadata/flow?source=loose&q=digest'); + }); + + it('a `?package=~org` link on another leg lands there too', () => { + expect(areaLocationRedirect('~all', 'flow', '?package=~org')).toBe(LOOSE_FLOWS); + expect(areaLocationRedirect('com.example.showcase', 'flow/nightly_digest', '?package=~org')).toBe(LOOSE_FLOWS); + // Control: a `?package=` that names a real package is not this redirect. + expect(areaLocationRedirect('~all', 'flow', '?package=com.example.showcase')).not.toBe(LOOSE_FLOWS); + }); +}); diff --git a/ui/packages/app-shell/src/views/studio-design/studioOrgScopeRetired.ts b/ui/packages/app-shell/src/views/studio-design/studioOrgScopeRetired.ts new file mode 100644 index 00000000000..73394bdd88e --- /dev/null +++ b/ui/packages/app-shell/src/views/studio-design/studioOrgScopeRetired.ts @@ -0,0 +1,72 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * objectstack#38150 (ADR-0084's amendment of 2026-11-26) — Studio's + * package-less scope (`/studio/~org/…`, objectui#11553) is retired. The items + * that belong to no package are listed on the area's cross-package leg under + * its "Loose" source value, where they are selected and moved into a package + * (`looseMove.ts`), so the scope that listed the package-less flows alone has + * no page left. + * + * Every address of the scope still opens: it lands on the Loose list of flows, + * `/studio/~all/metadata/flow?source=loose`. That is one target for the + * scope's list, a flow's own address and its `/history`, the old + * `/studio/~org/automations` deep links, and a `?package=~org` link from + * another leg. A flow's address lands on the list, not on the flow: the list + * is where the flow is found and moved, and its row opens the flow's page. + * + * This module is the one mapping. Its callers are the three places a Studio + * address is read before a page mounts: the design surface + * (`StudioDesignSurface`), the retired pillar addresses' redirect + * (`studioPillarRedirectModel.ts`) and the area's own leg redirect + * (`areaLocationRedirect`). A host that declares the `/studio` routes may + * call it from a route of the segment too, so the address is answered before + * the builder loads (the console's `StudioRoute` does). + * + * ## The segment stays reserved + * + * `~` is outside every package-id alphabet in play: the spec's + * `MANIFEST_ID_PATTERN` (lowercase letters, digits, hyphens, dots), which this + * app judges ids by (`isSpecPackageId`), and the alphabet `sanitizePackageId` + * keeps (`packages-io.ts`, which also keeps underscores). So no package id can + * ever equal the segment, and redirecting it shadows no package. + */ + +import { LIST_LOOSE_SOURCE, LIST_QUERY_PARAM, LIST_SORT_PARAM, LIST_SOURCE_PARAM } from '../metadata-admin/metadataListState.js'; +import { RETIRED_ORG_SCOPE_SEGMENT, STUDIO_ALL_PACKAGES_SEGMENT, studioMetadataAreaAddress } from './studioAddress.js'; + +// The retired segment is Studio address vocabulary, owned by `studioAddress.ts`; re-exported here. +export { RETIRED_ORG_SCOPE_SEGMENT } from './studioAddress.js'; + +/** The one type the retired scope served: the Loose list its addresses land on is this type's. */ +const RETIRED_ORG_SCOPE_TYPE = 'flow'; + +/** + * What an old address's query keeps: the list's search and its sort, which + * mean the same on the Loose list. Everything else goes: the scope's own + * `?source=` value (`runtime`), `?package=`, `?scope=`, a retired pillar's + * `?flow=` and `?surface=`, and `?changes=review`, whose sheet retired with + * the scope. + */ +export const RETIRED_ORG_SCOPE_KEPT_PARAMS: readonly string[] = Object.freeze([LIST_QUERY_PARAM, LIST_SORT_PARAM]); + +/** Whether a `/studio/:packageId` route segment, or a `?package=` value, names the retired package-less scope. */ +export function isRetiredOrgScope(segment: string | null | undefined): boolean { + return segment === RETIRED_ORG_SCOPE_SEGMENT; +} + +/** + * Where an address of the retired scope lands: the Loose list of flows on the + * cross-package leg, with the search and the sort the address carried. + * + * `search` is the old address's query, with or without its `?`. + */ +export function retiredOrgScopeTarget(search = ''): string { + const from = new URLSearchParams(search); + const query = new URLSearchParams({ [LIST_SOURCE_PARAM]: LIST_LOOSE_SOURCE }); + for (const key of RETIRED_ORG_SCOPE_KEPT_PARAMS) { + const value = from.get(key); + if (value) query.set(key, value); + } + return studioMetadataAreaAddress(STUDIO_ALL_PACKAGES_SEGMENT, RETIRED_ORG_SCOPE_TYPE, { query }); +} 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 index d69b6913794..f8917814c43 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioPillarRedirectModel.test.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioPillarRedirectModel.test.ts @@ -6,8 +6,8 @@ * * - 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. + * base's `.custom` pair, and the retired 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 @@ -20,6 +20,10 @@ * list: it opens the package's 概览 Overview (ADR-0084, amended 2026-11-28), * a pair's its base's, the query carried over. `/data` keeps the object list. * The table's two bare rows are re-pointed, and the landing has its own block. + * + * objectstack#38150 — the package-less scope is retired: every address of it, + * a flow's included, lands on the Loose list of flows on the cross-package + * leg. The table's `~org` rows are re-pointed to that one literal. */ import { describe, expect, it } from 'vitest'; @@ -79,14 +83,18 @@ const NAVIGATE_TABLE: ReadonlyArray = [ [`/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'], + // The retired package-less scope (objectstack#38150): the pillar it had, a flow that pillar + // named, and every other address of it, on the Loose list of flows. The flow is not carried: + // the list is where it is found. + ['/studio/~org/automations', '/studio/~all/metadata/flow?source=loose'], + ['/studio/~org/automations?surface=flow%3Aclone_1', '/studio/~all/metadata/flow?source=loose'], + ['/studio/~org/automations?surface=flow%3Aclone_1&package=~org', '/studio/~all/metadata/flow?source=loose'], + ['/studio/~org/automations?flow=clone_1&changes=review', '/studio/~all/metadata/flow?source=loose'], + ['/studio/~org/data', '/studio/~all/metadata/flow?source=loose'], + ['/studio/~org/access', '/studio/~all/metadata/flow?source=loose'], + ['/studio/~org/interfaces', '/studio/~all/metadata/flow?source=loose'], + ['/studio/~org/owd', '/studio/~all/metadata/flow?source=loose'], + ['/studio/~org/overview', '/studio/~all/metadata/flow?source=loose'], ]; describe('every retired pillar address lands on the page that replaced it (objectstack#36909)', () => { @@ -113,7 +121,7 @@ describe('every retired pillar address lands on the page that replaced it (objec 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', () => { + it('the table covers every retired pillar segment, on a package and on the retired 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(); @@ -167,9 +175,9 @@ describe('opening a package has one landing: the bare address opens 概览 Overv expect(redirectOf(`/studio/${P}/overview?tab=pending`)).toBeNull(); }); - it('CONTROL: `/data` still lands on the object list, and the package-less scope’s bare address on its flows', () => { + it('CONTROL: `/data` still lands on the object list, and the retired package-less scope’s bare address on the Loose list of flows', () => { expect(redirectOf(`/studio/${P}/data`)).toEqual({ kind: 'navigate', to: `/studio/${P}/metadata/object?package=${P}` }); - expect(redirectOf('/studio/~org')).toEqual({ kind: 'navigate', to: '/studio/~org/metadata/flow?source=runtime' }); + expect(redirectOf('/studio/~org')).toEqual({ kind: 'navigate', to: '/studio/~all/metadata/flow?source=loose' }); // The cross-package leg has no overview: its bare address is left to the area. expect(redirectOf('/studio/~all')).toBeNull(); }); diff --git a/ui/packages/app-shell/src/views/studio-design/studioPillarRedirectModel.ts b/ui/packages/app-shell/src/views/studio-design/studioPillarRedirectModel.ts index 0df54f285dc..e7c6707d490 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioPillarRedirectModel.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioPillarRedirectModel.ts @@ -17,8 +17,7 @@ * | `/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 object list, 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 | + * | `/studio/~org[/]` | the Loose list of flows on the cross-package leg (the retired package-less scope) | * * Each mapping lives beside its pillar (`dataPillarRedirect`, * `automationsPillarRedirect`, `accessPillarRedirect`, @@ -50,7 +49,7 @@ import { dataPillarRedirect, isStudioAllPackagesScope, settledAreaAddress } from import { RETIRED_INTERFACES_SEGMENT, STUDIO_HOME_PILLAR, type StudioPillarKey } from './studioAddress.js'; import { retiredInterfacesState, retiredInterfacesTarget } from './studioInterfacesRetired.js'; import { studioPackageOverviewPath } from './studioOverviewAddress.js'; -import { isStudioOrgScope, studioOrgScopePath } from './studioScope.js'; +import { isRetiredOrgScope, retiredOrgScopeTarget } from './studioOrgScopeRetired.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; @@ -63,7 +62,7 @@ export const STUDIO_RETIRED_PILLAR_SEGMENTS: readonly StudioRetiredPillarSegment RETIRED_INTERFACES_SEGMENT, ]); -/** The retired Automations pillar's segment, the one the package-less scope had. */ +/** The retired Automations pillar's segment. */ const AUTOMATIONS_SEGMENT: StudioRetiredPillarSegment = 'automations'; /** The retired Access pillar's segment. */ @@ -83,8 +82,8 @@ export type StudioPillarRedirectTarget = /** * 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 `?`. + * package id, or the retired `~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, @@ -92,13 +91,10 @@ export function studioPillarRedirect( search: string, ): StudioPillarRedirectTarget | null { if (!segment || isStudioAllPackagesScope(segment)) return null; - 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: the bare one too, the scope drawing no 概览. - const to = pillar === AUTOMATIONS_SEGMENT ? automationsPillarRedirect(segment, search) : studioOrgScopePath(); - return { kind: 'navigate', to }; - } + // objectstack#38150 — the package-less scope is retired: its bare address + // and every segment under it land on the Loose list of flows + // (`studioOrgScopeRetired.ts`), a flow the address named included. + if (isRetiredOrgScope(segment)) return { kind: 'navigate', to: retiredOrgScopeTarget(search) }; if (pillar === null || pillar === undefined) { // objectstack#37958 — the bare package address opens the package's 概览 // Overview; a pair's, its base's. The query is carried over as it came. 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 df9ab68a7e6..0ba3c099883 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 @@ -1,59 +1,29 @@ // Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. /** - * objectui#11553 — the package-less Studio scope's pure half: the reserved - * segment, the path it builds, and the predicates that decide which served - * items and draft headers belong to no package. + * objectui#11553 — the items that belong to no package, as Studio reads + * them: the predicates that decide which served items and draft headers + * belong to no package, and the address such an item opens on. * - * The segment pins are against the package-id rules this app and the spec - * actually enforce, read from their owners, so a widened alphabet that could - * let a package id equal the segment fails here rather than in a router. + * The package-less scope's own segment and where its addresses land are + * pinned in `studioOrgScopeRetired.test.ts` (objectstack#38150). */ import { describe, expect, it } from 'vitest'; -import { MANIFEST_ID_PATTERN } from '@objectstack/spec/kernel'; -import { - STUDIO_ORG_SCOPE_SEGMENT, - isOrgScopeDraft, - isPackageLessDraft, - isPackageLessItem, - isStudioOrgScope, - studioOrgScopePath, -} from './studioScope'; -import { isSpecPackageId, sanitizePackageId } from './packages-io'; +import { isPackageLessDraft, isPackageLessItem, packageLessItemPath } from './studioScope'; -describe('the reserved segment cannot name a package (objectui#11553)', () => { - it('is refused by the spec manifest-id rule and by the predicate this app judges ids by', () => { - expect(MANIFEST_ID_PATTERN.test(STUDIO_ORG_SCOPE_SEGMENT)).toBe(false); - expect(isSpecPackageId(STUDIO_ORG_SCOPE_SEGMENT)).toBe(false); - // Control: both accept a real reverse-domain id. - expect(MANIFEST_ID_PATTERN.test('com.example.showcase')).toBe(true); - expect(isSpecPackageId('com.example.showcase')).toBe(true); +describe('packageLessItemPath: where an item of no package opens', () => { + it('is the item page on the cross-package leg, whatever the type', () => { + expect(packageLessItemPath({ type: 'flow', name: 'qa_urgent_alert_clone' })).toBe( + '/studio/~all/metadata/flow/qa_urgent_alert_clone', + ); + expect(packageLessItemPath({ type: 'object', name: 'loose_thing' })).toBe('/studio/~all/metadata/object/loose_thing'); }); - it('cannot be typed into a package id: the sanitizer drops its first character', () => { - expect(sanitizePackageId(STUDIO_ORG_SCOPE_SEGMENT)).toEqual({ value: 'org', stripped: true }); - }); - - it('is told apart from a package segment', () => { - expect(isStudioOrgScope(STUDIO_ORG_SCOPE_SEGMENT)).toBe(true); - expect(isStudioOrgScope('com.example.showcase')).toBe(false); - expect(isStudioOrgScope('org')).toBe(false); - expect(isStudioOrgScope(undefined)).toBe(false); - }); -}); - -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`); - }); - - it('opens a flow full-screen on its address, round-tripping its name', () => { - const path = studioOrgScopePath({ type: 'flow', name: 'qa_urgent_alert_clone' }); - expect(path).toBe('/studio/~org/metadata/flow/qa_urgent_alert_clone?source=runtime'); - const url = new URL(path, 'http://x'); - expect(decodeURIComponent(url.pathname.split('/').pop()!)).toBe('qa_urgent_alert_clone'); - expect(url.searchParams.get('source')).toBe('runtime'); + it('names no package and carries no query: the leg binds none', () => { + const url = new URL(packageLessItemPath({ type: 'flow', name: 'nightly_digest' }), 'http://x'); + expect([...url.searchParams.keys()]).toEqual([]); + expect(decodeURIComponent(url.pathname.split('/').pop()!)).toBe('nightly_digest'); }); }); @@ -76,11 +46,4 @@ describe('package-less predicates', () => { expect(isPackageLessDraft({})).toBe(true); expect(isPackageLessDraft({ packageId: 'com.acme.app' })).toBe(false); }); - - it('the scope reviews package-less FLOW drafts only, stored spelling folded', () => { - expect(isOrgScopeDraft({ type: 'flow', packageId: null })).toBe(true); - expect(isOrgScopeDraft({ type: 'flows', packageId: null })).toBe(true); - expect(isOrgScopeDraft({ type: 'object', packageId: null })).toBe(false); - expect(isOrgScopeDraft({ type: 'flow', packageId: 'com.acme.app' })).toBe(false); - }); }); 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 cea1e5993a4..cadbd902dbd 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioScope.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioScope.ts @@ -1,91 +1,34 @@ // Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. /** - * The one Studio scope that is not a package: the organization's own, - * package-less flows (objectui#11553). + * The items that belong to no package, as Studio reads them (objectui#11553). * * 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/`) 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. + * stored row names no package. Such a row is the environment's own (ADR-0150 + * D1, bucket 4: "environment-authored rows"), and every package-scoped list + * omits it. * - * This scope is where such a flow is listed and edited. It is the SAME - * `StudioDesignSurface` with no package under it, not a second builder: the - * area's route serves `/studio/~org/metadata/flow?source=runtime` (the list) - * and `/studio/~org/metadata/flow/?source=runtime` (the designer), and - * the surface reads the reserved segment as "no package". objectstack#36903 — - * the old `/studio/~org/automations` redirects there. + * These rows are listed on the "All metadata" area's cross-package leg, under + * its "Loose" source value (`metadataListState.ts`), where a person who may + * author selects them and moves them into a package (`looseMove.ts`, + * objectstack#38150). A loose row opens its item page on that leg + * ({@link packageLessItemPath}), where its draft is published or discarded. * - * ## The segment cannot name a package - * - * `~` is outside every package-id alphabet in play: the spec's - * `MANIFEST_ID_PATTERN` (lowercase letters, digits, hyphens, dots), which this - * app judges ids by (`isSpecPackageId`), and the alphabet `sanitizePackageId` - * keeps (`packages-io.ts`, which also keeps underscores). So no package id can - * ever equal it. - * - * ## What the scope offers, and what it does not - * - * Flows only, which is what the ruling on objectui#11553 asks for: every flow - * that belongs to no package, listed and opened editable, because it is the - * organization's own. It offers no "New" flow: new authoring stays - * package-first, and this scope exists to reach flows that already exist - * without a package (a clone is the measured producer). - * - * ## Where it lives (objectstack#36903) - * - * In its own leg of the "All metadata" area, as a package's flows are in - * theirs: the list at `/studio/~org/metadata/flow`, a flow full-screen at - * `/studio/~org/metadata/flow/`. Both carry the list's source filter - * `?source=runtime`: an item with no owning package is the list's `runtime` - * 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`), and every other `/studio/~org/...` URL to - * the list (`studioPillarRedirectModel.ts`). + * The package-less scope that listed the flows among them (`/studio/~org/…`) + * is retired; `studioOrgScopeRetired.ts` says where its addresses land. */ -import { canonicalMetaUrlType } from '@objectstack/spec/shared'; -import { LIST_SOURCE_PARAM } from '../metadata-admin/metadataListState.js'; -import { - STUDIO_ORG_SCOPE_SEGMENT, - STUDIO_ORG_SCOPE_TYPE, - studioMetadataAreaAddress, - studioMetadataItemAddress, -} from './studioAddress.js'; - -// 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_TYPE } from './studioAddress.js'; +import { STUDIO_ALL_PACKAGES_SEGMENT, studioMetadataItemAddress } from './studioAddress.js'; /** - * objectstack#36903 — the list source the scope's addresses carry: the items - * with no owning package (`metadataListState.ts`'s `runtime`). + * Where an item that belongs to no package opens: its item page on the area's + * cross-package leg (`/studio/~all/metadata//`), the page its row + * of the "Loose" list opens. That leg names no package, so the page is the + * generic item page whatever the type. */ -export const STUDIO_ORG_SCOPE_SOURCE = 'runtime'; - -/** Whether a `/studio/:packageId` route segment names the package-less scope. */ -export function isStudioOrgScope(segment: string | null | undefined): boolean { - return segment === STUDIO_ORG_SCOPE_SEGMENT; -} - -/** - * The package-less scope's flows (objectstack#36903): its list in the area, - * or one flow's full-screen designer, each with the scope's source filter. - */ -export function studioOrgScopePath(surface?: { type: string; name: string }): string { - // The reserved segment is written as it is, as it always was (`~` is outside - // every package-id alphabet, and `encodeURIComponent` leaves it unchanged). - const query = `${LIST_SOURCE_PARAM}=${STUDIO_ORG_SCOPE_SOURCE}`; - if (!surface) { - return studioMetadataAreaAddress(STUDIO_ORG_SCOPE_SEGMENT, encodeURIComponent(STUDIO_ORG_SCOPE_TYPE), { - query, - segmentEncoding: 'verbatim', - }); - } - return studioMetadataItemAddress(STUDIO_ORG_SCOPE_SEGMENT, surface.type, surface.name, { query, segmentEncoding: 'verbatim' }); +export function packageLessItemPath(item: { type: string; name: string }): string { + return studioMetadataItemAddress(STUDIO_ALL_PACKAGES_SEGMENT, item.type, item.name); } /** @@ -106,7 +49,7 @@ function namesAPackage(value: unknown): boolean { * (`MetadataProtectionFields`, which `FlowSchema` spreads). The registry's * package filter keeps exactly the items whose `_packageId` equals the asked * package, so an item without one is precisely what every package-scoped list - * omits, and what this scope has to list. + * omits, and what the "Loose" list holds. */ export function isPackageLessItem(item: { _packageId?: unknown } | null | undefined): boolean { return !namesAPackage(item?._packageId); @@ -119,14 +62,3 @@ export function isPackageLessItem(item: { _packageId?: unknown } | null | undefi export function isPackageLessDraft(header: { packageId?: unknown } | null | undefined): boolean { return !namesAPackage(header?.packageId); } - -/** - * The drafts the package-less scope reviews and publishes: package-less FLOW - * drafts, nothing else. A package-less draft of another type is not on this - * surface, so its header must not count it and its Publish must not ship it. - * The stored type is folded first: the feed returns each row's stored - * spelling. - */ -export function isOrgScopeDraft(entry: { type: string; packageId?: unknown }): boolean { - return canonicalMetaUrlType(entry.type) === 'flow' && isPackageLessDraft(entry); -} diff --git a/ui/packages/app-shell/src/views/studio-design/studioSurfaceDrafts.tsx b/ui/packages/app-shell/src/views/studio-design/studioSurfaceDrafts.tsx index c4ff6e2ff4e..eb425ae9b68 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioSurfaceDrafts.tsx +++ b/ui/packages/app-shell/src/views/studio-design/studioSurfaceDrafts.tsx @@ -18,7 +18,6 @@ import type { StudioSavedDraft } from './StudioPillarKit.js'; import { usePendingDrafts } from '../../preview/usePendingDrafts.js'; import { STUDIO_CHANGES_PARAM, STUDIO_CHANGES_REVIEW } from './studioChangesLink.js'; import type { StudioRefusal } from './metadataError.js'; -import { isOrgScopeDraft } from './studioScope.js'; import type { SupportedLocale } from '../metadata-admin/i18n.js'; import type { DraftChangeEntry } from '../../preview/DraftChangesPanel.js'; @@ -88,13 +87,12 @@ export function useStudioChangesSheet() { /** The pending-drafts ledger, its count and the refusals kept on its entries. */ export function useStudioDraftLedger({ - packageId, draftScope, publishNonce, setDraftNonce, locale, }: { - packageId: string | null; + /** The package whose drafts the ledger lists (a read-only base's pair), or `null` on the cross-package leg: the environment's. */ draftScope: string | null; publishNonce: number; setDraftNonce: React.Dispatch>; @@ -111,17 +109,14 @@ export function useStudioDraftLedger({ // with every OTHER surface's publishes (chat bar, home banner) — previously // a publish from the right dock never updated this count. // - // objectui#11553 — the package-less scope reads the env-wide feed and counts - // only what it shows and publishes: package-less FLOW drafts. Still `null` - // while the feed is unknown, so the header keeps telling unknown from zero. + // `null` while the feed is unknown, so a reader keeps telling unknown from + // zero. const { - count: feedCount, + count: pendingCount, entries: pendingEntries, refresh: refreshPending, behindSave, } = usePendingDrafts({ packageId: draftScope }); - const pendingCount = - packageId !== null ? feedCount : feedCount === null ? null : pendingEntries.filter(isOrgScopeDraft).length; // A draft save asks for its own read (`onDraftSaved` below, objectui#11787); // this one serves the mount and a publish. @@ -134,12 +129,12 @@ export function useStudioDraftLedger({ }); // A kept refusal whose draft the ledger no longer lists has nothing left to // fix (discarded, or published from another surface), so it is not shown. - // Read only off a known ledger: an unknown one (`feedCount === null`) lists nothing. + // Read only off a known ledger: an unknown one (`pendingCount === null`) lists nothing. const listedPublishRefusals = React.useMemo(() => { - if (feedCount === null || publishRefusals.size === 0) return publishRefusals; + if (pendingCount === null || publishRefusals.size === 0) return publishRefusals; const listed = new Set(pendingEntries.map((e) => publishRefusalKey(e.type, e.name))); return new Map([...publishRefusals].filter(([key]) => listed.has(key))); - }, [feedCount, pendingEntries, publishRefusals]); + }, [pendingCount, pendingEntries, publishRefusals]); // objectui#11787 — a Studio draft save reports here when it lands, and the // count follows it: the read it asks for is sent after the save, never // answered by a read already on the wire, and until that read answers the @@ -181,15 +176,14 @@ export function useStudioDraftLedger({ ); const shownPendingCount = behindSave ? Math.max(pendingCount ?? 0, 1) : pendingCount; // objectui#12725 — the same ledger and number, for the pillars' item headers - // (「草稿 · N 项未发布」): the rows the count above counts, so the package-less - // scope offers its org-scope flow drafts only. + // (「草稿 · N 项未发布」): the rows the count above counts. const pillarPendingDrafts = React.useMemo( () => ({ count: shownPendingCount, - entries: packageId !== null ? pendingEntries : pendingEntries.filter(isOrgScopeDraft), + entries: pendingEntries, behindSave, }), - [shownPendingCount, packageId, pendingEntries, behindSave], + [shownPendingCount, pendingEntries, behindSave], ); return { setPublishRefusals, diff --git a/ui/packages/app-shell/src/views/studio-design/studioSurfaceNavigation.tsx b/ui/packages/app-shell/src/views/studio-design/studioSurfaceNavigation.tsx index 640b09f2173..aa9a6f9b27d 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioSurfaceNavigation.tsx +++ b/ui/packages/app-shell/src/views/studio-design/studioSurfaceNavigation.tsx @@ -15,7 +15,6 @@ import { useCommandPaletteProviderMounted } from '../../context/CommandPalettePr import { StudioPaletteGroups } from './StudioPaletteGroups.js'; import { openStudioPaletteAddress } from './studioPaletteModel.js'; import { isRetiredInterfacesLanding } from './studioInterfacesRetired.js'; -import { studioOrgScopePath } from './studioScope.js'; import { studioItemPath } from './studioAddress.js'; import type { SurfaceTarget } from './useSurfaceDeepLink.js'; import type { PkgEntry } from './packages-io.js'; @@ -50,7 +49,6 @@ export function useRetiredInterfacesLanding() { /** Where a surface request, a menu re-entry and a palette pick take the author. */ export function useStudioSurfaceNavigation({ scopeSegment, - allScope, packageId, draftScope, pkgMissing, @@ -60,7 +58,6 @@ export function useStudioSurfaceNavigation({ setChangesOpen, }: { scopeSegment: string; - allScope: boolean; packageId: string | null; draftScope: string | null; pkgMissing: boolean; @@ -99,9 +96,9 @@ export function useStudioSurfaceNavigation({ return; } // objectstack#36903 — a flow is its designer's own address, in a - // package's area or the package-less scope's. - if (target.type === 'flow' && !allScope) { - const to = packageId === null ? studioOrgScopePath(target) : studioItemPath(packageId, 'flow', target.name); + // package's area. + if (target.type === 'flow' && packageId !== null) { + const to = studioItemPath(packageId, 'flow', target.name); if (to.split('?')[0] !== currentPathname) { if (!confirmLeavePillar()) return false; shellNavigate(to); @@ -111,7 +108,7 @@ export function useStudioSurfaceNavigation({ } setChangesOpen(false); }, - [allScope, packageId, draftScope, confirmLeavePillar, shellNavigate, currentPathname, setChangesOpen], + [packageId, draftScope, confirmLeavePillar, shellNavigate, currentPathname, setChangesOpen], ); // objectstack#36899 — a menu entry or a palette pick that is the page // already shown, on another query, asks about unsaved work first: the diff --git a/ui/packages/app-shell/src/views/studio-design/studioSurfacePublish.ts b/ui/packages/app-shell/src/views/studio-design/studioSurfacePublish.ts index 4924d730217..7ce89786c32 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioSurfacePublish.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioSurfacePublish.ts @@ -4,8 +4,8 @@ * The design surface's publish, moved out of `StudioDesignSurface.tsx` * unchanged by objectstack#37553 (a move-only split): the one publish every * door runs (概览's Pending tab, the review sheet), on a package's drafts - * through the batch door or, in the package-less scope, flow by flow, and the - * toast that says what went live, what was refused and what the backfill wrote. + * through the batch door, and the toast that says what went live, what was + * refused and what the backfill wrote. */ import * as React from 'react'; @@ -19,11 +19,10 @@ import { extractDraftBody, formatMetadataError, } from '@object-ui/data-objectstack'; -import type { MetadataClient, MetadataError } from '@object-ui/data-objectstack'; +import type { MetadataClient } from '@object-ui/data-objectstack'; import { canonicalMetaUrlType } from '@objectstack/spec/shared'; -import { resolveI18nLabel } from '@objectstack/spec/ui'; import { toast } from 'sonner'; -import { fetchPendingDrafts, type UsePendingDraftsResult } from '../../preview/usePendingDrafts.js'; +import type { UsePendingDraftsResult } from '../../preview/usePendingDrafts.js'; import { emitMetadataRefresh } from '../../assistant/assistantBus.js'; import type { DraftPublishOptions } from '../../preview/DraftChangesPanel.js'; import { readEnvelopeFailureText } from '../../utils/apiErrorEnvelope.js'; @@ -36,7 +35,6 @@ import { type StudioRefusal, } from './metadataError.js'; import type { StudioSaveCoordinator } from './studioSaveBar.js'; -import { isOrgScopeDraft } from './studioScope.js'; import { NO_PUBLISH_REFUSALS, publishRefusalKey } from './studioSurfaceDrafts.js'; /** The batch door's `backfillApplied` receipt, by reference to what the client returns (objectui#12929). */ @@ -96,9 +94,13 @@ export function useStudioPublishAction({ const openAccessRef = React.useRef<() => void>(() => {}); // `options` is the review sheet's (objectui#12929): its checked backfill - // choices, or nothing. Only the package batch door below carries it; the - // sheet offers no choice in the package-less scope. + // choices, or nothing. const doPublish = React.useCallback(async (options?: DraftPublishOptions) => { + // The publish is a package's: its two doors (概览's Pending tab, the review + // sheet) are drawn for a package only. A draft bound to no package is + // published on its item page, or with Home's Publish all + // (`usePublishAllDrafts`), never from here. + if (packageId === null) return; if (heldEdit !== null) { toast.error(tFormat('engine.studio.held.publish', locale, { clause: heldEdit })); return; @@ -138,60 +140,6 @@ export function useStudioPublishAction({ ); }; try { - if (packageId === null) { - // objectui#11553 — the package-less scope has no package to publish - // as a batch: `POST /packages/:id/publish-drafts` cannot reach a draft - // bound to none. Each package-less flow draft is promoted BY REFERENCE - // instead, through the single-item door the client documents for - // exactly that case (`publishDraft`), as Home's publish-all does for - // its package-less drafts. Read fresh, never from the header's count, - // and narrowed to what this scope reviewed: package-less flows. - const pending = (await fetchPendingDrafts(null)).filter(isOrgScopeDraft); - const failed: PublishFailure[] = []; - for (const d of pending) { - try { - await shellClient.publishDraft('flow', d.name); - } catch (e) { - failed.push({ - type: 'flow', - name: d.name, - error: formatMetadataError(e), - issues: (e as Partial | null)?.issues, - }); - } - } - if (failed.length > 0) { - // Not all-or-nothing: the drafts that went live stay live, and the - // ones that did not keep their reason on their entries. - await keepRefusals(failed); - } else if (pending.length === 0) { - // objectui#11807 — nothing was pending by the time this read ran, so - // nothing went live: said as such, never as a success. - toast.info(t('engine.studio.publishNoneTitle', locale)); - setChangesOpen(false); - } else { - // objectui#11807 — how many went live: every draft read above, as - // none failed. - // The toast names what went live: one flow in its title, several - // by count with their names in the description. - setPublishRefusals(NO_PUBLISH_REFUSALS); - const names = pending.map((d) => resolveI18nLabel(d.label, locale)?.trim() || d.name); - if (names.length === 1) { - toast.success(tFormat('engine.studio.publishedAllFlowsOne', locale, { label: names[0] })); - } else { - toast.success(tFormat('engine.studio.publishedAllFlows', locale, { count: names.length }), { - description: names.join(', '), - }); - } - setChangesOpen(false); - } - setPublishNonce((n) => n + 1); - emitMetadataRefresh(); - // The tail below the `finally` is the package path's; this one - // re-reads the count itself before leaving. - await refreshPending(); - return; - } // objectui#10039 — through `MetadataClient`, not a bare `fetch`. The // route answers the runtime authoring gate's per-draft advisories on // each `published[]` element (objectstack#9343), and the client is the diff --git a/ui/packages/app-shell/src/views/studio-design/studioSurfaceRightSlot.tsx b/ui/packages/app-shell/src/views/studio-design/studioSurfaceRightSlot.tsx index 81c7b7b7fa8..3de6fe8034b 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioSurfaceRightSlot.tsx +++ b/ui/packages/app-shell/src/views/studio-design/studioSurfaceRightSlot.tsx @@ -45,8 +45,7 @@ export function useStudioSurfaceRightSlot({ // speak for itself. const isMobile = useIsMobile(); // objectui#12725 — the one right slot (`StudioRightSlot`): the open item's - // properties. Not in the package-less scope: its one pillar keeps its own - // aside (objectui#11553). + // properties. Not on the cross-package leg, which opens no package. // objectstack#32615 — nor in a package that is not there (`pkgMissing`). const slotHost = chatDockMode && packageId !== null && !pkgMissing; // Shown or hidden from the title row, remembered per tab under the key the diff --git a/ui/packages/app-shell/src/views/studio-design/studioSurfaceScope.ts b/ui/packages/app-shell/src/views/studio-design/studioSurfaceScope.ts index 1293f0b8612..0d078974bf5 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioSurfaceScope.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioSurfaceScope.ts @@ -3,7 +3,7 @@ /** * The design surface's scope resolution, moved out of `StudioDesignSurface.tsx` * unchanged by objectstack#37553 (a move-only split): the route segment read as - * a package, the package-less scope (`~org`) or the cross-package leg (`~all`); + * a package or the cross-package leg (`~all`); * what the package list answers about the open package (writable, its name, * missing, a read-only base's facts and its `.custom` pair); the base's * customization; and the package's apps. @@ -21,7 +21,6 @@ import { PACKAGE_LIST_TOAST_ID } from './PackageSwitcher.js'; import { type StudioAppTarget } from './StudioBackToApp.js'; import type { StudioBaseCustomization } from './StudioPillarKit.js'; import { STUDIO_HOME_PILLAR } from './studioInterfacesRetired.js'; -import { isStudioOrgScope } from './studioScope.js'; import { STUDIO_METADATA_AREA, isStudioAllPackagesScope } from './metadataArea.js'; import { useMetadataRefreshNonce } from './useMetadataRefreshNonce.js'; // objectui#11787 — the shared draft autosave, moved to its own module unchanged. @@ -42,17 +41,19 @@ import { useCustomizeDoorWalled } from './StudioCustomizeControls.js'; /** What the route segment names: the scope, the package (or none) and the page. */ export function useStudioSurfaceScope(area: typeof STUDIO_METADATA_AREA | undefined) { const params = useParams<{ packageId?: string; tab?: string }>(); - // The route segment: a package id, or the package-less scope's reserved - // segment (objectui#11553, `studioScope.ts`). URLs are built from it. + // The route segment: a package id, or the cross-package leg's reserved + // segment. URLs are built from it. The retired package-less scope's segment + // (`~org`) never reaches here: the surface redirects it before this hook + // runs (`StudioDesignSurface`, `studioOrgScopeRetired.ts`). const scopeSegment = params.packageId ?? 'com.example.showcase'; // objectstack#36899 — the "All metadata" area's cross-package leg (`~all`) // is drawn in this shell too, so the left menu is the same on every Studio // page: the area alone, with no package, no package actions and no slot. const allScope = isStudioAllPackagesScope(scopeSegment); - // `null` in the package-less scope and on the cross-package leg. Every - // package-scoped read, write and publish below keys on this value, so none - // of them can be handed a reserved segment as though it named a package. - const packageId: string | null = isStudioOrgScope(scopeSegment) || allScope ? null : scopeSegment; + // `null` on the cross-package leg. Every package-scoped read, write and + // publish below keys on this value, so none of them can be handed the + // reserved segment as though it named a package. + const packageId: string | null = allScope ? null : scopeSegment; const tab = area ?? params.tab ?? STUDIO_HOME_PILLAR; return { scopeSegment, allScope, packageId, tab }; } @@ -96,8 +97,8 @@ export function useStudioPackageFacts(packageId: string | null) { listedPair: string | null; } | null>(null); React.useEffect(() => { - // objectui#11553 — the package-less scope has no package to look up; its - // writability is decided below, not fetched. + // The cross-package leg has no package to look up; its writability is + // decided below, not fetched. if (packageId === null) return; let cancelled = false; setPkgWritable(undefined); @@ -167,9 +168,9 @@ export function useStudioPackageFacts(packageId: string | null) { cancelled = true; }; }, [packageId]); - // objectui#11553 — the package-less scope's flows are the organization's - // own, so they open editable whatever the last package answered. The - // server's write gate stays the authority, exactly as for a writable package. + // With no package open nothing is read-only by a package's verdict, + // whatever the last package answered. The server's write gate stays the + // authority, exactly as for a writable package. const readOnly = packageId !== null && pkgWritable === false; // objectstack#28562 — the base's pair: the ensure door's answer once this // surface has asked it, else the listed one. Pending, the changes panel and @@ -293,7 +294,7 @@ export function useStudioPackageApps( // same moment. Same resolution as the pillar now: published first, DRAFT app // fallback, re-resolved on draft saves and on the metadata-refresh pulse. const resolvePackageApp = React.useCallback(async (): Promise => { - // objectui#11553 — no package, so no package app to resolve. + // No package, so no package app to resolve. if (packageId === null) { setPackageApp(null); setPublishedApps([]); diff --git a/ui/packages/app-shell/src/views/studio-design/studioZhPillarNames-11801.test.ts b/ui/packages/app-shell/src/views/studio-design/studioZhPillarNames-11801.test.ts index e296b87b227..9b0ed6862a6 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioZhPillarNames-11801.test.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioZhPillarNames-11801.test.ts @@ -8,8 +8,9 @@ * designer tables' shared extractor (`readDesignerPairs` in * `ui/scripts/check-i18n-dead-keys.mjs`), so the population is the whole table * rather than a list of keys this file would have to keep. Its lit control: - * the extractor's zh value for `engine.studio.menu.orgFlows` (objectstack#36899 - * retired the pillar names with the top nav) must be the one + * the extractor's zh value for `engine.studio.menu.allTypes` (objectstack#36899 + * retired the pillar names with the top nav; objectstack#38150 retired + * `engine.studio.menu.orgFlows`, the control's key before) must be the one * `t()` serves, so an extractor that read nothing cannot pass for "no 支柱". * * Moved out of `StudioDesignSurface.railLabels.test.tsx` when objectstack#36502 @@ -34,12 +35,15 @@ const REPO_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '.. describe('zh-CN names a pillar by its tab label (objectui#11801)', () => { it('no zh value in the designer string tables says 支柱', () => { - const ZH_ORG_FLOWS = t('engine.studio.menu.orgFlows', 'zh-CN'); + const ZH_ALL_TYPES = t('engine.studio.menu.allTypes', 'zh-CN'); const tables = readTables(REPO_ROOT); const zh = tables.get('ENGINE_STRINGS_ZH'); // Lit control: the extractor reads the table `t()` serves. - expect(zh?.get('engine.studio.menu.orgFlows')).toBe(ZH_ORG_FLOWS); - expect(ZH_ORG_FLOWS).toBe('组织级流程'); + expect(zh?.get('engine.studio.menu.allTypes')).toBe(ZH_ALL_TYPES); + expect(ZH_ALL_TYPES).toBe('全部类型'); + // objectstack#38150 — the retired scope's menu name is in neither table. + expect(zh?.has('engine.studio.menu.orgFlows')).toBe(false); + expect(tables.get('ENGINE_STRINGS_EN')?.has('engine.studio.menu.orgFlows')).toBe(false); const offenders: string[] = []; for (const [name, table] of tables) { diff --git a/ui/packages/i18n/src/namespaces/studio/en.ts b/ui/packages/i18n/src/namespaces/studio/en.ts index 433960bee6d..bb9a04db172 100644 --- a/ui/packages/i18n/src/namespaces/studio/en.ts +++ b/ui/packages/i18n/src/namespaces/studio/en.ts @@ -3532,9 +3532,11 @@ const STUDIO_EN: Record = { // where Studio's entries that name no package land since the Studio home went. 'engine.studio.notFound.packageList': 'Open the package list', // The same way out for a principal who may enter Studio but not open - // Setup → Packages: the organization's flows (`~org`), which every - // principal who may enter Studio may open (objectstack#37565). - 'engine.studio.notFound.allMetadata': 'Open organization flows', + // Setup → Packages: the flows that belong to no package, the "Loose" list + // on the cross-package leg, which every principal who may enter Studio may + // open (objectstack#37565; objectstack#38150 retired the package-less + // scope this opened, and its name with it). + 'engine.studio.notFound.allMetadata': 'Open loose flows', 'engine.studio.notFound.pillar': 'This page does not exist. App Studio has no "{pillar}" section; pick Data, Automations, Interfaces, Access or All metadata above.', // objectui#12725 — the Studio right slot (the properties panel). 'engine.studio.slot.label': 'Right panel', @@ -3558,7 +3560,6 @@ const STUDIO_EN: Record = { 'engine.studio.menu.expand': 'Show the menu', 'engine.studio.menu.collapse': 'Hide the menu', 'engine.studio.menu.itemCount': '{count} items', - 'engine.studio.menu.orgFlows': 'Organization flows', 'engine.studio.menu.owd': 'Default sharing', 'engine.studio.menu.diagnostics': 'Diagnostics', 'engine.studio.menu.environment': 'Positions and permissions', @@ -3611,8 +3612,7 @@ const STUDIO_EN: Record = { 'engine.studio.interfacesRetired.sentence': 'Interface edits have moved into the app.', 'engine.studio.interfacesRetired.backToApp': 'Back to the app', 'engine.studio.interfacesRetired.dismiss': 'Dismiss', - // Header · package-level publish + app bridge - 'engine.studio.changes': 'Changes', + // Header · app bridge // objectstack#36501 — the top bar's left end: 「‹ Back to app」, the app's // name, and the Studio mark. It returns to the app page the author came from. 'engine.studio.backToApp': 'Back to app', @@ -3627,9 +3627,6 @@ const STUDIO_EN: Record = { 'engine.studio.pkg.search': 'Search packages', 'engine.studio.pkg.noMatches': 'No package matches', 'engine.studio.pkg.newPackage': 'New package', - // The switcher's name for the package-less scope (`~org`): its menu lists more - // than flows, so it is not named after its flow entry. - 'engine.studio.pkg.orgScope': 'Organization metadata', // objectstack#37139 — the 「⋯」 package menu beside the app or package name: // the development face's whole-package actions, for a manage_metadata holder. 'engine.studio.packageMenu.trigger': 'Package actions', @@ -3716,12 +3713,6 @@ const STUDIO_EN: Record = { 'engine.studio.landing.dupDefaultName': '{name} copy', 'engine.studio.landing.dupNamePlaceholder': 'Copy name', 'engine.studio.landing.dupIdPlaceholder': 'Copy package ID', - // objectui#11553 — the package-less scope: the organization's own flows. - 'engine.studio.org.name': 'Organization flows', - 'engine.studio.org.hint': 'Flows that belong to no package', - 'engine.studio.org.description': 'The organization’s own flows that belong to no package, such as a clone of a packaged flow. They open editable.', - // ADR-0146 D11 — no link out: no Setup page copies a flow into this scope any more. - 'engine.studio.org.none': 'No flows outside a package. To change a packaged flow, open its package and use New similar.', // objectstack#36748 — the new-app step of the package dialog (`newAppDoor.ts`), // run by the create-package dialog's 「同时创建应用」 (objectstack#37134). 'engine.studio.newApp.nameTaken': 'The app “{label}” already uses the identifier “{name}”. Change the namespace under Advanced.', @@ -3741,8 +3732,6 @@ const STUDIO_EN: Record = { 'engine.studio.area.formEditor.usedByOther': 'Once published, a change here reaches the {count} items built on this dataset:', 'engine.studio.area.formEditor.usedByNone': 'Nothing uses this dataset yet: no dashboard, report or other item names it.', 'engine.studio.area.formEditor.usedByError': 'The dashboards and reports that use this dataset could not be read, so what a change here reaches is not known.', - 'engine.studio.publishedAllFlows': 'Published {count} flows', - 'engine.studio.publishedAllFlowsOne': 'Published flow "{label}"', 'engine.studio.designer.search': 'Search…', 'engine.studio.designer.select': 'Select…', 'engine.studio.designer.pickDate': 'Pick a date…', diff --git a/ui/packages/i18n/src/namespaces/studio/zh.ts b/ui/packages/i18n/src/namespaces/studio/zh.ts index 84a37c31e5f..42d3ef85986 100644 --- a/ui/packages/i18n/src/namespaces/studio/zh.ts +++ b/ui/packages/i18n/src/namespaces/studio/zh.ts @@ -3115,7 +3115,7 @@ const STUDIO_ZH: Record = { 'engine.studio.desktopHint': '应用搭建专为桌面屏幕设计。', 'engine.studio.notFound.package': '未找到包。本部署没有安装 ID 为“{id}”的包,因此无处可构建。', 'engine.studio.notFound.packageList': '打开软件包列表', - 'engine.studio.notFound.allMetadata': '打开「组织流程」', + 'engine.studio.notFound.allMetadata': '打开散落的流程', 'engine.studio.notFound.pillar': '页面不存在。应用搭建没有“{pillar}”这一栏,请在上方选择数据、自动化、界面、权限或全部元数据。', // objectui#12725 — Studio 右栏(属性面板)。 'engine.studio.slot.label': '右栏', @@ -3138,7 +3138,6 @@ const STUDIO_ZH: Record = { 'engine.studio.menu.expand': '展开菜单', 'engine.studio.menu.collapse': '收起菜单', 'engine.studio.menu.itemCount': '{count} 项', - 'engine.studio.menu.orgFlows': '组织级流程', 'engine.studio.menu.owd': '默认共享', 'engine.studio.menu.diagnostics': '诊断', 'engine.studio.menu.environment': '岗位与权限', @@ -3191,8 +3190,7 @@ const STUDIO_ZH: Record = { 'engine.studio.interfacesRetired.sentence': '界面的修改已经搬到应用里', 'engine.studio.interfacesRetired.backToApp': '回到应用', 'engine.studio.interfacesRetired.dismiss': '关闭', - // Header · package-level publish + app bridge - 'engine.studio.changes': '变更', + // Header · app bridge 'engine.studio.backToApp': '返回应用', 'engine.studio.backToAppTitle': '离开应用搭建,回到 {app}', 'engine.studio.backToAppTitleNoApp': '离开应用搭建,回到你的应用', @@ -3204,7 +3202,6 @@ const STUDIO_ZH: Record = { 'engine.studio.pkg.search': '搜索软件包', 'engine.studio.pkg.noMatches': '没有匹配的软件包', 'engine.studio.pkg.newPackage': '新建软件包', - 'engine.studio.pkg.orgScope': '组织元数据', // objectstack#37139 — 应用名或包名右侧的「⋯」软件包菜单。 'engine.studio.packageMenu.trigger': '软件包操作', 'engine.studio.packageMenu.editInfo': '编辑软件包信息', @@ -3280,11 +3277,6 @@ const STUDIO_ZH: Record = { 'engine.studio.landing.dupDefaultName': '{name} 副本', 'engine.studio.landing.dupNamePlaceholder': '副本名称', 'engine.studio.landing.dupIdPlaceholder': '副本包 ID', - // objectui#11553 — the package-less scope: the organization's own flows. - 'engine.studio.org.name': '组织流程', - 'engine.studio.org.hint': '不属于任何软件包的流程', - 'engine.studio.org.description': '本组织自有、不属于任何软件包的流程,例如软件包流程的克隆副本。可直接编辑。', - 'engine.studio.org.none': '没有不属于软件包的流程。要修改软件包中的流程,请打开它所在的软件包,使用“新建类似”。', // objectstack#36748 — the package dialog's new-app step, run by 「同时创建应用」 (objectstack#37134). 'engine.studio.newApp.nameTaken': '应用「{label}」已经在用标识「{name}」。请在“高级”中换一个命名空间。', 'engine.studio.newApp.appFailed': '「{name}」已创建,但应用没能上线:{reason}。可以在软件包菜单里打开「应用」,点「新建」重试。', @@ -3300,8 +3292,6 @@ const STUDIO_ZH: Record = { 'engine.studio.area.formEditor.usedByOther': '发布后,这里的修改会影响基于此数据集的 {count} 项:', 'engine.studio.area.formEditor.usedByNone': '目前没有仪表盘、报表或其他内容使用此数据集。', 'engine.studio.area.formEditor.usedByError': '无法读取哪些仪表盘和报表在使用此数据集,因此不知道这里的修改会影响什么。', - 'engine.studio.publishedAllFlows': '已发布 {count} 个流程', - 'engine.studio.publishedAllFlowsOne': '已发布流程「{label}」', 'engine.studio.designer.search': '搜索…', 'engine.studio.designer.select': '请选择…', 'engine.studio.designer.pickDate': '选择日期…', From 94ca83cbaf74eba96020444388ce9329e7917c92 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Nov 2026 10:18:41 +0000 Subject: [PATCH 2/9] feat(app-shell): an item of a package the author can write reads New in the Studio list The App Studio list's Source read two facts: the row's customization mark, then its provenance. An item of a package authored in Studio is served under that package's id, so its provenance read `artifact` and the list drew it as System-shipped. The classification now reads a third fact between the two: whether the row's package is one the author can write, which is the listed package's `writable` verdict as the server computes it. `studioSourceKind` takes it as a required argument, and `useWritablePackageIds` is the one reader of the package list for it. The three readers of the classification move together: - the Source badge (`studioKindOf`), whose tooltip no longer explains such a row as shipped by a code package; - the source filter and its counts (`sourceOf`); - the detail's previous / next order (`useListOrderedNames`), which now also waits for the package list when the order is narrowed by source. Setup's list is unchanged: it reads the provenance as served and asks for no verdict. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01FEkQ5onqzpaipgzBKwyCbm --- ...tPage.authoredPackageSource-38150.test.tsx | 342 ++++++++++++++++++ .../views/metadata-admin/ResourceListPage.tsx | 25 +- .../views/metadata-admin/studioListSource.ts | 97 ++++- .../metadata-admin/useListOrderedNames.ts | 20 +- 4 files changed, 466 insertions(+), 18 deletions(-) create mode 100644 ui/packages/app-shell/src/views/metadata-admin/ResourceListPage.authoredPackageSource-38150.test.tsx diff --git a/ui/packages/app-shell/src/views/metadata-admin/ResourceListPage.authoredPackageSource-38150.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/ResourceListPage.authoredPackageSource-38150.test.tsx new file mode 100644 index 00000000000..ef6e26b005b --- /dev/null +++ b/ui/packages/app-shell/src/views/metadata-admin/ResourceListPage.authoredPackageSource-38150.test.tsx @@ -0,0 +1,342 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * objectstack#38150 (the ruling on objectstack#38061) — in the App Studio + * list, an item of a package the author can write reads "New" (新建), and an + * item a code package ships still reads "System-shipped" (系统自带). The fact + * is the listed package's `writable` verdict, read by `studioListSource.ts`. + * + * It is the classification that changed, not the badge alone, so the three + * readers are pinned against one fixture on `/studio/~all/metadata/flow`: + * + * - the Source badge of each row, and the words it draws in both locales; + * - the source filter: "modified and new" holds the authored package's flow, + * "system-shipped" does not, and the dropdown's counts say the same; + * - the detail's ‹ › order (`useListOrderedNames`), which walks the names the + * filtered list drew. + * + * Controls: a package the list reads as read-only, a package the list does + * not name, a package list that cannot be read, and Setup's list, which reads + * the provenance as served and asks for no verdict. + */ + +// Paid at collection, not inside a case's clock (check:test-source-alias). +import '@objectstack/lint'; +import '@testing-library/jest-dom/vitest'; +import * as React from 'react'; +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; +import { cleanup, render, renderHook, screen, waitFor, within } from '@testing-library/react'; +import { MemoryRouter, Route, Routes } from 'react-router-dom'; +import '@objectstack/spec/identity'; +import { loadStudioCatalogue } from '@object-ui/i18n/namespaces/studio'; +import { MetadataAreaHostContext, type MetadataAreaHost } from './metadataAreaHost'; + +// The Chinese catalogue is read at collection: the mocked locale hook starts no fetch of it. +await loadStudioCatalogue('zh'); + +const TYPE = 'flow'; +/** A package authored in Studio: the list reads it as writable. */ +const AUTHORED = 'com.acme.app'; +/** A package shipped in code: the list reads it as read-only. */ +const SHIPPED = 'com.example.showcase'; +/** A package id no row of the package list names. */ +const UNLISTED = 'com.gone.pkg'; + +type Item = Record; +const ITEMS: Item[] = [ + { name: 'authored_flow', label: 'Authored', _packageId: AUTHORED }, + { name: 'loose_flow', label: 'Loose' }, + { name: 'shipped_flow', label: 'Shipped', _packageId: SHIPPED }, + { name: 'unlisted_flow', label: 'Unlisted', _packageId: UNLISTED }, +]; + +const fixture = vi.hoisted(() => ({ + locale: 'en-US', + /** The `/api/v1/packages` answer's status: 200 serves the two packages. */ + packagesStatus: 200, + /** How many times the package list was asked for. */ + packagesReads: 0, +})); + +const CLIENT = { + list: async (type: string) => (type === TYPE ? ITEMS : []), + listResponse: async (type: string) => ({ items: type === TYPE ? ITEMS : [] }), + listDrafts: async () => [], +}; +const ENTRY = { type: TYPE, label: 'Flow', allowEnvironmentOverlay: false, allowRuntimeCreate: true }; + +vi.mock('./useMetadata', async (importOriginal) => ({ + ...(await importOriginal>()), + useMetadataClient: () => CLIENT, + useMetadataTypes: () => ({ loading: false, error: null, entries: [ENTRY] }), +})); +vi.mock('./i18n', async (importOriginal) => ({ + ...(await importOriginal>()), + useMetadataLocale: () => fixture.locale, +})); +vi.mock('../../hooks/useCanAuthorMetadata', async (importOriginal) => ({ + ...(await importOriginal>()), + useCanAuthorMetadata: () => true, +})); + +import { MetadataResourceListPage } from './ResourceListPage'; +import { useListOrderedNames } from './useListOrderedNames'; +import { registerDefaultMetadataSchemas } from './default-schemas'; +import { t, tFormat } from './i18n'; +import { + isWritablePackageItem, + studioListSource, + studioSourceKind, + type WritablePackageIds, +} from './studioListSource'; + +registerDefaultMetadataSchemas(); + +const json = (status: number, body: unknown) => + new Response(JSON.stringify(body), { status, headers: { 'Content-Type': 'application/json' } }); + +const fetchMock = vi.fn(async (url: string) => { + const u = String(url); + if (u === '/api/v1/packages') { + fixture.packagesReads += 1; + if (fixture.packagesStatus !== 200) return json(fixture.packagesStatus, { success: false }); + return json(200, { + success: true, + data: { + packages: [ + // The verdict is the server's, on each row: an authored package's manifest names no scope. + { manifest: { id: AUTHORED, name: 'Acme' }, writable: true }, + { manifest: { id: SHIPPED, name: 'Showcase', scope: 'project' }, writable: false }, + ], + }, + }); + } + if (u.endsWith('/customizations')) { + return json(200, { + success: true, + data: { + packageId: AUTHORED, + overrides: [], + extensions: [], + switchedOff: [], + arrangements: [], + contributions: [], + counts: { overrides: 0, extensions: 0, switchedOff: 0, arrangements: 0, contributions: 0 }, + }, + }); + } + return json(404, { success: false }); +}); + +beforeEach(() => { + fetchMock.mockClear(); + vi.stubGlobal('fetch', fetchMock); + fixture.locale = 'en-US'; + fixture.packagesStatus = 200; + fixture.packagesReads = 0; +}); +afterEach(() => { + cleanup(); + vi.unstubAllGlobals(); +}); + +/** The area's cross-package leg. */ +const ALL: MetadataAreaHost = { packageId: null, readOnly: false, basePath: '/studio/~all/metadata' }; +/** The authored package's own leg. */ +const ON_AUTHORED: MetadataAreaHost = { packageId: AUTHORED, readOnly: false, basePath: `/studio/${AUTHORED}/metadata` }; + +/** The flow list in the area (a host), or in Setup (`/apps/setup`, no host). */ +const SETUP_EVERY_PACKAGE = '?scope=environment'; +function mount(host: MetadataAreaHost | null, search = '') { + const base = host?.basePath ?? '/apps/setup/metadata'; + const tree = ( + + + } /> + + + + ); + return render(host ? {tree} : tree); +} + +const rowOf = (name: string) => screen.getByTestId(`metadata-row-${name}`).closest('tr') as HTMLElement; +const badge = (name: string) => within(rowOf(name)).getByTestId('metadata-row-source'); +const rowOrder = () => + screen + .getAllByTestId(/^metadata-row-(?!api-name$|source$|lock$)/) + .map((cell) => cell.getAttribute('data-testid')!.slice('metadata-row-'.length)); +/** The package list has answered and the authored package's row reads it. */ +const settled = async () => { + await screen.findByTestId('metadata-row-authored_flow'); + await waitFor(() => expect(badge('authored_flow')).toHaveAttribute('data-source-kind', 'new')); +}; +/** The names ‹ › walk on the cross-package leg, for a detail opened from the list at `search`. */ +async function orderedNames(search: string): Promise { + const hook = renderHook(() => useListOrderedNames(TYPE), { + wrapper: ({ children }: { children: React.ReactNode }) => ( + + {children} + + ), + }); + await waitFor(() => expect(hook.result.current.status).toBe('ready')); + const names = hook.result.current.names; + hook.unmount(); + return names; +} + +describe('the classification: a row of a package the author can write is new', () => { + const read = (...ids: string[]): WritablePackageIds => ({ status: 'read', ids: new Set(ids) }); + + it('the package verdict makes an artifact row new, after the mark and before the provenance', () => { + expect(studioSourceKind('artifact', null, true)).toBe('new'); + // CONTROL: without the verdict the same row is system-shipped. + expect(studioSourceKind('artifact', null, false)).toBe('system'); + // The mark is read first: a served override stays "modified". + expect(studioSourceKind('artifact', 'customized', true)).toBe('modified'); + expect(studioSourceKind('artifact', 'added', false)).toBe('new'); + expect(studioSourceKind('runtime', null, false)).toBe('new'); + expect(studioListSource(studioSourceKind('artifact', null, true))).toBe('runtime'); + expect(studioListSource(studioSourceKind('artifact', null, false))).toBe('artifact'); + }); + + it('only a package list that was read names a writable package', () => { + const item = { name: 'authored_flow', _packageId: AUTHORED }; + expect(isWritablePackageItem(item, read(AUTHORED))).toBe(true); + expect(isWritablePackageItem(item, read(SHIPPED))).toBe(false); + expect(isWritablePackageItem({ name: 'loose_flow' }, read(AUTHORED))).toBe(false); + expect(isWritablePackageItem(item, { status: 'off' })).toBe(false); + expect(isWritablePackageItem(item, { status: 'loading' })).toBe(false); + expect(isWritablePackageItem(item, { status: 'failed' })).toBe(false); + }); +}); + +describe('on /studio/~all/metadata/flow, the Source badge', () => { + it("the authored package's flow reads New; the code-shipped flow still reads System-shipped", async () => { + mount(ALL); + await settled(); + expect(badge('authored_flow')).toHaveTextContent(t('engine.list.source.new', 'en-US')); + expect(badge('shipped_flow')).toHaveAttribute('data-source-kind', 'system'); + expect(badge('shipped_flow')).toHaveTextContent(t('engine.list.source.system', 'en-US')); + }); + + it('draws the Chinese words for the two: the catalogue’s 新建 and 系统自带 entries', async () => { + fixture.locale = 'zh-CN'; + mount(ALL); + await settled(); + const fresh = t('engine.list.source.new', 'zh-CN'); + const system = t('engine.list.source.system', 'zh-CN'); + // The locale reached the badge: the two words are not the English ones. + expect(fresh).not.toBe(t('engine.list.source.new', 'en-US')); + expect(system).not.toBe(t('engine.list.source.system', 'en-US')); + expect(badge('authored_flow')).toHaveTextContent(fresh); + expect(badge('shipped_flow')).toHaveTextContent(system); + }); + + it('CONTROL — a package the list does not name, and no package at all, read as before', async () => { + mount(ALL); + await settled(); + expect(badge('unlisted_flow')).toHaveAttribute('data-source-kind', 'system'); + // A loose flow was authored at runtime: new by its provenance, as it was. + expect(badge('loose_flow')).toHaveAttribute('data-source-kind', 'new'); + }); + + it('explains the badge as authored here, naming the package, never as shipped by a code package', async () => { + mount(ALL); + await settled(); + expect(badge('authored_flow')).toHaveAttribute('title', `${t('engine.list.source.runtimeDesc', 'en-US')} (${AUTHORED})`); + expect(badge('shipped_flow')).toHaveAttribute('title', `${t('engine.list.source.artifactDesc', 'en-US')} (${SHIPPED})`); + }); + + it('CONTROL — a package list that cannot be read names no writable package: the row reads its provenance', async () => { + fixture.packagesStatus = 500; + mount(ALL); + await screen.findByTestId('metadata-row-authored_flow'); + await waitFor(() => expect(fixture.packagesReads).toBeGreaterThan(0)); + await new Promise((resolve) => setTimeout(resolve, 20)); + expect(badge('authored_flow')).toHaveAttribute('data-source-kind', 'system'); + expect(badge('loose_flow')).toHaveAttribute('data-source-kind', 'new'); + }); +}); + +describe('on /studio/~all/metadata/flow, the source filter and ‹ › agree with the badge', () => { + const CHANGED = ['authored_flow', 'loose_flow']; + const SYSTEM = ['shipped_flow', 'unlisted_flow']; + + it('"modified and new" holds the authored package’s flow, and its count says so', async () => { + mount(ALL, '?source=runtime'); + await screen.findByTestId('metadata-row-authored_flow'); + await waitFor(() => expect(rowOrder()).toEqual(CHANGED)); + expect(screen.getByTestId('metadata-source-filter')).toHaveTextContent( + tFormat('engine.list.sourceFilter.changed', 'en-US', { count: CHANGED.length }), + ); + // Every row the filter kept draws a badge the filter's name covers. + for (const name of CHANGED) expect(badge(name)).toHaveAttribute('data-source-kind', 'new'); + }); + + it('"system-shipped" holds the code-shipped flow and not the authored package’s', async () => { + mount(ALL, '?source=artifact'); + await screen.findByTestId('metadata-row-shipped_flow'); + await waitFor(() => expect(rowOrder()).toEqual(SYSTEM)); + expect(screen.getByTestId('metadata-source-filter')).toHaveTextContent( + tFormat('engine.list.sourceFilter.system', 'en-US', { count: SYSTEM.length }), + ); + expect(screen.queryByTestId('metadata-row-authored_flow')).toBeNull(); + }); + + it("the detail's ‹ › walk the names the filtered list drew, under each of the two values", async () => { + expect(await orderedNames('?source=runtime')).toEqual(CHANGED); + expect(await orderedNames('?source=artifact')).toEqual(SYSTEM); + // CONTROL: with no narrowing the order is every flow, and no verdict is asked for. + fixture.packagesReads = 0; + expect(await orderedNames('')).toEqual([...CHANGED, ...SYSTEM].sort()); + expect(fixture.packagesReads).toBe(0); + }); + + it('CONTROL — with the package list unreadable, ‹ › still agree with the badge: the flow is system-shipped in both', async () => { + fixture.packagesStatus = 500; + expect(await orderedNames('?source=artifact')).toEqual(['authored_flow', ...SYSTEM]); + expect(await orderedNames('?source=runtime')).toEqual(['loose_flow']); + }); +}); + +describe("on the authored package's own leg", () => { + it('its flow is under "modified and new", and "system-shipped" is empty', async () => { + mount(ON_AUTHORED, '?source=runtime'); + await screen.findByTestId('metadata-row-authored_flow'); + await waitFor(() => + expect(screen.getByTestId('metadata-source-filter')).toHaveTextContent( + tFormat('engine.list.sourceFilter.changed', 'en-US', { count: 1 }), + ), + ); + expect(rowOrder()).toEqual(['authored_flow']); + cleanup(); + mount(ON_AUTHORED, '?source=artifact'); + await waitFor(() => + expect(screen.getByTestId('metadata-source-filter')).toHaveTextContent( + tFormat('engine.list.sourceFilter.system', 'en-US', { count: 0 }), + ), + ); + expect(screen.queryByTestId('metadata-row-authored_flow')).toBeNull(); + }); +}); + +describe("CONTROL — Setup's list is left alone: it reads the provenance as served", () => { + it("the authored package's flow reads as an artifact there, and the package list is not asked for a verdict", async () => { + mount(null, SETUP_EVERY_PACKAGE); + await screen.findByTestId('metadata-row-authored_flow'); + await new Promise((resolve) => setTimeout(resolve, 20)); + expect(badge('authored_flow')).toHaveTextContent(t('engine.list.source.artifact', 'en-US')); + expect(badge('authored_flow')).not.toHaveAttribute('data-source-kind'); + expect(badge('loose_flow')).toHaveTextContent(t('engine.list.source.runtime', 'en-US')); + expect(fixture.packagesReads).toBe(0); + }); + + it('its "runtime" filter does not hold the authored package’s flow', async () => { + mount(null, `${SETUP_EVERY_PACKAGE}&source=runtime`); + await screen.findByTestId('metadata-row-loose_flow'); + await new Promise((resolve) => setTimeout(resolve, 20)); + expect(screen.queryByTestId('metadata-row-authored_flow')).toBeNull(); + }); +}); diff --git a/ui/packages/app-shell/src/views/metadata-admin/ResourceListPage.tsx b/ui/packages/app-shell/src/views/metadata-admin/ResourceListPage.tsx index f5c405b7bf3..9a8bce0b2a1 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/ResourceListPage.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/ResourceListPage.tsx @@ -143,7 +143,14 @@ import { useListDraftMarks } from './listDraftMarks.js'; import { ListChangedCell } from './ListChangedCell.js'; import { StudioListHeader } from './StudioListHeader.js'; import { STUDIO_MENU_TYPE_ICONS } from '../studio-design/StudioMenu.js'; -import { STUDIO_SOURCE_KEY, studioListSource, studioSourceKind, type StudioSourceKind } from './studioListSource.js'; +import { + STUDIO_SOURCE_KEY, + isWritablePackageItem, + studioListSource, + studioSourceKind, + useWritablePackageIds, + type StudioSourceKind, +} from './studioListSource.js'; /** * objectui#12982 — the Clone dialog of a declaration-only catalog @@ -322,6 +329,9 @@ function DefaultMetadataList({ type, appName }: { type: string; appName?: string // override, "added" for the rest), filterable to those alone. A pending or // failed read draws no mark; Setup (no host) reads nothing. const customizations = usePackageCustomizations(host?.packageId ?? null); + // objectstack#38150 — the packages the author can write, which the Studio + // list's Source reads (`studioListSource.ts`). Setup's list asks nothing. + const writablePackages = useWritablePackageIds(studioList); const pairId = React.useMemo(() => { if (!host?.packageId) return null; const pair = customizationPackageId(host.packageId); @@ -786,12 +796,14 @@ function DefaultMetadataList({ type, appName }: { type: string; appName?: string customizations.status === 'read' && (markedCount > 0 || customizationTotal(customizations.read) > 0); const filteringCustomized = onlyCustomized && showCustomizedFilter; // objectstack#37918 — what the Studio list's Source says of a row - // (`studioListSource.ts`): its mark first, then its provenance. Its source + // (`studioListSource.ts`): its mark first, then whether its package is one + // the author can write (objectstack#38150), then its provenance. Its source // filter's "modified and new" and "system-shipped" are this, so "only // customizations" is folded into it there and not offered beside it. const studioKindOf = React.useCallback( - (row: ItemRow): StudioSourceKind => studioSourceKind(row.source, markOf(row)), - [markOf], + (row: ItemRow): StudioSourceKind => + studioSourceKind(row.source, markOf(row), isWritablePackageItem(row.item, writablePackages)), + [markOf, writablePackages], ); const sourceOf = React.useCallback( (row: ItemRow): 'artifact' | 'runtime' => (studioList ? studioListSource(studioKindOf(row)) : row.source), @@ -1262,6 +1274,11 @@ function DefaultMetadataList({ type, appName }: { type: string; appName?: string pair: customizations.index.pairId, }); } + // objectstack#38150 — a row its writable package makes "new" was authored + // here: its badge is not explained as shipped by a code package. + if (row.source === 'artifact' && isWritablePackageItem(row.item, writablePackages)) { + return `${t('engine.list.source.runtimeDesc', locale)} (${String(row.item._packageId)})`; + } return provenanceDesc(row); }; const rowLock = (row: ItemRow): React.ReactNode => { diff --git a/ui/packages/app-shell/src/views/metadata-admin/studioListSource.ts b/ui/packages/app-shell/src/views/metadata-admin/studioListSource.ts index 8b2fe18fb3a..187ff2023a0 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/studioListSource.ts +++ b/ui/packages/app-shell/src/views/metadata-admin/studioListSource.ts @@ -5,35 +5,54 @@ * (objectstack#37918, the maintainer's decision 7 on epic objectstack#37424): * 系统自带 / 已修改 / 新建 — system-shipped, modified, new. * - * Read from two facts the list already has, and only those: + * Read from three facts, and only those: * * - the row's customization mark (`customizationMarks.ts`), from the base's * served customization read: a served override is "customized", any other * item of the base's `.custom` pair is "added" (ADR-0146 D3); + * - whether the row's package is one the author can write (objectstack#38150, + * the ruling on objectstack#38061): the listed package's `writable` verdict, + * the server's own ({@link useWritablePackageIds}). An item of such a + * package was made here, so it reads "new" whatever its provenance says; * - the row's provenance (`classifyProvenance` in `ResourceListPage`): a row * authored at runtime, or in a customization package, is `runtime`. * * A served override is served under the BASE's id, so its provenance reads - * `artifact`; the mark is what says it was modified. That is why the Studio - * list's source filter cannot read the provenance alone: its two narrowings - * — "modified and new", "system-shipped" — are {@link studioListSource}'s two - * values, written to the list's address as the existing `source` values - * (`metadataListState.ts`, unchanged), and the detail's ‹ › order reads the - * same function (`useListOrderedNames.ts`), so the two cannot disagree. + * `artifact`; the mark is what says it was modified. An item of a package + * authored in Studio is served under that package's id, so its provenance + * reads `artifact` too; the package's verdict is what says it is new. That is + * why the Studio list's source filter cannot read the provenance alone: its + * two narrowings — "modified and new", "system-shipped" — are + * {@link studioListSource}'s two values, written to the list's address as the + * existing `source` values (`metadataListState.ts`, unchanged), and the + * detail's ‹ › order reads the same function (`useListOrderedNames.ts`), so + * the two cannot disagree. + * + * Setup's list is not this: it reads the provenance as served, and neither + * the mark nor the package's verdict. */ +import * as React from 'react'; import type { CustomizationMarkKind } from '../studio-design/customizationMarks.js'; +import { fetchListedPackageManifests } from '../studio-design/packages-io.js'; /** What the Studio list's Source column says of a row. */ export type StudioSourceKind = 'system' | 'modified' | 'new'; -/** The kind of a row: its mark first, then its provenance. */ +/** + * The kind of a row: its mark first, then its package's verdict, then its + * provenance. `inWritablePackage` is required, never defaulted: a caller that + * left it out would read an authored package's item as system-shipped while + * the caller beside it read "new". + */ export function studioSourceKind( provenance: 'artifact' | 'runtime', mark: CustomizationMarkKind | null, + inWritablePackage: boolean, ): StudioSourceKind { if (mark === 'customized') return 'modified'; if (mark === 'added') return 'new'; + if (inWritablePackage) return 'new'; return provenance === 'runtime' ? 'new' : 'system'; } @@ -51,3 +70,65 @@ export const STUDIO_SOURCE_KEY: Readonly> = Obj modified: 'engine.list.source.modified', new: 'engine.list.source.new', }); + +/** + * The packages the author can write, as the Studio list holds them: + * + * - `off`: the list is not Studio's, and nothing was asked; + * - `loading`: the package list has not answered yet; + * - `read`: the ids whose listed verdict is `writable`; + * - `failed`: the package list could not be read. + * + * Only `read` names a package. In every other state no row is in a writable + * package, and a row reads as its mark and its provenance say. + */ +export type WritablePackageIds = + | { status: 'off' } + | { status: 'loading' } + | { status: 'read'; ids: ReadonlySet } + | { status: 'failed' }; + +const OFF: WritablePackageIds = Object.freeze({ status: 'off' }); +const LOADING: WritablePackageIds = Object.freeze({ status: 'loading' }); +const FAILED: WritablePackageIds = Object.freeze({ status: 'failed' }); + +/** + * The ids of the listed packages the author can write, read once per mount + * while `enabled`. The verdict is the package list's own `writable`, which + * the server computes per read (`packages-io.ts`), and the request is the one + * the other readers of that list share. + * + * A failed read is not reported here: the Studio surface reports its package + * list once, and the list page still draws, each row read from its mark and + * its provenance. + */ +export function useWritablePackageIds(enabled: boolean): WritablePackageIds { + const [answer, setAnswer] = React.useState(null); + React.useEffect(() => { + if (!enabled) return; + let cancelled = false; + fetchListedPackageManifests().then( + (manifests) => { + if (cancelled) return; + const ids = new Set(); + for (const listed of manifests.values()) if (listed.writable) ids.add(listed.id); + setAnswer({ status: 'read', ids }); + }, + () => { + if (!cancelled) setAnswer(FAILED); + }, + ); + return () => { + cancelled = true; + }; + }, [enabled]); + if (!enabled) return OFF; + return answer ?? LOADING; +} + +/** Whether a served item belongs to a package the author can write. */ +export function isWritablePackageItem(item: Record, writable: WritablePackageIds): boolean { + if (writable.status !== 'read') return false; + const packageId = item._packageId; + return typeof packageId === 'string' && writable.ids.has(packageId); +} diff --git a/ui/packages/app-shell/src/views/metadata-admin/useListOrderedNames.ts b/ui/packages/app-shell/src/views/metadata-admin/useListOrderedNames.ts index 172f911b891..ecc3de8d342 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/useListOrderedNames.ts +++ b/ui/packages/app-shell/src/views/metadata-admin/useListOrderedNames.ts @@ -37,7 +37,7 @@ import { classifyProvenance } from './ResourceListPage.js'; import { isPackageLessItem } from '../studio-design/studioScope.js'; import { useListChangedAt } from './listChangedAt.js'; import { useInSetupApp } from '../../console/setupApp.js'; -import { studioListSource, studioSourceKind } from './studioListSource.js'; +import { isWritablePackageItem, studioListSource, studioSourceKind, useWritablePackageIds } from './studioListSource.js'; import { decodeListState, hasListContext, @@ -50,8 +50,8 @@ import { export interface ListOrderedNames { /** * `loading` until the list — and any read its filters need (the - * customization read, the activation ledger) — has answered; `error` when - * the list read failed. + * customization read, the package list, the activation ledger) — has + * answered; `error` when the list read failed. */ status: 'loading' | 'ready' | 'error'; /** The names in list order; empty until `ready`. */ @@ -110,6 +110,10 @@ export function useListOrderedNames(type: string): ListOrderedNames { return pair.ok ? pair.value : null; }, [host?.packageId, envScope]); const customizations = usePackageCustomizations(host?.packageId ?? null); + // objectstack#38150 — the Studio list's Source reads whether a row's package + // is one the author can write; asked only when the order is narrowed by it. + const sourceNarrowed = studioList && state.source !== 'all'; + const writablePackages = useWritablePackageIds(sourceNarrowed); const [rows, setRows] = React.useState<{ type: string; rows: Row[] } | 'error' | null>(null); React.useEffect(() => { @@ -158,9 +162,10 @@ export function useListOrderedNames(type: string): ListOrderedNames { return React.useMemo((): ListOrderedNames => { if (rows === 'error') return { status: 'error', names: EMPTY, fromList }; if (rows === null || rows.type !== type) return { status: 'loading', names: EMPTY, fromList }; - if ((state.customizedOnly || (studioList && state.source !== 'all')) && customizations.status === 'loading') { + if ((state.customizedOnly || sourceNarrowed) && customizations.status === 'loading') { return { status: 'loading', names: EMPTY, fromList }; } + if (writablePackages.status === 'loading') return { status: 'loading', names: EMPTY, fromList }; if (needsLedger && ledger === null) return { status: 'loading', names: EMPTY, fromList }; if (state.sort.key === 'changed' && changedAt === null) return { status: 'loading', names: EMPTY, fromList }; @@ -187,7 +192,10 @@ export function useListOrderedNames(type: string): ListOrderedNames { name: (row) => String(row.item[primaryKey] ?? ''), label: (row) => (typeof row.item.label === 'string' ? row.item.label : undefined), matches: (row, query) => matchesQuery(row.item, query, searchKey.split('\n')), - source: (row) => (studioList ? studioListSource(studioSourceKind(row.source, markOf(row))) : row.source), + source: (row) => + studioList + ? studioListSource(studioSourceKind(row.source, markOf(row), isWritablePackageItem(row.item, writablePackages))) + : row.source, // objectstack#38150 — the list offers "Loose" on the area's cross-package leg alone. ...(looseOffered ? { loose: (row: Row) => isPackageLessItem(row.item) } : {}), changedAt: (row) => changedAt?.[String(row.item[primaryKey] ?? '')], @@ -206,5 +214,5 @@ export function useListOrderedNames(type: string): ListOrderedNames { }; return { status: 'ready', names: orderedListNames(scoped, state, read, locale), fromList }; // Keyed on the config members read, never on `config`, rebuilt every render. - }, [rows, changedAt, type, locale, state, fromList, customizations, needsLedger, ledger, envScope, unscoped, activePackage, pairId, primaryKey, listFilter, bundleMemberField, searchKey, studioList, looseOffered]); + }, [rows, changedAt, type, locale, state, fromList, customizations, needsLedger, ledger, envScope, unscoped, activePackage, pairId, primaryKey, listFilter, bundleMemberField, searchKey, studioList, looseOffered, sourceNarrowed, writablePackages]); } From 51d85a2cd373e7b28bfdbc664fc31f102b31a885 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Nov 2026 10:25:19 +0000 Subject: [PATCH 3/9] docs(adr): ADR-0084 and ADR-0070 record that the package-less scope retired with the move door ADR-0084's amendment of 2026-11-26 ruled that Studio's package-less entry retires when the door that moves loose items into a package ships. The door shipped and the entry is gone, so each sentence that named the scope as live is struck where it stands, with a dated note beside it that names the card and the ruling record: - the first row of "Entries that are not a type"; - the fold sentence, and items 1 and 3 of the 2026-11-26 list of points the rulings left silent, which named two scopes and now name one; - the fourth row of the top bar's homes table and its note of 2026-11-27 (the scope's Changes row). The struck row names its file alone: the component it pointed at is deleted, and the symbol anchor no longer resolved; - the entries sentence under Placements. The ruling's own sentences under "Organization-level content" are left as written. One dated note under them records that the door shipped, where it is opened from, and where the scope's old addresses land. ADR-0070 gains the mark that amendment said it was owed: a dated note under D5 that "move into a base" is the move-in door, that the bulk assignment to a default base is superseded by the same ruling, and that a row never moved stays legal. Its status line and TL;DR item 5 point at the note. No decision is added or reworded, and every heading anchor is unchanged. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01FEkQ5onqzpaipgzBKwyCbm --- docs/adr/0070-package-first-authoring.md | 6 ++++-- ...cation-builder-information-architecture.md | 20 ++++++++++++------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/docs/adr/0070-package-first-authoring.md b/docs/adr/0070-package-first-authoring.md index 2c7c8ff30ef..92cbda4ff9f 100644 --- a/docs/adr/0070-package-first-authoring.md +++ b/docs/adr/0070-package-first-authoring.md @@ -1,6 +1,6 @@ # ADR-0070: Package-first authoring — every runtime-authored item lives in a writable package (base); no orphans -**Status**: Accepted (2026-06-24) — P1–P3 implemented, merged & live-verified (see *Implementation status*); D4–D6 remaining · **Superseded in part by [ADR-0146](./0146-studio-designs-setup-administers-one-editor-per-item-paired-customize-package.md)** (2026-10-31) — D3's prompt to create a base, for the paired case only: a customer's first customization of an installed base lands in the auto-created `.custom` package without a prompt (ADR-0146 D3); D5's destination for a package-less overlay row of a packaged item: the base's `.custom`, as a declared override, after which the package-less write closes (ADR-0146 D11). D1, D2, D4 and D6 stand; D3's prompt stands everywhere else. · **Amended** (2026-10-31, [#28117](https://github.com/objectstack-ai/objectstack/issues/28117) — the maintainer's ruling of 2026-10-30, 「大包 + 设置里启用模块」, then 「同意」: a `type: module` sub-package of an installed app may be **disabled**, not authored into, by an admin, on the tie PR [#28308](https://github.com/objectstack-ai/objectstack/pull/28308) shipped; see the amendment note under D2. D2's two kinds and its writability predicate stand.) +**Status**: Accepted (2026-06-24) — P1–P3 implemented, merged & live-verified (see *Implementation status*); D4–D6 remaining · **Superseded in part by [ADR-0146](./0146-studio-designs-setup-administers-one-editor-per-item-paired-customize-package.md)** (2026-10-31) — D3's prompt to create a base, for the paired case only: a customer's first customization of an installed base lands in the auto-created `.custom` package without a prompt (ADR-0146 D3); D5's destination for a package-less overlay row of a packaged item: the base's `.custom`, as a declared override, after which the package-less write closes (ADR-0146 D11). D1, D2, D4 and D6 stand; D3's prompt stands everywhere else. · **Amended** (2026-10-31, [#28117](https://github.com/objectstack-ai/objectstack/issues/28117) — the maintainer's ruling of 2026-10-30, 「大包 + 设置里启用模块」, then 「同意」: a `type: module` sub-package of an installed app may be **disabled**, not authored into, by an admin, on the tie PR [#28308](https://github.com/objectstack-ai/objectstack/pull/28308) shipped; see the amendment note under D2. D2's two kinds and its writability predicate stand.) · **Amended** (2026-11-29, [#38150](https://github.com/objectstack-ai/objectstack/issues/38150) — ruling record [comment 7184753035](https://github.com/objectstack-ai/objectstack/issues/37424#issuecomment-7184753035), question 3, ruled C, as [ADR-0084](./0084-application-builder-information-architecture.md#amendment-2026-11-26-org) records it: D5's "move into a base" is the move-in door, and D5's bulk assignment to a default base is superseded; see the amendment note under D5. D1 and D6 stand.) **Deciders**: ObjectStack Protocol Architects **Builds on**: [ADR-0005](./0005-metadata-customization-overlay.md) (`allowOrgOverride` / runtime overlay model; one Zod source per type), [ADR-0048](./0048-cross-package-metadata-collision.md) (one app per package; package id is the addressing unit), [ADR-0033](./0033-ai-assisted-metadata-authoring.md) (AI authors metadata as drafts), [ADR-0067](./0067-commit-history-and-rollback-for-ai-authoring.md) (commit history & rollback for AI authoring) **Consumers**: `@objectstack/objectql` (`protocol.saveMetaItem` write path), `@objectstack/spec` (metadata-type registry), `../objectui` (Studio create flow, package scope selector, `PackagesPage`), `../cloud` (`service-ai-studio` — `create_metadata` / `resolvePackageId` / `apply_blueprint`) @@ -30,7 +30,7 @@ Built across the three surfaces and verified end-to-end in a real environment vi 2. **[existing->ruled] Two package kinds.** *Code/installed* packages (manifest `source: 'filesystem'` / installed via marketplace) are **read-only** — you may org-overlay an item where `allowOrgOverride` (ADR-0005), but you may **not** author *new* items into them. *Writable* packages (DB-backed, user/AI-created "bases") are the only authoring targets. 3. **[new] Create-flow contract — "pick or create a base first".** Before any create, all three surfaces (Studio UI, the AI authoring tools, the kernel write path) resolve to a writable package or **prompt to create one** — no silent default. This is enforced in code, not just prompt guidance. 4. **[new] The package is the lifecycle unit.** Delete (cascade all its items + data), export, snapshot/version, and duplicate operate on a whole package. This is the answer to "how do I delete the mess." -5. **[ruled] Retire the stopgaps.** #2252's null-coercion evolves into *redirect-to-a-writable-package*; #1946's "Local / Custom" scope becomes a **migration affordance** ("move these loose items into a base") and is then removed. +5. **[ruled] Retire the stopgaps.** #2252's null-coercion evolves into *redirect-to-a-writable-package*; #1946's "Local / Custom" scope becomes a **migration affordance** ("move these loose items into a base") and is then removed. *(Amended 2026-11-29, [#38150](https://github.com/objectstack-ai/objectstack/issues/38150): "move these loose items into a base" is the move-in door — the amendment note under D5.)* --- @@ -87,6 +87,8 @@ Operating on a *base* operates on all of its contents — this is the direct ans - The objectui #1946 *"Local / Custom"* scope is repurposed as a **one-time migration surface**: it lists the legacy package-less items and offers "move into a base" (assign them a writable `package_id`). Once an environment has no orphans, the scope is removed from the selector. - A small migration (or admin action) can bulk-assign legacy orphans to a default base named for the environment. +> **Amended 2026-11-29 ([#38150](https://github.com/objectstack-ai/objectstack/issues/38150), ruling record [comment 7184753035](https://github.com/objectstack-ai/objectstack/issues/37424#issuecomment-7184753035), question 3, ruled C; written into [ADR-0084's amendment of 2026-11-26](./0084-application-builder-information-architecture.md#amendment-2026-11-26-org)) — "move into a base" is the move-in door, and the bulk assignment to a default base is superseded.** TL;DR item 5's "move these loose items into a base" and this decision's `offers "move into a base"` are one door, and it shipped: `POST /api/v1/packages/:id/move-in` moves a selection of loose items — one, several, or all — into a writable package, each through the judges a save runs. The third bullet above, "A small migration (or admin action) can bulk-assign legacy orphans to a default base named for the environment", is superseded by that ruling: nothing is renamed or migrated, and there is no catch-all package. A row that is never moved stays legal: it belongs to the implicit environment package ([ADR-0150](./0150-behavioural-metadata-addressed-by-package-objects-keep-the-literal-prefix.md) D1, the fourth bucket). + ### D6 — Single-tenant framing; no "org" dumping ground [ruled] A metadata-customizable deployment is **single-tenant** (an *environment*; `project -> environment`); there is no per-org overlay dimension here. The relevant axis is **code package vs writable base**, not "org". The earlier instinct to make a package-less "org/local" scope the *default* is explicitly rejected: it reproduces the orphan pile. (Multi-tenant hosting keeps `package_id = null` overlays as a *tenant-overlay* mechanism; that is orthogonal and out of scope for this ADR.) diff --git a/docs/adr/0084-application-builder-information-architecture.md b/docs/adr/0084-application-builder-information-architecture.md index 211569489d0..97014bf6cac 100644 --- a/docs/adr/0084-application-builder-information-architecture.md +++ b/docs/adr/0084-application-builder-information-architecture.md @@ -231,7 +231,7 @@ The menu also holds four entries that open no type's list. Each sits in the grou | Entry | Group | Source | |---|---|---| -| **The organization's own flows** — the flows that belong to no package (the `~org` scope) | 自动化 Automation | decision 11 | +| ~~**The organization's own flows** — the flows that belong to no package (the `~org` scope)~~ | ~~自动化 Automation~~ | ~~decision 11~~ | | **The organization-wide default sharing overview** — a page with a route of its own, not a metadata item | 访问 Access | decision 11 | | **Diagnostics** | 平台 Platform | decision 11 | | **The cross-package environment directory** (the `~all` leg) | 访问 Access | **drafted here, not ruled** — [item 1](#amendment-silent) below | @@ -240,6 +240,8 @@ The menu also holds four entries that open no type's list. Each sits in the grou *(Amended 2026-11-26, card [#37451](https://github.com/objectstack-ai/objectstack/issues/37451): on a package the menu holds one more entry that opens no type's list — **概览 Overview**, the open package's own page, the menu's first row, above the groups, under no group and in no tier ([Amendment (2026-11-26)](#amendment-2026-11-26-overview)). One row of the table above leaves the menu for Setup: the cross-package environment directory, for a Setup group that holds access pages. Diagnostics stays, and on a package it reads that package. The organization's own flows keep their entry until the door that moves loose items into a package ships, and retire with it. The default sharing overview and 全部类型 All types stay ([Amendment (2026-11-26)](#amendment-2026-11-26-moves)).)* +*(Amended 2026-11-29, card [#38150](https://github.com/objectstack-ai/objectstack/issues/38150), ruling record [comment 7184753035](https://github.com/objectstack-ai/objectstack/issues/37424#issuecomment-7184753035), question 3: the table's first row is struck. The door that moves loose items into a package shipped, and the organization's own flows retired with it, the entry and the scope it opened alike ([Organization-level content](#amendment-2026-11-26-org)). Items that belong to no package are listed under the "Loose" value of the cross-package list's source filter, and a flow among them opens on its own page there.)* + ### What stands, and what the amendment replaces {#amendment-stands} | The 2026-07-01 text | Since the amendment | @@ -295,7 +297,7 @@ A group's label is drawn in a tier only where the group has an entry in that tie The four [entries that are not a type](#entries-not-a-type) are 高级 on a package. Each is drawn after the types of its group, the default sharing overview before the cross-package directory — where the menu adds them today (§3.4). -The tiers belong to a package's menu. The package-less scope (`~org`) and the cross-package leg (`~all`) draw no fold: the same labels and the same order, flat (§3.8). +The tiers belong to a package's menu. ~~The package-less scope (`~org`) and the cross-package leg (`~all`) draw no fold~~ The cross-package leg (`~all`) draws no fold: the same labels and the same order, flat (§3.8). *(Amended 2026-11-29, card [#38150](https://github.com/objectstack-ai/objectstack/issues/38150), ruling record [comment 7184753035](https://github.com/objectstack-ai/objectstack/issues/37424#issuecomment-7184753035), question 3: the sentence named two scopes that draw no fold. The package-less scope retired with its entry ([Organization-level content](#amendment-2026-11-26-org)), so it names one.)* *(Amended 2026-11-26: the two tiers and the rule below stand, and the ten 常用 types keep their places. Three types join them, each placed by name: `dataset` and `position`, and `form`, a type not yet registered, once Studio lists it — thirteen in all. 概览 Overview is drawn above the tiers and belongs to neither. Of the four entries that are not a type, the cross-package directory is to leave the menu. See [Amendment (2026-11-26)](#amendment-2026-11-26-moves).)* @@ -411,13 +413,15 @@ The top bar is drawn by `ui/packages/app-shell/src/views/studio-design/StudioDes | The way back to the app, with the app's name | The first control of the package row; the name is shown by the switcher beside it | the pick | | The ⋯ package menu (`ui/packages/app-shell/src/views/studio-design/StudioPackageMenu.tsx#STUDIO_PACKAGE_MENU_ITEMS`) | The header of 概览 Overview, moved as it is | the pick | | The pending-changes button with its count, and Publish | The Pending tab of 概览 Overview. The count is a badge on the menu's 概览 row, and one click on it opens that tab | the pick | -| The same button and Publish on the package-less scope (`~org`), which draws no 概览 | A 变更 Changes row with its count, in the left column under the package row (`ui/packages/app-shell/src/views/studio-design/StudioTopLeft.tsx#StudioScopePendingRow`), drawn only while that scope has something pending. It opens the changes sheet that exists, and Publish is in that sheet | not ruled — the note below | +| ~~The same button and Publish on the package-less scope (`~org`), which draws no 概览~~ | ~~A 变更 Changes row with its count, in the left column under the package row (`ui/packages/app-shell/src/views/studio-design/StudioTopLeft.tsx`), drawn only while that scope has something pending. It opens the changes sheet that exists, and Publish is in that sheet~~ | ~~not ruled — the note below~~ | | Save and Cancel, drawn while a page has unsaved edits | The action slot of the item's header (`ui/packages/app-shell/src/views/studio-design/StudioItemHeader.tsx#StudioItemHeader`) | the pick | | The AI assistant button, and the toggle of the right-hand panel | The right end of each page's title row — a list's title row, an item's header — where an app's page carries its own (`ui/packages/app-shell/src/layout/ShellPageActions.tsx#ShellPageActions`) | the pick | | The control that shows and hides the menu | Studio's row | decision 3 | | For a package with no app: the "create app" button, or the label that says its app waits for a publish | None — [item 5](#amendment-2026-11-26-silent) | not ruled | -*(Amended 2026-11-27, card [#37685](https://github.com/objectstack-ai/objectstack/issues/37685): the table gains its fourth row — where Changes and Publish live on the package-less scope. The pick sends them to 概览, and `~org` draws no 概览 ([item 1](#amendment-2026-11-26-silent)), so card [#37456](https://github.com/objectstack-ai/objectstack/issues/37456), which removed the top bar, gave that scope a row of its own. The row is written from the code, read at `origin/main` `73d5e347`: it is drawn on `~org` alone, it counts the drafts of the organization's own flows, the rail keeps it as an icon, and the sheet it opens is `ui/packages/app-shell/src/preview/DraftChangesPanel.tsx#DraftChangesPanel`. No ruling gives this home: it was built first and is recorded after the fact, as that change's contract review asked ([comment 7202356468](https://github.com/objectstack-ai/objectstack/pull/37579#issuecomment-7202356468), finding S3). Merging this note accepts it. The top bar still held seven things: the row is a second home for the third, on a scope where its first is not drawn. No other row changes.)* +~~*(Amended 2026-11-27, card [#37685](https://github.com/objectstack-ai/objectstack/issues/37685): the table gains its fourth row — where Changes and Publish live on the package-less scope. The pick sends them to 概览, and `~org` draws no 概览 ([item 1](#amendment-2026-11-26-silent)), so card [#37456](https://github.com/objectstack-ai/objectstack/issues/37456), which removed the top bar, gave that scope a row of its own. The row is written from the code, read at `origin/main` `73d5e347`: it is drawn on `~org` alone, it counts the drafts of the organization's own flows, the rail keeps it as an icon, and the sheet it opens is `ui/packages/app-shell/src/preview/DraftChangesPanel.tsx#DraftChangesPanel`. No ruling gives this home: it was built first and is recorded after the fact, as that change's contract review asked ([comment 7202356468](https://github.com/objectstack-ai/objectstack/pull/37579#issuecomment-7202356468), finding S3). Merging this note accepts it. The top bar still held seven things: the row is a second home for the third, on a scope where its first is not drawn. No other row changes.)*~~ + +*(Amended 2026-11-29, card [#38150](https://github.com/objectstack-ai/objectstack/issues/38150), ruling record [comment 7184753035](https://github.com/objectstack-ai/objectstack/issues/37424#issuecomment-7184753035), question 3: the fourth row and the note above are struck. The package-less scope retired with its entry ([Organization-level content](#amendment-2026-11-26-org)), and its 变更 Changes row and the batch publish behind that row retired with it. The row's component, `StudioScopePendingRow`, is deleted, so the struck row names its file alone. A draft that belongs to no package is still published from Home's Publish all, and is published or discarded on its own item page. The first three rows stand.)* Decision 3 says the ⋯ menu "is removed". It is read with decision 9 and the pick: the menu leaves the top left, and its rows live on in 概览's header. @@ -455,7 +459,7 @@ Decision 12 draws the line: **Studio develops one package; Setup runs the organi **The rule of 2026-11-25 is not reworded.** It says that where the maintainer places a type by name, the name decides, and it carried two such placements: `picklist` in 高级, and the three AI types in 常用. `dataset`, `position` and `form` are three more, each in 常用. The three tests still sort every type that no ruling names. -Of the four entries that are not a type, then, one leaves. Diagnostics stays. The organization's own flows (`~org`) keep their entry in 自动化 Automation until the door that moves loose items into a package ships, and retire with it ([Organization-level content](#amendment-2026-11-26-org)). The organization-wide default sharing overview stays in 访问 Access. +Of the four entries that are not a type, then, one leaves. Diagnostics stays. ~~The organization's own flows (`~org`) keep their entry in 自动化 Automation until the door that moves loose items into a package ships, and retire with it ([Organization-level content](#amendment-2026-11-26-org)).~~ *(Amended 2026-11-29, card [#38150](https://github.com/objectstack-ai/objectstack/issues/38150), ruling record [comment 7184753035](https://github.com/objectstack-ai/objectstack/issues/37424#issuecomment-7184753035), question 3: the door shipped, and the organization's own flows retired with it — [Organization-level content](#amendment-2026-11-26-org).)* The organization-wide default sharing overview stays in 访问 Access. Decision 12 also says how the two surfaces speak of each other: whose sharing rules, queues and assignment rules each side shows; a position defined in Studio and assigned in Setup, linked both ways; one vocabulary for a package's source and state. None of that changes a place in the menu, and it is left to its cards. @@ -478,6 +482,8 @@ Decision 11 of the epic, as ruled on its questions 2 and 3 (maintainer: 「同 - **Loose items stay where they are, and one door moves them** (question 3, ruled C). An item that belongs to no package stays legal: it belongs to the implicit environment package (ADR-0150 D1, the fourth bucket), and nothing is renamed or migrated. One new door moves a selection — one item, several, or all — into a package, and runs each through the judges a save runs, judging the selection as a set for the cross-boundary rule of ADR-0150 D3 (a). It reuses the list page that exists. When that door ships, the bulk adopt and Studio's `~org` entry retire together. This replaces the page that sorts loose items one by one, which decisions 11 and 12 planned. Where the new door is opened from is its card's to say. - **What this changes in the menu.** The organization's own flows keep their entry in 自动化 Automation until the door ships. The ⋯ menu keeps "adopt loose items" until then, and loses it then. +*(Amended 2026-11-29, card [#38150](https://github.com/objectstack-ai/objectstack/issues/38150), ruling record [comment 7184753035](https://github.com/objectstack-ai/objectstack/issues/37424#issuecomment-7184753035), question 3: the door shipped, and the bullets above are left as the ruling wrote them. The door is `POST /api/v1/packages/:id/move-in`. Its card opened it from the cross-package list: the "Loose" value of that list's source filter, `/studio/~all/metadata/TYPE?source=loose`, which a banner on Setup's Packages page links to for each type that holds a loose item. Studio's `~org` entry retired with the door, and the scope with it: the menu row, the scope's list, its 变更 Changes row and the batch publish behind that row. Every `/studio/~org/…` address lands on the Loose list of flows, `/studio/~all/metadata/flow?source=loose`. The bulk adopt retires in the same release, in that card's other change. ADR-0070's D5 carries its mark of the same date, as the paragraph below asks.)* + ADR-0070 is not edited by this amendment. Where the ruling restates its D1 and D5, the phase-4 cards that carry the ruling out owe that record its marks. ### What the amendment replaces, and what stands {#amendment-2026-11-26-stands} @@ -504,9 +510,9 @@ ADR-0070 is not edited by this amendment. Where the ruling restates its D1 and D Merging accepts them; an objection names the number. -1. **Where 概览 sits.** Decision 6 says it is the first entry. Written here: above the six groups, under no group and in no tier, drawn on every package and never folded. The package-less scope (`~org`) and the cross-package leg (`~all`) open no package and draw no 概览. +1. **Where 概览 sits.** Decision 6 says it is the first entry. Written here: above the six groups, under no group and in no tier, drawn on every package and never folded. ~~The package-less scope (`~org`) and the cross-package leg (`~all`) open no package and draw no 概览.~~ The cross-package leg (`~all`) opens no package and draws no 概览. *(Amended 2026-11-29, card [#38150](https://github.com/objectstack-ai/objectstack/issues/38150), ruling record [comment 7184753035](https://github.com/objectstack-ai/objectstack/issues/37424#issuecomment-7184753035), question 3: the sentence named two scopes. The package-less scope retired with its entry ([Organization-level content](#amendment-2026-11-26-org)), so it names one.)* 2. **What the package row names.** The 2026-11-24 ruling stands: the open package is named by its app where it publishes one, and by its own name where it does not. The switcher's rows are named the same way. Decision 8 speaks of "the app name in the switcher row", which agrees. -3. **What the switcher lists, and where it lands.** It lists packages and nothing else: a pair is folded under its base, and `~org` and `~all` are not rows of it. Picking a package opens that package's 概览. Weighed and not taken: the list of the type the person was on, which the other package may not hold. +3. **What the switcher lists, and where it lands.** It lists packages and nothing else: a pair is folded under its base, and ~~`~org` and `~all` are not rows of it~~ `~all` is not a row of it. *(Amended 2026-11-29, card [#38150](https://github.com/objectstack-ai/objectstack/issues/38150), ruling record [comment 7184753035](https://github.com/objectstack-ai/objectstack/issues/37424#issuecomment-7184753035), question 3: the package-less scope retired with its entry ([Organization-level content](#amendment-2026-11-26-org)), so one scope is left that is not a row.)* Picking a package opens that package's 概览. Weighed and not taken: the list of the type the person was on, which the other package may not hold. 4. **Below 768 px.** The menu is a drawer there, and something must open it. "No top bar" is read as from 768 px up, the way ADR-0146 D5's note reads the app's shell. Below that width the frame keeps what the app's shell keeps: a strip that holds the control which opens the drawer. 5. **The top bar's seventh tenant.** For a package with no app, the bar draws a "create app" button, or a label that says the app waits for a publish. No ruling gives them a home, and this record gives them none. 应用 `app` is a 常用 row, drawn "whether the package holds one or not, so a package without one still shows where the first is made" (2026-11-25), and an app that waits for a publish is counted on Pending. They go with the bar. 6. **Save and Cancel on a page that saves and is not an item.** The pick puts them in the item's header. A page with unsaved edits and no item header — the default sharing overview is one — carries them at the right end of its own title row. From 311216638d36cc4409ed43b5d8af35c21c205289 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Nov 2026 10:29:32 +0000 Subject: [PATCH 4/9] chore(changeset): record the retired package-less scope and the Studio list's New reading; one QA follow-up The changeset covers both halves of the change for the three ui packages it moves: the retired scope with where its addresses land, the nine keys that leave the published studio catalogue, the two renamed app-shell exports, and the Studio list reading an item of a writable package as New. The QA follow-up names the five checklist items whose live text still describes the retired scope. No checklist item is edited. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01FEkQ5onqzpaipgzBKwyCbm --- .changeset/38150-studio-org-entry-retired.md | 48 ++++++++++++++++++++ docs/qa/platform-checklist/FOLLOW-UPS.md | 4 ++ 2 files changed, 52 insertions(+) create mode 100644 .changeset/38150-studio-org-entry-retired.md diff --git a/.changeset/38150-studio-org-entry-retired.md b/.changeset/38150-studio-org-entry-retired.md new file mode 100644 index 00000000000..112070dc206 --- /dev/null +++ b/.changeset/38150-studio-org-entry-retired.md @@ -0,0 +1,48 @@ +--- +'@object-ui/app-shell': patch +'@object-ui/console': patch +'@object-ui/i18n': patch +--- + +feat(app-shell)!: Studio's package-less scope (`/studio/~org`) is retired and its addresses land on the Loose list of flows; in the App Studio list an item of a package you can write reads "New" + +Clause-②: no (narrowing) +Metadata-protocol: none + + + +Two changes to App Studio, both carrying out ADR-0084's amendment of 2026-11-26. + +**Studio's package-less scope is retired.** The scope listed the flows that belong to no package ("Organization flows", 「组织流程」) at `/studio/~org`. The amendment retires it together with the all-at-once adoption of loose items, once the door that moves a selection of loose items into a package ships. All three are in this release: the move door is the "Loose" source value of Studio's cross-package list (`/studio/~all/metadata/TYPE?source=loose`), where a person selects loose items of any type and moves them into a package, and the adoption's retirement has its own entry. + +- Every `/studio/~org/…` address still opens. It lands on the Loose list of flows, `/studio/~all/metadata/flow?source=loose`. That is one target for the scope's list, a flow's own address and its `/history`, the old `/studio/~org/automations` deep links, and a `?package=~org` link on another address. The list's search (`q`) and sort (`sort`) are kept and every other query key is dropped. A flow's old address lands on the list, not on the flow. +- A flow that belongs to no package is found on that list, and its row opens the flow's page at `/studio/~all/metadata/flow/NAME`. It no longer opens in the flow designer; move it into a package to design it there. A package's address that names such a flow opens the same page. +- Studio's left menu has no "Organization flows" row any more (it sat under Automation, inside the Advanced fold on a package), and Studio's command palette no longer lists it. A package-less flow that the app's command palette finds opens its page. +- The scope's "Changes" row and the batch publish behind it are gone. A draft that belongs to no package is published by Home's "Publish all", or published or discarded on its own page. +- A person who can enter Studio but cannot open Setup → Packages, and has no recent package, lands on the Loose list of flows. They landed on the package-less scope before. Home's "New blank app" leads the same person to the same list. +- On the "package not found" page, the way out for a person who cannot open Setup → Packages reads "Open loose flows" (「打开散落的流程」) and opens that list. It read "Open organization flows" (「打开「组织流程」」). + +**In the App Studio list, an item of a package you can write reads "New" (「新建」).** The list's Source column drew an item of a package authored in Studio as "System-shipped" (「系统自带」), because such an item is served under its package's id, as an item a code package ships is. The list now also reads the package list's `writable` verdict, which the server computes: an item of a writable package reads "New". The source filter and its counts, and the previous / next order of an item's page, read the same classification, so "Modified and new" holds those items and "System-shipped" does not. An item of a read-only package still reads "System-shipped", and a customized one still reads "Modified". Setup's metadata list is unchanged: it shows the source as served. + +**BREAKING**: nine keys leave the `studio` namespace of `@object-ui/i18n`, in `en` and `zh`. The retired scope was their only reader. + +- `engine.studio.menu.orgFlows` +- `engine.studio.pkg.orgScope` +- `engine.studio.org.name` +- `engine.studio.org.hint` +- `engine.studio.org.description` +- `engine.studio.org.none` +- `engine.studio.publishedAllFlows` +- `engine.studio.publishedAllFlowsOne` +- `engine.studio.changes` + +If a deployment overrides one of these keys (in its own i18next resources, or a Studio catalogue it registers), the override no longer applies: nothing in the console or Studio asks for the key. Remove the override. `engine.studio.notFound.allMetadata` keeps its key and changes its text, as above; an override of it still applies, and now names the link to the Loose list. + +For a host that declares the `/studio` routes itself, the two names `@object-ui/app-shell` exported for the scope are replaced: + +| before | after | +|:--|:--| +| `STUDIO_ORG_SCOPE_SEGMENT` | `RETIRED_ORG_SCOPE_SEGMENT`. The segment `~org` stays reserved: it can name no package | +| `studioOrgScopePath()` | `retiredOrgScopeTarget(search)`, the one address every `/studio/~org/…` address lands on | + +The fix in one line: link to `/studio/~all/metadata/flow?source=loose` where a link opened `/studio/~org/…`. Old links keep working through the redirect. diff --git a/docs/qa/platform-checklist/FOLLOW-UPS.md b/docs/qa/platform-checklist/FOLLOW-UPS.md index 22cb11170e6..feead8af512 100644 --- a/docs/qa/platform-checklist/FOLLOW-UPS.md +++ b/docs/qa/platform-checklist/FOLLOW-UPS.md @@ -1441,3 +1441,7 @@ listed in `releaseSweeps` with why. ### 19d. Security note No security finding was made, and none is withheld. + +## 20. Checklist drift 2026-11-29 — Studio's package-less scope is retired (#38150) + +Not a sweep: one follow-up, recorded by the change that retired the scope (ADR-0084's amendment of 2026-11-26, `#amendment-2026-11-26-org`), which edited no item. Every `/studio/~org/…` address now lands on `/studio/~all/metadata/flow?source=loose`, a flow that belongs to no package opens on its item page on the cross-package leg and not in the flow designer, and the scope's Changes row and batch publish are gone, so the live text of five items no longer describes the product: `studio-authoring.org-scope-flows` (the whole item: its title, steps[0], [4] and [5] and its three acceptance clauses describe the retired scope, so it is re-authored against the Loose list or retired), `automation.flow-run-step-nesting` steps[4], `automation.flow-error-handling` fixtures.requires[1], `automation.packaged-flow-clone-contract` steps[7], acceptance[6].verify and negative[4], and `integration-system.flow-connector-picker` steps[1]; `automation.flow-node-type-matrix` names the scope in a history row only and needs nothing. Each is re-measured with the product running before its text is changed. From 2a3c6e8f5b3461a9330f95ef4c626bfd65baa039 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Nov 2026 11:24:54 +0000 Subject: [PATCH 5/9] chore(changeset): name the bulk adopt's retirement as a change of its own; the retired scope's test pays the lint import at collection The changeset and the ADR-0084 note said the bulk adopt retires in the same release. It retired in a change of its own, which may ship a release earlier, so both now name that change and state what holds once this one lands on top of it. `studioOrgScopeRetired.test.ts` reaches the dynamic `@objectstack/lint` import through the Loose list's module; the first load is paid at collection, as `check:test-source-alias` asks. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01FEkQ5onqzpaipgzBKwyCbm --- .changeset/38150-studio-org-entry-retired.md | 2 +- docs/adr/0084-application-builder-information-architecture.md | 2 +- .../src/views/studio-design/studioOrgScopeRetired.test.ts | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.changeset/38150-studio-org-entry-retired.md b/.changeset/38150-studio-org-entry-retired.md index 112070dc206..55e051e814f 100644 --- a/.changeset/38150-studio-org-entry-retired.md +++ b/.changeset/38150-studio-org-entry-retired.md @@ -13,7 +13,7 @@ Metadata-protocol: none Two changes to App Studio, both carrying out ADR-0084's amendment of 2026-11-26. -**Studio's package-less scope is retired.** The scope listed the flows that belong to no package ("Organization flows", 「组织流程」) at `/studio/~org`. The amendment retires it together with the all-at-once adoption of loose items, once the door that moves a selection of loose items into a package ships. All three are in this release: the move door is the "Loose" source value of Studio's cross-package list (`/studio/~all/metadata/TYPE?source=loose`), where a person selects loose items of any type and moves them into a package, and the adoption's retirement has its own entry. +**Studio's package-less scope is retired.** The scope listed the flows that belong to no package ("Organization flows", 「组织流程」) at `/studio/~org`. The amendment retires it once the door that moves a selection of loose items into a package has shipped. It has: the door is the "Loose" source value of Studio's cross-package list (`/studio/~all/metadata/TYPE?source=loose`), where a person selects loose items of any type and moves them into a package. The same amendment retired the all-at-once adoption of loose items; that went in a change of its own (objectstack#38545), with its own entry. With the scope gone too, an item that belongs to no package is listed, and moved into a package, on the Loose list. - Every `/studio/~org/…` address still opens. It lands on the Loose list of flows, `/studio/~all/metadata/flow?source=loose`. That is one target for the scope's list, a flow's own address and its `/history`, the old `/studio/~org/automations` deep links, and a `?package=~org` link on another address. The list's search (`q`) and sort (`sort`) are kept and every other query key is dropped. A flow's old address lands on the list, not on the flow. - A flow that belongs to no package is found on that list, and its row opens the flow's page at `/studio/~all/metadata/flow/NAME`. It no longer opens in the flow designer; move it into a package to design it there. A package's address that names such a flow opens the same page. diff --git a/docs/adr/0084-application-builder-information-architecture.md b/docs/adr/0084-application-builder-information-architecture.md index 97014bf6cac..9a3c8130970 100644 --- a/docs/adr/0084-application-builder-information-architecture.md +++ b/docs/adr/0084-application-builder-information-architecture.md @@ -482,7 +482,7 @@ Decision 11 of the epic, as ruled on its questions 2 and 3 (maintainer: 「同 - **Loose items stay where they are, and one door moves them** (question 3, ruled C). An item that belongs to no package stays legal: it belongs to the implicit environment package (ADR-0150 D1, the fourth bucket), and nothing is renamed or migrated. One new door moves a selection — one item, several, or all — into a package, and runs each through the judges a save runs, judging the selection as a set for the cross-boundary rule of ADR-0150 D3 (a). It reuses the list page that exists. When that door ships, the bulk adopt and Studio's `~org` entry retire together. This replaces the page that sorts loose items one by one, which decisions 11 and 12 planned. Where the new door is opened from is its card's to say. - **What this changes in the menu.** The organization's own flows keep their entry in 自动化 Automation until the door ships. The ⋯ menu keeps "adopt loose items" until then, and loses it then. -*(Amended 2026-11-29, card [#38150](https://github.com/objectstack-ai/objectstack/issues/38150), ruling record [comment 7184753035](https://github.com/objectstack-ai/objectstack/issues/37424#issuecomment-7184753035), question 3: the door shipped, and the bullets above are left as the ruling wrote them. The door is `POST /api/v1/packages/:id/move-in`. Its card opened it from the cross-package list: the "Loose" value of that list's source filter, `/studio/~all/metadata/TYPE?source=loose`, which a banner on Setup's Packages page links to for each type that holds a loose item. Studio's `~org` entry retired with the door, and the scope with it: the menu row, the scope's list, its 变更 Changes row and the batch publish behind that row. Every `/studio/~org/…` address lands on the Loose list of flows, `/studio/~all/metadata/flow?source=loose`. The bulk adopt retires in the same release, in that card's other change. ADR-0070's D5 carries its mark of the same date, as the paragraph below asks.)* +*(Amended 2026-11-29, card [#38150](https://github.com/objectstack-ai/objectstack/issues/38150), ruling record [comment 7184753035](https://github.com/objectstack-ai/objectstack/issues/37424#issuecomment-7184753035), question 3: the door shipped, and the bullets above are left as the ruling wrote them. The door is `POST /api/v1/packages/:id/move-in`. Its card opened it from the cross-package list: the "Loose" value of that list's source filter, `/studio/~all/metadata/TYPE?source=loose`, which a banner on Setup's Packages page links to for each type that holds a loose item. Studio's `~org` entry retired with the door, and the scope with it: the menu row, the scope's list, its 变更 Changes row and the batch publish behind that row. Every `/studio/~org/…` address lands on the Loose list of flows, `/studio/~all/metadata/flow?source=loose`. The bulk adopt is retired by a change of its own under that card ([#38545](https://github.com/objectstack-ai/objectstack/pull/38545)), not by the one that retired this entry. ADR-0070's D5 carries its mark of the same date, as the paragraph below asks.)* ADR-0070 is not edited by this amendment. Where the ruling restates its D1 and D5, the phase-4 cards that carry the ruling out owe that record its marks. diff --git a/ui/packages/app-shell/src/views/studio-design/studioOrgScopeRetired.test.ts b/ui/packages/app-shell/src/views/studio-design/studioOrgScopeRetired.test.ts index 42880d0d84c..344431a53e5 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioOrgScopeRetired.test.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioOrgScopeRetired.test.ts @@ -17,6 +17,9 @@ import { describe, expect, it } from 'vitest'; import { MANIFEST_ID_PATTERN } from '@objectstack/spec/kernel'; +// `looseListPath`'s module reaches `celAuthoring`'s dynamic `@objectstack/lint` import; its +// first load is paid here, at collection (`check:test-source-alias`). +import '@objectstack/lint'; import { looseListPath } from '../metadata-admin/LooseItemsBanner'; import { decodeListState } from '../metadata-admin/metadataListState'; import { isSpecPackageId, sanitizePackageId } from './packages-io'; From 5fcf89b5c1c6eab9afd010c88c52c59d83a69493 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Nov 2026 12:48:53 +0000 Subject: [PATCH 6/9] docs(app-shell): comments stop describing Studio's retired package-less scope as live Eleven files of the Studio surface still named the scope as a place a person can be: the palette surface's doc, the flow grouping and app-edit notes, the wide-viewport note, the retired-interfaces notice's prop doc, and six test headers or titles. Comments and one test title only; no behaviour changes. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01QsR2jUba5JFq1ejCZ7Gxpk --- .../app-shell/src/chrome/CommandPalette.tsx | 2 +- .../AutomationsPillar.newSimilar-28567.test.tsx | 3 +-- .../StudioDesignSurface.backToApp-36501.test.tsx | 2 +- .../StudioDesignSurface.homeLoop-12513.test.tsx | 14 +++++--------- .../StudioInterfacesRetiredNotice.tsx | 2 +- .../studio-design/StudioPackageMenu-37139.test.tsx | 2 +- .../StudioPackageOverview-37454.test.tsx | 4 ++-- .../src/views/studio-design/flowGrouping.ts | 4 ++-- .../views/studio-design/packageSurfaces.test.ts | 2 +- .../src/views/studio-design/studioAppEdit.ts | 2 +- .../src/views/studio-design/wideViewport.ts | 2 +- 11 files changed, 17 insertions(+), 22 deletions(-) diff --git a/ui/packages/app-shell/src/chrome/CommandPalette.tsx b/ui/packages/app-shell/src/chrome/CommandPalette.tsx index a1bcdc16a27..503cd7b0e53 100644 --- a/ui/packages/app-shell/src/chrome/CommandPalette.tsx +++ b/ui/packages/app-shell/src/chrome/CommandPalette.tsx @@ -154,7 +154,7 @@ export interface StudioPaletteSurface { /** * Whether the page is one package's. Its groups then list that package's * items, so the palette does not also list every package's objects and - * flows; the package-less scope and the cross-package leg keep them. + * flows; the cross-package leg keeps them. */ packageScope: boolean; /** The page's groups for the query, drawn above the packages; mounted only while the palette is open. */ diff --git a/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.newSimilar-28567.test.tsx b/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.newSimilar-28567.test.tsx index 00eb0cdcceb..c140f9abc76 100644 --- a/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.newSimilar-28567.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/AutomationsPillar.newSimilar-28567.test.tsx @@ -14,8 +14,7 @@ * - a `409` (name taken) is the server's sentence, verbatim, the dialog stays * open on the names typed, and nothing opens; * - an answer that names no package opens nothing and says so; - * - without `manage_metadata` the item draws disabled, and nothing is sent; - * - the package-less scope draws no menu (no pair, no package to name). + * - without `manage_metadata` the item draws disabled, and nothing is sent. * * The harness is `AutomationsPillar.deleteFlow-27356`'s: the metadata server * doubled at the client, the `/automation` doors doubled at `fetch`, and the 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 8d4e8d61c64..ec84ea73ec8 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 @@ -262,7 +262,7 @@ describe('studioBackTarget — the order of the three answers (objectstack#36501 appLabel: 'Service', }); }); - it('no app, or the package-less scope: the apps home, unnamed, whatever is recorded', () => { + it('no app, or no package open: the apps home, unnamed, whatever is recorded', () => { const foreign = { path: '/apps/x/y', app: 'x', label: 'X app' }; expect(studioBackTarget({ ...base, remembered: foreign, apps: [] })).toEqual({ path: '/landing', appLabel: null }); expect(studioBackTarget({ ...base, remembered: null, apps: [] })).toEqual({ path: '/landing', appLabel: null }); 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 8968e49466d..12c96ae0355 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 @@ -4,15 +4,12 @@ * objectui#12513 — the Studio home loop. Inside a package the header's first * button and the package switcher's first row both returned to the Studio * landing (`/studio`); objectstack#36501 replaced both with 「‹ Back to app」 (since objectstack#36899 right after the menu toggle), - * and the first case below now says so. The Organization flows empty block's way out to - * Setup › Packaged automation retired with that page's flows half (objectstack - * ADR-0146 D11, N-28): the block now says where a packaged flow is changed, - * and links nowhere. + * and the first case below now says so. The Organization flows empty block went with the + * package-less scope it was drawn on, which is retired (objectstack#38150). * * Rendered through the REAL `StudioDesignSurface` on the REAL route shape, on * the server double objectui#11553's file uses: a read-only showcase package - * with two packaged flows, and no package-less flow (so the Organization - * flows scope is empty). + * with two packaged flows, and no package-less flow. */ import '@testing-library/jest-dom/vitest'; @@ -134,7 +131,7 @@ const dataSource = createEmptyDataSource(); failOnAbsorbedFetchError(); // The two global-`fetch` reads on this surface: the pending-drafts feed -// (`/meta/_drafts`, the header count and the package-less publish) and the +// (`/meta/_drafts`, the header count) and the // rail's `/automation/_status` probe (answered "absent", so no dots). vi.stubGlobal( 'fetch', @@ -224,6 +221,5 @@ describe('Studio home loop (objectui#12513)', () => { expect(within(screen.getByTestId('studio-brand-row')).getByTestId('studio-menu-toggle')).toBeTruthy(); expect(screen.queryByRole('button', { name: 'App Studio home' })).toBeNull(); }); - // objectstack#36903 — the Automations rail's empty blocks went with the rail: - // the package-less scope's list offers no create (StudioDesignSurface.packageLessFlows-11553). + // objectstack#36903 — the Automations rail's empty blocks went with the rail. }); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioInterfacesRetiredNotice.tsx b/ui/packages/app-shell/src/views/studio-design/StudioInterfacesRetiredNotice.tsx index fe6dd1d8996..da1627c2db3 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioInterfacesRetiredNotice.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioInterfacesRetiredNotice.tsx @@ -22,7 +22,7 @@ export function StudioInterfacesRetiredNotice({ navigate, onDismiss, }: { - /** The open package, or `null` in the package-less scope. */ + /** The open package, or `null` where none is open (the cross-package leg). */ packageId: string | null; /** The package's published apps. */ apps: readonly StudioAppTarget[]; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioPackageMenu-37139.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioPackageMenu-37139.test.tsx index 1f1f9441862..2c8efc71336 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioPackageMenu-37139.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioPackageMenu-37139.test.tsx @@ -24,7 +24,7 @@ * 2. Each item's greyed state: on a read-only package Edit package info and * Duplicate are greyed (the server refuses each there). Manage in Setup… * is never greyed. - * 3. No 「⋯」 on `~org` or `~all` (no current package): its one home, a + * 3. No 「⋯」 on `~all` (no current package), where the retired `~org` lands too: its one home, a * package's overview, is not drawn there at its own address. None for a * user without `manage_metadata`. * 4. Each item does what the development face's action does: the same door, diff --git a/ui/packages/app-shell/src/views/studio-design/StudioPackageOverview-37454.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioPackageOverview-37454.test.tsx index bbf4de93ed6..d433559dc4d 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioPackageOverview-37454.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioPackageOverview-37454.test.tsx @@ -17,8 +17,8 @@ * 4. A read-only package keeps its posture: 系统自带 with a lock, no Publish * from either door. * 5. The overview's branch order: an unknown package lands on the surface's - * not-found state, not on an overview; the package-less scope's - * `~org/overview` redirects to its area; inside the page, the row read's + * not-found state, not on an overview; the retired package-less scope's + * `~org/overview` redirects to the Loose list of flows; inside the page, the row read's * loading state (announced) comes before its failure, which comes before * the fields. * diff --git a/ui/packages/app-shell/src/views/studio-design/flowGrouping.ts b/ui/packages/app-shell/src/views/studio-design/flowGrouping.ts index 0703bf67322..ba11abe4b9b 100644 --- a/ui/packages/app-shell/src/views/studio-design/flowGrouping.ts +++ b/ui/packages/app-shell/src/views/studio-design/flowGrouping.ts @@ -168,8 +168,8 @@ export interface GroupFlowsOptions { noObjectLabel: string; /** * The objects in the order the app's navigation lists them - * (`navigationObjectOrder`); the groups follow it. Empty when the scope has - * no app (the package-less scope, a package without one): every group is + * (`navigationObjectOrder`); the groups follow it. Empty when the package + * has no app: every group is * then an unlisted one. Required, so no caller orders the rail by the * labels' alphabet by leaving it out (objectui#12612). */ diff --git a/ui/packages/app-shell/src/views/studio-design/packageSurfaces.test.ts b/ui/packages/app-shell/src/views/studio-design/packageSurfaces.test.ts index 7804a9a6e90..cbb407c21d8 100644 --- a/ui/packages/app-shell/src/views/studio-design/packageSurfaces.test.ts +++ b/ui/packages/app-shell/src/views/studio-design/packageSurfaces.test.ts @@ -95,7 +95,7 @@ describe('loadPackageSurfaces', () => { }); /** - * objectui#11553 — the package-less scope's rail. Measured on objectstack + * objectui#11553 — the items of no package, once the package-less scope's rail. Measured on objectstack * 17.6.0: the package-scoped flow list omits a clone (its row names no * package), the bare list includes it beside every packaged flow. So this * loader reads unscoped and keeps only what names no package, on both halves. diff --git a/ui/packages/app-shell/src/views/studio-design/studioAppEdit.ts b/ui/packages/app-shell/src/views/studio-design/studioAppEdit.ts index b682c36a12d..3c1ce8dc972 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioAppEdit.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioAppEdit.ts @@ -11,7 +11,7 @@ * of the open package's published apps, or when its menu opens this item; * 2. otherwise the package's first published app; * 3. none: the package has no published app, or the item is in no package - * (the package-less scope and the cross-package leg). The item then opens + * (the cross-package leg). The item then opens * the generic item page (decision 3). * * An item of a customization pair (`.custom`) with no published app of diff --git a/ui/packages/app-shell/src/views/studio-design/wideViewport.ts b/ui/packages/app-shell/src/views/studio-design/wideViewport.ts index b71f8ee9289..41a36205dfb 100644 --- a/ui/packages/app-shell/src/views/studio-design/wideViewport.ts +++ b/ui/packages/app-shell/src/views/studio-design/wideViewport.ts @@ -25,7 +25,7 @@ import { NODE_W, PADDING } from '../metadata-admin/previews/flow-canvas-layout.j * about 460px wide with no dock beside the pillar, and about 40px with it. * Where the slot hosts the pillar, the Configuration itself is in the slot * (objectui#12725, phase 2) and the row holds no aside, so only the classic - * layout folds: the package-less scope and an injected `aiSlot`. + * layout folds: an injected `aiSlot`. * * The sum, term by term: the flow rail (`w-52`, 208px; below `md` it becomes an * overlay, but every row below `md` is narrower than this sum anyway); the From c2ffeaa73247ba53d6cd2b84b5c07ab01688d4c4 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Nov 2026 14:11:16 +0000 Subject: [PATCH 7/9] test(e2e): the Studio menu's fold draws no Automation group once the organization's flows retired The left-menu Playwright page still waited for the fold's Automation group. On a package that group held one row, the organization's own flows, which retired with the package-less scope; a group is drawn only where it holds an entry, so the fold now draws System and Access. The case asserts those two and that the Automation group is absent. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01QsR2jUba5JFq1ejCZ7Gxpk --- ui/e2e/studio-left-menu-36899.spec.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/e2e/studio-left-menu-36899.spec.ts b/ui/e2e/studio-left-menu-36899.spec.ts index aabfa96b913..b8c872fb7d2 100644 --- a/ui/e2e/studio-left-menu-36899.spec.ts +++ b/ui/e2e/studio-left-menu-36899.spec.ts @@ -221,9 +221,12 @@ test.describe('Studio left menu (objectstack#36899)', () => { await fold.click(); await expect(fold).toHaveAttribute('aria-expanded', 'true'); - for (const g of ['automation', 'system', 'security']) { + for (const g of ['system', 'security']) { await expect(page.getByTestId(`studio-menu-advanced-group-${g}`)).toBeVisible(); } + // objectstack#38150 — the fold's Automation group held one row, the organization's own flows; + // it retired with the package-less scope, and a group is drawn only where it holds an entry. + await expect(page.getByTestId('studio-menu-advanced-group-automation')).toHaveCount(0); await expect(page.getByTestId('studio-menu-entry-diagnostics')).toBeVisible(); // Below the 常用 entries, inside the docked panel. const below = await page.getByTestId('studio-menu-entry-diagnostics').evaluate((el) => el.getBoundingClientRect().top); From 907138512117977f86e39e46b37a1843f4e77101 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Nov 2026 14:21:31 +0000 Subject: [PATCH 8/9] test(app-shell): a package-less flow's item page opens writable and saves a draft naming no package; ADR-0084 marks two more passages The retired scope's case "opens it editable, and an edit saves a draft bound to no package" had no replacement. The item page on the cross-package leg is that door now, so one case pins both facts on it: the designer's add controls are drawn and Save waits only for an edit, and an edit saved there writes a draft, then that item's own publish, neither naming a package. ADR-0084: the sorting rule's third test and item 3 of the 2026-11-25 silent-points list still placed the organization's own flows as a drawn entry; both are struck with a dated note. The 2026-11-29 note under Organization-level content now lists the scope's flow page among what retired, and says where a flow of no package opens. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01QsR2jUba5JFq1ejCZ7Gxpk --- ...cation-builder-information-architecture.md | 6 +-- ...ignSurface.packageLessFlows-11553.test.tsx | 41 ++++++++++++++++++- 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/docs/adr/0084-application-builder-information-architecture.md b/docs/adr/0084-application-builder-information-architecture.md index 9a3c8130970..c901ee5ea44 100644 --- a/docs/adr/0084-application-builder-information-architecture.md +++ b/docs/adr/0084-application-builder-information-architecture.md @@ -307,7 +307,7 @@ The rule is the proposal's (§3.1), ruled as proposed. A type is **常用** only 1. **It has no parent object.** Its schema does not require one object. A type bound to one object is authored from that object. 2. **A builder makes it directly, as a step of building an app.** It is not reference content, and not developer or operator work. -3. **It stays inside the open package.** An entry that leaves the package's scope — the organization's own flows, the cross-package directory — is 高级 on a package. +3. **It stays inside the open package.** An entry that leaves the package's scope — ~~the organization's own flows,~~ the cross-package directory — is 高级 on a package. *(Amended 2026-11-29, card [#38150](https://github.com/objectstack-ai/objectstack/issues/38150), ruling record [comment 7184753035](https://github.com/objectstack-ai/objectstack/issues/37424#issuecomment-7184753035), question 3: the first of the sentence's two examples is struck. The organization's own flows retired with their scope ([Organization-level content](#amendment-2026-11-26-org)), so the menu draws no such entry. The other example, the cross-package directory, is the entry the 2026-11-26 amendment moved to Setup ([Amendment (2026-11-26)](#amendment-2026-11-26-moves)). The test stands as ruled.)* **A type with no row in the table is drawn in 高级, at the end of its group. It is never invisible.** @@ -331,7 +331,7 @@ Merging accepts them; an objection names the number. 1. **The order of the types the proposal's list does not write out.** Its ordered list (§3.4) is written out for the 数据 Data and 界面 UI types and stops there. The Order column takes the rest from the proposal's drawing of the open fold (§3.2) and, for a type that drawing does not show, from the row order of its per-type table (§2), reading a row that names several types left to right. That places `job` after `flow`; `translation` · `api` · `datasource` · `external_catalog`, in that order, after `email_template`; and `sharing_rule` · `queue` · `capability`, in that order, after `assignment_rule`. 2. **Where `picklist` sits inside 高级.** The maintainer moved it between the tiers and named no place. It keeps the place the proposal's list gave it, second in 数据 Data, which makes it the first 高级 entry of that group. -3. **Where the four entries that are not a type sit.** After the types of their group, as §3.4 leaves them. The proposal's per-type table (§2) lists the organization's own flows between `flow` and `job`; this record follows §3.4, so on a package that holds a `job`, that type's entry is drawn above the organization's flows. +3. **Where the four entries that are not a type sit.** After the types of their group, as §3.4 leaves them. ~~The proposal's per-type table (§2) lists the organization's own flows between `flow` and `job`; this record follows §3.4, so on a package that holds a `job`, that type's entry is drawn above the organization's flows.~~ *(Amended 2026-11-29, card [#38150](https://github.com/objectstack-ai/objectstack/issues/38150), ruling record [comment 7184753035](https://github.com/objectstack-ai/objectstack/issues/37424#issuecomment-7184753035), question 3: the second sentence is struck. It placed the organization's own flows, which retired with their scope ([Organization-level content](#amendment-2026-11-26-org)). Of the four entries this item counts, a package's menu draws two since: the default sharing overview and diagnostics. The cross-package directory is the one the 2026-11-26 amendment moved to Setup ([Amendment (2026-11-26)](#amendment-2026-11-26-moves)). The first sentence stands for those two.)* 4. **The tiers' English names.** The ruling names the tiers in Chinese. This record writes Common and Advanced, after the two values of the proposal's list (§3.4). 5. **The table's shape.** One row per type, so that each type carries its own order and tier. Order counts inside a group, because the order of the groups is the six-group table's. 6. **~~A type registered after the ruling was written: `ai_context`.~~ Types registered after the ruling was written: `ai_context`, and since then `knowledge_source`.** *(Heading reworded 2026-11-27, for the second row that points here; the note that ends this item says what changed.)* The proposal and the ruling were made on a registry of 32 types. `ai_context`, the context pack of [ADR-0160](./0160-record-scoped-ai-inquiry.md) D1, was registered under `ai` the same day, after both. The maintainer's words on AI are 「AI 应该提到第一层分类,放在最下面」, and the ruling record lists the group's 常用 types as 智能体 · 工具 · 技能: three types, and not this one. Three ruled sentences place it, and they agree: its schema requires one root object, so the first test of the rule sorts it 高级; 高级 holds every type the ruling does not list as 常用; and a type with no row is drawn at the end of its group. The table writes that down as a row — last in AI, 高级 — so that the placement list has a row to mirror. If every AI type is meant to be 常用, the tier of this one row is the word to change. *(Amended 2026-11-27, card [#37740](https://github.com/objectstack-ai/objectstack/issues/37740), which decides nothing: a second type has been registered under `ai` since the ruling — `knowledge_source`, on 2026-11-27 ([ADR-0161](./0161-knowledge-platform-boundary-platform-owns-assembly-sync-split-record-return-knowledge-source-is-a-governed-type.md) K4) — and the change that registered it wrote its row under this item: fifth in AI, 高级. So `ai_context`'s row is the fourth, and no longer the last in AI. The ruling record's list of the group's 常用 types, 智能体 · 工具 · 技能, does not name this type either, and the same three sentences place it: its schema requires one object (the `object` key of its `source`, `packages/spec/src/ai/knowledge-source.zod.ts#ObjectKnowledgeSourceSchema`), so the first test of the rule sorts it 高级; 高级 holds every type the ruling does not list as 常用; and a type with no row is drawn at the end of its group. The sentence before this note holds for each of the two rows: if every AI type is meant to be 常用, the tier of that row is the word to change.)* @@ -482,7 +482,7 @@ Decision 11 of the epic, as ruled on its questions 2 and 3 (maintainer: 「同 - **Loose items stay where they are, and one door moves them** (question 3, ruled C). An item that belongs to no package stays legal: it belongs to the implicit environment package (ADR-0150 D1, the fourth bucket), and nothing is renamed or migrated. One new door moves a selection — one item, several, or all — into a package, and runs each through the judges a save runs, judging the selection as a set for the cross-boundary rule of ADR-0150 D3 (a). It reuses the list page that exists. When that door ships, the bulk adopt and Studio's `~org` entry retire together. This replaces the page that sorts loose items one by one, which decisions 11 and 12 planned. Where the new door is opened from is its card's to say. - **What this changes in the menu.** The organization's own flows keep their entry in 自动化 Automation until the door ships. The ⋯ menu keeps "adopt loose items" until then, and loses it then. -*(Amended 2026-11-29, card [#38150](https://github.com/objectstack-ai/objectstack/issues/38150), ruling record [comment 7184753035](https://github.com/objectstack-ai/objectstack/issues/37424#issuecomment-7184753035), question 3: the door shipped, and the bullets above are left as the ruling wrote them. The door is `POST /api/v1/packages/:id/move-in`. Its card opened it from the cross-package list: the "Loose" value of that list's source filter, `/studio/~all/metadata/TYPE?source=loose`, which a banner on Setup's Packages page links to for each type that holds a loose item. Studio's `~org` entry retired with the door, and the scope with it: the menu row, the scope's list, its 变更 Changes row and the batch publish behind that row. Every `/studio/~org/…` address lands on the Loose list of flows, `/studio/~all/metadata/flow?source=loose`. The bulk adopt is retired by a change of its own under that card ([#38545](https://github.com/objectstack-ai/objectstack/pull/38545)), not by the one that retired this entry. ADR-0070's D5 carries its mark of the same date, as the paragraph below asks.)* +*(Amended 2026-11-29, card [#38150](https://github.com/objectstack-ai/objectstack/issues/38150), ruling record [comment 7184753035](https://github.com/objectstack-ai/objectstack/issues/37424#issuecomment-7184753035), question 3: the door shipped, and the bullets above are left as the ruling wrote them. The door is `POST /api/v1/packages/:id/move-in`. Its card opened it from the cross-package list: the "Loose" value of that list's source filter, `/studio/~all/metadata/TYPE?source=loose`, which a banner on Setup's Packages page links to for each type that holds a loose item. Studio's `~org` entry retired with the door, and the scope with it: the menu row, the scope's list, the scope's flow page (the flow designer, which opened a flow of no package full-screen), its 变更 Changes row and the batch publish behind that row. A flow that belongs to no package opens on its item page on the cross-package leg, `/studio/~all/metadata/flow/NAME`, and is still saved in place there; the flow designer opens on a package's flow. Every `/studio/~org/…` address lands on the Loose list of flows, `/studio/~all/metadata/flow?source=loose`. The bulk adopt is retired by a change of its own under that card ([#38545](https://github.com/objectstack-ai/objectstack/pull/38545)), not by the one that retired this entry. ADR-0070's D5 carries its mark of the same date, as the paragraph below asks.)* ADR-0070 is not edited by this amendment. Where the ruling restates its D1 and D5, the phase-4 cards that carry the ruling out owe that record its marks. 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 ff31523991f..7b08a55661e 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 @@ -21,7 +21,9 @@ * - the clone's row there opens its item page on that leg; a package's * address that names the clone lands on that page too, and still opens no * other flow; - * - a draft of the clone is published, or discarded, from that item page; + * - that item page opens writable, and an edit saved there writes a draft + * naming no package; a draft of the clone is published, or discarded, from + * that page; * - no menu row, no Changes row and no changes sheet is drawn for the * retired scope; a package keeps its own. * @@ -470,7 +472,7 @@ describe('the packaged control: a read-only package stays read-only (objectui#11 }); }); -describe('a package-less flow draft is published, or discarded, from its item page (objectstack#38150)', () => { +describe('a package-less flow is edited, and its draft published or discarded, from its item page (objectstack#38150)', () => { beforeEach(() => { // The platform's own row for the type (`allowRuntimeCreate: true`), read from the spec. const flowRow = DEFAULT_METADATA_TYPE_REGISTRY.find((row) => row.type === 'flow'); @@ -514,6 +516,41 @@ describe('a package-less flow draft is published, or discarded, from its item pa expect(server.itemPublishes).toEqual([]); }); + // objectstack#38150 — the retired scope's page opened the clone in the flow designer, editable, and an + // edit there saved a draft bound to no package. The item page is that door now (the ruling keeps an + // in-place save of a loose row open: comment 7184753035, question 2), so the same two facts are pinned on it. + it('the item page opens writable, and an edit saved there writes a draft naming no package', async () => { + // No draft of the clone is pending in this case: the plain edit of a live loose row. + server.drafts = server.drafts.filter((d) => d.name !== 'qa_urgent_alert_clone'); + renderAt(CLONE_PAGE); + const save = await screen.findByTestId('resource-save', undefined, { timeout: 8000 }); + // Writable: the designer's add controls are drawn, and Save waits only for an edit. + expect(screen.getAllByRole('button', { name: 'Add connected node' }).length).toBeGreaterThan(0); + expect(save).toBeDisabled(); + expect(location()).toBe(CLONE_PAGE); + + const label = await waitFor(() => { + const input = document.getElementById('mdf-label') as HTMLInputElement | null; + expect(input?.value).toBe('QA urgent alert clone'); + return input!; + }); + fireEvent.change(label, { target: { value: 'QA urgent alert clone, edited' } }); + await waitFor(() => expect(save).toBeEnabled(), { timeout: 8000 }); + + fireEvent.click(save); + await waitFor(() => expect(server.saves).toHaveLength(1), { timeout: 8000 }); + const [saved] = server.saves; + expect([saved!.type, saved!.name]).toEqual(['flow', 'qa_urgent_alert_clone']); + expect(saved!.body.label).toBe('QA urgent alert clone, edited'); + expect(saved!.options?.mode).toBe('draft'); + expect(saved!.options ?? {}).not.toHaveProperty('packageId'); + // Save takes effect at once (objectstack#36902): that one item's own publish, naming no package either. + await waitFor(() => expect(server.itemPublishes).toHaveLength(1), { timeout: 8000 }); + expect([server.itemPublishes[0]!.type, server.itemPublishes[0]!.name]).toEqual(['flow', 'qa_urgent_alert_clone']); + expect(server.itemPublishes[0]!.options ?? {}).not.toHaveProperty('packageId'); + expect(server.packageBatches).toEqual([]); + }); + it('CONTROL: a package draws no Changes row; its count is 概览\'s badge, and its sheet is not narrowed', async () => { renderAt(`/studio/${SHOWCASE}/metadata/flow/showcase_urgent_task_alert`); await openedFlow('showcase_urgent_task_alert'); From 85939f9cf79dff9a38b19ec52670be6955ad0d1b Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Nov 2026 14:37:53 +0000 Subject: [PATCH 9/9] test(app-shell): the package-less flow's page is pinned writable from a read-only package's address too The retired scope had two more entries that asserted the clone opens editable: the measured link through a package, and a switch from a read-only package. The new item-page case now runs over both entries that are left, the page's own address and a read-only package's address that names the clone, so the page is pinned writable, and its save as a draft naming no package, from each. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01QsR2jUba5JFq1ejCZ7Gxpk --- ...tudioDesignSurface.packageLessFlows-11553.test.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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 7b08a55661e..22ead62b97a 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 @@ -519,15 +519,20 @@ describe('a package-less flow is edited, and its draft published or discarded, f // objectstack#38150 — the retired scope's page opened the clone in the flow designer, editable, and an // edit there saved a draft bound to no package. The item page is that door now (the ruling keeps an // in-place save of a loose row open: comment 7184753035, question 2), so the same two facts are pinned on it. - it('the item page opens writable, and an edit saved there writes a draft naming no package', async () => { + // The second entry is a read-only package's address that names the clone: the surface that opened on that + // package redirects to the clone's page, which must not take the package's read-only state with it. + it.each([ + ['its own address', CLONE_PAGE], + ['a read-only package’s address that names it', `/studio/${SHOWCASE}/metadata/flow/qa_urgent_alert_clone`], + ])('the item page opens writable, and an edit saved there writes a draft naming no package (%s)', async (_entry, url) => { // No draft of the clone is pending in this case: the plain edit of a live loose row. server.drafts = server.drafts.filter((d) => d.name !== 'qa_urgent_alert_clone'); - renderAt(CLONE_PAGE); + renderAt(url); + await waitFor(() => expect(location()).toBe(CLONE_PAGE), { timeout: 8000 }); const save = await screen.findByTestId('resource-save', undefined, { timeout: 8000 }); // Writable: the designer's add controls are drawn, and Save waits only for an edit. expect(screen.getAllByRole('button', { name: 'Add connected node' }).length).toBeGreaterThan(0); expect(save).toBeDisabled(); - expect(location()).toBe(CLONE_PAGE); const label = await waitFor(() => { const input = document.getElementById('mdf-label') as HTMLInputElement | null;