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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .changeset/37564-dataset-data-domain-common-tier.md
Original file line number Diff line number Diff line change
@@ -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.
21 changes: 12 additions & 9 deletions docs/adr/0084-application-builder-information-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -172,19 +173,19 @@ 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` 页面 | 常用 |
| **界面 UI** | `ui` | 3 | `dashboard` 仪表盘 | 常用 |
| **界面 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` 文档 | 高级 |
Expand All @@ -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` | 高级 |
Expand All @@ -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).)*
Expand Down Expand Up @@ -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}

Expand Down
19 changes: 19 additions & 0 deletions packages/spec/src/kernel/metadata-plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
});
7 changes: 6 additions & 1 deletion packages/spec/src/kernel/metadata-plugin.zod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
41 changes: 38 additions & 3 deletions ui/packages/app-shell/src/views/studio-design/StudioMenu.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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] },
Expand Down Expand Up @@ -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' },
Expand All @@ -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']);
});
});

Expand Down Expand Up @@ -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([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand All @@ -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',
Expand Down Expand Up @@ -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']);
});
});

Expand Down
Loading
Loading