Skip to content

Commit 3d1de0b

Browse files
feat(studio): App Studio's package overview gets Export as a button, a Publish history tab with the revert, and is where opening a package lands (#38318)
<!-- claude-projects-attribution: {"github_login":"os-tesla"} --> _Requested by **Tesla** · [project thread](https://claude.ai/code/project/chan_01AXsQkLFKRdQCqQ3RTr6Jao?thread=cmsg_01AXsQkLFKRdQCqQ3RTr6Jao8yuuVTeYz2cp3jbp8jpvkr)_ Fixes #37958 Fixes #37687 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:在应用搭建里打开一个软件包,现在先到它的「概览」页(以前先到对象列表);概览页头多了「导出」按钮,多了「发布历史」页签,按时间倒序列出每次发布(做了什么、什么时候、几项、谁发布的),「还原到上次发布」也搬到这个页签里;带定制的系统自带包上,导出、发布历史和还原都针对它的定制包,按钮写成「导出 某某 的定制」;「全部类型」页标题下那一行,除了已定制几项还写已停用几项;只读包的小锁和「待发布」页签,用键盘和读屏也能读到只读的原因。 - 为什么做:应用搭建改版专题里「完整概览页」这一项,按你 11 月 27 日点的「全部按建议」落地,同时并入「只读原因只有鼠标悬停才看得到」那张卡。 - 出错会怎样:最坏是打开软件包落到的页面不对,或者导出、还原找错了包(基础包和它的定制包之间);还原有确认框,只丢弃还没发布的改动、不动已发布的内容,这次改动可以直接撤回。 - 要你做什么:这次把你定的四条写进了一份架构决策记录,按规矩要你或另一位维护者批准后才能合并。 ## What changes A package's 概览 Overview in App Studio becomes the full page of decision 9 of topic #37424, as ruled in [comment 7218879913](#37424 (comment)). - **Header.** Export is a button of the page header (`studio-overview-export`), drawn for a `manage_metadata` holder. The ⋯ menu keeps four rows: Edit package info, Duplicate as a new package, Adopt loose items, Manage in Setup…. Export and the revert have left it; disable, enable and delete were never in it. - **Publish history tab** (`?tab=history`, the third tab). The package's publishes, newest first, read from the commit list the build timeline already reads (`fetchCommits`): what each was (a publish, or the undoing of one), its note, when, how many items and who. "Revert to last publish" sits on this tab with the confirmation dialog it had in the ⋯ menu, moved, not copied. A list and that one revert: an entry has no revert of its own (the claim's option A). - **What the three act on.** On a read-only package with a `.custom` pair, Export, the history and the revert act on the pair (`pairId ?? packageId`), the package Pending and Publish already act on. Export then reads "Export customizations of NAME" / 「导出 NAME 的定制」 and downloads the pair; the base is not exported from this page. The revert is greyed only where nothing can be published (a read-only package with no pair) or nothing is pending, and it says which in words beside the button. - **Landing.** The bare address `/studio/PKG` and App Studio's return to the package last opened now open `/studio/PKG/overview`. Both opened the object list before. `/studio/PKG/data` still opens the object list and the other retired addresses keep their redirects. - **「全部类型」 All types.** The line under the title says what is switched off beside what is customized: "3 customized · 2 switched off on HotCRM" / 「HotCRM 已定制 3 项 · 已停用 2 项」. With nothing switched off the line is unchanged. - **Read-only reasons for keyboard and screen-reader users (#37687).** The lock beside a read-only package's name in the package switcher is named by the reason, and the switcher button is described by it, in the collapsed column too. Where nothing can be published, the Pending tab is described by the same sentence and shows it in words when opened; the greyed revert names its reason the same way. - **ADR-0084.** One dated paragraph after the sentence that left two things open in § 概览 Overview records the ruling's four items (what the three act on, Export's option and its ground, the address and the two landings, the home of the line per package with its three accepted costs). No other ADR text moves. - **i18n.** New `studio` keys in en and zh: `engine.studio.overview.tab.history`, `engine.studio.overview.exportCustomizations`, `engine.studio.overview.history.{note,noteCustomizations,empty,loading,loadFailed,unreachable,published,undone,items,itemsOne}`, `engine.directory.customizations.totalSwitchedOff`. Two things the live app showed, fixed in this PR: - **Who published is a name.** A publish records its actor's user id, so the first build printed a 32-character id. The tab asks the user directory once for the distinct actors of the list (`useHistoryActorNames`, the read an item's history already names its actors with) and shows the user's name, the id kept on its title. An actor the directory has no row for (an AI principal among them) is shown as recorded. - **The page waits to learn what the package is.** A read-only package's pair is learned from the surface's read of the package list. Opened straight on the history tab, the page asked for the base's commit list before that read landed and offered "Export" on the base in the same moment. While the surface is still asking, the history is not read, Export is disabled and the revert is greyed; after it answers, the base's commit list is never asked for. ## Tests - `StudioPackageOverview-37454.test.tsx` (49 cases): Export as a header button and what it downloads; the tab, its address and its states (loading, refused, unreachable, empty, the list in en and zh); who published by name; no revert per entry; the revert's dialog, its target and its two greyed reasons; the pair blocks (Export, history and revert on the pair, the no-pair control); the wait for the package facts; the Pending tab's reason by role, name and description. - `StudioPackageMenu-37139.test.tsx`: four rows; the export and revert doors are imported by the overview page only, and the revert confirmation has one copy. - `StudioTopLeft-37456.test.tsx`: the lock's accessible name is the reason; the switcher button's description is the reason, in en and zh and in the collapsed column; a writable package's is not. - `studioPillarRedirectModel.test.ts`, `StudioEntryRedirect.test.tsx`, `studioAddress.test.ts`: the bare address, the pair's bare address and the entry all land on 概览, the query kept; `/data` still opens the object list. - `metadataAreaHost.customizations-28568.test.tsx`: both counts on the line, the zh sentence, a base with nothing customized and something switched off, and the unchanged line as control. - `StudioRoute.metadataArea-28561.test.tsx`, `StudioRoute.recentPackage-11863.test.tsx` (console): they pinned the old landing on the real routes and are re-pointed. Ablations (`node scripts/ablation-replace.mjs`, each restore proven by blob == HEAD and an empty `git diff HEAD`): | Mutation | Result | |---|---| | `revertPackage(actionTarget)` → `revertPackage(packageId)` | 1 failed / 45 passed: expected `POST …/com.vendor.crm.custom/revert`, received `POST …/com.vendor.crm/revert` | | `revertReason = publishReadOnly` → `= readOnly` | 2 failed / 44 passed: the pair's revert is no longer offered; greyed "for read-only" | | switcher `aria-describedby` deleted | 3 failed / 15 passed: no button with name "Switch package: Sales" and the reason as description (en, zh, collapsed) | | lock `aria-label` back to "Read-only" | 3 failed / 15 passed: no `img` named by the reason | | Pending tab `aria-describedby` deleted | 2 failed / 44 passed: no button "Pending" / 「待发布」 with the reason as description | | actor name → the recorded id | 1 failed / 48 passed: "Unable to find an element with the text: Ada Lovelace" | | history read no longer waits for the package facts | 3 failed / 46 passed: `GET …/com.vendor.crm/commits` asked before the pair's | <details><summary>Readings</summary> - Readings below were taken at `63ebd3a19` (8 commits on `98bd8deed`). Head `60305c2c6` adds two commits: the app shell line in the changeset frontmatter, and one ADR-0084 sentence; no source or test file changed. At `60305c2c6` the 21 gate commands derived for the ADR path ran, each exit 0, with `--ran` at 21 derived, 21 run, 0 unrun. - Dependency closure build (turbo: the app shell's dependencies and the showcase): 106 of 107 tasks. The one red task was the app shell's own build, compiled while the tree was mid-edit; `pnpm --dir ui --filter @object-ui/app-shell build` at the final head → lock `VERDICT command-exit 0`. - `type-check` of `@object-ui/app-shell`, `@object-ui/i18n` and `@object-ui/console` at the final head → each lock `VERDICT command-exit 0`. - `pnpm --dir ui --filter @object-ui/i18n test` → `Test Files 109 passed (109)`, `Tests 1873 passed | 13 skipped (1886)`. - `pnpm --dir ui --filter @object-ui/console test` → `Test Files 340 passed (340)`, `Tests 3727 passed (3727)`. - `pnpm --dir ui --filter @object-ui/app-shell test` → `Test Files 1 failed | 2442 passed | 1 skipped (2444)`, `Tests 2 failed | 23931 passed | 9 skipped (23942)`, lock `VERDICT command-exit 1`. The red file is `layout/__tests__/designModeMenuSave-36363.test.ts`: two cases expect `emitMetadataRefresh` once and count 0. It passes alone (`Tests 47 passed (47)`) and fails the same two cases whenever `designModeMenuCreate-36364.test.ts` runs before it in one worker (those two files with `--maxWorkers=1`: `Tests 2 failed | 60 passed (62)`): each mocks the same module with a spy of its own, and the `unit` project shares its module cache between files. Neither file is in this diff; of the 40 files the two import, this diff touches one, in comments only. - The nine test files this PR changes, together → `Test Files 9 passed (9)`, `Tests 234 passed (234)`. - `node scripts/pm/dispatch-gates.mjs --commands` at the final head: 48 commands, each run, each exit 0; `--ran` → "48 derived, 48 run, 0 NOT-MEASURED, 0 UNRUN". - `node scripts/pm/overlap-check.mjs` → `VERDICT clean exit 0`, against `origin/main` at `98bd8deed` and the two open pull requests that share the studio i18n files (38285 and 38204), each "merges cleanly". - ESLint over the changed UI files: 0 errors. New cross-file line citations against the base: 0. - Ablations 1 to 5 ran on `db83d2350` (the test file then held 46 cases), 6 and 7 on `63ebd3a19` (49 cases). </details> ## Acceptance notes - **Screenshots** (Chromium, 1440×900, showcase app, light and dark, zh-CN; four in en-US) in `card-37958/screenshots/`: a writable package's Overview on Info and on Publish history (`overview-writable-{info,history}-zh-{light,dark}.png`); the read-only showcase with its `.custom` pair on Info and on Publish history, the header reading 「导出 ObjectStack Showcase 的定制」 (`overview-readonly-pair-{info,history}-zh-{light,dark}.png`); a read-only package with no pair on Pending, with the reason in words (`overview-readonly-nopair-pending-zh-{light,dark}.png`); the All types header with both counts (`all-types-header-zh-{light,dark}.png`); one 760px-wide capture of the history tab. In the same run the page was driven: Export downloaded `com.example.showcase.custom.package.json`, the revert posted to the pair and then greyed with "Nothing has changed since the last publish.", and the only package doors asked were the pair's. - **Surface beyond the claim, named.** `studioAddress.ts` and `studioAddressTable.ts` (doc comments and two table rows that described the old landing), `studioAddress.test.ts`, `StudioTopLeft-37456.test.tsx`, `metadataAreaHost.customizations-28568.test.tsx`, and the two console `StudioRoute.*` tests that pinned the old landing. `useHistoryActorNames` is imported from `views/item-tools/`, not edited. - **A pair's own bare address** (`/studio/BASE.custom`) now opens its base's 概览 in one redirect. Before, it opened the pair's own object list. The ruling does not speak of it; the base's page is where the pair's Export, history and revert live. - **Studio's entry** sends the overview address directly instead of the bare address through the route, so the return to the last package is one redirect. A test pins that it equals where the bare address lands. - **The All types line** is also drawn when nothing is customized and something is switched off ("0 customized · 2 switched off on X"), as the Setup panel draws zeros. - **The switcher** describes its button by the reason, beyond the card's literal "the lock's accessible name": a button's children are presentational to assistive technology, so the lock's own name is not announced when the button is focused. - **The revert on a pair that has drafts and has never been published** is offered (the ruling greys it only for the two cases above); the server answers 409 with its own sentence, shown in the toast. - **Other doors into a package's Studio name the object list explicitly (`/data`) and still open it**: the command palette's package entries, an app's design-in-Studio path, the empty-menu state's "Open in Studio" (its text is about creating objects), Setup → Packages' create landing and "Open in Studio", and the customizations panel's link. The last three belong to the Setup slimming (#37401). The ruling names the bare address and Studio's entry, so the rest is left as it is; the seat kept this PR to those two and carries the rest to the maintainer as an open question in the Tier H hand-off. A package in the recent-items list is recorded with the bare address, so it opens 概览 too. The pair's own bare address (`/studio/BASE.custom`, which now opens its base's 概览; see the bullet above) is unruled too and goes in the same hand-off. ADR-0084's amendment paragraph now says the ruling names the two doors only and that one landing for every door is not ruled (rework round 1, head `60305c2c6`). - **The top bar's review sheet** still gives no read-only reason where its Publish is absent. #37687 is read here as the overview's Pending tab and the switcher's lock. Observation, not filed. - **Changeset frontmatter.** The changeset names `'@object-ui/app-shell': patch` beside `'@object-ui/i18n': patch` (seat ruling after round 1): the changeset config versions private packages, the app shell has a changelog, and the tree's other Studio changesets name both. - **One red file in the app shell's own suite, not from this diff**: `designModeMenuSave-36363.test.ts` fails two cases when `designModeMenuCreate-36364.test.ts` runs before it in the same worker (Readings has the recipe). Reported to the seat, not touched here. - This PR edits `docs/adr/**`: Tier H, merged on a maintainer's approval. ## Verification First read, by risk: 1. `StudioPackageOverviewPage.tsx`: `actionTarget`, `targetKnown` and `revertReason` at the top of the component, and the revert dialog's `revertPackage(actionTarget)`. A wrong target here exports or reverts the wrong package. 2. `studioPillarRedirectModel.ts`: the bare-address branch. It decides where the bare package address lands, a pair's included. 3. `docs/adr/0084-application-builder-information-architecture.md`: the paragraph dated 2026-11-28, against the ruling's four items. Two-minute check: `pnpm --dir ui exec vitest run packages/app-shell/src/views/studio-design/StudioPackageOverview-37454.test.tsx --maxWorkers=2` → 49 passed. In the running console, open `/studio/PKG (a read-only package that has customizations)`: it lands on Overview, the header button reads "Export customizations of NAME", and Publish history lists the customization package's publishes with "Revert to last publish" beside them. --- _Generated by [Claude Code](https://claude.ai/code/session_01L9qibwhvDmUtvvE3VyLJRf)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L9qibwhvDmUtvvE3VyLJRf <!-- signed: repo:objectstack#3 · os-tesla · session_01L9qibwhvDmUtvvE3VyLJRf --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent ceb5cdf commit 3d1de0b

24 files changed

Lines changed: 1381 additions & 239 deletions
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
'@object-ui/i18n': patch
4+
---
5+
6+
feat(app-shell): App Studio's package overview gets Export as a button, a Publish history tab with the revert, and is where opening a package lands
7+
8+
Clause-②: no
9+
Metadata-protocol: none
10+
11+
A package's 概览 Overview in App Studio is now the full page.
12+
13+
- **Export** is a button of the page header and has left the ⋯ menu. On a read-only package that has customizations (a `.custom` package paired with it), the button reads "Export customizations of NAME" (「导出 NAME 的定制」) and downloads that `.custom` package; the read-only package itself is no longer exported from this page. On any other package it reads "Export" and downloads the package, as before.
14+
- **Publish history** is a third tab (`?tab=history`): the package's publishes, newest first, each with what it was, when, how many items and who published it, by the user's name where the user directory has one. "Revert to last publish" is on this tab with the confirmation it always had, and has left the ⋯ menu. An entry has no revert of its own here.
15+
- On a read-only package with customizations, the history and the revert act on the `.custom` package, the same one Pending and Publish act on. The revert is greyed only where nothing can be published (a read-only package with no customizations) or nothing is pending, and it says which.
16+
- The ⋯ menu keeps "Edit package info", "Duplicate as a new package", "Adopt loose items" and "Manage in Setup…".
17+
- **Opening a package lands on 概览.** The address `/studio/<package>` and App Studio's return to the package last opened now open `/studio/<package>/overview`; both opened the object list before. `/studio/<package>/data` still opens the object list, and the other retired addresses keep their redirects.
18+
- The 「全部类型」 All types page says what is switched off beside what is customized: "3 customized · 2 switched off on HotCRM" (「HotCRM 已定制 3 项 · 已停用 2 项」). With nothing switched off the line is unchanged.
19+
- **Read-only reasons reach keyboard and screen-reader users.** The lock beside a read-only package's name in the package switcher is named by the reason, and the switcher button is described by it, in the collapsed column too. On a read-only package with nothing to publish, the Pending tab is described by the same reason and says it in words when opened.
20+
21+
New `studio` keys, in en and zh: `engine.studio.overview.tab.history`, `engine.studio.overview.exportCustomizations`, `engine.studio.overview.history.{note,noteCustomizations,empty,loading,loadFailed,unreachable,published,undone,items,itemsOne}` and `engine.directory.customizations.totalSwitchedOff`. Other languages fall back to en.

‎docs/adr/0084-application-builder-information-architecture.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,8 @@ It is not a page of news: no recent publishes, no "our changes", no list of what
440440

441441
Two things about 概览 are not decided here, and neither is yet a question: on a read-only package with a pair, which of the two Export, revert and the history act on; and 概览's address, which is not a metadata address because a package is not an item. The card that builds each brings a ruling if it needs one.
442442

443+
*(Amended 2026-11-28, card [#37958](https://github.com/objectstack-ai/objectstack/issues/37958), ruling record [comment 7218879913](https://github.com/objectstack-ai/objectstack/issues/37424#issuecomment-7218879913), the maintainer's 「全部按建议」 on the decision card for the full page's open questions: both are decided, and with them where ADR-0146 D3's line per package stands. **(1) Revert and the publish history**: on a read-only package with a pair they act on the pair, the same target as Pending and Publish. Revert is greyed only where nothing can be published (a read-only package with no pair) or the pair has nothing pending. **(2) Export** (option A): with a pair, 概览's Export downloads the pair, labelled as the base's customizations (「导出 HotCRM 的定制」); with no pair it downloads the package, as before. The cost is accepted: once a pair exists the base is not exported from the UI (it comes from the marketplace or from code). The ground: the uninstall refusal (`packages/objectql/src/registry.ts#PackageUninstallExtendedError`) and ADR-0146 D8 item 3 name the pair's export as the way to keep customizations. **(3) 概览's address** stays `/studio/<package>/overview`: a package page, not a metadata address, like the default sharing overview's `owd`. The bare `/studio/<package>` and the Studio entry's return to the last package open 概览 too, so opening a package has one landing; both landed on the object list before. This ruling names those two doors only, and one landing for every door is not ruled: the command palette's (⌘K) package entries, an app's design-in-Studio entry (`ui/packages/app-shell/src/utils/appRoute.ts#appStudioDesignPath`), the "Open in Studio" of an app's empty menu, and Setup's doors, which go with the Setup slimming (decision 10; [#37401](https://github.com/objectstack-ai/objectstack/issues/37401)), still open the object list, and that question is put to the maintainer at the merge of this amendment's pull request ([#38318](https://github.com/objectstack-ai/objectstack/pull/38318)). **(4) The line per package**, `<base> 已定制 n 项 · 已停用 m 项` (ADR-0146 D3; option B), is not on 概览: it stands under the title of the 全部类型 All types page, which already showed the customized count and gains the switched-off count. The detail panel of Setup → Packages is left as it is and goes with the Setup slimming ([#37401](https://github.com/objectstack-ai/objectstack/issues/37401)). Three costs are accepted: the 全部类型 row sits last in the 高级 Advanced fold; "switched off m" has no list to filter to; and the separate re-order count has no home.)*
444+
443445
### Placements, and what moves to Setup {#amendment-2026-11-26-moves}
444446

445447
Decision 12 draws the line: **Studio develops one package; Setup runs the organization and holds what is global** (maintainer: 「同意」). Five places are settled by it, by decision 6, and by the rulings of the same day on what the two had left open ([comment 7187264388](https://github.com/objectstack-ai/objectstack/issues/37451#issuecomment-7187264388)). A sixth is written for a type that is about to join the menu.

‎ui/apps/console/src/components/StudioRoute.metadataArea-28561.test.tsx‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,11 @@ describe('/studio — every retired pillar address redirects once, to its new ad
236236
const PAIR = 'com.example.crm.custom';
237237

238238
it.each([
239-
[`/studio/${PKG}`, `/studio/${PKG}/metadata/object?package=${PKG}`],
239+
// objectstack#37958 — the bare package address opens the package's overview (the object
240+
// list before), its query kept; a pair's opens its base's. `/data` keeps the object list.
241+
[`/studio/${PKG}`, `/studio/${PKG}/overview`],
242+
[`/studio/${PKG}?tab=pending`, `/studio/${PKG}/overview?tab=pending`],
243+
[`/studio/${PAIR}`, `/studio/${PKG}/overview`],
240244
[`/studio/${PKG}/data`, `/studio/${PKG}/metadata/object?package=${PKG}`],
241245
[`/studio/${PKG}/data?surface=object%3Aaccount`, `/studio/${PKG}/metadata/object/account?package=${PKG}`],
242246
// The server's draft review link (`studioChangesReviewLink`).
@@ -265,6 +269,9 @@ describe('/studio — every retired pillar address redirects once, to its new ad
265269
it.each([
266270
`/studio/${PKG}/owd`,
267271
`/studio/${PKG}/owd?object=account`,
272+
// The overview's own address, where the bare one lands (objectstack#37958).
273+
`/studio/${PKG}/overview`,
274+
`/studio/${PKG}/overview?tab=history`,
268275
`/studio/${PKG}/metadata/object?package=${PKG}`,
269276
`/studio/${PKG}/metadata/flow/notify?package=${PKG}`,
270277
// A segment no page has: the builder, which draws its not-found state.

‎ui/apps/console/src/components/StudioRoute.recentPackage-11863.test.tsx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,10 @@ describe('/studio/PKG/TAB records the package as a recent entry (objectui#11863)
169169
expect(JSON.parse(localStorage.getItem(STORAGE_KEY) ?? '[]')).toEqual([entry]);
170170
});
171171

172-
it('the bare package route records it too, once it lands on the object list', async () => {
172+
// objectstack#37958 — the bare package address opens the package's overview; it landed on the object list before.
173+
it('the bare package route records it too, once it lands on the package overview', async () => {
173174
renderStudio('/studio/com.acme.crm');
174-
await waitFor(() => expect(screen.getByTestId('pathname')).toHaveTextContent('/studio/com.acme.crm/metadata/object'));
175+
await waitFor(() => expect(screen.getByTestId('pathname')).toHaveTextContent(/^\/studio\/com\.acme\.crm\/overview$/));
175176
await waitFor(() => expect(recent().map((r) => r.id)).toEqual(['package:com.acme.crm']));
176177
});
177178

‎ui/packages/app-shell/src/views/metadata-admin/DirectoryPage.tsx‎

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -291,14 +291,24 @@ export function MetadataDirectoryPage() {
291291
<p className="text-sm text-muted-foreground mt-1 max-w-3xl" data-testid="directory-description">
292292
{t('engine.directory.description', locale)}
293293
</p>
294-
{customizations.status === 'read' && customizationTotal(customizations.read) > 0 && (
295-
<p className="text-sm text-muted-foreground mt-1" data-testid="directory-customizations-total">
296-
{tFormat('engine.directory.customizations.total', locale, {
297-
customized: customizationTotal(customizations.read),
298-
baseName: customizations.baseName,
299-
})}
300-
</p>
301-
)}
294+
{/* The package's one line (ADR-0146 D3; objectstack#37958, ADR-0084 amended
295+
2026-11-28): what is customized on the base and, where the served read
296+
counts any, what is switched off on it. Both numbers are the server's. */}
297+
{customizations.status === 'read' &&
298+
(customizationTotal(customizations.read) > 0 || customizations.read.counts.switchedOff > 0) && (
299+
<p className="text-sm text-muted-foreground mt-1" data-testid="directory-customizations-total">
300+
{customizations.read.counts.switchedOff > 0
301+
? tFormat('engine.directory.customizations.totalSwitchedOff', locale, {
302+
customized: customizationTotal(customizations.read),
303+
switchedOff: customizations.read.counts.switchedOff,
304+
baseName: customizations.baseName,
305+
})
306+
: tFormat('engine.directory.customizations.total', locale, {
307+
customized: customizationTotal(customizations.read),
308+
baseName: customizations.baseName,
309+
})}
310+
</p>
311+
)}
302312
{customizations.status === 'failed' && (
303313
<p className="text-xs text-muted-foreground mt-1" data-testid="directory-customizations-failed">
304314
{tFormat('engine.customizationMark.readFailed', locale, { message: customizations.message })}

‎ui/packages/app-shell/src/views/metadata-admin/metadataAreaHost.customizations-28568.test.tsx‎

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ import { MetadataResourceListPage } from './ResourceListPage';
113113
import { useListOrderedNames } from './useListOrderedNames';
114114
import { registerDefaultMetadataSchemas } from './default-schemas';
115115
import { t, tFormat } from './i18n';
116+
import { loadStudioCatalogue } from '@object-ui/i18n/namespaces/studio';
116117

117118
registerDefaultMetadataSchemas();
118119

@@ -147,6 +148,14 @@ const EMPTY_READ = { packageId: PLAIN, overrides: [], extensions: [], switchedOf
147148
let customizationsFail = false;
148149
/** objectstack#30063 — the read also lists a page's override. */
149150
let readListsPage = false;
151+
/** objectstack#37958 — the base's items this deployment switched off, as the read serves them. */
152+
let switchedOffServed: Array<{ type: string; name: string }> = [];
153+
/** objectstack#37958 — a read's answer with those switched-off items and their count. */
154+
const withSwitchedOff = <R extends { counts: { switchedOff: number } }>(read: R) => ({
155+
...read,
156+
switchedOff: switchedOffServed,
157+
counts: { ...read.counts, switchedOff: switchedOffServed.length },
158+
});
150159
const withPage = (read: typeof HOTCRM_READ) => ({
151160
...read,
152161
overrides: [...read.overrides, { type: 'page', name: 'crm_welcome', basedOn: '2.1.0' }],
@@ -166,7 +175,10 @@ const fetchMock = vi.fn(async (url: string) => {
166175
}
167176
const hotcrm = readListsPage ? withPage(HOTCRM_READ) : HOTCRM_READ;
168177
const id = decodeURIComponent(m[1]);
169-
return json(200, { success: true, data: id === BASE ? hotcrm : id === ARRANGED ? ARRANGED_READ : EMPTY_READ });
178+
return json(200, {
179+
success: true,
180+
data: withSwitchedOff(id === BASE ? hotcrm : id === ARRANGED ? ARRANGED_READ : EMPTY_READ),
181+
});
170182
}
171183
if (u.startsWith('/api/v1/data/sys_metadata_activation')) {
172184
return json(200, { object: 'sys_metadata_activation', records: [], hasMore: false });
@@ -177,6 +189,7 @@ const fetchMock = vi.fn(async (url: string) => {
177189
beforeEach(() => {
178190
customizationsFail = false;
179191
readListsPage = false;
192+
switchedOffServed = [];
180193
fetchMock.mockClear();
181194
vi.stubGlobal('fetch', fetchMock);
182195
});
@@ -394,3 +407,58 @@ describe('objectstack#37236 — "customized" is overrides + extensions, never an
394407
expect(screen.getByTestId('ordered')).toHaveTextContent(/^crm_en$/);
395408
});
396409
});
410+
411+
/**
412+
* objectstack#37958 (ADR-0084, amended 2026-11-28; ADR-0146 D3) — the
413+
* package's one line, "<base> 已定制 n 项 · 已停用 m 项", stands under the title
414+
* of the 「全部类型」 page: the customized count it already drew, and beside it
415+
* the switched-off count the same read serves. Both numbers are the server's.
416+
*/
417+
describe('the All metadata directory header says what is switched off beside what is customized (objectstack#37958)', () => {
418+
const TWO_OFF = [
419+
{ type: 'action', name: 'crm_account.archive' },
420+
{ type: 'flow', name: 'crm_lead_assign' },
421+
];
422+
423+
it('with items switched off, the line carries both served counts', async () => {
424+
switchedOffServed = TWO_OFF;
425+
mountDirectory(area(BASE));
426+
const total = await screen.findByTestId('directory-customizations-total');
427+
expect(total).toHaveTextContent(/^3 customized · 2 switched off on HotCRM$/);
428+
expect(total).toHaveTextContent(
429+
tFormat('engine.directory.customizations.totalSwitchedOff', 'en-US', { customized: 3, switchedOff: 2, baseName: 'HotCRM' }),
430+
);
431+
// The switched-off count is the header's: no tile draws it.
432+
expect(screen.getByTestId('directory-tile-customized-object')).toHaveTextContent(
433+
tFormat('engine.directory.customizations.tile', 'en-US', { customized: 1 }),
434+
);
435+
});
436+
437+
it('zh-CN reads 「HotCRM 已定制 3 项 · 已停用 2 项」', async () => {
438+
await loadStudioCatalogue('zh');
439+
expect(
440+
tFormat('engine.directory.customizations.totalSwitchedOff', 'zh-CN', { customized: 3, switchedOff: 2, baseName: 'HotCRM' }),
441+
).toBe('HotCRM 已定制 3 项 · 已停用 2 项');
442+
});
443+
444+
it('a base with nothing customized and something switched off still gets its line', async () => {
445+
switchedOffServed = [TWO_OFF[0]];
446+
mountDirectory(area(ARRANGED));
447+
expect(await screen.findByTestId('directory-customizations-total')).toHaveTextContent(/^0 customized · 1 switched off on /);
448+
});
449+
450+
it('CONTROL: with nothing switched off the line is the customized count alone, with no "0 switched off"', async () => {
451+
mountDirectory(area(BASE));
452+
const total = await screen.findByTestId('directory-customizations-total');
453+
expect(total).toHaveTextContent(/^3 customized on HotCRM$/);
454+
expect(total).not.toHaveTextContent(/switched off/);
455+
});
456+
457+
it('CONTROL: a failed read draws neither count', async () => {
458+
switchedOffServed = TWO_OFF;
459+
customizationsFail = true;
460+
mountDirectory(area(BASE));
461+
await screen.findByTestId('directory-customizations-failed');
462+
expect(screen.queryByTestId('directory-customizations-total')).toBeNull();
463+
});
464+
});

‎ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx‎

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ import { useMetadataClient } from '../metadata-admin/useMetadata.js';
4545
// objectui#11773 — every draft save of an existing item sends the version its buffer was built on.
4646
// objectstack#26858 — the served verdict a flow's inspectors read at their own paths.
4747
import { emitMetadataRefresh } from '../../assistant/assistantBus.js';
48-
import { STUDIO_HOME_PILLAR } from './studioInterfacesRetired.js';
4948
import {
5049
StudioSaveControls,
5150
} from './studioSaveBar.js';
@@ -55,6 +54,7 @@ import {
5554
customizationPairBaseOf,
5655
} from './StudioRailCustomizations.js';
5756
import {
57+
STUDIO_OVERVIEW_SECTION,
5858
studioMetadataTypePath,
5959
studioPillarPath,
6060
} from './studioAddress.js';
@@ -113,13 +113,17 @@ export interface StudioDesignSurfaceProps {
113113
* objectstack#36909 — a retired pillar's address (`data`, `automations`,
114114
* `access`, `interfaces`) is redirected by the route (`StudioPillarRedirect`)
115115
* before this surface mounts, so none is handled here.
116+
*
117+
* objectstack#37958 — the pair's bare address is its base's 概览 Overview, as
118+
* the base's own bare address is. The route answers that before this surface
119+
* mounts too; a host that mounts the surface without it gets the same landing.
116120
*/
117121
export function StudioDesignSurface(props: StudioDesignSurfaceProps): React.ReactElement {
118122
const params = useParams<{ packageId?: string; tab?: string }>();
119123
const location = useLocation();
120124
const pairBase = props.area ? null : customizationPairBaseOf(params.packageId ?? null);
121125
if (pairBase !== null) {
122-
const tab = params.tab ?? STUDIO_HOME_PILLAR;
126+
const tab = params.tab ?? STUDIO_OVERVIEW_SECTION;
123127
return <Navigate to={studioPillarPath(pairBase, tab, { search: location.search })} state={location.state} replace />;
124128
}
125129
return <StudioDesignSurfaceBody {...props} />;
@@ -209,7 +213,8 @@ function StudioDesignSurfaceBody({ aiSlot, area }: StudioDesignSurfaceProps): Re
209213
// for a Studio-only author (the same choice as Studio's entry).
210214
const notFoundExit = studioEntryFallbackPath(useStudioEntryPermissions());
211215
// objectstack#37139 — the package's 「⋯」 menu (`StudioPackageMenu`) is a
212-
// manage_metadata holder's. A revert or an adoption changes what the package
216+
// manage_metadata holder's, as 概览's Export and revert are
217+
// (objectstack#37958). A revert or an adoption changes what the package
213218
// holds: the pillars re-read their baseline, the pending count re-reads (the
214219
// nonce's effect above), and the other surfaces hear of it. Saved package
215220
// info renames the bar's package name in place.
@@ -256,14 +261,15 @@ function StudioDesignSurfaceBody({ aiSlot, area }: StudioDesignSurfaceProps): Re
256261
// objectstack#37139 — the package's 「⋯」 menu: a current package (never
257262
// `~org` or `~all`) that is there, and a manage_metadata holder.
258263
// objectstack#37454 — drawn in 概览 Overview's header, moved there from the
259-
// top bar with its six rows as they were (ADR-0084, amended 2026-11-26).
264+
// top bar (ADR-0084, amended 2026-11-26). objectstack#37958 — Export and the
265+
// revert left it for the page itself, which acts on the pair where the
266+
// package has one (`canAuthorPackage` and `onPackageChanged` go with them).
260267
const packageMenu =
261268
packageId !== null && !pkgMissing && canAuthorPackage ? (
262269
<StudioPackageMenu
263270
packageId={packageId}
264271
packageName={pkgEntry?.id === packageId ? pkgEntry.name : packageId}
265272
writable={pkgWritable}
266-
pendingCount={shownPendingCount}
267273
locale={locale}
268274
onChanged={onPackageChanged}
269275
onRenamed={onPackageRenamed}
@@ -360,6 +366,8 @@ function StudioDesignSurfaceBody({ aiSlot, area }: StudioDesignSurfaceProps): Re
360366
notFoundExit={notFoundExit}
361367
customization={customization}
362368
packageMenu={packageMenu}
369+
canAuthorPackage={canAuthorPackage}
370+
onPackageChanged={onPackageChanged}
363371
overviewRefresh={overviewRefresh}
364372
/>
365373
</StudioSurfaceFrame>

0 commit comments

Comments
 (0)