Skip to content

feat(studio): 全部类型 All types ends the 高级 fold, and the type directory lists every type a package could hold - #37380

Draft
objectstack-fleet[bot] wants to merge 3 commits into
mainfrom
claude/issue-37360-advanced-all-types
Draft

objectstack-fleet[bot] wants to merge 3 commits into
mainfrom
claude/issue-37360-advanced-all-types

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #37360
Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:在 Studio 左侧菜单的「高级」折叠区最下面,多了一行「全部类型」;点开是类型目录页,列出六个分组里的所有类型,这个应用还没有的类型标着「还没有」,并写明在这里能否新建。
  • 为什么做:属于 Studio 左侧菜单改版;替从零新建应用的开发者解决邮件模板、文档、字段映射这类东西的第一条无处新建的问题。
  • 出错会怎样:打开「全部类型」的开发者可能看到某个类型的「还没有」标错;「高级」里原有的行不受影响,本改动可以整体撤回。
  • 要你做什么:本改动在架构决策记录里加了一句修订,需要你亲手合并或批准。

What changes

Implements ruling A on #37360 (ruling record comment 7177310364, maintainer, verbatim: 「37360 同意」).

  • The row. On a package, the 高级 Advanced fold ends with one row, 「全部类型」 All types, below its groups and under no group's label. It opens the area's type directory (/studio/PKG/metadata), and on that page it is the current entry, so the fold opens by itself there without writing its cookie. A menu search lists it last when its name matches. ~org and ~all draw no fold and no row. The row is not part of buildStudioMenu's groups, so the fold's rule does not change: a 高级 type is drawn when the package holds one, and appears there by itself once it does.
  • The directory. On a package under Studio's area, the page lists the types the package holds exactly as before (the shared scopeDirectoryEntries rule is untouched, so the menu and the directory still agree on what a package holds) and, after them in each group, every other served type of the menu's six groups (directoryNotHeldEntries). Each of those is marked "None yet" / 「还没有」 in place of an item count, with the existing state word for what can be done there (read-only / can be customized / can be added / writable). A tile opens the type's list, which carries New. A failed diagnostics sweep says nothing about what the package holds, so then nothing is marked or added. The cross-package leg and Setup's directory list as before.
  • ADR-0084 gains one dated amendment line under "Entries that are not a type": the fifth entry, 全部类型, the fold's last row, the one entry under no group; the fold's rule stands.
  • Studio catalogue keys (en, zh): engine.studio.menu.allTypes, engine.directory.notHeld, engine.directory.notHeldTitle, engine.directory.notHeldReadOnlyTitle. The palette's entry-icon map gains the new entry kind (the palette lists only the menu's groups, so it draws nothing new).

Read first (by risk):

  1. ui/packages/app-shell/src/views/metadata-admin/DirectoryPage.tsx — directoryNotHeldEntries and the notHeldEntries memo (the diagError guard), and the tile's not-held badge.
  2. ui/packages/app-shell/src/views/studio-design/StudioMenu.tsx — renderAllTypes inside the fold region, after renderGroups(tiers.advanced, 'advanced'), and currentIsAdvanced.
  3. ui/packages/app-shell/src/views/studio-design/studioMenuModel.ts — studioMenuAllTypesEntry and the area-root branch of studioMenuCurrentKey.

Tests

Pins (each ablated once, below):

  • The row exists and is last, under no group — StudioMenu.test.tsx › 全部类型 All types: the last link of the fold region, after every studio-menu-advanced-group-*, inside no data-sidebar="group" and under no group label; href /studio/PKG/metadata. Model pins in studioMenuModel.test.ts (package only; in no group of the menu or either tier).
  • The directory lists held and not-held types correctly — DirectoryPage.allTypes-37360.test.tsx: held types first with their counts and no mark; then each group's not-held types marked "None yet" with no count and the right state word (api read-only, doc addable, email_template writable); a type outside the six groups and the hidden field are never listed; a failed sweep marks nothing; the cross-package leg is unchanged.
  • A not-held type's tile reaches a list with New — same file: clicking the email_template tile routes to /studio/PKG/metadata/email_template?package=PKG, where the real list page renders metadata-list-create.
  • CONTROL: the fold still omits a not-held type — StudioMenu.test.tsx (rendered: email_template and position served, held by none, absent from the open fold while 全部类型 is there) and studioMenuModel.test.ts (the shared rule plus buildStudioMenu).

Rewritten on purpose (each marked in place): studioMenuModel.test.ts "nothing at the directory" → the directory's current entry is allTypes; StudioDesignSurface.metadataArea-28561.test.tsx "The directory is no one entry's page" → the current link is studio-menu-entry-allTypes; metadataAreaHost.scope-28561.test.tsx kernel-package directory read "No matches" → it lists the kernel package's not-held types, scoped to it, URL unrepaired.

Ablations (one per pin, each through scripts/ablation-replace.mjs, anchor hit 1 → 0, blob changed, restored to the HEAD blob with git diff HEAD empty; tests import the source by relative path, so no dist/ is involved):

Pin Mutation Result
Row last, under no group drop the row's render in the fold red: Unable to find an element by: [data-testid="studio-menu-entry-allTypes"]
Directory lists held + not-held directoryNotHeldEntries returns nothing red: expected [ 'hook', 'object' ] to deeply equal [ Array(5) ]
Not-held tile reaches list with New a not-held tile links to . red: the tile's href assertion
CONTROL fold omits not-held the menu's always list becomes every served type red: expected ... to be null on studio-menu-entry-type:email_template

Readings are in the details blocks under Verification.

Acceptance notes

  • The six types that cannot be created in Studio are listed, marked read-only (the choice the ruling left to execution). Reasons: the ruling's own words are "every type of the six groups", and leaving six out would need a second hand-kept exception list beside the registry the page reads; listing them tells a builder the type exists and that its items come from code, which is the question the page answers; the page already carries the read-only word and the "Hide read-only" filter, which drops them in one click (pinned).
  • Not-held types are listed on a read-only package too, with the same state word the page already draws there: a read-only base's New lands in its .custom pair (ADR-0146 D3), so the list can still make a first item.
  • A failed diagnostics sweep adds and marks nothing: it answered nothing about what the package holds, and "None yet" on every type would be a wrong claim (pinned).
  • The menu's ⌘K palette does not list 全部类型: it lists the menu's groups, and the row sits in none. Its icon map gained the kind only because the map is typed over every entry kind.
  • Files beyond the claim's surface: StudioPaletteGroups.tsx (one icon row, required by its typed map), and two test files whose pins described the old directory (StudioDesignSurface.metadataArea-28561.test.tsx, metadataAreaHost.scope-28561.test.tsx), each rewritten on purpose.
  • Browser walk on a new empty package (the card's suggested end-to-end check): NOT MEASURED, reason: not run in this container; the routing from tile to list and New is pinned over the real directory and list pages in jsdom.

Verification

Two-minute check: open Studio on a new, empty app, expand 「高级」 and click its last row 「全部类型」; expect every type under its group, e.g. 邮件模板 tile with 「还没有」 and 「可写」, and clicking it opens the empty email-template list with 「新建」.

All readings on head 45ed0a4bf5c unless noted.

Affected package tests (narrowed, declared)
  • ui: pnpm exec vitest run --maxWorkers=2 packages/app-shell/src/views/studio-design/ packages/app-shell/src/views/metadata-admin/DirectoryPage packages/app-shell/src/views/metadata-admin/metadataAreaHost packages/i18n/ on 122de301019 — Test Files 2 failed / 397 passed, Tests 2 failed / 4399 passed / 13 skipped: the two failures were the pins that described the old directory, rewritten on purpose in 8c09070ce61.
  • Re-run on 45ed0a4bf5c of those two files plus the three new-pin files: Test Files 5 passed (5), Tests 90 passed (90), lock VERDICT command-exit 0.
  • Every other test file under ui that names the menu, the palette or the directory (22 files: the console AppContent.* landings, UnifiedSidebar.studioNoHome-12113, ResourceListPage.setupPosture-12606, check-i18n-call-site-keys, …) on 45ed0a4bf5c: Test Files 22 passed (22), Tests 607 passed (607), lock VERDICT command-exit 0.
  • Declared narrowing: the rest of @object-ui/app-shell's suite (about 2,000 files that import none of the changed modules) is left to CI's Test UI.
Type check

pnpm --filter @object-ui/app-shell --filter @object-ui/i18n run type-check on 45ed0a4bf5c: both Done, lock VERDICT command-exit 0. (The first run, before 45ed0a4bf5c, was red on the palette's entry-icon map, TS2741 Property 'allTypes' is missing; fixed there.)

Derived gate families

node scripts/pm/dispatch-gates.mjs --commands on 45ed0a4bf5c: 48 commands, all run, each exit 0 (exit captured before any pipe), including pnpm --dir ui exec vitest run scripts/ (Test Files 172 passed / 2 skipped). --ran reconciliation: "48 derived famil(ies) accounted for — 48 run, 0 NOT-MEASURED (a DERIVED zero — all 48 recorded an exit code and none of them is 3)".

node scripts/pm/overlap-check.mjs on 45ed0a4bf5c: origin/main merges cleanly; #37368 and #37362 (share the studio catalogues) merge cleanly; VERDICT clean exit 0.

Ablations

Each through node scripts/ablation-replace.mjs --file F --anchor A --replacement R -- (the pin's test, under the verify lock); every leg printed "ok mutation landed: anchor 1 -> 0" and "ok restored: blob == HEAD … and git diff HEAD is empty"; tree clean after (0 changed paths).

  • A, StudioMenu.tsx row render → {null}: Tests 1 failed — Unable to find an element by: [data-testid="studio-menu-entry-allTypes"].
  • B, directoryNotHeldEntries → return []: Tests 1 failed — expected [ 'hook', 'object' ] to deeply equal [ Array(5) ].
  • C, tile to={notHeld ? '.' : href}: Tests 1 failed — the tile's href assertion.
  • D, studioMenuData.ts always: → every served type: Tests 1 failed — expected … to be null (the fold drew type:email_template).

Generated by Claude Code

…y lists every type of the six groups

The fold's last row, under no group, opens the area's type directory. On a
package the directory now lists the types the package holds as before and,
after them, every other type of the menu's six groups, marked "None yet"
with the state word for what can be done there. The fold's own rule is
unchanged. ADR-0084 gains the dated amendment line.

Claude-Session: https://claude.ai/code/session_01QSeKYpEsWWE9Y5YtSsDgqZ
Co-Authored-By: Claude <noreply@anthropic.com>
…ory lists its not-held types

Two pins written before the row existed are rewritten on purpose: the area's
root is now the current page of 全部类型 All types, and a package that holds
none of the served types lists each as held by none yet instead of "No matches".
Adds the changeset.

Claude-Session: https://claude.ai/code/session_01QSeKYpEsWWE9Y5YtSsDgqZ
Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/l documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 26, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/l tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Decision] Studio「高级」里一条都没有的类型(如邮件模板、文档、字段映射),从哪里新建第一条

2 participants