From e6f8c174b985bcff500048828e3e65a5f3a48f29 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 13:44:20 +0000 Subject: [PATCH 1/7] feat(setup): the environment directory moves from Studio to Setup's access group (WIP) Claude-Session: https://claude.ai/code/session_01Utp6CZhAqkgRyMYuZeZt9S Co-authored-by: Claude --- .../src/apps/setup-nav.contributions.ts | 17 +++ .../src/apps/translations/ar.source-hashes.ts | 1 + .../src/apps/translations/ar.ts | 1 + .../src/apps/translations/de.source-hashes.ts | 1 + .../src/apps/translations/de.ts | 1 + .../src/apps/translations/en.ts | 1 + .../apps/translations/es-ES.source-hashes.ts | 1 + .../src/apps/translations/es-ES.ts | 1 + .../src/apps/translations/fr.source-hashes.ts | 1 + .../src/apps/translations/fr.ts | 1 + .../apps/translations/ja-JP.source-hashes.ts | 1 + .../src/apps/translations/ja-JP.ts | 1 + .../src/apps/translations/ko.source-hashes.ts | 1 + .../src/apps/translations/ko.ts | 1 + .../apps/translations/pt-BR.source-hashes.ts | 1 + .../src/apps/translations/pt-BR.ts | 1 + .../src/apps/translations/ru.source-hashes.ts | 1 + .../src/apps/translations/ru.ts | 1 + .../apps/translations/zh-CN.source-hashes.ts | 1 + .../src/apps/translations/zh-CN.ts | 1 + .../translations/zh-Hant.source-hashes.ts | 1 + .../src/apps/translations/zh-Hant.ts | 1 + .../console/src/components/StudioRoute.tsx | 14 +- ui/packages/app-shell/src/index.ts | 4 + .../src/services/builtinComponents.tsx | 17 +++ .../src/views/setup/AccessDirectoryPage.tsx | 80 ++++++++++++ .../src/views/setup/accessDirectory.ts | 122 ++++++++++++++++++ .../src/views/setup/accessDirectoryRef.ts | 27 ++++ .../studio-design/StudioEntryRedirect.tsx | 5 +- .../src/views/studio-design/StudioMenu.tsx | 2 - .../studio-design/StudioMetadataArea.tsx | 5 + .../studio-design/setupMetadataRedirect.ts | 18 ++- .../studio-design/studioEntryPermissions.ts | 18 ++- .../src/views/studio-design/studioMenuData.ts | 1 - .../views/studio-design/studioMenuModel.ts | 36 +++--- ui/packages/i18n/src/namespaces/studio/en.ts | 1 + ui/packages/i18n/src/namespaces/studio/zh.ts | 1 + 37 files changed, 344 insertions(+), 45 deletions(-) create mode 100644 ui/packages/app-shell/src/views/setup/AccessDirectoryPage.tsx create mode 100644 ui/packages/app-shell/src/views/setup/accessDirectory.ts create mode 100644 ui/packages/app-shell/src/views/setup/accessDirectoryRef.ts diff --git a/packages/platform-objects/src/apps/setup-nav.contributions.ts b/packages/platform-objects/src/apps/setup-nav.contributions.ts index 1f55db98e0a..afb2b60cf11 100644 --- a/packages/platform-objects/src/apps/setup-nav.contributions.ts +++ b/packages/platform-objects/src/apps/setup-nav.contributions.ts @@ -116,6 +116,23 @@ export const SETUP_NAV_CONTRIBUTIONS: NavigationContribution[] = [ { id: 'nav_invitations', type: 'object', label: 'Invitations', objectName: 'sys_invitation', icon: 'mail' }, ], }, + { + app: 'setup', + group: 'group_access_control', + // [ADR-0084, amended 2026-11-26, question 5] The environment directory — + // positions, capabilities, permission sets and sharing rules across every + // package — left Studio's menu for this group: Setup holds what is global. + // Priority 100 keeps it first, where plugin-security's catalog entries were. + // Gate: `studio.access`, the Studio entry that admitted a principal to the + // directory before it moved, so moving it widens nobody's view; the Setup + // app's `setup.access` applies on top. Its items still open in Studio + // (ADR-0146 D1). The console binds the ref to its page (app-shell + // `builtinComponents`). + priority: 100, + items: [ + { id: 'nav_access_directory', type: 'component', label: 'Positions and Permissions', componentRef: 'security:access-directory', icon: 'key-round', requiredPermissions: ['studio.access'] }, + ], + }, { app: 'setup', group: 'group_access_control', diff --git a/packages/platform-objects/src/apps/translations/ar.source-hashes.ts b/packages/platform-objects/src/apps/translations/ar.source-hashes.ts index 85ea633c5cf..9073c9c79a7 100644 --- a/packages/platform-objects/src/apps/translations/ar.source-hashes.ts +++ b/packages/platform-objects/src/apps/translations/ar.source-hashes.ts @@ -101,6 +101,7 @@ export const arSourceHashes: Readonly> = { 'apps.setup.navigation.nav_sso_providers.label': '7b06b6a6abf53ba4', 'apps.setup.navigation.nav_scim_credentials.label': '2d94a32c33ca2957', 'apps.setup.navigation.nav_api_keys.label': '8cda9851248b0490', + 'apps.setup.navigation.nav_access_directory.label': '60b7217f289b11e9', 'apps.setup.navigation.nav_approvals_inbox.label': '0a9269b20d0266c9', 'apps.setup.navigation.nav_approval_requests.label': 'aafd0f7c6a376f55', 'apps.setup.navigation.nav_approval_actions.label': 'd2ebad7acfd50978', diff --git a/packages/platform-objects/src/apps/translations/ar.ts b/packages/platform-objects/src/apps/translations/ar.ts index d7a834c8d21..57053d0e189 100644 --- a/packages/platform-objects/src/apps/translations/ar.ts +++ b/packages/platform-objects/src/apps/translations/ar.ts @@ -79,6 +79,7 @@ export const ar: TranslationData = { // the same case as the entry above; see `en.ts` (#31123). nav_scim_credentials: { label: 'بيانات اعتماد SCIM' }, nav_api_keys: { label: 'مفاتيح API' }, + nav_access_directory: { label: 'المناصب والأذونات' }, // صندوق الموافقات = the Approvals Inbox component (#7234) — the surface // with decision actions. The three below are the engine's raw tables; the diff --git a/packages/platform-objects/src/apps/translations/de.source-hashes.ts b/packages/platform-objects/src/apps/translations/de.source-hashes.ts index 7c2392663e4..daa58d5dccd 100644 --- a/packages/platform-objects/src/apps/translations/de.source-hashes.ts +++ b/packages/platform-objects/src/apps/translations/de.source-hashes.ts @@ -101,6 +101,7 @@ export const deSourceHashes: Readonly> = { 'apps.setup.navigation.nav_sso_providers.label': '7b06b6a6abf53ba4', 'apps.setup.navigation.nav_scim_credentials.label': '2d94a32c33ca2957', 'apps.setup.navigation.nav_api_keys.label': '8cda9851248b0490', + 'apps.setup.navigation.nav_access_directory.label': '60b7217f289b11e9', 'apps.setup.navigation.nav_approvals_inbox.label': '0a9269b20d0266c9', 'apps.setup.navigation.nav_approval_requests.label': 'aafd0f7c6a376f55', 'apps.setup.navigation.nav_approval_actions.label': 'd2ebad7acfd50978', diff --git a/packages/platform-objects/src/apps/translations/de.ts b/packages/platform-objects/src/apps/translations/de.ts index 045eb6894bd..6d15085b7fc 100644 --- a/packages/platform-objects/src/apps/translations/de.ts +++ b/packages/platform-objects/src/apps/translations/de.ts @@ -80,6 +80,7 @@ export const de: TranslationData = { // of `sys_scim_connection_credential.pluralLabel`. nav_scim_credentials: { label: 'SCIM-Anmeldedaten' }, nav_api_keys: { label: 'API-Schlüssel' }, + nav_access_directory: { label: 'Positionen und Berechtigungen' }, // Genehmigungseingang = the Approvals Inbox component (#7234) — the // surface with decision actions. The three below are the engine's raw diff --git a/packages/platform-objects/src/apps/translations/en.ts b/packages/platform-objects/src/apps/translations/en.ts index be6aae9cf7f..07a9ed78918 100644 --- a/packages/platform-objects/src/apps/translations/en.ts +++ b/packages/platform-objects/src/apps/translations/en.ts @@ -121,6 +121,7 @@ export const en: TranslationData = { // list; the label is the short form of that object's `pluralLabel`. nav_scim_credentials: { label: 'SCIM Credentials' }, nav_api_keys: { label: 'API Keys' }, + nav_access_directory: { label: 'Positions and Permissions' }, // Approvals. `nav_approvals_inbox` is the working surface (#7234); the // three below it are the engine's raw tables, kept as the admin view. diff --git a/packages/platform-objects/src/apps/translations/es-ES.source-hashes.ts b/packages/platform-objects/src/apps/translations/es-ES.source-hashes.ts index dd04272280c..b668123d8b2 100644 --- a/packages/platform-objects/src/apps/translations/es-ES.source-hashes.ts +++ b/packages/platform-objects/src/apps/translations/es-ES.source-hashes.ts @@ -96,6 +96,7 @@ export const esESSourceHashes: Readonly> = { 'apps.setup.navigation.nav_sso_providers.label': '7b06b6a6abf53ba4', 'apps.setup.navigation.nav_scim_credentials.label': '2d94a32c33ca2957', 'apps.setup.navigation.nav_api_keys.label': '8cda9851248b0490', + 'apps.setup.navigation.nav_access_directory.label': '60b7217f289b11e9', 'apps.setup.navigation.nav_connect_agent.label': 'a4542422fb5e8a68', 'apps.setup.navigation.nav_approvals_inbox.label': '0a9269b20d0266c9', 'apps.setup.navigation.nav_approval_requests.label': 'aafd0f7c6a376f55', diff --git a/packages/platform-objects/src/apps/translations/es-ES.ts b/packages/platform-objects/src/apps/translations/es-ES.ts index 8d0ad4921df..25702444b00 100644 --- a/packages/platform-objects/src/apps/translations/es-ES.ts +++ b/packages/platform-objects/src/apps/translations/es-ES.ts @@ -79,6 +79,7 @@ export const esES: TranslationData = { // the same case as the entry above; see `en.ts` (#31123). nav_scim_credentials: { label: 'Credenciales SCIM' }, nav_api_keys: { label: 'Claves API' }, + nav_access_directory: { label: 'Puestos y permisos' }, nav_approvals_inbox: { label: 'Centro de aprobaciones' }, nav_approval_requests: { label: 'Solicitudes' }, diff --git a/packages/platform-objects/src/apps/translations/fr.source-hashes.ts b/packages/platform-objects/src/apps/translations/fr.source-hashes.ts index 02114573799..d5cc2eb5ddb 100644 --- a/packages/platform-objects/src/apps/translations/fr.source-hashes.ts +++ b/packages/platform-objects/src/apps/translations/fr.source-hashes.ts @@ -101,6 +101,7 @@ export const frSourceHashes: Readonly> = { 'apps.setup.navigation.nav_sso_providers.label': '7b06b6a6abf53ba4', 'apps.setup.navigation.nav_scim_credentials.label': '2d94a32c33ca2957', 'apps.setup.navigation.nav_api_keys.label': '8cda9851248b0490', + 'apps.setup.navigation.nav_access_directory.label': '60b7217f289b11e9', 'apps.setup.navigation.nav_approvals_inbox.label': '0a9269b20d0266c9', 'apps.setup.navigation.nav_approval_requests.label': 'aafd0f7c6a376f55', 'apps.setup.navigation.nav_approval_actions.label': 'd2ebad7acfd50978', diff --git a/packages/platform-objects/src/apps/translations/fr.ts b/packages/platform-objects/src/apps/translations/fr.ts index a3b8832a586..33edf893ce4 100644 --- a/packages/platform-objects/src/apps/translations/fr.ts +++ b/packages/platform-objects/src/apps/translations/fr.ts @@ -80,6 +80,7 @@ export const fr: TranslationData = { // of `sys_scim_connection_credential.pluralLabel`. nav_scim_credentials: { label: 'Identifiants SCIM' }, nav_api_keys: { label: 'Clés API' }, + nav_access_directory: { label: 'Postes et autorisations' }, // Centre d’approbations = the Approvals Inbox component (#7234) — the // surface with decision actions. The three below are the engine's raw diff --git a/packages/platform-objects/src/apps/translations/ja-JP.source-hashes.ts b/packages/platform-objects/src/apps/translations/ja-JP.source-hashes.ts index 738fdc79ab2..a7c764e6dd3 100644 --- a/packages/platform-objects/src/apps/translations/ja-JP.source-hashes.ts +++ b/packages/platform-objects/src/apps/translations/ja-JP.source-hashes.ts @@ -96,6 +96,7 @@ export const jaJPSourceHashes: Readonly> = { 'apps.setup.navigation.nav_sso_providers.label': '7b06b6a6abf53ba4', 'apps.setup.navigation.nav_scim_credentials.label': '2d94a32c33ca2957', 'apps.setup.navigation.nav_api_keys.label': '8cda9851248b0490', + 'apps.setup.navigation.nav_access_directory.label': '60b7217f289b11e9', 'apps.setup.navigation.nav_connect_agent.label': 'a4542422fb5e8a68', 'apps.setup.navigation.nav_approvals_inbox.label': '0a9269b20d0266c9', 'apps.setup.navigation.nav_approval_requests.label': 'aafd0f7c6a376f55', diff --git a/packages/platform-objects/src/apps/translations/ja-JP.ts b/packages/platform-objects/src/apps/translations/ja-JP.ts index abd13efc8ad..941ae9daeb5 100644 --- a/packages/platform-objects/src/apps/translations/ja-JP.ts +++ b/packages/platform-objects/src/apps/translations/ja-JP.ts @@ -79,6 +79,7 @@ export const jaJP: TranslationData = { // the same case as the entry above; see `en.ts` (#31123). nav_scim_credentials: { label: 'SCIM 資格情報' }, nav_api_keys: { label: 'API キー' }, + nav_access_directory: { label: '役職と権限' }, nav_approvals_inbox: { label: '承認センター' }, nav_approval_requests: { label: 'リクエスト' }, diff --git a/packages/platform-objects/src/apps/translations/ko.source-hashes.ts b/packages/platform-objects/src/apps/translations/ko.source-hashes.ts index ee0b3f01564..5557ee53556 100644 --- a/packages/platform-objects/src/apps/translations/ko.source-hashes.ts +++ b/packages/platform-objects/src/apps/translations/ko.source-hashes.ts @@ -101,6 +101,7 @@ export const koSourceHashes: Readonly> = { 'apps.setup.navigation.nav_sso_providers.label': '7b06b6a6abf53ba4', 'apps.setup.navigation.nav_scim_credentials.label': '2d94a32c33ca2957', 'apps.setup.navigation.nav_api_keys.label': '8cda9851248b0490', + 'apps.setup.navigation.nav_access_directory.label': '60b7217f289b11e9', 'apps.setup.navigation.nav_approvals_inbox.label': '0a9269b20d0266c9', 'apps.setup.navigation.nav_approval_requests.label': 'aafd0f7c6a376f55', 'apps.setup.navigation.nav_approval_actions.label': 'd2ebad7acfd50978', diff --git a/packages/platform-objects/src/apps/translations/ko.ts b/packages/platform-objects/src/apps/translations/ko.ts index 4422134badf..5c9a2255041 100644 --- a/packages/platform-objects/src/apps/translations/ko.ts +++ b/packages/platform-objects/src/apps/translations/ko.ts @@ -80,6 +80,7 @@ export const ko: TranslationData = { // of `sys_scim_connection_credential.pluralLabel`. nav_scim_credentials: { label: 'SCIM 자격 증명' }, nav_api_keys: { label: 'API 키' }, + nav_access_directory: { label: '직위 및 권한' }, // 승인 받은편지함 = the Approvals Inbox component (#7234) — the surface // with decision actions. The three below are the engine's raw tables; diff --git a/packages/platform-objects/src/apps/translations/pt-BR.source-hashes.ts b/packages/platform-objects/src/apps/translations/pt-BR.source-hashes.ts index 20542dc8227..964cba30111 100644 --- a/packages/platform-objects/src/apps/translations/pt-BR.source-hashes.ts +++ b/packages/platform-objects/src/apps/translations/pt-BR.source-hashes.ts @@ -101,6 +101,7 @@ export const ptBRSourceHashes: Readonly> = { 'apps.setup.navigation.nav_sso_providers.label': '7b06b6a6abf53ba4', 'apps.setup.navigation.nav_scim_credentials.label': '2d94a32c33ca2957', 'apps.setup.navigation.nav_api_keys.label': '8cda9851248b0490', + 'apps.setup.navigation.nav_access_directory.label': '60b7217f289b11e9', 'apps.setup.navigation.nav_approvals_inbox.label': '0a9269b20d0266c9', 'apps.setup.navigation.nav_approval_requests.label': 'aafd0f7c6a376f55', 'apps.setup.navigation.nav_approval_actions.label': 'd2ebad7acfd50978', diff --git a/packages/platform-objects/src/apps/translations/pt-BR.ts b/packages/platform-objects/src/apps/translations/pt-BR.ts index 904add3f7e0..adc6542adf2 100644 --- a/packages/platform-objects/src/apps/translations/pt-BR.ts +++ b/packages/platform-objects/src/apps/translations/pt-BR.ts @@ -80,6 +80,7 @@ export const ptBR: TranslationData = { // of `sys_scim_connection_credential.pluralLabel`. nav_scim_credentials: { label: 'Credenciais SCIM' }, nav_api_keys: { label: 'Chaves de API' }, + nav_access_directory: { label: 'Cargos e permissões' }, // Central de aprovações = the Approvals Inbox component (#7234) — the // surface with decision actions. The three below are the engine's raw diff --git a/packages/platform-objects/src/apps/translations/ru.source-hashes.ts b/packages/platform-objects/src/apps/translations/ru.source-hashes.ts index 1671428a58a..17f2e6a597e 100644 --- a/packages/platform-objects/src/apps/translations/ru.source-hashes.ts +++ b/packages/platform-objects/src/apps/translations/ru.source-hashes.ts @@ -101,6 +101,7 @@ export const ruSourceHashes: Readonly> = { 'apps.setup.navigation.nav_sso_providers.label': '7b06b6a6abf53ba4', 'apps.setup.navigation.nav_scim_credentials.label': '2d94a32c33ca2957', 'apps.setup.navigation.nav_api_keys.label': '8cda9851248b0490', + 'apps.setup.navigation.nav_access_directory.label': '60b7217f289b11e9', 'apps.setup.navigation.nav_approvals_inbox.label': '0a9269b20d0266c9', 'apps.setup.navigation.nav_approval_requests.label': 'aafd0f7c6a376f55', 'apps.setup.navigation.nav_approval_actions.label': 'd2ebad7acfd50978', diff --git a/packages/platform-objects/src/apps/translations/ru.ts b/packages/platform-objects/src/apps/translations/ru.ts index eb2b6588a1e..6b901b91ce4 100644 --- a/packages/platform-objects/src/apps/translations/ru.ts +++ b/packages/platform-objects/src/apps/translations/ru.ts @@ -80,6 +80,7 @@ export const ru: TranslationData = { // of `sys_scim_connection_credential.pluralLabel`. nav_scim_credentials: { label: 'Учётные данные SCIM' }, nav_api_keys: { label: 'API-ключи' }, + nav_access_directory: { label: 'Должности и разрешения' }, // Центр согласований = the Approvals Inbox component (#7234) — the // surface with decision actions. The three below are the engine's raw diff --git a/packages/platform-objects/src/apps/translations/zh-CN.source-hashes.ts b/packages/platform-objects/src/apps/translations/zh-CN.source-hashes.ts index 7a45b4e202d..0c9f1d20d13 100644 --- a/packages/platform-objects/src/apps/translations/zh-CN.source-hashes.ts +++ b/packages/platform-objects/src/apps/translations/zh-CN.source-hashes.ts @@ -96,6 +96,7 @@ export const zhCNSourceHashes: Readonly> = { 'apps.setup.navigation.nav_sso_providers.label': '7b06b6a6abf53ba4', 'apps.setup.navigation.nav_scim_credentials.label': '2d94a32c33ca2957', 'apps.setup.navigation.nav_api_keys.label': '8cda9851248b0490', + 'apps.setup.navigation.nav_access_directory.label': '60b7217f289b11e9', 'apps.setup.navigation.nav_connect_agent.label': 'a4542422fb5e8a68', 'apps.setup.navigation.nav_approvals_inbox.label': '0a9269b20d0266c9', 'apps.setup.navigation.nav_approval_requests.label': 'aafd0f7c6a376f55', diff --git a/packages/platform-objects/src/apps/translations/zh-CN.ts b/packages/platform-objects/src/apps/translations/zh-CN.ts index 55f348c2a26..480af8d6fb4 100644 --- a/packages/platform-objects/src/apps/translations/zh-CN.ts +++ b/packages/platform-objects/src/apps/translations/zh-CN.ts @@ -79,6 +79,7 @@ export const zhCN: TranslationData = { // the same case as the entry above; see `en.ts` (#31123). nav_scim_credentials: { label: 'SCIM 凭据' }, nav_api_keys: { label: 'API 密钥' }, + nav_access_directory: { label: '岗位与权限' }, // 审批中心 = the Approvals Inbox component (#7234) — the surface with // decision actions. The three below are the engine's raw tables. diff --git a/packages/platform-objects/src/apps/translations/zh-Hant.source-hashes.ts b/packages/platform-objects/src/apps/translations/zh-Hant.source-hashes.ts index 95ff436fc2d..588af1dbcc8 100644 --- a/packages/platform-objects/src/apps/translations/zh-Hant.source-hashes.ts +++ b/packages/platform-objects/src/apps/translations/zh-Hant.source-hashes.ts @@ -100,6 +100,7 @@ export const zhHantSourceHashes: Readonly> = { 'apps.setup.navigation.nav_sso_providers.label': '7b06b6a6abf53ba4', 'apps.setup.navigation.nav_scim_credentials.label': '2d94a32c33ca2957', 'apps.setup.navigation.nav_api_keys.label': '8cda9851248b0490', + 'apps.setup.navigation.nav_access_directory.label': '60b7217f289b11e9', 'apps.setup.navigation.nav_connect_agent.label': 'a4542422fb5e8a68', 'apps.setup.navigation.nav_approvals_inbox.label': '0a9269b20d0266c9', 'apps.setup.navigation.nav_approval_requests.label': 'aafd0f7c6a376f55', diff --git a/packages/platform-objects/src/apps/translations/zh-Hant.ts b/packages/platform-objects/src/apps/translations/zh-Hant.ts index c9bd7f21525..f2eb1cb9e14 100644 --- a/packages/platform-objects/src/apps/translations/zh-Hant.ts +++ b/packages/platform-objects/src/apps/translations/zh-Hant.ts @@ -79,6 +79,7 @@ export const zhHant: TranslationData = { // the same case as the entry above; see `en.ts` (#31123). nav_scim_credentials: { label: 'SCIM 憑證' }, nav_api_keys: { label: 'API 金鑰' }, + nav_access_directory: { label: '職位與權限' }, // 核准中心 = the Approvals Inbox component (#7234) — the surface with // decision actions. The three below are the engine's raw tables; the diff --git a/ui/apps/console/src/components/StudioRoute.tsx b/ui/apps/console/src/components/StudioRoute.tsx index 5f61e5f1a5f..9ab02a8de59 100644 --- a/ui/apps/console/src/components/StudioRoute.tsx +++ b/ui/apps/console/src/components/StudioRoute.tsx @@ -39,13 +39,13 @@ import { Link, Navigate, Outlet, Route, useParams } from 'react-router-dom'; import { Lock } from 'lucide-react'; import { Button, Empty, EmptyTitle } from '@object-ui/components'; import { + ACCESS_DIRECTORY_PATH, LoadingFallback, LoadingScreen, STUDIO_ALL_PACKAGES_SEGMENT, STUDIO_METADATA_AREA, STUDIO_ORG_SCOPE_SEGMENT, StudioEntryPermissionsProvider, - studioMetadataAreaPath, studioOrgScopePath, studioPackagePath, useHomePath, @@ -267,7 +267,7 @@ function StudioPillarAddress({ children }: { children?: ReactNode }) { * * `/studio` Studio's entry: the last package, else the package list * `/studio/~org` the package-less scope lands on its flow list - * `/studio/~all/*` lands on the "All metadata" area across packages + * `/studio/~all/*` lands on Setup's environment directory (objectstack#37565) * `/studio/:packageId` a package lands on its object list * `/studio/:packageId/metadata/*` a package's "All metadata" area, in the builder * `/studio/:packageId/:tab` a retired pillar redirects; any other segment is @@ -286,14 +286,16 @@ function StudioPillarAddress({ children }: { children?: ReactNode }) { * `/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 it, so none reaches the - * builder as a package id. + * `~org`); 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. * * objectstack#36899 — the cross-package leg (`/studio/~all/metadata/*`) is * served by the generic area route: the SAME `StudioDesignSurface`, which * reads `~all` as "no package" and draws the area alone, under the left menu * every Studio page draws. The more specific `:packageId/metadata/*` outranks - * `~all/*` for an area URL; every other `~all` URL still lands on the area. + * `~all/*` for an area URL; the area sends its root and the directory's lists + * to Setup, and keeps the items, which still open in Studio. * * objectstack#36909 — no pillar draws a page any more. Each retired pillar * address (`data`, `automations`, `access`, `interfaces`, and the bare package @@ -308,7 +310,7 @@ export const studioRoutes = ( } /> } + element={} /> } /> const PermissionSetAssignmentPage = lazyPage('permission set assignments', () => import('../views/setup/PermissionSetAssignmentPage.js').then((m) => m.PermissionSetAssignmentPage), ); +const AccessDirectoryPage = lazyPage('positions and permissions', () => + import('../views/setup/AccessDirectoryPage.js').then((m) => m.AccessDirectoryPage), +); const RecycleBinPage = lazyPage('recycle bin', () => import('../views/setup/RecycleBinPage.js').then((m) => m.RecycleBinPage), ); @@ -268,6 +272,19 @@ registerAppComponent({ component: PermissionSetAssignmentPage, }); +/** + * Setup → Access control → Positions and permissions (ADR-0084, amendment of + * 2026-11-26): the environment directory, moved out of Studio's menu. The entry + * naming this ref is `@objectstack/platform-objects`' Setup navigation + * contribution; the shell declares no entry for it. + */ +registerAppComponent({ + ref: ACCESS_DIRECTORY_REF, + label: 'Positions and Permissions', + source: '@object-ui/app-shell', + component: AccessDirectoryPage, +}); + /** * Setup → Configuration → Recycle bin (ADR-0148, objectstack#30239): the * deleted records of each object whose bin the caller manages, to restore one diff --git a/ui/packages/app-shell/src/views/setup/AccessDirectoryPage.tsx b/ui/packages/app-shell/src/views/setup/AccessDirectoryPage.tsx new file mode 100644 index 00000000000..3e959bc7a05 --- /dev/null +++ b/ui/packages/app-shell/src/views/setup/AccessDirectoryPage.tsx @@ -0,0 +1,80 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * Setup → Access control → Positions and permissions: the environment + * directory and each of its types' lists in the environment scope, moved out + * of Studio's menu (ADR-0084, amendment of 2026-11-26; see `accessDirectory.ts` + * for what the page serves and where everything else opens). + * + * It mounts the metadata-admin pages Studio's cross-package leg mounted, under + * the same host shape (`packageId: null`, the leg's), rooted at this page, so + * the reads, the activation switches and every server refusal are theirs. + * + * Gated by {@link ACCESS_DIRECTORY_CAPABILITY} (`hasCapabilities`, which fails + * open on an unreported answer: the metadata reads still refuse a caller the + * server does not admit). Without it the page reads nothing. + */ + +import * as React from 'react'; +import { Navigate, Route, Routes, useLocation } from 'react-router-dom'; +import { Alert, AlertDescription } from '@object-ui/components'; +import { usePermissions } from '@object-ui/permissions'; +import { MetadataAreaHostContext, type MetadataAreaHost } from '../metadata-admin/metadataAreaHost.js'; +import { t, tFormat, useMetadataLocale } from '../metadata-admin/i18n.js'; +import { ACCESS_DIRECTORY_CAPABILITY, ACCESS_DIRECTORY_PATH, accessDirectoryLocation } from './accessDirectory.js'; + +const MetadataDirectoryPage = React.lazy(() => + import('../metadata-admin/index.js').then((m) => ({ default: m.MetadataDirectoryPage })), +); +const MetadataResourceListPage = React.lazy(() => + import('../metadata-admin/index.js').then((m) => ({ default: m.MetadataResourceListPage })), +); + +/** The host the pages read: the cross-package leg's shape, rooted here. */ +const HOST: MetadataAreaHost = { packageId: null, readOnly: false, basePath: ACCESS_DIRECTORY_PATH }; + +function Loading({ locale }: { locale: string }): React.ReactElement { + return ( +
+ {t('engine.studio.loading', locale)} +
+ ); +} + +export function AccessDirectoryPage(): React.ReactElement { + const { pathname, search } = useLocation(); + const locale = useMetadataLocale(); + const { hasCapabilities } = usePermissions(); + const allowed = hasCapabilities([ACCESS_DIRECTORY_CAPABILITY]); + + if (!allowed) { + return ( +
+ + + {tFormat('engine.setup.accessDirectory.notAllowed', locale, { capability: ACCESS_DIRECTORY_CAPABILITY })} + + +
+ ); + } + + const rest = pathname.startsWith(ACCESS_DIRECTORY_PATH) + ? pathname.slice(ACCESS_DIRECTORY_PATH.length).replace(/^\/+/, '') + : ''; + const redirect = accessDirectoryLocation(rest, search); + if (redirect) return ; + + return ( + +
+ }> + + } /> + } /> + + +
+
+ ); +} diff --git a/ui/packages/app-shell/src/views/setup/accessDirectory.ts b/ui/packages/app-shell/src/views/setup/accessDirectory.ts new file mode 100644 index 00000000000..9ad1d57a529 --- /dev/null +++ b/ui/packages/app-shell/src/views/setup/accessDirectory.ts @@ -0,0 +1,122 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * Setup → Access control → Positions and permissions: the environment + * directory, moved out of Studio (ADR-0084, amendment of 2026-11-26 + * "Placements, and what moves to Setup"; question 5 of that amendment, ruled). + * + * The directory lists the environment catalog's types (positions, + * capabilities, permission sets, sharing rules: `ENVIRONMENT_AREA_TYPES`) + * across every package, and each type's list in the environment scope. Setup + * holds what is global; Studio develops one package. An item listed here still + * opens in Studio (ADR-0146 D1), on the editor the environment scope uses + * (`/studio/~all/metadata/TYPE/NAME?scope=environment`): an environment item + * is edited by name, and it may belong to no package. + * + * Pure addresses only, so the routing rules are pinned without a render. + */ + +import { CATALOG_SCOPE_PARAM, ENVIRONMENT_SCOPE } from '../metadata-admin/catalog-scope.js'; +import { ENVIRONMENT_AREA_TYPES } from '../metadata-admin/metadataAreaHost.js'; +import { + STUDIO_ALL_PACKAGES_SEGMENT, + studioMetadataAreaAddress, + studioMetadataAreaRoot, +} from '../studio-design/studioAddress.js'; +import { ACCESS_DIRECTORY_PATH } from './accessDirectoryRef.js'; + +export { ACCESS_DIRECTORY_CAPABILITY, ACCESS_DIRECTORY_PATH, ACCESS_DIRECTORY_REF } from './accessDirectoryRef.js'; + +function withQuery(path: string, params: URLSearchParams): string { + const query = params.toString(); + return query ? `${path}?${query}` : path; +} + +/** Whether a type is one the directory lists. */ +export function isAccessDirectoryType(type: string): boolean { + return ENVIRONMENT_AREA_TYPES.includes(type); +} + +/** + * The directory, or one type's list in the environment scope. `type` is the + * type's name, not encoded. + */ +export function accessDirectoryPath(type?: string): string { + if (!type) return ACCESS_DIRECTORY_PATH; + return `${ACCESS_DIRECTORY_PATH}/${encodeURIComponent(type)}?${CATALOG_SCOPE_PARAM}=${ENVIRONMENT_SCOPE}`; +} + +function decodedSegments(rest: string): string[] | null { + try { + return rest.split('/').filter(Boolean).map((s) => decodeURIComponent(s)); + } catch { + return null; + } +} + +/** + * Where an address of Studio's cross-package leg (`/studio/~all/metadata/…`) + * belongs now, or `null` when it stays in Studio. Read after the leg's own + * redirect has settled it on the leg (`areaLocationRedirect`). + * + * - the leg's root is the directory: the Setup page, the query kept; + * - a list of one of the directory's types in the environment scope is that + * type's list on the Setup page, the query kept; + * - anything else (an item, a create, a history, the cross-package list of a + * type outside the environment scope) stays: those open in Studio. + * + * `rest` is the path below the leg's root as the URL spells it (encoded), `''` + * at the root; `search` is the URL's query, with or without its `?`. + */ +export function studioAllLegSetupRedirect(rest: string, search: string): string | null { + const params = new URLSearchParams(search); + const segments = decodedSegments(rest); + if (!segments) return null; + if (segments.length === 0) return withQuery(ACCESS_DIRECTORY_PATH, params); + if (segments.length !== 1 || !isAccessDirectoryType(segments[0])) return null; + if (params.get(CATALOG_SCOPE_PARAM) !== ENVIRONMENT_SCOPE) return null; + return withQuery(`${ACCESS_DIRECTORY_PATH}/${encodeURIComponent(segments[0])}`, params); +} + +/** + * {@link studioAllLegSetupRedirect} for a whole Studio address (path, query, + * fragment), for a caller that has built one: the address itself when it is + * not on the cross-package leg or stays in Studio, else the Setup page's. + */ +export function studioAddressAfterSetupMove(address: string): string { + const root = studioMetadataAreaRoot(STUDIO_ALL_PACKAGES_SEGMENT); + const hashAt = address.indexOf('#'); + const hash = hashAt === -1 ? '' : address.slice(hashAt); + const beforeHash = hashAt === -1 ? address : address.slice(0, hashAt); + const queryAt = beforeHash.indexOf('?'); + const path = queryAt === -1 ? beforeHash : beforeHash.slice(0, queryAt); + const search = queryAt === -1 ? '' : beforeHash.slice(queryAt); + if (path !== root && !path.startsWith(`${root}/`)) return address; + const moved = studioAllLegSetupRedirect(path.slice(root.length).replace(/^\/+/, ''), search); + return moved ? `${moved}${hash}` : address; +} + +/** + * Where an address below the Setup page belongs, or `null` when the page + * serves it: the directory, and a directory type's list in the environment + * scope. + * + * - a directory type's list without the environment scope gets it (and loses + * `?package=`, which the environment scope never binds); + * - a list of another type is the cross-package list, which stays in Studio; + * - an item, a create or a history opens in Studio, on the same path below + * the cross-package leg, the query kept (ADR-0146 D1). + */ +export function accessDirectoryLocation(rest: string, search: string): string | null { + const params = new URLSearchParams(search); + const segments = decodedSegments(rest); + if (!segments) return ACCESS_DIRECTORY_PATH; + if (segments.length === 0) return null; + const studio = () => + studioMetadataAreaAddress(STUDIO_ALL_PACKAGES_SEGMENT, rest.replace(/^\/+|\/+$/g, ''), { query: params }); + if (segments.length > 1 || !isAccessDirectoryType(segments[0])) return studio(); + if (params.get(CATALOG_SCOPE_PARAM) === ENVIRONMENT_SCOPE) return null; + params.delete('package'); + params.set(CATALOG_SCOPE_PARAM, ENVIRONMENT_SCOPE); + return withQuery(`${ACCESS_DIRECTORY_PATH}/${encodeURIComponent(segments[0])}`, params); +} diff --git a/ui/packages/app-shell/src/views/setup/accessDirectoryRef.ts b/ui/packages/app-shell/src/views/setup/accessDirectoryRef.ts new file mode 100644 index 00000000000..7ada672267f --- /dev/null +++ b/ui/packages/app-shell/src/views/setup/accessDirectoryRef.ts @@ -0,0 +1,27 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * Setup → Access control → Positions and permissions: the page's ref, path and + * gate, kept apart from `accessDirectory.ts` so the eager registry + * (`builtinComponents`) imports constants, never the routing model's imports. + * + * The entry that opens the page is a Setup navigation contribution + * (`@objectstack/platform-objects`, `group_access_control`); this ref is what + * that entry names, and its `requiredPermissions` is + * {@link ACCESS_DIRECTORY_CAPABILITY}. + */ + +import { componentRefToUrlSegments } from '../../services/componentRegistry.js'; + +/** The component ref of the Setup page. */ +export const ACCESS_DIRECTORY_REF = 'security:access-directory'; + +/** + * The capability the page and its Setup entry ask on top of Setup's own entry: + * Studio's entry capability, the one that admitted a principal to the + * directory while it was in Studio. Moving the page must not widen who sees it. + */ +export const ACCESS_DIRECTORY_CAPABILITY = 'studio.access'; + +/** The page's root inside the Setup app. */ +export const ACCESS_DIRECTORY_PATH = `/apps/setup/component/${componentRefToUrlSegments(ACCESS_DIRECTORY_REF).join('/')}`; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioEntryRedirect.tsx b/ui/packages/app-shell/src/views/studio-design/StudioEntryRedirect.tsx index 409ab0f6b5e..2fdfaeff8f2 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioEntryRedirect.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioEntryRedirect.tsx @@ -13,9 +13,8 @@ * recent items the Studio route records (`StudioRoute`), still named by * the package list — opens in Studio; * 2. otherwise the package list: Setup → Packages for a principal who may - * open it, and Studio's "All metadata" area across packages - * (`/studio/~all/metadata`) for one who may enter Studio and not that - * Setup page (`studioEntryFallbackPath`). + * open it, and Studio's package-less scope (`/studio/~org`) for one who + * may enter Studio and not that Setup page (`studioEntryFallbackPath`). * * The retired `/studio?new=package` bookmark is forwarded to Setup's New * Package (`studioNewPackage.ts`) for a principal who may open Setup → diff --git a/ui/packages/app-shell/src/views/studio-design/StudioMenu.tsx b/ui/packages/app-shell/src/views/studio-design/StudioMenu.tsx index e16b7cc4e34..8706ac63521 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioMenu.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioMenu.tsx @@ -65,7 +65,6 @@ import { Gauge, Globe, Inbox, - KeyRound, Languages, LayoutGrid, ListChecks, @@ -185,7 +184,6 @@ const STUDIO_MENU_KIND_ICONS: Readonly; + // objectstack#37565 — the cross-package leg's directory is Setup's page now + // (ADR-0084, amended 2026-11-26): its addresses land there, once. + const moved = segment === STUDIO_ALL_PACKAGES_SEGMENT ? studioAllLegSetupRedirect(rest, search) : null; + if (moved) return ; // A page must not offer a write before the package's state is known. if (packageId !== null && writable === undefined) return ; diff --git a/ui/packages/app-shell/src/views/studio-design/setupMetadataRedirect.ts b/ui/packages/app-shell/src/views/studio-design/setupMetadataRedirect.ts index 185cb36799f..34d3fab4b39 100644 --- a/ui/packages/app-shell/src/views/studio-design/setupMetadataRedirect.ts +++ b/ui/packages/app-shell/src/views/studio-design/setupMetadataRedirect.ts @@ -6,10 +6,12 @@ * * Every `/apps//metadata/...` URL, and every legacy alias that chained * into one, opens Studio's "All metadata" area (`metadataArea.ts`) on the same - * page: the area mounts the metadata-admin pages under the same route shapes, - * so the path below `metadata` carries over as it is. The query carries over - * too, because `?package=`, `?scope=environment` and `?review=1` keep their - * Setup meaning there. The URL is put on the leg its query names here, with + * page, except the environment directory and its lists, which are Setup's own + * page again (`views/setup/accessDirectory.ts`, objectstack#37565). The area + * mounts the metadata-admin pages under the same route shapes, so the path + * below `metadata` carries over as it is. The query carries over too, because + * `?package=`, `?scope=environment` and `?review=1` keep their Setup meaning + * there. The URL is put on the leg its query names here, with * {@link areaLocationRedirect}, so an old link lands in one hop. * * ⛔ Not the datasource. D1 places it in Setup (runtime configuration, not @@ -20,6 +22,7 @@ import { STUDIO_ALL_PACKAGES_SEGMENT, areaLocationRedirect } from './metadataArea.js'; import { studioHomePath, studioMetadataAreaAddress, studioPillarPath } from './studioAddress.js'; import { SETUP_PACKAGES_PATH } from '../metadata-admin/packageSource.js'; +import { studioAddressAfterSetupMove } from '../setup/accessDirectory.js'; /** The one metadata type whose Setup pages stay in Setup (ADR-0146 D1). */ export const SETUP_KEPT_METADATA_TYPE = 'datasource'; @@ -38,8 +41,11 @@ export function setupMetadataStudioPath(rest: string, search: string, hash = '') if (segments[0] === SETUP_KEPT_METADATA_TYPE) return null; const tail = segments.join('/'); const onLeg = areaLocationRedirect(STUDIO_ALL_PACKAGES_SEGMENT, tail, search); - if (onLeg) return `${onLeg}${hash}`; - return studioMetadataAreaAddress(STUDIO_ALL_PACKAGES_SEGMENT, tail, { query: new URLSearchParams(search), hash }); + const studio = onLeg + ? `${onLeg}${hash}` + : studioMetadataAreaAddress(STUDIO_ALL_PACKAGES_SEGMENT, tail, { query: new URLSearchParams(search), hash }); + // objectstack#37565 — the leg's directory is Setup's page: land there in one hop. + return studioAddressAfterSetupMove(studio); } /** 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 8cb36f40938..f571b956f3e 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioEntryPermissions.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioEntryPermissions.ts @@ -7,8 +7,12 @@ * 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 "All metadata" area across packages for one who may - * enter Studio and not that Setup page (`studioEntryFallbackPath`). The host + * 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 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. @@ -16,7 +20,7 @@ import * as React from 'react'; import { SETUP_NEW_PACKAGE_PATH, SETUP_PACKAGES_PATH } from '../metadata-admin/packageSource.js'; -import { STUDIO_ALL_PACKAGES_SEGMENT, studioMetadataAreaPath } from './metadataArea.js'; +import { studioOrgScopePath } from './studioScope.js'; const StudioEntryPermissionsContext = React.createContext(undefined); @@ -43,14 +47,14 @@ 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 "All metadata" - * area across packages, which every principal who may enter Studio may open. + * 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. */ export function studioEntryFallbackPath(systemPermissions: readonly string[] | undefined): string { return holdsSetupPackages(systemPermissions) ? SETUP_PACKAGES_PATH - : studioMetadataAreaPath(STUDIO_ALL_PACKAGES_SEGMENT); + : studioOrgScopePath(); } /** @@ -73,5 +77,5 @@ export function studioNewPackageEntryPath(systemPermissions: readonly string[] | * non-holder (objectstack#36908). */ export function newPackageDoorPath(holdsSetupPackagesPair: boolean): string { - return holdsSetupPackagesPair ? SETUP_NEW_PACKAGE_PATH : studioMetadataAreaPath(STUDIO_ALL_PACKAGES_SEGMENT); + return holdsSetupPackagesPair ? SETUP_NEW_PACKAGE_PATH : studioOrgScopePath(); } 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 7a7a74500ac..1422db96533 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioMenuData.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioMenuData.ts @@ -39,7 +39,6 @@ export const STUDIO_MENU_ENTRY_LABEL_KEYS: Readonly/owd`, objectstack#36905); - * - diagnostics, under Platform; - * - the cross-package environment catalog (`~all`), under Access. + * - diagnostics, under Platform. + * The fourth, the cross-package environment directory, left the menu for + * Setup → Access control (ADR-0084, amended 2026-11-26, question 5; + * objectstack#37565): `views/setup/accessDirectory.ts`. * * And on a package one entry under no group, 全部类型 All types * ({@link studioMenuAllTypesEntry}; ADR-0084, amended 2026-11-25, @@ -47,7 +49,7 @@ * Inside a group the type entries follow the placement table * (`STUDIO_MENU_PLACEMENT`, `studioMenuPlacement.ts`), and each entry carries * its row's tier. A type with no row is 高级 Advanced and is drawn after the - * placed types of its group, in served order. The four entries that are not a + * placed types of its group, in served order. The entries that are not a * type are 高级 and follow the types of their group, in the order above. * * A 常用 entry the diagnostics sweep has answered for, holding no item, is @@ -61,14 +63,14 @@ * 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. + * 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. */ -import { ENVIRONMENT_SCOPE_QUERY } from '../metadata-admin/catalog-scope.js'; import { SETUP_DATASOURCES_PATH } from '../metadata-admin/metadataAreaHost.js'; +import { accessDirectoryPath } from '../setup/accessDirectory.js'; import { isStudioAllPackagesScope } from './metadataArea.js'; import { - STUDIO_ALL_PACKAGES_SEGMENT, STUDIO_OWD_SECTION, studioMetadataAreaAddress, studioMetadataAreaRoot, @@ -117,7 +119,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' | 'environment' | 'allTypes'; +export type StudioMenuEntryKind = 'type' | 'orgFlows' | 'owd' | 'diagnostics' | 'allTypes'; export interface StudioMenuEntry { /** Unique within the menu: `type:` for a type, the kind otherwise. */ @@ -152,9 +154,8 @@ export function studioMenuScope(segment: string): StudioMenuScope { } function typeEntryPath(scope: StudioMenuScope, type: string): string { - if (scope.kind !== 'package') { - return studioMetadataAreaAddress(STUDIO_ALL_PACKAGES_SEGMENT, encodeURIComponent(type), { query: ENVIRONMENT_SCOPE_QUERY }); - } + // objectstack#37565 — the environment catalog's lists are Setup's now. + if (scope.kind !== 'package') return accessDirectoryPath(type); // ADR-0146 D1 — a datasource is Setup's runtime configuration, as its directory tile says. if (type === 'datasource') return SETUP_DATASOURCES_PATH; return studioMetadataAreaAddress(scope.packageId, encodeURIComponent(type), { @@ -209,12 +210,6 @@ export function buildStudioMenu(input: { tier: 'advanced', }); } - groups.get('security')!.push({ - key: 'environment', - kind: 'environment', - to: studioMetadataAreaRoot(STUDIO_ALL_PACKAGES_SEGMENT), - tier: 'advanced', - }); return STUDIO_MENU_GROUPS.map((group) => ({ group, entries: groups.get(group)! })).filter((g) => g.entries.length > 0); } @@ -247,8 +242,9 @@ export function studioMenuTiers(menu: readonly StudioMenuGroupModel[]): Record = { 'engine.studio.menu.owd': 'Default sharing', 'engine.studio.menu.diagnostics': 'Diagnostics', 'engine.studio.menu.environment': 'Positions and permissions', + 'engine.setup.accessDirectory.notAllowed': 'Opening this page needs the {capability} capability, the one Studio asks.', // objectstack#37201 — the 「高级」 fold (ADR-0084, amended 2026-11-25), and a 常用 type with no item yet. 'engine.studio.menu.advanced': 'Advanced', 'engine.studio.menu.emptyType': 'None yet: open the list to make the first', diff --git a/ui/packages/i18n/src/namespaces/studio/zh.ts b/ui/packages/i18n/src/namespaces/studio/zh.ts index acd16589a57..a0300baa413 100644 --- a/ui/packages/i18n/src/namespaces/studio/zh.ts +++ b/ui/packages/i18n/src/namespaces/studio/zh.ts @@ -3139,6 +3139,7 @@ const STUDIO_ZH: Record = { 'engine.studio.menu.owd': '默认共享', 'engine.studio.menu.diagnostics': '诊断', 'engine.studio.menu.environment': '岗位与权限', + 'engine.setup.accessDirectory.notAllowed': '打开此页需要 {capability} 权限,即进入 Studio 所需的权限。', // objectstack#37201 — the 「高级」 fold (ADR-0084, amended 2026-11-25), and a 常用 type with no item yet. 'engine.studio.menu.advanced': '高级', 'engine.studio.menu.emptyType': '还没有:打开列表新建第一项', From 5d3846ee2e7c6e944e869a260f9ad9c27eeb2c4e Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 14:09:18 +0000 Subject: [PATCH 2/7] test(setup): re-point the ~all directory tests to the Setup access page Adds a render test for the Setup page and the pure routing tests. Claude-Session: https://claude.ai/code/session_01Utp6CZhAqkgRyMYuZeZt9S Co-authored-by: Claude --- .changeset/37565-access-directory-in-setup.md | 20 +++ .../AppContent.legacyRedirects.test.tsx | 23 +++- .../AppContent.systemHubRoutes.test.tsx | 37 ++--- .../StudioRoute.metadataArea-28561.test.tsx | 17 ++- ...declared-sharing-rules-reach-13091.spec.ts | 7 +- ...Content.setupMetadataStudio-28578.test.tsx | 30 +++- .../HomePage.noAgentsBuildChip-26614.test.tsx | 7 +- .../views/setup/AccessDirectoryPage.test.tsx | 121 ++++++++++++++++ .../src/views/setup/accessDirectory.test.ts | 130 ++++++++++++++++++ ...oDesignSurface.metadataArea-28561.test.tsx | 7 +- .../StudioEntryRedirect.test.tsx | 33 +++-- .../views/studio-design/StudioMenu.test.tsx | 11 +- .../StudioMetadataArea.routes-28561.test.tsx | 21 ++- .../studio-design/StudioMetadataArea.tsx | 9 +- .../StudioPackageMenu-37139.test.tsx | 3 +- ...oPaletteGroups.surfaceScope-36900.test.tsx | 5 +- .../setupMetadataRedirect.test.ts | 28 +++- .../studio-design/studioMenuModel.test.ts | 29 ++-- 18 files changed, 450 insertions(+), 88 deletions(-) create mode 100644 .changeset/37565-access-directory-in-setup.md create mode 100644 ui/packages/app-shell/src/views/setup/AccessDirectoryPage.test.tsx create mode 100644 ui/packages/app-shell/src/views/setup/accessDirectory.test.ts diff --git a/.changeset/37565-access-directory-in-setup.md b/.changeset/37565-access-directory-in-setup.md new file mode 100644 index 00000000000..f9377d1708d --- /dev/null +++ b/.changeset/37565-access-directory-in-setup.md @@ -0,0 +1,20 @@ +--- +'@objectstack/platform-objects': patch +'@object-ui/app-shell': patch +'@object-ui/i18n': patch +'@object-ui/console': patch +--- + +feat(setup): the environment directory (positions, capabilities, permission sets, sharing rules) moves from Studio's menu to Setup → Access control + +Clause-②: no +Metadata-protocol: none + +Studio develops one package, and Setup holds what is global (ADR-0084, amended 2026-11-26). The cross-package directory of the environment's access metadata (positions, capabilities, permission sets and sharing rules) is now a Setup page: **Setup → Access control → Positions and Permissions** (`/apps/setup/component/security/access-directory`). + +- The page shows the same directory and the same per-type lists as before, with the activation switches, Clone and New. Opening an item, creating one, or opening its history still happens in Studio, on the same editor as before. +- Studio's left menu no longer has the "Positions and permissions" entry under Access. On the organization-flows scope (`~org`), the menu's access rows open their lists on the Setup page. +- Old links keep working and land in one hop: `/studio/~all/metadata`, a directory type's list (`/studio/~all/metadata/permission?scope=environment`), a bare `/studio/~all/…` address, and the old Setup metadata URLs that led there. Item links under `/studio/~all/metadata/TYPE/NAME` are unchanged. +- Visibility does not widen. The Setup entry and the page both require `studio.access`, the capability that admitted a user to the directory in Studio, in addition to Setup's own `setup.access`. +- A user who can enter Studio but cannot open Setup → Packages, and has no recent package, now lands on Studio's organization-flows scope (`/studio/~org`) instead of the old directory. This is temporary: the scope retires when the door that moves loose items into a package ships, and the landing is decided again then. +- One new Setup menu label, "Positions and Permissions", in every Setup locale, and one new message for a user without `studio.access`. diff --git a/ui/apps/console/src/__tests__/AppContent.legacyRedirects.test.tsx b/ui/apps/console/src/__tests__/AppContent.legacyRedirects.test.tsx index 24b1fec4efc..8f4411428d4 100644 --- a/ui/apps/console/src/__tests__/AppContent.legacyRedirects.test.tsx +++ b/ui/apps/console/src/__tests__/AppContent.legacyRedirects.test.tsx @@ -97,6 +97,8 @@ function renderAt(url: string): string[] { } /> } /> } /> + {/* objectstack#37565 — Setup → Access control's environment directory. */} + } /> {/* The Studio app the host mounts beside `/apps/*` (objectstack ADR-0146 D1). */} } /> @@ -128,7 +130,6 @@ describe('console host legacy redirects → Studio\'s All metadata area, in ONE it.each([ ['/apps/x/system/metadata/object', '/studio/~all/metadata/object'], ['/apps/x/system/metadata/object/account', '/studio/~all/metadata/object/account'], - ['/apps/x/system/metadata', '/studio/~all/metadata'], ['/apps/x/system/objects/account', '/studio/~all/metadata/object/account'], ['/apps/x/system/objects', '/studio/~all/metadata/object'], ['/apps/my-app/system/metadata/permission/admin', '/studio/~all/metadata/permission/admin'], @@ -138,7 +139,7 @@ describe('console host legacy redirects → Studio\'s All metadata area, in ONE it.each([ ['/apps/x/system/metadata/object?package=crm', '/studio/crm/metadata/object?package=crm'], - ['/apps/x/system/metadata/position?scope=environment', '/studio/~all/metadata/position?scope=environment'], + ['/apps/x/system/metadata/position/manager?scope=environment', '/studio/~all/metadata/position/manager?scope=environment'], ['/apps/x/system/metadata/object/account?review=1', '/studio/~all/metadata/object/account?review=1'], ['/apps/x/system/objects/account?package=crm#fields', '/studio/crm/metadata/object/account?package=crm#fields'], ['/apps/x/system/metadata/object?keep=me#frag', '/studio/~all/metadata/object?keep=me#frag'], @@ -150,12 +151,20 @@ describe('console host legacy redirects → Studio\'s All metadata area, in ONE expectStudioInOneHop(renderAt(from), from, to); }); + // objectstack#37565 — the environment directory and its lists left Studio's cross-package leg for + // Setup → Access control (ADR-0084, amended 2026-11-26): these landed on the leg before, in one hop. it.each([ - ['/apps/x/system/positions', '/studio/~all/metadata/position?scope=environment'], - ['/apps/x/system/roles', '/studio/~all/metadata/position?scope=environment'], - ['/apps/x/system/permissions', '/studio/~all/metadata/permission?scope=environment'], - ])('the retired catalog page %s opens the catalog in Studio', (from, to) => { - expectStudioInOneHop(renderAt(from), from, to); + ['/apps/x/system/metadata', '/apps/setup/component/security/access-directory'], + ['/apps/x/system/metadata/position?scope=environment', '/apps/setup/component/security/access-directory/position?scope=environment'], + ['/apps/x/system/positions', '/apps/setup/component/security/access-directory/position?scope=environment'], + ['/apps/x/system/roles', '/apps/setup/component/security/access-directory/position?scope=environment'], + ['/apps/x/system/permissions', '/apps/setup/component/security/access-directory/permission?scope=environment'], + ])('the environment directory %s opens on Setup\'s page, in one hop', (from, to) => { + const chain = renderAt(from); + expect(chain).toEqual([from, to]); + expect(screen.getByTestId('setup-directory')).toBeInTheDocument(); + expect(screen.queryByTestId('studio')).not.toBeInTheDocument(); + expectNoAliasAnywhere(chain); }); it('a datasource stays in Setup: the canonical route, the app prefix preserved', () => { diff --git a/ui/apps/console/src/__tests__/AppContent.systemHubRoutes.test.tsx b/ui/apps/console/src/__tests__/AppContent.systemHubRoutes.test.tsx index 600e40dbc98..7e01bdb510f 100644 --- a/ui/apps/console/src/__tests__/AppContent.systemHubRoutes.test.tsx +++ b/ui/apps/console/src/__tests__/AppContent.systemHubRoutes.test.tsx @@ -345,7 +345,10 @@ describe('system-hub entries reach the framework system objects (objectui#3655)' }); }); -describe('the catalog entries reach the catalog, in Studio (objectui#7611, ADR-0146 D1)', () => { +/** objectstack#37565 — Setup → Access control → Positions and Permissions. */ +const SETUP_DIRECTORY = '/apps/setup/component/security/access-directory'; + +describe('the catalog entries reach the catalog, on Setup\'s directory page (objectui#7611, objectstack#37565)', () => { /** * `roles`, `positions` and `permissions` name the security CATALOG, which * ADR-0131 D3 moves into the environment registry, so they land on the @@ -354,24 +357,26 @@ describe('the catalog entries reach the catalog, in Studio (objectui#7611, ADR-0 * `sys_role` -> `sys_position`), and `permissions` still means the * permission-set surface (objectui#3655 decision A). * - * Setup carries no metadata catalog since objectstack ADR-0146 D1 (N-28): - * the list is Studio's "All metadata" area's, on its cross-package leg, and - * the URL goes there directly rather than through Setup's own redirect. + * The environment directory left Studio's cross-package leg for Setup → + * Access control (ADR-0084, amended 2026-11-26; objectstack#37565): the list + * is that page's, and the URL goes there directly. It landed on the leg, in + * one hop, before. */ it.each([ - ['/apps/setup/system/roles', '/studio/~all/metadata/position?scope=environment'], - ['/apps/setup/system/positions', '/studio/~all/metadata/position?scope=environment'], - ['/apps/setup/system/permissions', '/studio/~all/metadata/permission?scope=environment'], + ['/apps/setup/system/roles', `${SETUP_DIRECTORY}/position?scope=environment`], + ['/apps/setup/system/positions', `${SETUP_DIRECTORY}/position?scope=environment`], + ['/apps/setup/system/permissions', `${SETUP_DIRECTORY}/permission?scope=environment`], // Outside every app, so the app prefix is not part of the target. - ['/apps/my-app/system/permissions', '/studio/~all/metadata/permission?scope=environment'], + ['/apps/my-app/system/permissions', `${SETUP_DIRECTORY}/permission?scope=environment`], ])('%s reaches %s in ONE hop', async (url, target) => { renderConsoleAt(url); - expect(await screen.findByTestId('studio-probe')).toBeInTheDocument(); - expect(chain).toEqual([url, target]); - // Never the row page the URL used to land on, nor Setup's catalog list. + await waitFor(() => expect(chain[1]).toBe(target)); + expect(chain[0]).toBe(url); + expect(chain.some((entry) => entry.startsWith('/studio'))).toBe(false); + // Never the row page the URL used to land on: the type's environment list, on Setup's page. expect(screen.queryByTestId('object-view')).not.toBeInTheDocument(); - expect(screen.queryByTestId('metadata-resource-list-page')).not.toBeInTheDocument(); + expect(await screen.findByTestId('metadata-resource-list-page')).toHaveTextContent(new URL(target, 'http://x').pathname.split('/').pop()!); }); /** @@ -380,14 +385,14 @@ describe('the catalog entries reach the catalog, in Studio (objectui#7611, ADR-0 * to land on, which end at the "No Apps Configured" guard there. */ it.each([ - ['/apps/setup/system/positions', '/studio/~all/metadata/position?scope=environment'], - ['/apps/setup/system/permissions', '/studio/~all/metadata/permission?scope=environment'], + ['/apps/setup/system/positions', `${SETUP_DIRECTORY}/position?scope=environment`], + ['/apps/setup/system/permissions', `${SETUP_DIRECTORY}/permission?scope=environment`], ])('with no apps, %s still reaches the catalog', async (url, target) => { metadataApps = []; renderConsoleAt(url); - expect(await screen.findByTestId('studio-probe')).toBeInTheDocument(); - expect(chain).toEqual([url, target]); + await waitFor(() => expect(chain[1]).toBe(target)); + expect(chain[0]).toBe(url); }); }); 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 a35d5abad73..2e9977bef2f 100644 --- a/ui/apps/console/src/components/StudioRoute.metadataArea-28561.test.tsx +++ b/ui/apps/console/src/components/StudioRoute.metadataArea-28561.test.tsx @@ -12,7 +12,9 @@ * - The cross-package leg (`/studio/~all/metadata/*`) is the same builder * route with `~all` as its segment (objectstack#36899): the surface draws * the area alone, with no package, beside the left menu every Studio page - * has. Every other `~all` URL lands on it, so none reaches a pillar. + * has. Every other `~all` URL lands on Setup's environment directory, the + * leg's root's page since it left Studio (objectstack#37565), so none + * reaches a pillar. * - The entry gate decides first, as for every Studio URL, the left menu's * targets included. * @@ -114,6 +116,7 @@ function renderStudio(url: string) { {studioRoutes} home} /> + } /> , ); @@ -166,14 +169,16 @@ describe('/studio — the "All metadata" area\'s routes (objectstack#28561)', () expect(location()).toBe('/studio/~all/metadata/permission?scope=environment'); }); + // objectstack#37565 — rewritten on purpose: these landed on the leg's root, which is Setup's + // environment directory now (ADR-0084, amended 2026-11-26). Still never a pillar. it.each(['/studio/~all', '/studio/~all/data', '/studio/~all/flow/f1'])( - '%s lands on the cross-package area, never on a pillar', + '%s lands on Setup\'s environment directory, in one hop, never on a pillar', async (url) => { renderStudio(url); - const surface = await screen.findByTestId('studio-pillar-builder'); - expect(location()).toBe('/studio/~all/metadata'); - expect(surface).toHaveAttribute('data-area', 'metadata'); - expect(surface).toHaveAttribute('data-package', '~all'); + expect(await screen.findByTestId('setup-directory')).toBeInTheDocument(); + expect(location()).toBe('/apps/setup/component/security/access-directory'); + expect(screen.queryByTestId('studio-pillar-builder')).toBeNull(); + expect(seen).toEqual([url, '/apps/setup/component/security/access-directory']); }, ); diff --git a/ui/e2e/live/declared-sharing-rules-reach-13091.spec.ts b/ui/e2e/live/declared-sharing-rules-reach-13091.spec.ts index b2bcfe76aff..6d56a886082 100644 --- a/ui/e2e/live/declared-sharing-rules-reach-13091.spec.ts +++ b/ui/e2e/live/declared-sharing-rules-reach-13091.spec.ts @@ -16,9 +16,10 @@ import { test, expect, type Locator } from '@playwright/test'; * The unit pins for the same page are in * `ResourceListPage.declaredSharingRules-12982.test.tsx`. */ -// Studio's "All metadata" area, cross-package leg: the catalog's home since -// Setup carries none (objectstack ADR-0146 D1). -const LIST = '/studio/~all/metadata/sharing_rule?scope=environment'; +// Setup → Access control → Positions and permissions, the environment +// directory's home since it left Studio's cross-package leg (ADR-0084, amended +// 2026-11-26; objectstack#37565). +const LIST = '/apps/setup/component/security/access-directory/sharing_rule?scope=environment'; async function boxOf(locator: Locator) { const box = await locator.boundingBox(); diff --git a/ui/packages/app-shell/src/console/__tests__/AppContent.setupMetadataStudio-28578.test.tsx b/ui/packages/app-shell/src/console/__tests__/AppContent.setupMetadataStudio-28578.test.tsx index 5079ab94d0c..80b6b414eb1 100644 --- a/ui/packages/app-shell/src/console/__tests__/AppContent.setupMetadataStudio-28578.test.tsx +++ b/ui/packages/app-shell/src/console/__tests__/AppContent.setupMetadataStudio-28578.test.tsx @@ -153,7 +153,6 @@ beforeEach(() => { /** [Setup URL, the Studio URL it lands on in one hop] */ const TO_STUDIO: Array<[string, string]> = [ // canonical routes - ['/metadata', '/studio/~all/metadata'], ['/metadata/_diagnostics', '/studio/~all/metadata/_diagnostics'], ['/metadata/object', '/studio/~all/metadata/object'], ['/metadata/object/new', '/studio/~all/metadata/object/new'], @@ -162,17 +161,28 @@ const TO_STUDIO: Array<[string, string]> = [ // the query is carried, and names the leg ['/metadata/object/account?package=crm', '/studio/crm/metadata/object/account?package=crm'], ['/metadata/object?package=all', '/studio/~all/metadata/object?package=all'], - ['/metadata/position?scope=environment', '/studio/~all/metadata/position?scope=environment'], - ['/metadata/sharing_rule?scope=environment&package=crm', '/studio/~all/metadata/sharing_rule?scope=environment'], + ['/metadata/position/manager?scope=environment', '/studio/~all/metadata/position/manager?scope=environment'], ['/metadata/object/account?review=1', '/studio/~all/metadata/object/account?review=1'], ['/metadata/object/account?package=crm&review=1', '/studio/crm/metadata/object/account?package=crm&review=1'], ['/metadata/object/account#fields', '/studio/~all/metadata/object/account#fields'], // the pre-refactor aliases, straight to Studio (not via the canonical route) - ['/component/metadata/directory', '/studio/~all/metadata'], ['/component/metadata/resource?type=object', '/studio/~all/metadata/object'], ['/component/metadata/resource/account?type=object', '/studio/~all/metadata/object/account'], ['/component/metadata/resource/account?type=object&package=crm', '/studio/crm/metadata/object/account?package=crm'], - ['/component/metadata/resource?type=position&scope=environment', '/studio/~all/metadata/position?scope=environment'], +]; + +/** + * objectstack#37565 — [Setup URL, where it lands in one hop]: the environment + * directory and its lists, which left Studio's cross-package leg for Setup → + * Access control (ADR-0084, amended 2026-11-26). Before, each landed on the leg. + */ +const SETUP_DIRECTORY = '/apps/setup/component/security/access-directory'; +const TO_SETUP_DIRECTORY: Array<[string, string]> = [ + ['/metadata', SETUP_DIRECTORY], + ['/metadata/position?scope=environment', `${SETUP_DIRECTORY}/position?scope=environment`], + ['/metadata/sharing_rule?scope=environment&package=crm', `${SETUP_DIRECTORY}/sharing_rule?scope=environment`], + ['/component/metadata/directory', SETUP_DIRECTORY], + ['/component/metadata/resource?type=position&scope=environment', `${SETUP_DIRECTORY}/position?scope=environment`], ]; /** [Setup URL, the page it keeps rendering, where it settles] */ @@ -202,6 +212,16 @@ describe.each([ expect(screen.queryByTestId('metadata-resource-edit-page')).not.toBeInTheDocument(); }); + it.each(TO_SETUP_DIRECTORY)(`${base}%s → %s, in one hop`, async (from, to) => { + metadataApps = [...apps]; + const chain = renderAt(`${base}${from}`); + + await waitFor(() => expect(chain[1]).toBe(to)); + expect(chain[0]).toBe(`${base}${from}`); + expect(chain.some((entry) => entry.startsWith('/studio'))).toBe(false); + expect(screen.queryByTestId('studio-probe')).not.toBeInTheDocument(); + }); + it.each(STAYS)(`${base}%s stays in Setup on %s`, async (from, testid, settles) => { metadataApps = [...apps]; const chain = renderAt(`${base}${from}`); 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 6ded735d007..01b82477f44 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,12 +249,13 @@ describe('with no agent in the catalog (objectstack#26614)', () => { expect(SETUP_NEW_PACKAGE_PATH).toBe('/apps/setup/component/developer/packages?face=admin&new=package'); }); - it('an author who may enter Studio but not Setup → Packages is sent to the "All metadata" area, never Setup (objectstack#36908)', async () => { + // 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 () => { state.setupPair = false; const user = userEvent.setup(); render(); await user.click(await screen.findByTestId('home-build-in-studio')); - expect(navigateMock).toHaveBeenCalledWith('/studio/~all/metadata'); + expect(navigateMock).toHaveBeenCalledWith('/studio/~org/metadata/flow?source=runtime'); expect(navigateMock).not.toHaveBeenCalledWith(SETUP_NEW_PACKAGE_PATH); }); @@ -268,7 +269,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 "All metadata" area', ['manage_metadata'], '/studio/~all/metadata'], + ['control: a reported set without the pair goes to the package-less scope', ['manage_metadata'], '/studio/~org/metadata/flow?source=runtime'], ])('%s', async (_case, systemPermissions, to) => { state.setupPair = 'unreported'; const answer: MePermissionsAuthenticatedResponse = { diff --git a/ui/packages/app-shell/src/views/setup/AccessDirectoryPage.test.tsx b/ui/packages/app-shell/src/views/setup/AccessDirectoryPage.test.tsx new file mode 100644 index 00000000000..c2cae4f90db --- /dev/null +++ b/ui/packages/app-shell/src/views/setup/AccessDirectoryPage.test.tsx @@ -0,0 +1,121 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * objectstack#37565 — Setup → Access control → Positions and permissions, the + * environment directory moved out of Studio (ADR-0084, amended 2026-11-26): + * + * 1. Behind Studio's entry capability (`studio.access`): without it the page + * reads nothing and says what it needs. CONTROL: with it, the directory. + * 2. The page mounts the metadata-admin directory and a type's list under the + * cross-package leg's host shape (no package, writable), rooted at the page. + * 3. A list outside the environment scope gets it; an item, a create and a + * history open in Studio, on the environment scope's editor. + * + * The metadata-admin pages are stubs printing the host they read; the gate is + * `usePermissions`' answer, stubbed. + */ + +import '@testing-library/jest-dom/vitest'; +import { afterEach, describe, expect, it, vi } from 'vitest'; +import * as React from 'react'; +import { cleanup, render, screen } from '@testing-library/react'; +import { MemoryRouter, Route, Routes, useLocation, useParams } from 'react-router-dom'; +import { useMetadataAreaHost } from '../metadata-admin/metadataAreaHost'; + +function PageStub({ page }: { page: string }) { + const host = useMetadataAreaHost(); + const { type } = useParams(); + return
; +} + +vi.mock('../metadata-admin/index.js', () => ({ + MetadataDirectoryPage: () => , + MetadataResourceListPage: () => , +})); + +const held = vi.hoisted(() => ({ capabilities: new Set(['studio.access']) })); +vi.mock('@object-ui/permissions', async (importOriginal) => ({ + ...(await importOriginal>()), + usePermissions: () => ({ hasCapabilities: (caps: string[]) => caps.every((c) => held.capabilities.has(c)) }), +})); + +import { AccessDirectoryPage } from './AccessDirectoryPage'; + +const SETUP = '/apps/setup/component/security/access-directory'; + +function Where() { + const { pathname, search } = useLocation(); + return
{`${pathname}${search}`}
; +} + +function mount(url: string) { + return render( + + + + } /> + } /> + + , + ); +} + +const where = () => screen.getByTestId('where').textContent; +async function page() { + const el = await screen.findByTestId('area-page'); + return { page: el.getAttribute('data-page'), type: el.getAttribute('data-type'), host: JSON.parse(el.getAttribute('data-host')!) }; +} + +afterEach(() => { + cleanup(); + held.capabilities = new Set(['studio.access']); +}); + +describe('the gate: Studio\'s entry capability (objectstack#37565)', () => { + it('without studio.access the page reads nothing and names the capability', () => { + held.capabilities = new Set(['setup.access', 'manage_platform_settings']); + mount(SETUP); + expect(screen.getByTestId('access-directory-not-allowed')).toHaveTextContent('studio.access'); + expect(screen.queryByTestId('area-page')).toBeNull(); + }); + + it('CONTROL — with it, the directory', async () => { + mount(SETUP); + expect((await page()).page).toBe('directory'); + expect(screen.queryByTestId('access-directory-not-allowed')).toBeNull(); + }); +}); + +describe('the pages it mounts (objectstack#37565)', () => { + const HOST = { packageId: null, readOnly: false, basePath: SETUP }; + + it('the directory, on the cross-package leg\'s host shape, rooted at the page', async () => { + mount(SETUP); + expect(await page()).toEqual({ page: 'directory', type: '', host: HOST }); + expect(where()).toBe(SETUP); + }); + + it.each(['permission', 'position', 'capability', 'sharing_rule'])('a type\'s list in the environment scope: %s', async (type) => { + mount(`${SETUP}/${type}?scope=environment`); + expect(await page()).toEqual({ page: 'list', type, host: HOST }); + expect(where()).toBe(`${SETUP}/${type}?scope=environment`); + }); + + it('a list outside the environment scope gets it, and drops the package', async () => { + mount(`${SETUP}/permission?package=crm`); + expect(await page()).toMatchObject({ page: 'list', type: 'permission' }); + expect(where()).toBe(`${SETUP}/permission?scope=environment`); + }); + + it.each([ + [`${SETUP}/permission/admin?scope=environment`, '/studio/~all/metadata/permission/admin?scope=environment'], + [`${SETUP}/permission/new?scope=environment`, '/studio/~all/metadata/permission/new?scope=environment'], + [`${SETUP}/position/manager/history?scope=environment`, '/studio/~all/metadata/position/manager/history?scope=environment'], + [`${SETUP}/flow`, '/studio/~all/metadata/flow'], + ])('%s opens in Studio, in one hop: %s', async (from, to) => { + mount(from); + expect(await screen.findByTestId('studio')).toBeInTheDocument(); + expect(where()).toBe(to); + expect(screen.queryByTestId('area-page')).toBeNull(); + }); +}); diff --git a/ui/packages/app-shell/src/views/setup/accessDirectory.test.ts b/ui/packages/app-shell/src/views/setup/accessDirectory.test.ts new file mode 100644 index 00000000000..e6bc655a4db --- /dev/null +++ b/ui/packages/app-shell/src/views/setup/accessDirectory.test.ts @@ -0,0 +1,130 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * objectstack#37565 — the environment directory's addresses after it moved + * from Studio's cross-package leg to Setup → Access control (ADR-0084, amended + * 2026-11-26, question 5): which `~all` address lands on the Setup page, which + * stays in Studio, and what the Setup page serves itself. + */ + +import { describe, expect, it } from 'vitest'; +import { ENVIRONMENT_AREA_TYPES } from '../metadata-admin/metadataAreaHost.js'; +import { + ACCESS_DIRECTORY_CAPABILITY, + ACCESS_DIRECTORY_PATH, + ACCESS_DIRECTORY_REF, + accessDirectoryLocation, + accessDirectoryPath, + studioAddressAfterSetupMove, + studioAllLegSetupRedirect, +} from './accessDirectory.js'; + +const SETUP = '/apps/setup/component/security/access-directory'; + +describe('the Setup page (objectstack#37565)', () => { + it('is a component page of the Setup app, behind Studio\'s entry capability', () => { + expect(ACCESS_DIRECTORY_REF).toBe('security:access-directory'); + expect(ACCESS_DIRECTORY_PATH).toBe(SETUP); + expect(ACCESS_DIRECTORY_CAPABILITY).toBe('studio.access'); + }); + + it('addresses the directory, and a type\'s list in the environment scope', () => { + expect(accessDirectoryPath()).toBe(SETUP); + expect(accessDirectoryPath('permission')).toBe(`${SETUP}/permission?scope=environment`); + expect(accessDirectoryPath('sharing_rule')).toBe(`${SETUP}/sharing_rule?scope=environment`); + }); +}); + +describe("a Studio cross-package address (studioAllLegSetupRedirect)", () => { + it.each([ + // [rest, search, expected] + ['', '', SETUP], + ['', '?q=admin', `${SETUP}?q=admin`], + ['position', '?scope=environment', `${SETUP}/position?scope=environment`], + ['permission', '?scope=environment&q=sales', `${SETUP}/permission?scope=environment&q=sales`], + ['sharing_rule', '?scope=environment', `${SETUP}/sharing_rule?scope=environment`], + ['capability', '?scope=environment', `${SETUP}/capability?scope=environment`], + ])('the directory lands on Setup: %s %s', (rest, search, expected) => { + expect(studioAllLegSetupRedirect(rest, search)).toBe(expected); + }); + + it('every type the directory lists lands on Setup in the environment scope', () => { + for (const type of ENVIRONMENT_AREA_TYPES) { + expect(studioAllLegSetupRedirect(encodeURIComponent(type), '?scope=environment'), type).toBe( + accessDirectoryPath(type), + ); + } + }); + + it.each([ + // An item, a create and a history open in Studio (ADR-0146 D1). + ['permission/admin', '?scope=environment'], + ['permission/new', '?scope=environment'], + ['position/manager/history', '?scope=environment'], + // The cross-package list outside the environment scope is another read: it stays. + ['permission', ''], + ['permission', '?package=all'], + ['flow', ''], + ['object', '?scope=environment'], + // Diagnostics is Studio's. + ['_diagnostics', ''], + // A path no decoding reads stays where it is. + ['%E0%A4%A', '?scope=environment'], + ])('stays in Studio: %s %s', (rest, search) => { + expect(studioAllLegSetupRedirect(rest, search)).toBeNull(); + }); + + it('maps a whole built address, hash included, and leaves any other address alone', () => { + expect(studioAddressAfterSetupMove('/studio/~all/metadata')).toBe(SETUP); + expect(studioAddressAfterSetupMove('/studio/~all/metadata/position?scope=environment#top')).toBe( + `${SETUP}/position?scope=environment#top`, + ); + for (const address of [ + '/studio/~all/metadata/position/manager?scope=environment', + '/studio/~all/metadata/flow?package=all', + '/studio/crm/metadata', + '/studio/~allx/metadata', + '/studio/~org/metadata/flow?source=runtime', + ]) { + expect(studioAddressAfterSetupMove(address), address).toBe(address); + } + }); +}); + +describe('an address below the Setup page (accessDirectoryLocation)', () => { + it.each([ + ['', ''], + ['', '?q=admin'], + ['position', '?scope=environment'], + ['permission', '?scope=environment&q=sales'], + ])('the page serves it: %s %s', (rest, search) => { + expect(accessDirectoryLocation(rest, search)).toBeNull(); + }); + + it('a directory type\'s list gets the environment scope, and no package', () => { + expect(accessDirectoryLocation('position', '')).toBe(`${SETUP}/position?scope=environment`); + expect(accessDirectoryLocation('permission', '?package=crm&q=x')).toBe(`${SETUP}/permission?q=x&scope=environment`); + }); + + it.each([ + // [rest, search, Studio target] — an item, a create, a history: the editor the environment scope uses. + ['permission/admin', '?scope=environment', '/studio/~all/metadata/permission/admin?scope=environment'], + ['permission/new', '?scope=environment', '/studio/~all/metadata/permission/new?scope=environment'], + ['position/manager/history', '?scope=environment', '/studio/~all/metadata/position/manager/history?scope=environment'], + ['permission/sales%20rep', '?scope=environment', '/studio/~all/metadata/permission/sales%20rep?scope=environment'], + // Another type's list is the cross-package list, which stays in Studio. + ['flow', '', '/studio/~all/metadata/flow'], + ])('opens in Studio: %s %s', (rest, search, expected) => { + expect(accessDirectoryLocation(rest, search)).toBe(expected); + }); + + it('never sends Studio\'s target back to Setup: one hop', () => { + for (const [rest, search] of [ + ['permission/admin', '?scope=environment'], + ['flow', ''], + ] as const) { + const target = accessDirectoryLocation(rest, search)!; + expect(studioAddressAfterSetupMove(target)).toBe(target); + } + }); +}); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.metadataArea-28561.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.metadataArea-28561.test.tsx index 485c23a390d..af0758ae3df 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.metadataArea-28561.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.metadataArea-28561.test.tsx @@ -316,14 +316,17 @@ describe('⌘K on the builder (objectstack#36900)', () => { expect(current()).toHaveAttribute('data-testid', 'studio-menu-entry-type:flow'); }); + // objectstack#37565 — the leg's root redirects to Setup now, and the menu has no environment entry: + // the leg's cross-package list is a page it still draws, and its menu is the environment's. it('on the cross-package leg, Ctrl+K opens the palette again, with the environment menu', async () => { servePackages(); - renderAt('/studio/~all/metadata'); + renderAt('/studio/~all/metadata/flow?package=all'); await areaPage(); fireEvent.keyDown(document, { key: 'k', ctrlKey: true }); await waitFor(() => expect(overlay()).not.toBeNull()); - await waitFor(() => expect(paletteItem('studio-entry environment')).not.toBeNull()); + await waitFor(() => expect(paletteItem('studio-entry orgFlows')).not.toBeNull()); + expect(paletteItem('studio-entry environment')).toBeNull(); expect(paletteItem('studio-entry diagnostics')).toBeNull(); }); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioEntryRedirect.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioEntryRedirect.test.tsx index 841e91831ac..7294c0d0ecf 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioEntryRedirect.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioEntryRedirect.test.tsx @@ -4,9 +4,11 @@ * objectstack#36908 (epic #36890 decision 9) — bare `/studio` draws no page. * It opens the package the author was last in, still named by the package * list; otherwise the package list: Setup → Packages for a principal who may - * open it, the "All metadata" area across packages for one who may only enter - * Studio. The retired `/studio?new=package` bookmark lands on Setup's New - * Package for the first, and on that same "All metadata" area for the second. + * open it, the package-less scope (`~org`) for one who may only enter Studio + * (objectstack#37565: the "All metadata" area across packages it landed on + * before is Setup's environment directory now, which such a principal may not + * open). The retired `/studio?new=package` bookmark lands on Setup's New + * Package for the first, and on that same scope for the second. * * The recent store and the list read are stubbed at their modules: what is * measured is where the entry SENDS the author, read off the router's @@ -32,7 +34,8 @@ import { StudioEntryRedirect } from './StudioEntryRedirect'; import { newPackageDoorPath, studioEntryFallbackPath, studioNewPackageEntryPath } from './studioEntryPermissions'; const SETUP_PACKAGES = '/apps/setup/component/developer/packages?face=admin'; -const ALL_METADATA = '/studio/~all/metadata'; +/** objectstack#37565 — the package-less scope's flows, `studioOrgScopePath()`. */ +const ORG_SCOPE = '/studio/~org/metadata/flow?source=runtime'; const ADMIN = ['studio.access', 'setup.access', 'manage_platform_settings']; /** May enter Studio and author metadata; holds neither capability Setup → Packages is shown under. */ const STUDIO_ONLY = ['studio.access', 'manage_metadata']; @@ -115,16 +118,16 @@ describe("Studio's entry: the package list (objectstack#36908)", () => { expect(read).not.toHaveBeenCalled(); }); - it('a principal who may enter Studio but not Setup → Packages lands on the "All metadata" area', async () => { + it('a principal who may enter Studio but not Setup → Packages lands on the package-less scope', async () => { renderEntry('/studio', ['studio.access', 'setup.access']); - expect(await screen.findByTestId('where')).toHaveTextContent(ALL_METADATA); + expect(await screen.findByTestId('where')).toHaveTextContent(ORG_SCOPE); }); it('the fallback reads the two capabilities Setup → Packages is shown under, and holds nothing for no answer', () => { expect(studioEntryFallbackPath(ADMIN)).toBe(SETUP_PACKAGES); - expect(studioEntryFallbackPath(['studio.access', 'manage_platform_settings'])).toBe(ALL_METADATA); - expect(studioEntryFallbackPath(['studio.access', 'setup.access'])).toBe(ALL_METADATA); - expect(studioEntryFallbackPath(undefined)).toBe(ALL_METADATA); + expect(studioEntryFallbackPath(['studio.access', 'manage_platform_settings'])).toBe(ORG_SCOPE); + expect(studioEntryFallbackPath(['studio.access', 'setup.access'])).toBe(ORG_SCOPE); + expect(studioEntryFallbackPath(undefined)).toBe(ORG_SCOPE); }); }); @@ -136,24 +139,24 @@ describe('the retired `/studio?new=package` bookmark (objectstack#36908)', () => expect(await screen.findByTestId('where')).toHaveTextContent(`${SETUP_PACKAGES}&new=package`); }); - it('a principal who may enter Studio but not Setup → Packages is never sent to Setup: the "All metadata" area', async () => { + it('a principal who may enter Studio but not Setup → Packages is never sent to Setup: the package-less scope', async () => { recent.items = [pkg('com.acme.crm')]; listed.read = async () => new Set(['com.acme.crm']); renderEntry('/studio?new=package', STUDIO_ONLY); const where = await screen.findByTestId('where'); - expect(where).toHaveTextContent(new RegExp(`^${ALL_METADATA}$`)); + expect(where.textContent).toBe(ORG_SCOPE); expect(where.textContent).not.toContain('/apps/setup'); }); it('the forward reads the same two capabilities as the fallback, and holds nothing for no answer', () => { expect(studioNewPackageEntryPath(ADMIN)).toBe(`${SETUP_PACKAGES}&new=package`); - expect(studioNewPackageEntryPath(['studio.access', 'manage_platform_settings'])).toBe(ALL_METADATA); - expect(studioNewPackageEntryPath(['studio.access', 'setup.access'])).toBe(ALL_METADATA); - expect(studioNewPackageEntryPath(undefined)).toBe(ALL_METADATA); + expect(studioNewPackageEntryPath(['studio.access', 'manage_platform_settings'])).toBe(ORG_SCOPE); + expect(studioNewPackageEntryPath(['studio.access', 'setup.access'])).toBe(ORG_SCOPE); + expect(studioNewPackageEntryPath(undefined)).toBe(ORG_SCOPE); }); it('the console doors outside Studio (Home, /ai, 「Add app」) make the same choice from the session\'s own answer', () => { expect(newPackageDoorPath(true)).toBe(`${SETUP_PACKAGES}&new=package`); - expect(newPackageDoorPath(false)).toBe(ALL_METADATA); + expect(newPackageDoorPath(false)).toBe(ORG_SCOPE); }); }); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioMenu.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioMenu.test.tsx index e64f38b81d3..61315d268ff 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioMenu.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioMenu.test.tsx @@ -274,9 +274,9 @@ describe('the group labels (objectstack#37201)', () => { 'studio-menu-advanced-group-security', ]); // Inside the closed fold: out of the accessibility tree until it opens. + // objectstack#37565 — the environment directory left the menu for Setup. expect(within(screen.getByTestId('studio-menu-advanced-group-security')).getAllByRole('link', { hidden: true }).map((a) => a.getAttribute('data-testid'))).toEqual([ 'studio-menu-entry-owd', - 'studio-menu-entry-environment', ]); }); }); @@ -419,7 +419,8 @@ describe('the 「高级」 fold (objectstack#37201)', () => { describe('~org and ~all draw no fold (objectstack#37201)', () => { it.each([ ['~org', '/studio/~org/metadata/flow?source=runtime'], - ['~all', '/studio/~all/metadata'], + // objectstack#37565 — the leg's root redirects to Setup; an item page is what still draws this menu. + ['~all', '/studio/~all/metadata/permission/admin?scope=environment'], ])('%s: its entries flat, in the table\'s order, under their groups\' labels', (segment, path) => { renderAt(path, segment); expect(screen.queryByTestId('studio-menu-advanced-toggle')).toBeNull(); @@ -428,8 +429,12 @@ describe('~org and ~all draw no fold (objectstack#37201)', () => { expect(within(security).getAllByRole('link').map((a) => a.getAttribute('data-testid'))).toEqual([ 'studio-menu-entry-type:permission', 'studio-menu-entry-type:position', - 'studio-menu-entry-environment', ]); + // objectstack#37565 — each catalog row opens its list on Setup's directory page. + expect(within(security).getByTestId('studio-menu-entry-type:position')).toHaveAttribute( + 'href', + '/apps/setup/component/security/access-directory/position?scope=environment', + ); for (const a of within(security).getAllByRole('link')) expect(a).toBeVisible(); expect(security.querySelector('[data-sidebar="group-label"]')).toHaveTextContent(/^Access$/); expect(screen.getByTestId('studio-menu-entry-orgFlows')).toBeVisible(); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioMetadataArea.routes-28561.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioMetadataArea.routes-28561.test.tsx index 97a637167e0..3245bc73492 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioMetadataArea.routes-28561.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioMetadataArea.routes-28561.test.tsx @@ -141,6 +141,7 @@ function mount(url: string) { } /> } /> } /> + } /> , ); @@ -182,13 +183,27 @@ describe('the area mounts the metadata pages (objectstack#28561)', () => { expect((await page()).host.readOnly).toBe(false); }); - it('the cross-package leg: no package, and the environment-scope permission list', async () => { - mount('/studio/~all/metadata/permission?scope=environment'); + // objectstack#37565 — rewritten on purpose: the environment-scope list was the leg's page; it is + // Setup's directory page now (ADR-0084, amended 2026-11-26). The leg still serves the cross-package list. + it('the cross-package leg: no package, and the cross-package permission list', async () => { + mount('/studio/~all/metadata/permission?package=all'); expect(await page()).toEqual({ page: 'list', host: { packageId: null, readOnly: false, basePath: '/studio/~all/metadata' }, }); - expect(where()).toBe('/studio/~all/metadata/permission?scope=environment'); + expect(where()).toBe('/studio/~all/metadata/permission?package=all'); + }); + + it.each([ + ['/studio/~all/metadata', '/apps/setup/component/security/access-directory'], + ['/studio/~all/metadata/permission?scope=environment', '/apps/setup/component/security/access-directory/permission?scope=environment'], + // A package's leg that names the environment scope lands on Setup in one hop, not via the leg. + [`/studio/${WRITABLE}/metadata/position?scope=environment&package=${WRITABLE}`, '/apps/setup/component/security/access-directory/position?scope=environment'], + ])('the environment directory %s lands on Setup\'s page: %s', async (from, to) => { + mount(from); + expect(await screen.findByTestId('setup-directory')).toBeInTheDocument(); + expect(where()).toBe(to); + expect(screen.queryByTestId('area-page')).toBeNull(); }); it('the environment scope opened under a package moves to the cross-package leg', async () => { diff --git a/ui/packages/app-shell/src/views/studio-design/StudioMetadataArea.tsx b/ui/packages/app-shell/src/views/studio-design/StudioMetadataArea.tsx index a9dce30d6c1..54833df14ba 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioMetadataArea.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioMetadataArea.tsx @@ -57,7 +57,7 @@ import { studioMetadataAreaPath, } from './metadataArea.js'; import { STUDIO_ORG_SCOPE_SEGMENT } from './studioScope.js'; -import { studioAllLegSetupRedirect } from '../setup/accessDirectory.js'; +import { studioAddressAfterSetupMove, studioAllLegSetupRedirect } from '../setup/accessDirectory.js'; import { STUDIO_ORG_SCOPE_TYPE } from './studioAddress.js'; import { StudioBundleItemEditor } from './StudioBundleItemEditor.js'; import { AutomationsPillar } from './AutomationsPillar.js'; @@ -484,10 +484,11 @@ export function StudioMetadataArea({ // The query names the leg (`areaLocationRedirect`). Settled before any page // mounts, so no page reads a scope the URL is about to change. const rest = pathname.startsWith(basePath) ? pathname.slice(basePath.length).replace(/^\/+/, '') : ''; - const redirect = areaLocationRedirect(segment, rest, search); - if (redirect) return ; // objectstack#37565 — the cross-package leg's directory is Setup's page now - // (ADR-0084, amended 2026-11-26): its addresses land there, once. + // (ADR-0084, amended 2026-11-26): its addresses land there, once, whether + // the URL is on the leg or the leg is where its query sends it. + const redirect = areaLocationRedirect(segment, rest, search); + if (redirect) return ; const moved = segment === STUDIO_ALL_PACKAGES_SEGMENT ? studioAllLegSetupRedirect(rest, search) : null; if (moved) return ; // A page must not offer a write before the package's state is known. 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 1c04f799322..227dc3b72eb 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 @@ -331,7 +331,8 @@ describe('no 「⋯」 without a current package or without manage_metadata (obj expect(within(header()).queryByTestId('studio-package-menu')).toBeNull(); cleanup(); - renderAt('/studio/~all/metadata'); + // objectstack#37565 — the leg's root redirects to Setup; a page the leg still draws. + renderAt('/studio/~all/metadata/permission/admin?scope=environment'); await waitFor(() => expect(within(header()).getByTestId('studio-back-app-name')).toHaveTextContent(t('engine.studio.menu.environment', locale)), { timeout: 8000, }); 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 bb2fbc28ec6..43703340c96 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 @@ -263,7 +263,6 @@ describe("on a package, the palette lists the left menu and the package's items 'studio-entry diagnostics', 'studio-entry type:permission', 'studio-entry owd', - 'studio-entry environment', 'studio-entry type:agent', ]); // Another package's object, and the datasource (Setup's), are not items. @@ -413,14 +412,14 @@ describe("on a package, the palette lists the left menu and the package's items describe('on the cross-package leg, the menu joins every package\'s objects and flows (objectstack#36900)', () => { it("lists the environment menu's entries, reads no item list, and keeps the landing's groups", async () => { - const { cacheReads } = mount('~all', { at: '/studio/~all/metadata?palette=1', packageScope: false }); + // objectstack#37565 — the leg's root redirects to Setup; an item page still opens on the leg. + 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)); expect(values('studio-entry ')).toEqual([ 'studio-entry orgFlows', 'studio-entry type:permission', 'studio-entry type:position', - 'studio-entry environment', ]); expect(values('studio-item ')).toEqual([]); expect(reads.state.calls).toEqual([]); diff --git a/ui/packages/app-shell/src/views/studio-design/setupMetadataRedirect.test.ts b/ui/packages/app-shell/src/views/studio-design/setupMetadataRedirect.test.ts index dd04191b242..0fd38679ff5 100644 --- a/ui/packages/app-shell/src/views/studio-design/setupMetadataRedirect.test.ts +++ b/ui/packages/app-shell/src/views/studio-design/setupMetadataRedirect.test.ts @@ -16,11 +16,17 @@ import { setupMetadataStudioPath, } from './setupMetadataRedirect.js'; import { areaLocationRedirect } from './metadataArea.js'; +import { + ACCESS_DIRECTORY_PATH, + accessDirectoryLocation, + studioAllLegSetupRedirect, +} from '../setup/accessDirectory.js'; describe('setupMetadataStudioPath', () => { it.each([ // [rest, search, expected] - ['', '', '/studio/~all/metadata'], + // objectstack#37565 — the leg's root is the environment directory, Setup's page now. + ['', '', '/apps/setup/component/security/access-directory'], ['_diagnostics', '', '/studio/~all/metadata/_diagnostics'], ['object', '', '/studio/~all/metadata/object'], ['object/account', '', '/studio/~all/metadata/object/account'], @@ -30,9 +36,11 @@ describe('setupMetadataStudioPath', () => { ['object/account', '?package=crm', '/studio/crm/metadata/object/account?package=crm'], ['object', 'package=crm', '/studio/crm/metadata/object?package=crm'], ['object', '?package=all', '/studio/~all/metadata/object?package=all'], - // `?scope=environment` is the cross-package leg; it binds no package. - ['position', '?scope=environment', '/studio/~all/metadata/position?scope=environment'], - ['position', '?scope=environment&package=crm', '/studio/~all/metadata/position?scope=environment'], + // `?scope=environment` is the cross-package leg; it binds no package. objectstack#37565 — + // a directory type's list there is Setup's page now; its item still opens in Studio. + ['position', '?scope=environment', '/apps/setup/component/security/access-directory/position?scope=environment'], + ['position', '?scope=environment&package=crm', '/apps/setup/component/security/access-directory/position?scope=environment'], + ['position/manager', '?scope=environment', '/studio/~all/metadata/position/manager?scope=environment'], // `?review=1` is kept, alone or beside a package. ['object/account', '?review=1', '/studio/~all/metadata/object/account?review=1'], ['object/account', '?package=crm&review=1', '/studio/crm/metadata/object/account?package=crm&review=1'], @@ -69,12 +77,22 @@ describe('setupMetadataStudioPath', () => { for (const [rest, search] of [ ['object/account', ''], ['object/account', '?package=crm'], - ['position', '?scope=environment&package=crm'], + ['position/manager', '?scope=environment&package=crm'], ['object', '?package=all&review=1'], ] as const) { const target = new URL(setupMetadataStudioPath(rest, search)!, 'http://x'); const [, , leg, , ...tail] = target.pathname.split('/'); expect(areaLocationRedirect(decodeURIComponent(leg), tail.join('/'), target.search)).toBeNull(); + expect(studioAllLegSetupRedirect(tail.join('/'), target.search)).toBeNull(); + } + // objectstack#37565 — a directory address lands on Setup's page, which serves it without a further hop. + for (const [rest, search] of [ + ['', ''], + ['position', '?scope=environment&package=crm'], + ] as const) { + const target = new URL(setupMetadataStudioPath(rest, search)!, 'http://x'); + expect(target.pathname.startsWith(ACCESS_DIRECTORY_PATH)).toBe(true); + expect(accessDirectoryLocation(target.pathname.slice(ACCESS_DIRECTORY_PATH.length), target.search)).toBeNull(); } }); }); 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 703f92bf7f8..02f1e2ff89c 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 @@ -56,14 +56,16 @@ describe('the menu groups (objectstack#36899, ADR-0084 amended)', () => { expect(STUDIO_MENU_GROUPS).toEqual(['data', 'ui', 'automation', 'system', 'security', 'ai']); }); - it('a package: every type in its domain\'s group, and the four entries that are not a type', () => { + // objectstack#37565 — rewritten on purpose: the fourth entry that is not a type, the cross-package + // environment directory, left the menu for Setup (ADR-0084, amended 2026-11-26, question 5). + it('a package: every type in its domain\'s group, and the three 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'], system: ['type:datasource', 'diagnostics'], - security: ['type:permission', 'owd', 'environment'], + security: ['type:permission', 'owd'], ai: ['type:agent'], }); const entry = (key: string) => menu.flatMap((g) => g.entries).find((e) => e.key === key)!; @@ -75,7 +77,9 @@ describe('the menu groups (objectstack#36899, ADR-0084 amended)', () => { expect(entry('diagnostics').to).toBe(`/studio/${PKG}/metadata/_diagnostics`); // objectstack#36905 — the overview's own route. expect(entry('owd').to).toBe(`/studio/${PKG}/owd`); - expect(entry('environment').to).toBe('/studio/~all/metadata'); + // objectstack#37565 — no entry opens the cross-package leg's directory any more. + expect(menu.flatMap((g) => g.entries).map((e) => e.kind)).not.toContain('environment'); + expect(menu.flatMap((g) => g.entries).some((e) => e.to.startsWith('/studio/~all/'))).toBe(false); }); // objectstack#37201 — rewritten on purpose: a group is drawn only where it holds an entry @@ -85,7 +89,7 @@ describe('the menu groups (objectstack#36899, ADR-0084 amended)', () => { expect(keysOf(menu)).toEqual({ automation: ['orgFlows'], system: ['diagnostics'], - security: ['owd', 'environment'], + security: ['owd'], }); }); @@ -98,10 +102,11 @@ describe('the menu groups (objectstack#36899, ADR-0084 amended)', () => { // objectstack#37201 — the table's order, not the served one: permission set (常用) before position (高级). expect(keysOf(menu)).toEqual({ automation: ['orgFlows'], - security: ['type:permission', 'type:position', 'environment'], + security: ['type:permission', 'type:position'], }); + // objectstack#37565 — the environment catalog's lists are Setup's page now: the row opens it there. expect(menu.flatMap((g) => g.entries).find((e) => e.key === 'type:position')!.to).toBe( - '/studio/~all/metadata/position?scope=environment', + '/apps/setup/component/security/access-directory/position?scope=environment', ); }); }); @@ -142,7 +147,7 @@ describe('the menu reads the placement table (objectstack#37201, ADR-0084 amende ui: ['type:app', 'type:page', 'type:dashboard', 'type:report', 'type:view', 'type:action'], automation: ['type:flow', 'type:job', 'orgFlows'], system: ['type:doc', 'type:book', 'type:email_template', 'diagnostics'], - security: ['type:permission', 'type:position', 'type:assignment_rule', 'owd', 'environment'], + security: ['type:permission', 'type:position', 'type:assignment_rule', 'owd'], ai: ['type:agent', 'type:tool', 'type:skill'], }); }); @@ -156,8 +161,8 @@ describe('the menu reads the placement table (objectstack#37201, ADR-0084 amende expect(entries.find((e) => e.key === 'type:picklist')!.tier).toBe('advanced'); }); - it('the four entries that are not a type are 高级 on a package', () => { - for (const key of ['orgFlows', 'diagnostics', 'owd', 'environment']) { + it('the three entries that are not a type are 高级 on a package', () => { + for (const key of ['orgFlows', 'diagnostics', 'owd']) { expect(entries.find((e) => e.key === key)!.tier, key).toBe('advanced'); } }); @@ -178,7 +183,6 @@ describe('the menu reads the placement table (objectstack#37201, ADR-0084 amende 'type:position', 'type:assignment_rule', 'owd', - 'environment', ]); }); @@ -279,10 +283,11 @@ describe('the current entry (aria-current)', () => { expect(current(PKG, `/studio/${PKG}/bogus`)).toBeNull(); }); - it('the package-less scope is its flows; the cross-package leg\'s root is the environment catalog', () => { + // 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'); - expect(current('~all', '/studio/~all/metadata')).toBe('environment'); + expect(current('~all', '/studio/~all/metadata')).toBeNull(); expect(current('~all', '/studio/~all/metadata/position')).toBe('type:position'); }); }); From fbca52179e1855df9484ad41edec814903644f5f Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 14:21:50 +0000 Subject: [PATCH 3/7] docs(permissions): the environment catalog lives in Setup's access group Claude-Session: https://claude.ai/code/session_01Utp6CZhAqkgRyMYuZeZt9S Co-authored-by: Claude --- content/docs/permissions/authorization.mdx | 10 +++++----- content/docs/permissions/permission-sets.mdx | 8 +++++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/content/docs/permissions/authorization.mdx b/content/docs/permissions/authorization.mdx index 63f6de390e2..13b6d204c64 100644 --- a/content/docs/permissions/authorization.mdx +++ b/content/docs/permissions/authorization.mdx @@ -267,11 +267,11 @@ only what it owns: **live** (config); the sets a position distributes are its definition's `permissionSets`. It owns environment-authored sets and assignments — not package sets. The set **definition** has one authoritative store, the - metadata layer (ADR-0094 D1, ADR-0131 D3): Studio's **All metadata** area - lists the catalog (`/studio/~all/metadata/permission?scope=environment`; - Setup carries no metadata catalog, and its old - `/apps/setup/metadata/permission` address redirects there), and a create or - edit there is a metadata save (`PUT /api/v1/meta/permission/:name`) into the + metadata layer (ADR-0094 D1, ADR-0131 D3): Setup → Access control → + **Positions and Permissions** lists the catalog + (`/apps/setup/component/security/access-directory/permission?scope=environment`; + the old Studio and Setup catalog addresses redirect there), a set opens in + Studio's editor, and a create or edit there is a metadata save (`PUT /api/v1/meta/permission/:name`) into the environment's definition ledger (`sys_metadata`), served from the registry beside the packages' sets. No row mirrors it: the `sys_permission_set` object is no longer registered, so no data route serves one. The save diff --git a/content/docs/permissions/permission-sets.mdx b/content/docs/permissions/permission-sets.mdx index 84990e76e5a..1645e15b170 100644 --- a/content/docs/permissions/permission-sets.mdx +++ b/content/docs/permissions/permission-sets.mdx @@ -423,9 +423,11 @@ layer — a package's declaration, or a definition authored in this system and saved in `sys_metadata` — served by name from the security catalog. Nothing mirrors it into a row: the `sys_permission_set` record ADR-0094 kept as a projection is retired, its object is no longer registered, and no data -route serves it (ADR-0131 D3). Studio's All metadata area lists the catalog -(`/studio/~all/metadata/permission?scope=environment`; Setup's old -`/apps/setup/metadata/permission` address redirects there), a grant +route serves it (ADR-0131 D3). Setup → Access control → Positions and +Permissions lists the catalog +(`/apps/setup/component/security/access-directory/permission?scope=environment`; +the old Studio and Setup catalog addresses redirect there, and a set opens in +Studio's editor), a grant names its set by its package and name (`sys_user_permission_set.permission_set_package` and `permission_set`), and a write goes through the metadata door (`PUT` or `DELETE /api/v1/meta/permission/:name`), From 18b0534d0f546b3a5f58b4284be109c41eeab314 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 14:36:37 +0000 Subject: [PATCH 4/7] test(setup): pay the lint load during collection in the Setup page test Claude-Session: https://claude.ai/code/session_01Utp6CZhAqkgRyMYuZeZt9S Co-authored-by: Claude --- .../app-shell/src/views/setup/AccessDirectoryPage.test.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ui/packages/app-shell/src/views/setup/AccessDirectoryPage.test.tsx b/ui/packages/app-shell/src/views/setup/AccessDirectoryPage.test.tsx index c2cae4f90db..9ed58174b7c 100644 --- a/ui/packages/app-shell/src/views/setup/AccessDirectoryPage.test.tsx +++ b/ui/packages/app-shell/src/views/setup/AccessDirectoryPage.test.tsx @@ -16,6 +16,8 @@ */ import '@testing-library/jest-dom/vitest'; +// The page's source reach loads this lazily; pay that load during collection (check:test-source-alias). +import '@objectstack/lint'; import { afterEach, describe, expect, it, vi } from 'vitest'; import * as React from 'react'; import { cleanup, render, screen } from '@testing-library/react'; From ab28aec73e1e9070e977606dedce7473de0b11d1 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 14:40:42 +0000 Subject: [PATCH 5/7] fix(studio): the palette's icon map drops the retired environment entry Claude-Session: https://claude.ai/code/session_01Utp6CZhAqkgRyMYuZeZt9S Co-authored-by: Claude --- .../app-shell/src/views/studio-design/StudioPaletteGroups.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 e3105817ab7..fe2eac674c0 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, KeyRound, LayoutGrid, type LucideIcon } from 'lucide-react'; +import { List, Building2, 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'; @@ -55,7 +55,6 @@ const ENTRY_ICONS: Record = { orgFlows: Building2, owd: Share2, diagnostics: Activity, - environment: KeyRound, // objectstack#37360 — the menu's 全部类型 row; the palette lists only the menu's groups, so it draws none today. allTypes: LayoutGrid, }; From f9a5798c8d63805f6b570de8ec74967385b8f9b2 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 14:53:00 +0000 Subject: [PATCH 6/7] docs(permissions): the administrator guide finds positions and sets in Setup Claude-Session: https://claude.ai/code/session_01Utp6CZhAqkgRyMYuZeZt9S Co-authored-by: Claude --- content/docs/permissions/administrator-guide.mdx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/content/docs/permissions/administrator-guide.mdx b/content/docs/permissions/administrator-guide.mdx index 97cc24c1109..2364aebbe5e 100644 --- a/content/docs/permissions/administrator-guide.mdx +++ b/content/docs/permissions/administrator-guide.mdx @@ -196,8 +196,9 @@ One rule of thumb: **capability ships with the apps you install — you rarely author a permission set by hand.** If you are in this section, you've confirmed no shipped position covers the need. -The permission-set **matrix editor** (Studio → **All metadata** → Permission -Set, then open the set) is a structured spreadsheet — you never hand-write JSON: +The permission-set **matrix editor** (Setup → Access Control → **Positions and +Permissions** → Permission Set, then open the set in Studio's editor) is a +structured spreadsheet — you never hand-write JSON: - **Object grid** — per object: Create / Read / Update / Delete, lifecycle bits (Transfer / Restore / Purge), and View All / Modify All, with per-row @@ -322,7 +323,7 @@ sets can't be edited in place either, but they can be cloned and adjusted | Users, invitations | Setup → People & Organization → Users / Invitations | | Business-unit tree | Setup → People & Organization → Business Units | | Teams | Setup → People & Organization → Teams | -| Positions, permission sets, capabilities: what they grant, and a position's or set's on/off switch | Studio → All metadata | +| Positions, permission sets, capabilities: what they grant, and a position's or set's on/off switch | Setup → Access Control → Positions and Permissions | | Who holds a position, who holds a permission set | Setup → People & Organization → Position Holders / Permission Set Assignment | | Sharing rules, record shares | Setup → Access Control | | Password policy, MFA, lockout, SSO | Setup → Configuration → Authentication | From 107d65afd1b5623f23222f75e2da3cdde6de3795 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 15:15:18 +0000 Subject: [PATCH 7/7] test(console): re-point the remaining directory and fallback pins to Setup and ~org The not-found exit's label names where it now goes (organization flows). Claude-Session: https://claude.ai/code/session_01Utp6CZhAqkgRyMYuZeZt9S Co-authored-by: Claude --- ...tent.emptyNavigationLanding-12079.test.tsx | 10 +++--- .../AppContent.noAppComponentRoutes.test.tsx | 27 ++++++++------- .../AppContent.pseudoRouteSegments.test.tsx | 33 ++++++++++++++++--- .../__tests__/SidebarAppMenu-36112.test.tsx | 9 ++--- ...tudioDesignSurface.notFound-26708.test.tsx | 14 ++++---- ui/packages/i18n/src/namespaces/studio/en.ts | 2 +- ui/packages/i18n/src/namespaces/studio/zh.ts | 2 +- 7 files changed, 66 insertions(+), 31 deletions(-) diff --git a/ui/packages/app-shell/src/console/__tests__/AppContent.emptyNavigationLanding-12079.test.tsx b/ui/packages/app-shell/src/console/__tests__/AppContent.emptyNavigationLanding-12079.test.tsx index 4125ad5026d..3049bcdfa5d 100644 --- a/ui/packages/app-shell/src/console/__tests__/AppContent.emptyNavigationLanding-12079.test.tsx +++ b/ui/packages/app-shell/src/console/__tests__/AppContent.emptyNavigationLanding-12079.test.tsx @@ -269,10 +269,12 @@ describe('AppContent — an app with empty navigation lands on an empty state (o renderConsoleAt('/apps/studio'); // `metadata:directory` resolves to the app's `metadata` route, which since - // objectstack ADR-0146 D1 (N-28) opens Studio's "All metadata" area: the - // landing reached the entry, not the empty state. - expect(await screen.findByTestId('studio-probe')).toBeInTheDocument(); - expect(screen.getByTestId('pathname').textContent).toBe('/studio/~all/metadata'); + // objectstack ADR-0146 D1 (N-28) opened Studio's "All metadata" area and + // since objectstack#37565 opens Setup → Access Control → Positions and + // Permissions: the landing reached the entry, not the empty state. + await waitFor(() => + expect(screen.getByTestId('pathname').textContent).toBe('/apps/setup/component/security/access-directory'), + ); expect(screen.queryByTestId('app-no-access-empty-state')).not.toBeInTheDocument(); }); }); diff --git a/ui/packages/app-shell/src/console/__tests__/AppContent.noAppComponentRoutes.test.tsx b/ui/packages/app-shell/src/console/__tests__/AppContent.noAppComponentRoutes.test.tsx index 8d0d5f724ca..c26054845fc 100644 --- a/ui/packages/app-shell/src/console/__tests__/AppContent.noAppComponentRoutes.test.tsx +++ b/ui/packages/app-shell/src/console/__tests__/AppContent.noAppComponentRoutes.test.tsx @@ -97,7 +97,7 @@ import '@testing-library/jest-dom/vitest'; import '@objectstack/lint'; import { describe, it, expect, vi, beforeEach } from 'vitest'; import React from 'react'; -import { fireEvent, render, screen } from '@testing-library/react'; +import { fireEvent, render, screen, waitFor } from '@testing-library/react'; import { MemoryRouter, Routes, @@ -290,6 +290,8 @@ function renderConsoleAt(initialUrl: string) { } const pathname = () => screen.getByTestId('pathname').textContent; +/** objectstack#37565 — the environment directory's Setup page. */ +const SETUP_DIRECTORY = '/apps/setup/component/security/access-directory'; describe('AppContent — zero-app component/metadata destinations (objectui#3610)', () => { beforeEach(() => { @@ -361,13 +363,14 @@ describe('AppContent — zero-app component/metadata destinations (objectui#3610 // arm. That arm used to aim at `component/metadata/directory` — the second // alias, and the second blank screen without it — and since objectui#3658 // aims at the canonical directory route directly. - // Since objectstack ADR-0146 D1 (N-28) the directory is Studio's. + // Since objectstack ADR-0146 D1 (N-28) the directory was Studio's; since + // objectstack#37565 it is Setup → Access Control → Positions and Permissions. const chain = renderConsoleAt('/apps/setup/system/metadata'); - expect(await screen.findByTestId('studio-probe')).toBeInTheDocument(); - expect(chain).toEqual(['/apps/setup/system/metadata', '/studio/~all/metadata']); + await waitFor(() => expect(pathname()).toBe(SETUP_DIRECTORY)); + expect(chain).toEqual(['/apps/setup/system/metadata', SETUP_DIRECTORY]); expect(chain.some((entry) => entry.includes('component/metadata'))).toBe(false); - expect(pathname()).toBe('/studio/~all/metadata'); + expect(screen.queryByTestId('studio-probe')).not.toBeInTheDocument(); }); it('the legacy directory alias still resolves when entered directly', async () => { @@ -385,14 +388,16 @@ describe('AppContent — zero-app component/metadata destinations (objectui#3610 // wall), so the alias is live input, not a museum piece — entered directly // here, exactly as `sys-datasources` above enters the resource alias. // - // Since objectstack ADR-0146 D1 (N-28) it lands in Studio's "All metadata" - // area, still in one hop: this branch's alias aims there directly. + // Since objectstack ADR-0146 D1 (N-28) it landed in Studio's "All metadata" + // area; since objectstack#37565 the directory is Setup's, still in one hop. const chain = renderConsoleAt('/apps/setup/component/metadata/directory'); - expect(await screen.findByTestId('studio-probe')).toBeInTheDocument(); - expect(chain).toEqual(['/apps/setup/component/metadata/directory', '/studio/~all/metadata']); - expect(pathname()).toBe('/studio/~all/metadata'); - expect(screen.queryByTestId('create-first-app-btn')).not.toBeInTheDocument(); + await waitFor(() => expect(pathname()).toBe(SETUP_DIRECTORY)); + expect(chain).toEqual(['/apps/setup/component/metadata/directory', SETUP_DIRECTORY]); + expect(screen.queryByTestId('studio-probe')).not.toBeInTheDocument(); + // The destination is a Setup component page, which this zero-app branch + // serves no more than any other (objectstack#37565): what is pinned here is + // the one hop onto it, never a bounce to the host. expect(screen.queryByTestId('root-landing')).not.toBeInTheDocument(); }); diff --git a/ui/packages/app-shell/src/console/__tests__/AppContent.pseudoRouteSegments.test.tsx b/ui/packages/app-shell/src/console/__tests__/AppContent.pseudoRouteSegments.test.tsx index 7d0cbcfabc8..056dbc53b5a 100644 --- a/ui/packages/app-shell/src/console/__tests__/AppContent.pseudoRouteSegments.test.tsx +++ b/ui/packages/app-shell/src/console/__tests__/AppContent.pseudoRouteSegments.test.tsx @@ -110,10 +110,12 @@ * rendered) — the hop count is not part of their claim. */ +// Paid during collection: the pages' source reach loads it lazily (check:test-source-alias). +import '@objectstack/lint'; import '@testing-library/jest-dom/vitest'; import { describe, it, expect, vi, beforeEach } from 'vitest'; import React from 'react'; -import { render, screen } from '@testing-library/react'; +import { render, screen, waitFor } from '@testing-library/react'; import { MemoryRouter, Routes, @@ -360,6 +362,8 @@ function renderConsoleAt(initialUrl: string) { } const pathname = () => screen.getByTestId('pathname').textContent; +/** objectstack#37565 — the environment directory's Setup page. */ +const SETUP_DIRECTORY = '/apps/setup/component/security/access-directory'; beforeEach(() => { vi.clearAllMocks(); @@ -408,10 +412,8 @@ describe('AppContent pseudo-routes — live input surface stays special (objectu }); it.each([ - ['/apps/ghost/metadata', '/studio/~all/metadata'], ['/apps/ghost/metadata/_diagnostics', '/studio/~all/metadata/_diagnostics'], ['/apps/ghost/metadata/object/sys_user', '/studio/~all/metadata/object/sys_user'], - ['/apps/ghost/component/metadata/directory', '/studio/~all/metadata'], ])('unresolved app segment: the retired Setup metadata URL %s still takes the metadata branch, into Studio', async (url, studio) => { // The metadata flag must still fire for these (the branch that redirects // them is the pseudo-route's), so they reach Studio and never "App not @@ -423,6 +425,20 @@ describe('AppContent pseudo-routes — live input surface stays special (objectu expect(screen.queryByTestId('app-not-available-retry')).not.toBeInTheDocument(); }); + // objectstack#37565 — the directory itself moved to Setup → Access Control → + // Positions and Permissions: still the metadata branch, still one hop. + it.each(['/apps/ghost/metadata', '/apps/ghost/component/metadata/directory'])( + 'unresolved app segment: the retired Setup directory URL %s still takes the metadata branch, onto Setup\'s directory page', + async (url) => { + const chain = renderConsoleAt(url); + + await waitFor(() => expect(chain[chain.length - 1]).toBe(SETUP_DIRECTORY)); + expect(chain).toEqual([url, SETUP_DIRECTORY]); + expect(screen.queryByTestId('studio-probe')).not.toBeInTheDocument(); + expect(screen.queryByTestId('app-not-available-retry')).not.toBeInTheDocument(); + }, + ); + it('unresolved app segment: the host rewrite reaches Studio in ONE hop', async () => { // Lifted out of the table above so the hop COUNT can be asserted, not just // the endpoint. The host's `MetadataRedirect` rewrites this URL onto the @@ -503,7 +519,6 @@ describe('AppContent pseudo-routes — zero-app deployment (objectui#3638)', () ['/apps/setup/system/marketplace', 'marketplace-page'], // Retired into Studio (objectstack ADR-0146 D1, N-28): still the // pseudo-route branch, which is what redirects them. - ['/apps/setup/metadata', 'studio-probe'], ['/apps/setup/metadata/object', 'studio-probe'], ['/apps/setup/metadata/datasource', 'metadata-resource-list-page'], ['/apps/setup/component/metadata/resource?type=datasource', 'metadata-resource-list-page'], @@ -517,6 +532,16 @@ describe('AppContent pseudo-routes — zero-app deployment (objectui#3638)', () expect(screen.queryByTestId('create-first-app-btn')).not.toBeInTheDocument(); expect(screen.queryByTestId('root-landing')).not.toBeInTheDocument(); }); + + // objectstack#37565 — the directory is Setup's now: the pseudo-route branch still redirects it, in one hop. + it('with zero apps /apps/setup/metadata still reaches the pseudo-route branch, onto Setup\'s directory page', async () => { + metadataApps = []; + const chain = renderConsoleAt('/apps/setup/metadata'); + + await waitFor(() => expect(chain[chain.length - 1]).toBe(SETUP_DIRECTORY)); + expect(chain).toEqual(['/apps/setup/metadata', SETUP_DIRECTORY]); + expect(screen.queryByTestId('root-landing')).not.toBeInTheDocument(); + }); }); describe('AppContent pseudo-routes — a near-miss segment no longer hijacks another app (objectui#3638)', () => { 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 a043d0c4253..4a96730ee74 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,10 +318,11 @@ describe('「Add app」 offers 「New blank app」 whatever the catalog serves, ]); }); - it('an author who may enter Studio but not Setup → Packages is sent to the "All metadata" area, never Setup (objectstack#36908)', () => { + // 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)', () => { setupPair = false; const choices = addChoices(); - expect(choices.getByTestId('sidebar-app-menu-add-new-in-studio')).toHaveAttribute('href', '/studio/~all/metadata'); + expect(choices.getByTestId('sidebar-app-menu-add-new-in-studio')).toHaveAttribute('href', '/studio/~org/metadata/flow?source=runtime'); }); it.each([ @@ -685,14 +686,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 the "All metadata" area', () => { + it('an author who may not open Setup → Packages gets 「New blank app」 to Studio\'s package-less scope (objectstack#37565)', () => { 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/~all/metadata'); + ).toHaveAttribute('href', '/studio/~org/metadata/flow?source=runtime'); }); it('guard: handed no entries, it draws no 「Add app」 and no separator for it', () => { diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.notFound-26708.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.notFound-26708.test.tsx index d388cbfc9a8..f8ebd5d054f 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.notFound-26708.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.notFound-26708.test.tsx @@ -116,9 +116,10 @@ function SetupPackages() { return
{search}
; } -/** The "All metadata" area across packages. */ -function AllMetadata() { - return
; +/** Studio's package-less scope (`~org`), with the address it was opened at. */ +function OrgScope() { + const { pathname, search } = useLocation(); + return
{`${pathname}${search}`}
; } /** Holds the two capabilities Setup → Packages is shown under. */ @@ -140,7 +141,7 @@ function renderAt( } /> - } /> + } /> {/* objectstack#36904, objectstack#36903 — `/data` and `/automations` land on the area's object and flow lists. */} , { area: 'metadata' })} /> {surface}} /> @@ -212,13 +213,14 @@ describe('Studio: a package id no package has renders "package not found" (objec expect(await screen.findByTestId('setup-packages')).toHaveTextContent('?face=admin'); }); - it('for a principal who may enter Studio but not Setup → Packages, it opens the "All metadata" area, never Setup (objectstack#36908)', async () => { + // objectstack#37565 — the cross-package directory moved to Setup; the way out is the package-less scope, for now. + it('for a principal who may enter Studio but not Setup → Packages, it opens the package-less scope, never Setup (objectstack#36908)', async () => { servePackages(); renderAt(`/studio/${PHANTOM}/data`, , STUDIO_ONLY); const notFound = await screen.findByTestId('studio-package-not-found'); expect(within(notFound).queryByRole('button', { name: t('engine.studio.notFound.packageList', 'en') })).toBeNull(); within(notFound).getByRole('button', { name: t('engine.studio.notFound.allMetadata', 'en') }).click(); - expect(await screen.findByTestId('all-metadata')).toBeInTheDocument(); + expect(await screen.findByTestId('org-scope')).toHaveTextContent('/studio/~org/metadata/flow?source=runtime'); expect(screen.queryByTestId('setup-packages')).toBeNull(); }); diff --git a/ui/packages/i18n/src/namespaces/studio/en.ts b/ui/packages/i18n/src/namespaces/studio/en.ts index 8710a126f1e..81d716fc063 100644 --- a/ui/packages/i18n/src/namespaces/studio/en.ts +++ b/ui/packages/i18n/src/namespaces/studio/en.ts @@ -3520,7 +3520,7 @@ const STUDIO_EN: Record = { '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 "All metadata" area across packages. - 'engine.studio.notFound.allMetadata': 'Open All metadata', + 'engine.studio.notFound.allMetadata': 'Open organization flows', 'engine.studio.notFound.pillar': 'This page does not exist. Studio has no "{pillar}" section; pick Data, Automations, Interfaces, Access or All metadata above.', 'engine.studio.aiCopilot': 'AI Assistant', // objectui#12725 — the Studio right slot: properties OR the copilot. diff --git a/ui/packages/i18n/src/namespaces/studio/zh.ts b/ui/packages/i18n/src/namespaces/studio/zh.ts index a0300baa413..429d68e93cb 100644 --- a/ui/packages/i18n/src/namespaces/studio/zh.ts +++ b/ui/packages/i18n/src/namespaces/studio/zh.ts @@ -3105,7 +3105,7 @@ const STUDIO_ZH: Record = { 'engine.studio.desktopHint': 'Studio 专为桌面屏幕设计。', 'engine.studio.notFound.package': '未找到包。本部署没有安装 ID 为“{id}”的包,因此无处可构建。', 'engine.studio.notFound.packageList': '打开软件包列表', - 'engine.studio.notFound.allMetadata': '打开「全部元数据」', + 'engine.studio.notFound.allMetadata': '打开「组织流程」', 'engine.studio.notFound.pillar': '页面不存在。Studio 没有“{pillar}”这一栏,请在上方选择数据、自动化、界面、权限或全部元数据。', 'engine.studio.aiCopilot': 'AI 助手', // objectui#12725 — Studio 右栏:属性或 AI 助手二选一。