Repository navigation
Commit bbb4ad3
feat(studio): 全部类型 All types ends the 高级 fold, and the type directory lists every type a package could hold (#37380)
Fixes #37360
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 用户能看到什么变化:在 Studio
左侧菜单的「高级」折叠区最下面,多了一行「全部类型」;点开是类型目录页,列出六个分组里的所有类型,这个应用还没有的类型标着「还没有」,并写明在这里能否新建。
- 为什么做:属于 Studio 左侧菜单改版;替从零新建应用的开发者解决邮件模板、文档、字段映射这类东西的第一条无处新建的问题。
- 出错会怎样:打开「全部类型」的开发者可能看到某个类型的「还没有」标错;「高级」里原有的行不受影响,本改动可以整体撤回。
- 要你做什么:本改动在架构决策记录里加了一句修订,需要你亲手合并或批准。
## What changes
Implements ruling **A** on #37360 (ruling record [comment
7177310364](#37360 (comment)),
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.
<details><summary>Affected package tests (narrowed, declared)</summary>
- `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.
</details>
<details><summary>Type check</summary>
`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.)
</details>
<details><summary>Derived gate families</summary>
`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.
</details>
<details><summary>Ablations</summary>
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`).
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01QSeKYpEsWWE9Y5YtSsDgqZ)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 40914bd commit bbb4ad3
14 files changed
Lines changed: 509 additions & 27 deletions
File tree
- .changeset
- docs/adr
- ui/packages
- app-shell/src/views
- metadata-admin
- studio-design
- i18n/src/namespaces/studio
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
| 220 | + | |
| 221 | + | |
220 | 222 | | |
221 | 223 | | |
222 | 224 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
0 commit comments