Repository navigation
Commit 8316d3d
feat(studio): the left menu reads the placement table — 常用 types first, the rest in one 「高级」 fold (#37341)
Fixes #37201
Fixes #37211
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 用户能看到什么变化:在 Studio 里打开一个软件包,左侧菜单先列常用的十项(对象 · 应用、页面、仪表盘、报表 · 流程 · 权限集 ·
智能体、工具、技能),其余全部收进底部默认收起的「高级」;分组名变成灰色小字、不再带数字,条目旁的灰色数字只表示有多少条。
- 为什么做:这是 Studio
重构专题里「左侧菜单分常用和高级两层」那项裁决的落地,解决菜单二十多项一样重、重点不清的问题,也让新建的空软件包能看到应用、页面、仪表盘、报表的入口。
- 出错会怎样:受影响的只是菜单怎么排、怎么折叠,地址和收藏链接一个没改,打不开的页面不会因此出现;撤回只需回退这一个改动。
- 要你做什么:无。
## What changes
`buildStudioMenu` (`studioMenuModel.ts`) now reads the placement table
`STUDIO_MENU_PLACEMENT` (landed in #37232):
- **Order.** Inside each group the type entries follow the table's row
order; a type with no row comes after the placed ones in served order;
the four entries that are not a type (organization flows, diagnostics,
default sharing, the environment catalog) follow the types of their
group, as before.
- **Tier.** Every entry carries `tier: 'common' | 'advanced'` from its
row; a type with no row is `advanced`; the four non-type entries are
`advanced` (ruling 7151834490, ADR-0084 amendment of 2026-11-25).
- **Always listed.** The directory rule's `always` list is now
`STUDIO_MENU_ALWAYS_TYPES`, the table's 常用 rows (it was
`STUDIO_MENU_DESIGNER_TYPES`, object · flow · permission). A new package
shows app, page, dashboard, report and the three AI types before it
holds one.
- **Empty.** A 常用 entry on a package is `empty` only when the
diagnostics sweep has answered (`settled`) and counts none of it. The
menu passes `countsAnswered` (`studioMenuData.ts`): settled **and** not
failed, because a server without the sweep answers no counts, not "none
of each". The palette's own `settled` is unchanged.
- **Groups.** A group is returned only where it holds an entry, on every
scope; `studioMenuTiers()` splits the menu into the 常用 groups and the 高级
fold's groups, each holding only its tier's entries.
`StudioMenu.tsx` draws it:
- Group labels: 11 px, muted, no count, no link, not focusable (the icon
stays at reduced opacity). The group-count test id
`studio-menu-group-count-GROUP` is gone; nothing else's id changes.
- Entry counts: muted, items only (unchanged class; new test id
`studio-menu-count-KEY`).
- An empty 常用 entry: dimmed label, no number (never "0"), still a link,
with a tooltip; marked `data-empty="true"`.
- Below a divider, one 「高级」 / "Advanced" button (`aria-expanded`,
`aria-controls` → the region) over a region holding the 高级 groups
(`studio-menu-advanced-group-GROUP`). The region stays in the DOM with
`hidden` when closed.
- Closed by default; a click writes `studio_menu_advanced=true|false`
(path `/`, 7 days, the menu collapse cookie's lifetime), apart from
`studio_menu_state`.
- Open by itself while the current entry is a 高级 one (a bookmark to the
hook list, the default sharing overview), without writing the cookie;
the author can still close it there.
- A search lists the matches of both tiers flat, under their group
labels, with no fold.
- `~org` and `~all` draw no fold: their entries are listed flat, in the
table's order, under the same muted labels.
⌘K: no change to the palette model. It reads `buildStudioMenu`'s output,
so it lists the same entries in the new order and ignores the fold; on a
package it now also shows the AI group, because its 常用 agent type is
always listed (`StudioPaletteGroups.surfaceScope-36900.test.tsx` updated
on purpose).
`studioMenuPlacement.ts`: #37232's L1 N1 carried. The `## Pins` block
names the three pins (the registry, the ruled order, ADR-0084), and "the
menu applies that rule when it reads this list" is now true and says
where (`buildStudioMenu`).
i18n: two keys added in `studio/{en,zh}.ts` —
`engine.studio.menu.advanced` (Advanced / 高级) and
`engine.studio.menu.emptyType`. None removed;
`engine.studio.menu.typeCount` is now unread (see Acceptance notes).
No route, address, entry key or entry test id changes.
## Tests
- `studioMenuModel.test.ts`
- **`:64` rewritten on purpose**: "a package draws all six groups, an
empty one included" → "a package draws a group only where it holds an
entry" (with no type served, only the non-type entries' groups).
- New: table order with an unplaced type and the non-type entries last;
tier stamping (rows, unplaced → advanced); the four non-type entries are
高级; `studioMenuTiers` (a group in a tier only where it has an entry of
that tier; 平台 only in the fold); addresses and keys unchanged;
`STUDIO_MENU_ALWAYS_TYPES` = the 常用 rows and the directory rule lists
them on a package that holds none; empty = settled ∧ no item (not before
settled, never on 高级, never off a package); the cookie reader.
- The `~org`/`~all` case now expects the table's order (permission
before position).
- `StudioMenu.test.tsx`: group labels muted with no count / link; muted
item count; tier-labelled groups; empty 常用 type dimmed, numberless (no
"0" either), a link; not empty before the sweep answers or when it
failed; a new package lists every 常用 type; the fold (closed by default,
`aria-expanded` / `aria-controls`, the cookie written on click and read
on remount, open by itself on a bookmark to 钩子 with no cookie written,
closable there, a 常用 page leaves it closed, search ignores it); focus
order toggle → search → 常用 entries → 高级 button → its entries; `~org` /
`~all` flat with no fold and, for #37211, no count above Organization
flows.
- `StudioPaletteGroups.surfaceScope-36900.test.tsx`,
`StudioDesignSurface.notFound-26708.test.tsx`: expectations moved on
purpose (the AI group in ⌘K; the 常用 groups and the fold on a listed
package).
- `ui/e2e/studio-left-menu-36899.spec.ts` (Chromium, real Tailwind): the
six-groups case now reads the 常用 groups; a new case lays out the fold
closed, opened by a click, its cookie written and kept across a reload.
<details><summary>Local runs (head <code>ff794532</code>; the readings
below name the tree each was taken on)</summary>
- `ui`: `vitest run packages/app-shell/src/views/studio-design/
packages/app-shell/src/views/metadata-admin/` at `ba3afa16` less one
fix: **Test Files 1 failed | 1078 passed (1079)**, Tests 1 failed |
10757 passed | 1 skipped. The one failure was
`StudioDesignSurface.notFound-26708.test.tsx` "CONTROL — a listed
package renders its builder" (it expected all six groups drawn on a
package); fixed in `ba3afa16`, re-run green: 2 files, 18 passed.
- Menu, palette and surface files at `b5b0f6ad` + the fixture fix:
**Test Files 6 passed (6), Tests 97 passed (97)**.
- `pnpm --filter @object-ui/app-shell type-check` (both `tsc` programs,
the test one included): exit 0 at `ff794532`'s bytes. The first run,
before `ff794532`, was red on the search fixture missing `tier` (TS2345
x4) — the reason for that commit.
- `ui/e2e/studio-left-menu-36899.spec.ts`, Chromium, with the Console
web server switched off (the spec bundles and serves its own page): **4
passed**.
- `pnpm --dir ui exec vitest run scripts/`: Test Files 172 passed | 2
skipped, Tests 5130 passed | 2 skipped.
- `eslint` on the 11 changed ui files: exit 0.
- Derived gate families (`dispatch-gates.mjs --commands`): 38 derived,
38 run, every one exit 0; `--ran` reconciliation: "38 run, 0
NOT-MEASURED (a DERIVED zero)". Before every push:
`check:test-source-alias` exit 0, `ui check:i18n-keys` exit 0,
`overlap-check.mjs` "VERDICT clean exit 0" (against `origin/main` and
#37315, which shares the two studio i18n files and merges cleanly).
</details>
<details><summary>Ablations: 17 of 17 red, each restored to the HEAD
blob</summary>
Committed implementation first (`b5b0f6ad`); each row mutated one anchor
through `scripts/ablation-replace.mjs` (anchor hit 1 → 0, blob moved,
restored blob equal to HEAD, `git diff HEAD` empty) and ran
`studioMenuModel.test.ts` + `StudioMenu.test.tsx` (45 tests; all green
unmutated). The test files are resolved from `ui/` source by vitest, so
there is no `dist/` leg.
| # | Mutation | Result |
|---|---|---|
| A1 | no sort by the placement table | 4 failed |
| A2 | every type stamped 常用 | 8 failed |
| A3 | organization flows stamped 常用 | 4 failed |
| A4 | always-listed = the old object · flow · permission | 8 failed |
| A5 | empty without `settled` | 3 failed |
| A6 | a failed sweep counts as answered | 1 failed |
| A7 | a group drawn in a tier with no entry of it | 2 failed |
| A8 | group label not muted | 3 failed |
| A9 | an empty 常用 type still shows its number | 1 failed |
| A10 | an empty 常用 type not dimmed | 1 failed |
| A11 | fold open by default | 4 failed |
| A12 | a click writes no cookie | 2 failed |
| A13 | no self-open on a 高级 page | 2 failed |
| A14 | the self-open writes the cookie | 1 failed |
| A15 | the search honours the fold | 2 failed |
| A16 | a fold on `~org` / `~all` | 2 failed |
| A17 | no `aria-controls` | 1 failed |
A first pass of this table is not counted: three rows (A6, A12, A14)
were refused by `ablation-replace.mjs` before running (the replacement
was a substring of the anchor), and A9 stayed green — no test had an
empty 常用 type with a served count of 0. That pin was added (`b5b0f6ad`,
"a sweep that counts 0 of it: still no number, never 0") and the whole
table re-run.
</details>
## Acceptance notes
- `engine.studio.menu.typeCount` ("{count} types") has no reader after
this change; `check:i18n-dead-keys` reports it as a candidate. It ships
in the released `@object-ui/i18n` catalogue, and this card's rule is
additive-only, so it stays.
- "Empty" uses `countsAnswered` (settled and the sweep did not fail)
rather than the bare `settled`: on a failed sweep `settled` is true with
no counts, which would have dimmed every 常用 type.
- `studio-menu-group-GROUP` now names the 常用 (or flat) instance of a
group; the fold's instance is `studio-menu-advanced-group-GROUP`.
- Follow-up decision cards F1–F3 from proposal §3.10 are the seat's to
file when this lands (card Notes).
## Verification
**Browser walk-through on a live showcase stack** — measured, not
described. Own ports, torn down after: backend `examples/app-showcase`
`objectstack dev --seed-admin --fresh -p 38417` (built tree at
`b5b0f6ad`, `pnpm build` 121/121), Console from `ui/` source
(`ui/apps/console`, `vite --port 5197 --strictPort`, `DEV_PROXY_TARGET`
the backend). Driven with Playwright/Chromium at 1280 px, signed in as
the seeded admin; the menu was read from the DOM after the reads
settled, and screenshots were checked.
1. **Package scope, 高级 closed** —
`/studio/com.example.showcase/metadata/object?package=com.example.showcase`,
fresh browser. Fold: a `BUTTON` "Advanced", `aria-expanded=false`,
`aria-controls` resolves to the region. Drawn: Data — Object 24
(current) · UI — Application 1, Page 29, Dashboard 3, Report 4 ·
Automation — Flow 33 · Access — Permission Set 9 · AI — AI Agent, AI
Tool, AI Skill (dimmed, no number: the package holds none). Every group
label muted, no group count anywhere (0 `studio-menu-group-count-*`
nodes). The 高级 groups were in the DOM and not visible.
2. **Package scope, 高级 open** — one click: `aria-expanded=true`, cookie
`studio_menu_advanced=true`, `studio_menu_state` not written. The fold
shows Data — Hook 8, Mapping 1 · UI — View 36, Action 73, Dataset 4 ·
Automation — Job 1, Organization flows · Platform — Doc 8, Book 1, Email
template 1, API 3, Datasource 1, Diagnostics · Access — Position 10,
Sharing rule 2, Capability 2, Default sharing, Positions and permissions
· AI — AI context 2. A reload kept it open. Closed again and searched
"hook": the hook entry listed under Data, no fold drawn.
3. **A bookmark to 钩子** — a second fresh browser straight to
`/studio/com.example.showcase/metadata/hook?package=com.example.showcase`:
the fold open, Hook 8 marked current, and no `studio_menu_advanced`
cookie in the jar.
4. **A new empty package** — `POST /api/v1/packages` (201,
`com.walk.empty…`), then its object list: all ten 常用 entries listed and
dimmed with no number (Object, Application, Page, Dashboard, Report,
Flow, Permission Set, AI Agent, AI Tool, AI Skill); the fold closed,
holding only Organization flows, Diagnostics, Default sharing, Positions
and permissions.
5. **`~org`** — `/studio/~org/metadata/flow?source=runtime`: no fold;
Automation — Organization flows (current), with no number above it
(#37211); Access — Permission Set 19, Position 17, Sharing rule 3,
Capability 13, Positions and permissions, in the table's order. `~all`
reads the same, the catalog entry current.
**Two-minute check:** open any package in Studio. Expect the ten Common
entries, then a closed "Advanced" row; click it, reload, and it stays
open.
> PM note (zone a4-S): #37211 now carries a claim (7172656271) naming
this branch, so `Fixes #37211` closes it at merge. That was the dev's
open question 1, ruled A.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01QSeKYniqTW93usTV1hShjE)_
<!-- signed: repo:objectstack#4 · os-justin ·
session_01QSeKYkkwuF6UuFtu85Yd5H -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent f339060 commit 8316d3d
12 files changed
Lines changed: 769 additions & 133 deletions
File tree
- .changeset
- ui
- e2e
- packages
- app-shell/src/views/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 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
21 | 25 | | |
22 | 26 | | |
23 | 27 | | |
| |||
65 | 69 | | |
66 | 70 | | |
67 | 71 | | |
68 | | - | |
| 72 | + | |
69 | 73 | | |
70 | 74 | | |
71 | 75 | | |
| |||
175 | 179 | | |
176 | 180 | | |
177 | 181 | | |
| 182 | + | |
| 183 | + | |
178 | 184 | | |
179 | 185 | | |
| 186 | + | |
180 | 187 | | |
181 | 188 | | |
182 | 189 | | |
| |||
186 | 193 | | |
187 | 194 | | |
188 | 195 | | |
189 | | - | |
| 196 | + | |
190 | 197 | | |
191 | 198 | | |
192 | 199 | | |
| |||
195 | 202 | | |
196 | 203 | | |
197 | 204 | | |
198 | | - | |
| 205 | + | |
| 206 | + | |
199 | 207 | | |
200 | 208 | | |
| 209 | + | |
201 | 210 | | |
202 | 211 | | |
203 | 212 | | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
204 | 242 | | |
205 | 243 | | |
206 | 244 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
229 | | - | |
230 | | - | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
231 | 232 | | |
232 | 233 | | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
233 | 237 | | |
234 | 238 | | |
235 | 239 | | |
| |||
0 commit comments