From 8978038bc7ebb4caedf8a1fafec92872594347d2 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 25 Nov 2026 03:37:38 +0000 Subject: [PATCH 1/5] feat(studio): one table holds the menu's type order and its common / advanced tier STUDIO_MENU_PLACEMENT lists every type the directory can list, in the ruled order, each with its tier. It holds order and tier only; a type's group stays its served domain. A pin holds it against DEFAULT_METADATA_TYPE_REGISTRY and against the ruled order. Not wired into the menu yet. Co-authored-by: Claude Claude-Session: https://claude.ai/code/session_01QSeKYkkwuF6UuFtu85Yd5H --- .changeset/37200-studio-menu-placement.md | 10 +++ .../studio-design/studioMenuPlacement.test.ts | 86 +++++++++++++++++++ .../studio-design/studioMenuPlacement.ts | 86 +++++++++++++++++++ 3 files changed, 182 insertions(+) create mode 100644 .changeset/37200-studio-menu-placement.md create mode 100644 ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.test.ts create mode 100644 ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.ts diff --git a/.changeset/37200-studio-menu-placement.md b/.changeset/37200-studio-menu-placement.md new file mode 100644 index 00000000000..4d0b51b41f5 --- /dev/null +++ b/.changeset/37200-studio-menu-placement.md @@ -0,0 +1,10 @@ +--- +'@object-ui/app-shell': patch +--- + +chore(studio): one table holds the order and the 常用 / 高级 tier of every type Studio's left menu lists + +Clause-②: no +Metadata-protocol: none + +`studioMenuPlacement.ts` adds `STUDIO_MENU_PLACEMENT`, one ordered list of `{ type, tier }` rows. The common rows are object, app, page, dashboard, report, flow, permission, agent, tool and skill, in that order; every other type the directory lists is advanced, picklist and email template included. The table holds order and tier only: a type's group stays its served registry `domain`. A test holds the list against `DEFAULT_METADATA_TYPE_REGISTRY`, so a newly registered type fails until it has a row. Nothing reads the table yet, and the menu draws exactly what it drew before. diff --git a/ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.test.ts b/ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.test.ts new file mode 100644 index 00000000000..4d53ecfe1d0 --- /dev/null +++ b/ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.test.ts @@ -0,0 +1,86 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * objectstack#37200 — Studio's menu placement table agrees with the registry + * and with the ruled order (ruling on #37192). + * + * Two holds: + * - against `DEFAULT_METADATA_TYPE_REGISTRY`: every type the directory can + * list has exactly one row, and every row names a registered, listable + * type — so a newly registered type fails here until it is placed; + * - against the ruling: the rows, in order, with their tiers. The expected + * values are literals, so a reordered or re-tiered row fails here, not in + * the menu. + * + * The ADR-0084 pin (the type table's order and tier columns equal this list) + * follows once the ADR amendment that adds those columns has merged. + */ + +import { describe, expect, it } from 'vitest'; +import { DEFAULT_METADATA_TYPE_REGISTRY } from '@objectstack/spec/kernel'; +import { HIDDEN_DIRECTORY_TYPES } from '../metadata-admin/directoryScope.js'; +import { STUDIO_MENU_PLACEMENT } from './studioMenuPlacement.js'; + +/** The types a package's directory can list: every registered type it does not hide. */ +const LISTABLE_TYPES = DEFAULT_METADATA_TYPE_REGISTRY.map((entry) => entry.type).filter( + (type) => !HIDDEN_DIRECTORY_TYPES.has(type), +); + +describe('the menu placement table agrees with the registry (objectstack#37200)', () => { + it('every type the directory can list has exactly one row', () => { + for (const type of LISTABLE_TYPES) { + expect(STUDIO_MENU_PLACEMENT.filter((row) => row.type === type).length, type).toBe(1); + } + }); + + it('every row names a registered type the directory lists', () => { + const registered = new Set(DEFAULT_METADATA_TYPE_REGISTRY.map((entry) => entry.type)); + for (const row of STUDIO_MENU_PLACEMENT) { + expect(registered.has(row.type), row.type).toBe(true); + expect(HIDDEN_DIRECTORY_TYPES.has(row.type), row.type).toBe(false); + } + }); + + it('the rows and the listable types are the same set', () => { + expect(STUDIO_MENU_PLACEMENT.map((row) => row.type).sort()).toEqual([...LISTABLE_TYPES].sort()); + }); +}); + +describe('the menu placement table holds the ruled order and tiers (objectstack#37200)', () => { + it('常用: object · app, page, dashboard, report · flow · permission · agent, tool, skill, in that order', () => { + expect(STUDIO_MENU_PLACEMENT.filter((row) => row.tier === 'common').map((row) => row.type)).toEqual([ + 'object', + 'app', 'page', 'dashboard', 'report', + 'flow', + 'permission', + 'agent', 'tool', 'skill', + ]); + }); + + it("高级: every other type, in the proposal's order", () => { + expect(STUDIO_MENU_PLACEMENT.filter((row) => row.tier === 'advanced').map((row) => row.type)).toEqual([ + 'picklist', 'hook', 'mapping', 'object_extension', 'seed', + 'view', 'action', 'dataset', + 'job', + 'doc', 'book', 'email_template', 'translation', 'api', 'datasource', 'external_catalog', + 'position', 'assignment_rule', 'sharing_rule', 'queue', 'capability', + ]); + }); + + it('the common rows come first, and every row carries one of the two tiers', () => { + const tiers = STUDIO_MENU_PLACEMENT.map((row) => row.tier); + expect(new Set(tiers)).toEqual(new Set(['common', 'advanced'])); + expect(tiers.indexOf('advanced')).toBe(tiers.lastIndexOf('common') + 1); + }); + + it('picklist and email template are advanced, as ruled', () => { + expect(STUDIO_MENU_PLACEMENT.find((row) => row.type === 'picklist')?.tier).toBe('advanced'); + expect(STUDIO_MENU_PLACEMENT.find((row) => row.type === 'email_template')?.tier).toBe('advanced'); + }); + + it('each row holds a type and a tier, and nothing else (the group stays the served domain)', () => { + for (const row of STUDIO_MENU_PLACEMENT) { + expect(Object.keys(row).sort(), row.type).toEqual(['tier', 'type']); + } + }); +}); diff --git a/ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.ts b/ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.ts new file mode 100644 index 00000000000..a6791cdb9f4 --- /dev/null +++ b/ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.ts @@ -0,0 +1,86 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * Where each metadata type sits in Studio's left menu: its order and its tier + * (objectstack ADR-0084; epic #36890, ruling on #37192). + * + * One ordered list of `{ type, tier }`. It holds order and tier ONLY: a type's + * group stays its served registry `domain`, so this table can never disagree + * with the registry about a group. + * + * ## Tiers + * + * - `common` (常用): always listed on a package, in this order — object · + * app, page, dashboard, report · flow · permission · agent, tool, skill. + * The AI group is drawn last of the visible groups, above the fold. + * - `advanced` (高级): every other type the directory lists, in one collapsed + * fold under the common groups, still under its own group label. That + * includes picklist (选项列表) and email template. + * + * A type with no row here is drawn in `advanced`, at the end of its group. It + * is never invisible; the menu applies that rule when it reads this list. + * + * ## Order + * + * A consumer sorts the entries of one group, within one tier, by the row's + * index in {@link STUDIO_MENU_PLACEMENT}. The common rows come first, in the + * ruled order; the advanced rows follow in the proposal's order, group by + * group. + * + * ## Pins + * + * `studioMenuPlacement.test.ts` holds this list against + * `DEFAULT_METADATA_TYPE_REGISTRY`: every type the directory can list has + * exactly one row, and every row names a registered type. Nothing reads the + * list yet; the menu reads it once `buildStudioMenu` orders by it. + */ + +/** A type's tier in Studio's left menu. */ +export type StudioMenuTier = 'common' | 'advanced'; + +/** One row: a metadata type and its tier. Its position in the list is its order. */ +export interface StudioMenuPlacementRow { + readonly type: string; + readonly tier: StudioMenuTier; +} + +/** Every listable metadata type, in menu order, with its tier. */ +export const STUDIO_MENU_PLACEMENT: readonly StudioMenuPlacementRow[] = Object.freeze([ + // 常用 — in the ruled order. + { type: 'object', tier: 'common' }, + { type: 'app', tier: 'common' }, + { type: 'page', tier: 'common' }, + { type: 'dashboard', tier: 'common' }, + { type: 'report', tier: 'common' }, + { type: 'flow', tier: 'common' }, + { type: 'permission', tier: 'common' }, + { type: 'agent', tier: 'common' }, + { type: 'tool', tier: 'common' }, + { type: 'skill', tier: 'common' }, + // 高级 — data + { type: 'picklist', tier: 'advanced' }, + { type: 'hook', tier: 'advanced' }, + { type: 'mapping', tier: 'advanced' }, + { type: 'object_extension', tier: 'advanced' }, + { type: 'seed', tier: 'advanced' }, + // 高级 — ui + { type: 'view', tier: 'advanced' }, + { type: 'action', tier: 'advanced' }, + { type: 'dataset', tier: 'advanced' }, + // 高级 — automation + { type: 'job', tier: 'advanced' }, + // 高级 — system (平台) + { type: 'doc', tier: 'advanced' }, + { type: 'book', tier: 'advanced' }, + { type: 'email_template', tier: 'advanced' }, + { type: 'translation', tier: 'advanced' }, + { type: 'api', tier: 'advanced' }, + { type: 'datasource', tier: 'advanced' }, + { type: 'external_catalog', tier: 'advanced' }, + // 高级 — security (访问) + { type: 'position', tier: 'advanced' }, + { type: 'assignment_rule', tier: 'advanced' }, + { type: 'sharing_rule', tier: 'advanced' }, + { type: 'queue', tier: 'advanced' }, + { type: 'capability', tier: 'advanced' }, +] as const satisfies readonly StudioMenuPlacementRow[]); From 4515399af3868ba53a567248eb488b7116d4d0bb Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 25 Nov 2026 04:22:24 +0000 Subject: [PATCH 2/5] feat(studio): place ai_context, the 33rd registered type, in the advanced tier main registers ai_context (domain ai) since the table was written; it takes an advanced row, last in ai, matching the ADR table on the M1 PR. Co-authored-by: Claude Claude-Session: https://claude.ai/code/session_01QSeKYkkwuF6UuFtu85Yd5H --- .../src/views/studio-design/studioMenuPlacement.test.ts | 1 + .../app-shell/src/views/studio-design/studioMenuPlacement.ts | 2 ++ 2 files changed, 3 insertions(+) diff --git a/ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.test.ts b/ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.test.ts index 4d53ecfe1d0..fab1fdfeadf 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.test.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.test.ts @@ -64,6 +64,7 @@ describe('the menu placement table holds the ruled order and tiers (objectstack# 'job', 'doc', 'book', 'email_template', 'translation', 'api', 'datasource', 'external_catalog', 'position', 'assignment_rule', 'sharing_rule', 'queue', 'capability', + 'ai_context', ]); }); diff --git a/ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.ts b/ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.ts index a6791cdb9f4..fb9c3b6a864 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.ts @@ -83,4 +83,6 @@ export const STUDIO_MENU_PLACEMENT: readonly StudioMenuPlacementRow[] = Object.f { type: 'sharing_rule', tier: 'advanced' }, { type: 'queue', tier: 'advanced' }, { type: 'capability', tier: 'advanced' }, + // 高级 — ai + { type: 'ai_context', tier: 'advanced' }, ] as const satisfies readonly StudioMenuPlacementRow[]); From 2eae5a0f909c14412fee58ed7599fd97015a2e1e Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 25 Nov 2026 04:27:36 +0000 Subject: [PATCH 3/5] test(studio): type the registered-type set as strings so the pin type-checks Co-authored-by: Claude Claude-Session: https://claude.ai/code/session_01QSeKYkkwuF6UuFtu85Yd5H --- .../src/views/studio-design/studioMenuPlacement.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.test.ts b/ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.test.ts index fab1fdfeadf..95a58e31016 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.test.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.test.ts @@ -34,7 +34,7 @@ describe('the menu placement table agrees with the registry (objectstack#37200)' }); it('every row names a registered type the directory lists', () => { - const registered = new Set(DEFAULT_METADATA_TYPE_REGISTRY.map((entry) => entry.type)); + const registered = new Set(DEFAULT_METADATA_TYPE_REGISTRY.map((entry) => entry.type)); for (const row of STUDIO_MENU_PLACEMENT) { expect(registered.has(row.type), row.type).toBe(true); expect(HIDDEN_DIRECTORY_TYPES.has(row.type), row.type).toBe(false); From 4442d56064a69f808965617d743e90eb1665dda0 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 25 Nov 2026 04:58:38 +0000 Subject: [PATCH 4/5] test(studio): pin the placement table to ADR-0084's Order and Tier columns The ADR's type-to-group table now carries an order and a tier per type. The pin reads it and holds the list equal to it: tier per type both ways, each row's group equal to the served domain, and the order inside each group. A drift names the type or the group. Co-authored-by: Claude Claude-Session: https://claude.ai/code/session_01QSeKYkkwuF6UuFtu85Yd5H --- .../studio-design/studioMenuPlacement.test.ts | 66 +++++++++++++++++-- 1 file changed, 61 insertions(+), 5 deletions(-) diff --git a/ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.test.ts b/ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.test.ts index 95a58e31016..6fbddb2f98a 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.test.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.test.ts @@ -4,19 +4,22 @@ * objectstack#37200 — Studio's menu placement table agrees with the registry * and with the ruled order (ruling on #37192). * - * Two holds: + * Three holds: * - against `DEFAULT_METADATA_TYPE_REGISTRY`: every type the directory can * list has exactly one row, and every row names a registered, listable * type — so a newly registered type fails here until it is placed; * - against the ruling: the rows, in order, with their tiers. The expected * values are literals, so a reordered or re-tiered row fails here, not in - * the menu. - * - * The ADR-0084 pin (the type table's order and tier columns equal this list) - * follows once the ADR amendment that adds those columns has merged. + * the menu; + * - against ADR-0084's type-to-group table: its Order and Tier columns + * equal this list, group by group, so the record and the code cannot drift + * apart; a drift either way names the type. */ import { describe, expect, it } from 'vitest'; +import { readFileSync } from 'node:fs'; +import { dirname, resolve } from 'node:path'; +import { fileURLToPath } from 'node:url'; import { DEFAULT_METADATA_TYPE_REGISTRY } from '@objectstack/spec/kernel'; import { HIDDEN_DIRECTORY_TYPES } from '../metadata-admin/directoryScope.js'; import { STUDIO_MENU_PLACEMENT } from './studioMenuPlacement.js'; @@ -85,3 +88,56 @@ describe('the menu placement table holds the ruled order and tiers (objectstack# } }); }); + +const HERE = dirname(fileURLToPath(import.meta.url)); +const ADR_0084 = resolve(HERE, '../../../../../../docs/adr/0084-application-builder-information-architecture.md'); + +/** One row of ADR-0084's type-to-group table: `| Group | domain | Order | Registered type | Tier |`. */ +interface AdrRow { + readonly domain: string; + readonly order: number; + readonly type: string; + readonly tier: 'common' | 'advanced'; +} + +const ADR_ROW = /^\| \*\*[^|]+\*\* \| `([a-z_]+)` \| (\d+) \| `([a-z_]+)`[^|]* \| (常用|高级) \|$/; + +function adrRows(): AdrRow[] { + return readFileSync(ADR_0084, 'utf8') + .split('\n') + .map((line) => ADR_ROW.exec(line.trim())) + .filter((m): m is RegExpExecArray => m !== null) + .map((m): AdrRow => ({ domain: m[1], order: Number(m[2]), type: m[3], tier: m[4] === '常用' ? 'common' : 'advanced' })); +} + +/** Each type's served registry `domain`. */ +const DOMAIN_OF = new Map(DEFAULT_METADATA_TYPE_REGISTRY.map((entry) => [entry.type, entry.domain])); + +describe("the menu placement table equals ADR-0084's Order and Tier columns (objectstack#37200)", () => { + const rows = adrRows(); + + it('the ADR table is read: one row per listable type', () => { + expect(rows.length).toBe(LISTABLE_TYPES.length); + }); + + it('every type has the same tier in the ADR and in the list', () => { + for (const row of STUDIO_MENU_PLACEMENT) { + expect(rows.find((r) => r.type === row.type)?.tier, `${row.type}: ADR-0084 row`).toBe(row.tier); + } + for (const r of rows) { + expect(STUDIO_MENU_PLACEMENT.find((row) => row.type === r.type)?.tier, `${r.type}: placement row`).toBe(r.tier); + } + }); + + it("every ADR row's group is the type's served domain", () => { + for (const r of rows) expect(DOMAIN_OF.get(r.type), r.type).toBe(r.domain); + }); + + it("inside each group, the list's order is the ADR's Order column", () => { + for (const domain of new Set(rows.map((r) => r.domain))) { + const adr = rows.filter((r) => r.domain === domain).sort((a, b) => a.order - b.order).map((r) => r.type); + const list = STUDIO_MENU_PLACEMENT.filter((row) => DOMAIN_OF.get(row.type) === domain).map((row) => row.type); + expect(list, `group ${domain}`).toEqual(adr); + } + }); +}); From 5568fa63a1698f656c29f4e2145301125d732d28 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 25 Nov 2026 04:59:19 +0000 Subject: [PATCH 5/5] docs(changeset): name the ADR-0084 pin and the ai_context row Co-authored-by: Claude Claude-Session: https://claude.ai/code/session_01QSeKYkkwuF6UuFtu85Yd5H --- .changeset/37200-studio-menu-placement.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/37200-studio-menu-placement.md b/.changeset/37200-studio-menu-placement.md index 4d0b51b41f5..73bf83a2767 100644 --- a/.changeset/37200-studio-menu-placement.md +++ b/.changeset/37200-studio-menu-placement.md @@ -7,4 +7,4 @@ chore(studio): one table holds the order and the 常用 / 高级 tier of every t Clause-②: no Metadata-protocol: none -`studioMenuPlacement.ts` adds `STUDIO_MENU_PLACEMENT`, one ordered list of `{ type, tier }` rows. The common rows are object, app, page, dashboard, report, flow, permission, agent, tool and skill, in that order; every other type the directory lists is advanced, picklist and email template included. The table holds order and tier only: a type's group stays its served registry `domain`. A test holds the list against `DEFAULT_METADATA_TYPE_REGISTRY`, so a newly registered type fails until it has a row. Nothing reads the table yet, and the menu draws exactly what it drew before. +`studioMenuPlacement.ts` adds `STUDIO_MENU_PLACEMENT`, one ordered list of `{ type, tier }` rows. The common rows are object, app, page, dashboard, report, flow, permission, agent, tool and skill, in that order; every other type the directory lists is advanced, picklist, email template and `ai_context` included. The table holds order and tier only: a type's group stays its served registry `domain`. A test holds the list against `DEFAULT_METADATA_TYPE_REGISTRY`, so a newly registered type fails until it has a row, and against the Order and Tier columns of ADR-0084's type-to-group table, so the record and the code cannot drift apart. Nothing reads the table yet, and the menu draws exactly what it drew before.