Skip to content

Commit 7b29406

Browse files
committed
test(app-shell): hold the customization read pending in four landing tests; add the changeset
The landing now reads each read-only base's customizations. Four landing tests that are not about it would send that read to a real socket, so they stub the reader with a pending promise. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jRL4qcnwHDD4M1e4wx
1 parent 4affd99 commit 7b29406

5 files changed

Lines changed: 38 additions & 0 deletions
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
'@object-ui/i18n': patch
4+
---
5+
6+
feat(app-shell): each read-only base's card on the Studio landing says "n customized, m switched off"
7+
8+
Clause-②: yes (widening)
9+
Metadata-protocol: none
10+
11+
Before an upgrade, or just to check, an administrator wants to see which installed apps they changed and what they switched off. Studio's landing now says it on each read-only base's card, for example "4 customized, 2 switched off" (zh 「已定制 4 项,已停用 2 项」).
12+
13+
- **The numbers are the server's.** Each card reads `GET /api/v1/packages/:id/customizations` once. "Customized" is the served overrides plus the served extensions of the base's `<base>.custom` pair, and "switched off" is the served switched-off count. The answer is judged by `GetPackageCustomizationsResponseSchema`. An answer that schema refuses counts as a failed read.
14+
- **Zero only when the server answered.** While the read is pending, the line shows no number. A failed read shows a muted "Couldn't read customizations", with the server's sentence as its title, never "0".
15+
- **Links.** When the package list holds the base's pair, "n customized" opens the pair in Studio (`/studio/<base>.custom/data`). "m switched off" opens the base's Automations pillar.
16+
- **No line on a writable package or on a pair**, and a pair id is never sent: the route refuses one.
17+
- **The landing paints first.** The counts arrive after it.
18+
- **New strings.** `@object-ui/i18n`'s studio namespace gains seven `engine.studio.landing.customizations.*` keys in `en` and `zh`. The other languages fall back to `en`, as the whole namespace does. They interpolate `customized`, `switchedOff` and `pair`.

‎ui/packages/app-shell/src/views/studio-design/BuilderLanding.accessibleNames-12510.test.tsx‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ vi.mock('./packages-io', async (importOriginal) => {
2727

2828
// The create dialog is closed throughout; its own names are pinned beside it.
2929
vi.mock('../metadata-admin/PackageFormDialog', () => ({ PackageFormDialog: () => null }));
30+
// A read-only base's customization read (ADR-0146 D3) is not under test here:
31+
// it stays pending, so no request leaves the file.
32+
vi.mock('./packageCustomizations-io', () => ({
33+
fetchPackageCustomizationCounts: vi.fn(() => new Promise<never>(() => {})),
34+
}));
3035

3136
import { BuilderLanding } from './BuilderLanding';
3237
import { RecentItemsProvider } from '../../context/RecentItemsProvider';

‎ui/packages/app-shell/src/views/studio-design/BuilderLanding.orgScope-11553.test.tsx‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ vi.mock('./packages-io', async (importOriginal) => {
2525

2626
// The create dialog is closed throughout; its form stack is not under test.
2727
vi.mock('../metadata-admin/PackageFormDialog', () => ({ PackageFormDialog: () => null }));
28+
// A read-only base's customization read (ADR-0146 D3) is not under test here:
29+
// it stays pending, so no request leaves the file.
30+
vi.mock('./packageCustomizations-io', () => ({
31+
fetchPackageCustomizationCounts: vi.fn(() => new Promise<never>(() => {})),
32+
}));
2833

2934
import { BuilderLanding } from './BuilderLanding';
3035

‎ui/packages/app-shell/src/views/studio-design/BuilderLanding.recentPackages-11863.test.tsx‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ vi.mock('./packages-io', async (importOriginal) => {
4646

4747
// The create dialog is closed throughout; its form stack is not under test.
4848
vi.mock('../metadata-admin/PackageFormDialog', () => ({ PackageFormDialog: () => null }));
49+
// A read-only base's customization read (ADR-0146 D3) is not under test here:
50+
// it stays pending, so no request leaves the file.
51+
vi.mock('./packageCustomizations-io', () => ({
52+
fetchPackageCustomizationCounts: vi.fn(() => new Promise<never>(() => {})),
53+
}));
4954

5055
import { BuilderLanding } from './BuilderLanding';
5156
import { RecentItemsProvider } from '../../context/RecentItemsProvider';

‎ui/packages/app-shell/src/views/studio-design/BuilderLanding.setupExit-12513.test.tsx‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ vi.mock('./packages-io', async (importOriginal) => {
2121

2222
// The create dialog is closed throughout; its form stack is not under test.
2323
vi.mock('../metadata-admin/PackageFormDialog', () => ({ PackageFormDialog: () => null }));
24+
// A read-only base's customization read (ADR-0146 D3) is not under test here:
25+
// it stays pending, so no request leaves the file.
26+
vi.mock('./packageCustomizations-io', () => ({
27+
fetchPackageCustomizationCounts: vi.fn(() => new Promise<never>(() => {})),
28+
}));
2429

2530
import { BuilderLanding, packagedAutomationPath } from './BuilderLanding';
2631

0 commit comments

Comments
 (0)