diff --git a/.changeset/37564-dataset-data-domain-common-tier.md b/.changeset/37564-dataset-data-domain-common-tier.md new file mode 100644 index 00000000000..ad5ba464413 --- /dev/null +++ b/.changeset/37564-dataset-data-domain-common-tier.md @@ -0,0 +1,15 @@ +--- +'@objectstack/spec': patch +'@object-ui/app-shell': patch +--- + +feat(studio): a dataset is a data type — Studio lists it under Data, directly after objects, and always shows datasets and positions + +Clause-②: no +Metadata-protocol: none + +`DEFAULT_METADATA_TYPE_REGISTRY` registers `dataset` under `domain: 'data'`; it was `'ui'`. A dataset is the semantic layer that charts and an AI's data questions both read, so it is data and not interface (ADR-0084, amended 2026-11-26). Nothing an author writes changes: a `*.dataset.ts` item validates and loads as it did, the `domain` enum keeps its six values, and the registry's declared type is the same. `dashboard` and `report` stay `ui` types. + +What changes is a served value. `GET /api/v1/meta/types` answers `domain: "data"` for the `dataset` entry, and because that listing is ordered by domain and then by type, the entry now sits among the data types. Code that finds the entry by its `type` sees no difference; code that selected datasets by `domain === 'ui'`, from the listing or from the exported registry, reads `'data'` instead. + +In Studio the left menu, the type directory and a dataset page's badge follow the registry, so datasets are found under Data. `STUDIO_MENU_PLACEMENT` places `dataset` and `position` in the common tier by name: a package's menu always lists both above the Advanced fold, whether the package holds one or not — dataset directly after object, position directly after permission set. diff --git a/docs/adr/0084-application-builder-information-architecture.md b/docs/adr/0084-application-builder-information-architecture.md index 881a99bcddd..d22d280366f 100644 --- a/docs/adr/0084-application-builder-information-architecture.md +++ b/docs/adr/0084-application-builder-information-architecture.md @@ -15,7 +15,8 @@ > area, and the line that kept the Platform and AI types out of the builder no longer describe the surface. Each > sentence the amendment replaces is struck or marked where it stands and points to > [Amendment (2026-11-24)](#amendment-2026-11-24); everything not marked stands. *(Amended 2026-11-26: "the -> development surface of one app" is reworded — Studio is the entry for developing a package; the note below.)* +> development surface of one app" is reworded — Studio is the entry for developing a package: +> [Amendment (2026-11-26)](#amendment-2026-11-26-position).)* > **Amendment (2026-11-25) — the menu draws two tiers, 常用 Common and 高级 Advanced.** The six groups stand. On a > package the menu lists the 常用 types under their groups, and one collapsed 高级 fold beneath them holds every other @@ -172,11 +173,12 @@ Every type the spec registers, enumerated at `origin/main` `151e8123` from `pack | Group | `domain` | Order | Registered type | Tier | |---|---|---|---|---| | **数据 Data** | `data` | 1 | `object` 对象 | 常用 | -| **数据 Data** | `data` | 2 | `picklist` 选项列表 | 高级 | -| **数据 Data** | `data` | 3 | `hook` 钩子 | 高级 | -| **数据 Data** | `data` | 4 | `mapping` 字段映射 | 高级 | -| **数据 Data** | `data` | 5 | `object_extension` | 高级 | -| **数据 Data** | `data` | 6 | `seed` | 高级 | +| **数据 Data** | `data` | 2 | `dataset` 数据集 | 常用 | +| **数据 Data** | `data` | 3 | `picklist` 选项列表 | 高级 | +| **数据 Data** | `data` | 4 | `hook` 钩子 | 高级 | +| **数据 Data** | `data` | 5 | `mapping` 字段映射 | 高级 | +| **数据 Data** | `data` | 6 | `object_extension` | 高级 | +| **数据 Data** | `data` | 7 | `seed` | 高级 | | **数据 Data** | `data` | — | `field` | — | | **界面 UI** | `ui` | 1 | `app` 应用 | 常用 | | **界面 UI** | `ui` | 2 | `page` 页面 | 常用 | @@ -184,7 +186,6 @@ Every type the spec registers, enumerated at `origin/main` `151e8123` from `pack | **界面 UI** | `ui` | 4 | `report` 报表 | 常用 | | **界面 UI** | `ui` | 5 | `view` 视图 | 高级 | | **界面 UI** | `ui` | 6 | `action` 操作 | 高级 | -| **界面 UI** | `ui` | 7 | `dataset` 数据集 | 高级 | | **自动化 Automation** | `automation` | 1 | `flow` 流程 | 常用 | | **自动化 Automation** | `automation` | 2 | `job` | 高级 | | **平台 Platform** | `system` | 1 | `doc` 文档 | 高级 | @@ -195,7 +196,7 @@ Every type the spec registers, enumerated at `origin/main` `151e8123` from `pack | **平台 Platform** | `system` | 6 | `datasource` | 高级 | | **平台 Platform** | `system` | 7 | `external_catalog` | 高级 | | **访问 Access** | `security` | 1 | `permission` 权限集 | 常用 | -| **访问 Access** | `security` | 2 | `position` 岗位 | 高级 | +| **访问 Access** | `security` | 2 | `position` 岗位 | 常用 | | **访问 Access** | `security` | 3 | `assignment_rule` 分配规则 | 高级 | | **访问 Access** | `security` | 4 | `sharing_rule` 共享规则 | 高级 | | **访问 Access** | `security` | 5 | `queue` | 高级 | @@ -207,6 +208,8 @@ Every type the spec registers, enumerated at `origin/main` `151e8123` from `pack *(Amended 2026-11-25: the table is redrawn one row per type and gains two columns, **Order** and **Tier** — [Amendment (2026-11-25)](#amendment-2026-11-25). Read again at `origin/main` `a33691e567`: 33 entries — the 32 of the first reading, each in the domain it had, and `ai_context`, registered `ai` on 2026-11-25 ([ADR-0160](./0160-record-scoped-ai-inquiry.md) D1). No type changed group, and the rows count 数据 Data 7 · 界面 UI 7 · 自动化 Automation 2 · 平台 Platform 7 · 访问 Access 6 · AI 4.)* +*(Rewritten 2026-11-26, card [#37564](https://github.com/objectstack-ai/objectstack/issues/37564), which carries out [Amendment (2026-11-26)](#amendment-2026-11-26-moves) for two rows and decides nothing: `dataset` and `position`. `dataset` is registered `data` by the same change, so its row leaves 界面 UI, where it was seventh, for 数据 Data, where it is second, directly after `object`; each 数据 Data type behind it is one place later, and its tier is 常用. `position` keeps its place, and its tier is 常用. The registry holds the same 33 entries, and the rows now count 数据 Data 8 · 界面 UI 6 · 自动化 Automation 2 · 平台 Platform 7 · 访问 Access 6 · AI 4. The `datasource` row is not touched and `form` has no row yet: each is rewritten, or written, by the change that moves it.)* + The rows are in the menu's order: by group, then by **Order**, which counts inside a group. **Tier** is 常用 Common or 高级 Advanced. The Chinese word beside a registered name is the one the ruling or its proposal uses for that type; a type neither names in Chinese has none. `field` carries no order and no tier because it draws no row (the second reading below). The table is the registry read at one commit. **The rule above is what binds**: a type added to the registry, or given another domain there, moves in the menu without this table being edited, and where the two disagree the registry is right. *(Amended 2026-11-25: that sentence is about the Group and `domain` columns. The Order and Tier columns are read from no registry — they are decided in this record, and a type the table has no row for is drawn in 高级 Advanced, at the end of its group: [Amendment (2026-11-25)](#amendment-2026-11-25).)* @@ -454,7 +457,7 @@ When the registry and the placement list have changed, the three groups these mo That makes thirteen 常用 types: the ten of 2026-11-25, and these three. -**The [type → group table](#type-to-group) is not redrawn today.** A test pins it, row by row, to the registry and to the placement list (`ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.test.ts`), and both still hold `dataset` under `ui`, `datasource` with a row, no `form`, and every tier as ruled on 2026-11-25. A row is rewritten, or written, in the change that moves it — the same pull request, since the pin fails otherwise: `dataset`'s with its registry change and its tier, `position`'s with its tier, `datasource`'s with the menu's, and `form`'s when the type is taken off the directory's hidden types. Each of those carries out this section and needs no further ruling. Until then the table is what the menu draws. +**The [type → group table](#type-to-group) is not redrawn today.** A test pins it, row by row, to the registry and to the placement list (`ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.test.ts`), and both still hold `dataset` under `ui`, `datasource` with a row, no `form`, and every tier as ruled on 2026-11-25. A row is rewritten, or written, in the change that moves it — the same pull request, since the pin fails otherwise: `dataset`'s with its registry change and its tier, `position`'s with its tier, `datasource`'s with the menu's, and `form`'s when the type is taken off the directory's hidden types. Each of those carries out this section and needs no further ruling. Until then the table is what the menu draws. *(Since rewritten: `dataset`'s row and `position`'s, by card [#37564](https://github.com/objectstack-ai/objectstack/issues/37564), with the registry change and the placement list. `datasource`'s and `form`'s still wait for their changes — the [note under the table](#type-to-group).)* ### Organization-level content {#amendment-2026-11-26-org} diff --git a/packages/spec/src/kernel/metadata-plugin.test.ts b/packages/spec/src/kernel/metadata-plugin.test.ts index 0ea7b7844b8..342f50262ec 100644 --- a/packages/spec/src/kernel/metadata-plugin.test.ts +++ b/packages/spec/src/kernel/metadata-plugin.test.ts @@ -544,5 +544,24 @@ describe('MetadataPluginProtocol', () => { expect(byDomain('ai')).toContain('tool'); expect(byDomain('ai')).toContain('skill'); }); + + // ADR-0084, amended 2026-11-26 ("Placements, and what moves to Setup"): a + // dataset is the semantic layer that charts and an AI's data questions both + // read, so it is registered `data`. One type changes domain; the two types + // that bind to it stay `ui`, and no seventh domain is made for analytics. + it('registers `dataset` under `data`, and leaves `dashboard` and `report` under `ui`', () => { + const domainOf = (type: string) => DEFAULT_METADATA_TYPE_REGISTRY.find(e => e.type === type)?.domain; + + expect(domainOf('dataset')).toBe('data'); + expect(domainOf('dashboard')).toBe('ui'); + expect(domainOf('report')).toBe('ui'); + expect(new Set(DEFAULT_METADATA_TYPE_REGISTRY.map(e => e.domain))).toEqual( + new Set(['data', 'ui', 'automation', 'system', 'security', 'ai']), + ); + // The move changes where the type is listed and nothing about how it loads. + const dataset = DEFAULT_METADATA_TYPE_REGISTRY.find(e => e.type === 'dataset')!; + expect(dataset.loadOrder).toBe(55); + expect(dataset.loadOrder).toBeLessThan(DEFAULT_METADATA_TYPE_REGISTRY.find(e => e.type === 'report')!.loadOrder); + }); }); }); diff --git a/packages/spec/src/kernel/metadata-plugin.zod.ts b/packages/spec/src/kernel/metadata-plugin.zod.ts index 76dc493b5ae..def28c774ff 100644 --- a/packages/spec/src/kernel/metadata-plugin.zod.ts +++ b/packages/spec/src/kernel/metadata-plugin.zod.ts @@ -974,7 +974,12 @@ export const DEFAULT_METADATA_TYPE_REGISTRY: MetadataTypeRegistryEntryParsed[] = { type: 'report', label: 'Report', filePatterns: ['**/*.report.ts', '**/*.report.yml'], supportsOverlay: true, allowEnvironmentOverlay: true, allowRuntimeCreate: true, supportsVersioning: true, executionPinned: false, loadOrder: 60, domain: 'ui' }, // ADR-0021: dataset is the analytics semantic layer that report/dashboard bind to. // loadOrder 55 < report/dashboard (60) so datasets register before their consumers. - { type: 'dataset', label: 'Dataset', description: 'Analytics semantic layer — dimensions & measures', filePatterns: ['**/*.dataset.ts', '**/*.dataset.yml', '**/*.dataset.json'], supportsOverlay: true, allowEnvironmentOverlay: false, allowRuntimeCreate: true, supportsVersioning: true, executionPinned: false, loadOrder: 55, domain: 'ui' }, + // ADR-0084 (amended 2026-11-26, "Placements, and what moves to Setup"): a + // dataset is a `data` type — the semantic layer that charts and an AI's data + // questions both read — so its `domain` is `data` and Studio lists it under + // 数据 Data, directly after `object`. The row stays in this block because the + // overlay notes above name it, and its schema still lives in `ui/dataset.zod.ts`. + { type: 'dataset', label: 'Dataset', description: 'Analytics semantic layer — dimensions & measures', filePatterns: ['**/*.dataset.ts', '**/*.dataset.yml', '**/*.dataset.json'], supportsOverlay: true, allowEnvironmentOverlay: false, allowRuntimeCreate: true, supportsVersioning: true, executionPinned: false, loadOrder: 55, domain: 'data' }, // Automation Protocol — flow is executionPinned (ADR-0009). // ADR-0019: there is no `approval` metadata type — approvals are Approval 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..c256297bd91 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 @@ -148,6 +148,7 @@ beforeEach(() => { setWidth(1280); reads.entries = SERVED; // The package holds objects, flows, permission sets and hooks; no app, page or position. + // (A position is 常用 since objectstack#37564: drawn on a package all the same, dimmed.) reads.sweep = { countsByType: { object: 3, flow: 2, permission: 1, hook: 27 }, packagesByType: { object: [PKG], flow: [PKG], permission: [PKG], hook: [PKG] }, @@ -323,8 +324,10 @@ describe('a package that holds nothing yet (objectstack#37201)', () => { it('lists every served 常用 type, holding one or not; a 高级 type only when held', () => { reads.entries = [ ...SERVED, + { type: 'dataset', domain: 'data' }, { type: 'dashboard', domain: 'ui' }, { type: 'report', domain: 'ui' }, + { type: 'assignment_rule', domain: 'security' }, { type: 'agent', domain: 'ai' }, { type: 'tool', domain: 'ai' }, { type: 'skill', domain: 'ai' }, @@ -333,21 +336,53 @@ describe('a package that holds nothing yet (objectstack#37201)', () => { renderAt(`/studio/${PKG}/data`); const links = (root: HTMLElement) => within(root).queryAllByRole('link').map((a) => a.getAttribute('data-testid')!.replace('studio-menu-entry-', '')); const common = links(screen.getByTestId('studio-menu')).filter((k) => !links(foldRegion()).includes(k)); + // objectstack#37564 — dataset and position are 常用 by name (ADR-0084, amended 2026-11-26). expect(common).toEqual([ 'type:object', + 'type:dataset', 'type:app', 'type:page', 'type:dashboard', 'type:report', 'type:flow', 'type:permission', + 'type:position', 'type:agent', 'type:tool', 'type:skill', ]); for (const k of common) expect(entry(k)).toHaveAttribute('data-empty', 'true'); expect(screen.queryByTestId('studio-menu-entry-type:hook')).toBeNull(); - expect(screen.queryByTestId('studio-menu-entry-type:position')).toBeNull(); + expect(screen.queryByTestId('studio-menu-entry-type:assignment_rule')).toBeNull(); + }); +}); + +describe('dataset and position are 常用, placed by name (objectstack#37564, ADR-0084 amended 2026-11-26)', () => { + const keysIn = (testId: string) => + within(screen.getByTestId(testId)) + .queryAllByRole('link', { hidden: true }) + .map((a) => a.getAttribute('data-testid')!.replace('studio-menu-entry-', '')); + + it('dataset is drawn under Data directly after object, position under Access directly after permission set, both above the fold', () => { + // Served as the registry serves it: a dataset is a `data` type. + reads.entries = [{ type: 'dataset', domain: 'data' }, ...SERVED]; + renderAt(`/studio/${PKG}/data`); + expect(keysIn('studio-menu-group-data')).toEqual(['type:object', 'type:dataset']); + expect(keysIn('studio-menu-group-security')).toEqual(['type:permission', 'type:position']); + expect(foldRegion().contains(entry('type:dataset'))).toBe(false); + expect(foldRegion().contains(entry('type:position'))).toBe(false); + // The package holds none of either: drawn all the same, as any empty 常用 type is. + expect(entry('type:dataset')).toHaveAttribute('data-empty', 'true'); + expect(entry('type:position')).toHaveAttribute('data-empty', 'true'); + expect(entry('type:dataset')).toHaveAttribute('href', `/studio/${PKG}/metadata/dataset?package=${PKG}`); + expect(entry('type:position')).toHaveAttribute('href', `/studio/${PKG}/metadata/position?package=${PKG}`); + }); + + it('CONTROL: a type the rule sorts 高级 stays inside the fold, and the UI group draws no dataset', () => { + reads.entries = [{ type: 'dataset', domain: 'data' }, ...SERVED]; + renderAt(`/studio/${PKG}/data`); + expect(foldRegion().contains(screen.getByTestId('studio-menu-entry-type:hook'))).toBe(true); + expect(keysIn('studio-menu-group-ui')).toEqual(['type:app', 'type:page']); }); }); @@ -481,13 +516,13 @@ describe('全部类型 All types (objectstack#37360, ADR-0084 amended 2026-11-25 }); it('CONTROL: the fold still leaves out a 高级 type the package holds none of', () => { - reads.entries = [...SERVED, { type: 'email_template', domain: 'system' }]; + reads.entries = [...SERVED, { type: 'email_template', domain: 'system' }, { type: 'assignment_rule', domain: 'security' }]; renderAt(`/studio/${PKG}/data`); fireEvent.click(fold()); expect(entry('allTypes')).toBeVisible(); expect(entry('type:hook')).toBeVisible(); expect(screen.queryByTestId('studio-menu-entry-type:email_template')).toBeNull(); - expect(screen.queryByTestId('studio-menu-entry-type:position')).toBeNull(); + expect(screen.queryByTestId('studio-menu-entry-type:assignment_rule')).toBeNull(); }); it.each([ 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..4dece26b11f 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 @@ -243,6 +243,7 @@ describe("on a package, the palette lists the left menu and the package's items // The menu's six groups, in the menu's order, then the packages and the // theme commands. No cross-package Objects / Flows. objectstack#37201 — // AI is drawn: its 常用 agent type is listed on a package that holds none. + // objectstack#37564 — so is `position`, 常用 by name, directly after `permission`. expect(headings()).toEqual([ group('data'), group('ui'), @@ -262,6 +263,7 @@ describe("on a package, the palette lists the left menu and the package's items 'studio-entry type:datasource', 'studio-entry diagnostics', 'studio-entry type:permission', + 'studio-entry type:position', 'studio-entry owd', 'studio-entry environment', 'studio-entry type:agent', @@ -407,7 +409,8 @@ describe("on a package, the palette lists the left menu and the package's items it("CONTROL — opened, it reads each listed type's list", async () => { mount(PKG); await itemsListed(); - expect([...reads.state.calls].sort()).toEqual(['agent', 'dashboard', 'flow', 'hook', 'object', 'permission']); + // objectstack#37564 — `position` is listed on every package, so its list is read; this package holds none. + expect([...reads.state.calls].sort()).toEqual(['agent', 'dashboard', 'flow', 'hook', 'object', 'permission', 'position']); }); }); 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..2b50313aac6 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 @@ -95,7 +95,7 @@ describe('the menu groups (objectstack#36899, ADR-0084 amended)', () => { { type: 'permission', domain: 'security' }, ]; const menu = buildStudioMenu({ scope: studioMenuScope(segment), types, counts: {} }); - // objectstack#37201 — the table's order, not the served one: permission set (常用) before position (高级). + // objectstack#37201 — the table's order, not the served one: permission set, then position. expect(keysOf(menu)).toEqual({ automation: ['orgFlows'], security: ['type:permission', 'type:position', 'environment'], @@ -108,6 +108,7 @@ describe('the menu groups (objectstack#36899, ADR-0084 amended)', () => { /** A package's served types in the server's order: by domain, then alphabetically by type. */ const SERVED = [ + { type: 'dataset', domain: 'data' }, { type: 'hook', domain: 'data' }, { type: 'mapping', domain: 'data' }, { type: 'object', domain: 'data' }, @@ -138,7 +139,7 @@ describe('the menu reads the placement table (objectstack#37201, ADR-0084 amende it("orders each group by the table, an unplaced type after the placed ones, then the entries that are not a type", () => { expect(keysOf(menu)).toEqual({ - data: ['type:object', 'type:picklist', 'type:hook', 'type:mapping', 'type:zz_unplaced'], + data: ['type:object', 'type:dataset', 'type:picklist', 'type:hook', 'type:mapping', 'type:zz_unplaced'], ui: ['type:app', 'type:page', 'type:dashboard', 'type:report', 'type:view', 'type:action'], automation: ['type:flow', 'type:job', 'orgFlows'], system: ['type:doc', 'type:book', 'type:email_template', 'diagnostics'], @@ -154,6 +155,9 @@ describe('the menu reads the placement table (objectstack#37201, ADR-0084 amende } expect(entries.find((e) => e.key === 'type:object')!.tier).toBe('common'); expect(entries.find((e) => e.key === 'type:picklist')!.tier).toBe('advanced'); + // objectstack#37564 — placed by name (ADR-0084, amended 2026-11-26). + expect(entries.find((e) => e.key === 'type:dataset')!.tier).toBe('common'); + expect(entries.find((e) => e.key === 'type:position')!.tier).toBe('common'); }); it('the four entries that are not a type are 高级 on a package', () => { @@ -165,17 +169,17 @@ describe('the menu reads the placement table (objectstack#37201, ADR-0084 amende it('splits into the 常用 groups and the 高级 fold, a group in a tier only where it holds an entry of that tier', () => { const tiers = studioMenuTiers(menu); expect(Object.fromEntries(tiers.common.map((g) => [g.group, g.entries.map((e) => e.key)]))).toEqual({ - data: ['type:object'], + // objectstack#37564 — dataset directly after object, position directly after permission set, both above the fold. + data: ['type:object', 'type:dataset'], ui: ['type:app', 'type:page', 'type:dashboard', 'type:report'], automation: ['type:flow'], - security: ['type:permission'], + security: ['type:permission', 'type:position'], ai: ['type:agent', 'type:tool', 'type:skill'], }); // 平台 Platform holds no 常用 entry: its label is drawn inside the fold alone; AI holds no 高级 one here. expect(tiers.common.map((g) => g.group)).not.toContain('system'); expect(tiers.advanced.map((g) => g.group)).toEqual(['data', 'ui', 'automation', 'system', 'security']); expect(tiers.advanced.find((g) => g.group === 'security')!.entries.map((e) => e.key)).toEqual([ - 'type:position', 'type:assignment_rule', 'owd', 'environment', @@ -193,7 +197,13 @@ describe('the menu reads the placement table (objectstack#37201, ADR-0084 amende describe('the 常用 types are always listed on a package (objectstack#37201)', () => { it('the list the directory rule keeps regardless of the sweep is the table\'s 常用 rows, in order', () => { expect(STUDIO_MENU_ALWAYS_TYPES).toEqual(STUDIO_MENU_PLACEMENT.filter((r) => r.tier === 'common').map((r) => r.type)); - expect(STUDIO_MENU_ALWAYS_TYPES).toEqual(['object', 'app', 'page', 'dashboard', 'report', 'flow', 'permission', 'agent', 'tool', 'skill']); + expect(STUDIO_MENU_ALWAYS_TYPES).toEqual([ + 'object', 'dataset', + 'app', 'page', 'dashboard', 'report', + 'flow', + 'permission', 'position', + 'agent', 'tool', 'skill', + ]); }); it("a new package's directory rule lists them though the sweep has none of them", async () => { @@ -204,7 +214,9 @@ describe('the 常用 types are always listed on a package (objectstack#37201)', packagesByType: {}, always: STUDIO_MENU_ALWAYS_TYPES, }).map((e) => e.type); - expect(listed.sort()).toEqual(['agent', 'app', 'dashboard', 'flow', 'object', 'page', 'permission', 'report', 'skill', 'tool']); + expect(listed.sort()).toEqual([ + 'agent', 'app', 'dashboard', 'dataset', 'flow', 'object', 'page', 'permission', 'position', 'report', 'skill', 'tool', + ]); }); }); 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 6fbddb2f98a..29549869006 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 @@ -2,7 +2,8 @@ /** * objectstack#37200 — Studio's menu placement table agrees with the registry - * and with the ruled order (ruling on #37192). + * and with the ruled order (ruling on #37192; ADR-0084 amended 2026-11-26, + * objectstack#37564: `dataset` and `position` placed in 常用 by name). * * Three holds: * - against `DEFAULT_METADATA_TYPE_REGISTRY`: every type the directory can @@ -50,12 +51,12 @@ describe('the menu placement table agrees with the registry (objectstack#37200)' }); 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', () => { + it('常用: object, dataset · app, page, dashboard, report · flow · permission, position · agent, tool, skill, in that order', () => { expect(STUDIO_MENU_PLACEMENT.filter((row) => row.tier === 'common').map((row) => row.type)).toEqual([ - 'object', + 'object', 'dataset', 'app', 'page', 'dashboard', 'report', 'flow', - 'permission', + 'permission', 'position', 'agent', 'tool', 'skill', ]); }); @@ -63,10 +64,10 @@ describe('the menu placement table holds the ruled order and tiers (objectstack# 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', + 'view', 'action', 'job', 'doc', 'book', 'email_template', 'translation', 'api', 'datasource', 'external_catalog', - 'position', 'assignment_rule', 'sharing_rule', 'queue', 'capability', + 'assignment_rule', 'sharing_rule', 'queue', 'capability', 'ai_context', ]); }); @@ -82,6 +83,16 @@ describe('the menu placement table holds the ruled order and tiers (objectstack# expect(STUDIO_MENU_PLACEMENT.find((row) => row.type === 'email_template')?.tier).toBe('advanced'); }); + // ADR-0084, amended 2026-11-26 ("Placements, and what moves to Setup"): two + // placements by name. The rule's tests alone would sort each of them 高级. + it('dataset and position are common, placed by name: dataset directly after object, position directly after permission', () => { + const types = STUDIO_MENU_PLACEMENT.map((row) => row.type); + expect(STUDIO_MENU_PLACEMENT.find((row) => row.type === 'dataset')?.tier).toBe('common'); + expect(STUDIO_MENU_PLACEMENT.find((row) => row.type === 'position')?.tier).toBe('common'); + expect(types.indexOf('dataset')).toBe(types.indexOf('object') + 1); + expect(types.indexOf('position')).toBe(types.indexOf('permission') + 1); + }); + 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']); @@ -141,3 +152,42 @@ describe("the menu placement table equals ADR-0084's Order and Tier columns (obj } }); }); + +/** One group of the menu as the list and the registry draw it: its 常用 types, then its 高级 types. */ +function groupTiers(domain: string): { common: string[]; advanced: string[] } { + const rows = STUDIO_MENU_PLACEMENT.filter((row) => DOMAIN_OF.get(row.type) === domain); + return { + common: rows.filter((row) => row.tier === 'common').map((row) => row.type), + advanced: rows.filter((row) => row.tier === 'advanced').map((row) => row.type), + }; +} + +describe('the groups the 2026-11-26 placements touch read as ADR-0084 lists them (objectstack#37564)', () => { + it('the registry serves dataset under data, so the menu draws it in 数据 Data with no special case', () => { + expect(DOMAIN_OF.get('dataset')).toBe('data'); + expect(DOMAIN_OF.get('dashboard')).toBe('ui'); + expect(DOMAIN_OF.get('report')).toBe('ui'); + }); + + it('数据 Data: object · dataset | picklist · hook · mapping · object_extension · seed', () => { + expect(groupTiers('data')).toEqual({ + common: ['object', 'dataset'], + advanced: ['picklist', 'hook', 'mapping', 'object_extension', 'seed'], + }); + }); + + // `form` joins the 常用 types here, after `report`, when its type is registered and listed (ADR-0159). + it('界面 UI closes up behind dataset: app · page · dashboard · report | view · action', () => { + expect(groupTiers('ui')).toEqual({ + common: ['app', 'page', 'dashboard', 'report'], + advanced: ['view', 'action'], + }); + }); + + it('访问 Access: permission · position | assignment_rule · sharing_rule · queue · capability', () => { + expect(groupTiers('security')).toEqual({ + common: ['permission', 'position'], + advanced: ['assignment_rule', 'sharing_rule', 'queue', 'capability'], + }); + }); +}); 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 a4a471023d2..a7f3f66e3f0 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.ts @@ -2,7 +2,8 @@ /** * Where each metadata type sits in Studio's left menu: its order and its tier - * (objectstack ADR-0084; epic #36890, ruling on #37192). + * (objectstack ADR-0084; epic #36890, ruling on #37192; amended 2026-11-26, + * "Placements, and what moves to Setup", objectstack#37564). * * 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 @@ -10,9 +11,10 @@ * * ## 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. + * - `common` (常用): always listed on a package, in this order — object, + * dataset · app, page, dashboard, report · flow · permission, position · + * 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. @@ -21,6 +23,13 @@ * is never invisible: `buildStudioMenu` (`studioMenuModel.ts`) applies that * rule when it reads this list (objectstack#37201). * + * ## Placements by name + * + * The rule that sorts a type into a tier has three tests (ADR-0084, amended + * 2026-11-25). Where the maintainer places a type by name, the name decides, + * and the row says so beside it. `dataset` and `position` are two such rows: + * the rule alone would sort each of them `advanced`. + * * ## Order * * `buildStudioMenu` sorts the entries of one group by the row's index in @@ -36,7 +45,8 @@ * directory can list has exactly one row, and every row names a * registered, listable type; * - the ruled order: the rows, in order, with their tiers, as literals - * (ruling on #37192), so a reordered or re-tiered row fails there; + * (ruling on #37192, and the placements by name of 2026-11-26), so a + * reordered or re-tiered row fails there; * - ADR-0084: its type-to-group table's Order and Tier columns equal this * list, group by group. * @@ -57,12 +67,20 @@ export interface StudioMenuPlacementRow { export const STUDIO_MENU_PLACEMENT: readonly StudioMenuPlacementRow[] = Object.freeze([ // 常用 — in the ruled order. { type: 'object', tier: 'common' }, + // Placed by name, directly after `object`: a dataset is the semantic layer + // that charts and an AI's data questions both read. Its schema requires one + // object, so the rule's first test alone would sort it 高级. + { type: 'dataset', 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' }, + // Placed by name, directly after `permission`: a position is one slot per + // name in the environment, not in the package (ADR-0150 D7), so the rule's + // third test alone would sort it 高级. + { type: 'position', tier: 'common' }, { type: 'agent', tier: 'common' }, { type: 'tool', tier: 'common' }, { type: 'skill', tier: 'common' }, @@ -75,7 +93,6 @@ export const STUDIO_MENU_PLACEMENT: readonly StudioMenuPlacementRow[] = Object.f // 高级 — ui { type: 'view', tier: 'advanced' }, { type: 'action', tier: 'advanced' }, - { type: 'dataset', tier: 'advanced' }, // 高级 — automation { type: 'job', tier: 'advanced' }, // 高级 — system (平台) @@ -87,7 +104,6 @@ export const STUDIO_MENU_PLACEMENT: readonly StudioMenuPlacementRow[] = Object.f { 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' },