Skip to content

Commit 697a307

Browse files
test(app-shell): fold ten Interfaces rail label pins onto one shared StudioDesignSurface harness (#26255)
<!-- claude-projects-attribution: {"github_login":"os-steve"} --> _Requested by **Steve** · [project thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi93kH3NmKTNuUFhcMmaWEDak)_ Part of #25911 Slice 1a of #25911: the shared-setup pilot on the `StudioDesignSurface.*` app-shell tests. Five Interfaces-rail label pins rendered the real `InterfacesPillar` over the same three mocks and differed only in their metadata-client double. They are now folded into one file, `StudioDesignSurface.railLabels.test.tsx`. The file declares the three mocks once, and each former file is a top-level `describe` named after it. Each of those blocks installs its own client double in a `beforeEach`. No test is deleted, and every assertion moves verbatim. The seat split the original ten-file fold to keep this PR under the 3,000-line bar. The other five pins (`interfacesRailLabelMap-11158`, `interfacesAppLabelMap-11181`, `railServedLabels-12688`, `zhPillarNames-11801`, `navEntryIdentity-11774`) join this file in the next PR from this branch. Clause-②: no Metadata-protocol: none ## Measured first (base f143cd8, this container, under `os-verify-lock`, `--maxWorkers=2`) Per-file vitest module diagnostics over the 95 `StudioDesignSurface.*` files (656 tests). Fixed cost = environment + prepare + setup + import: - Fixed cost: 678 s, which is 66.4 % of 1022 s CPU. Test bodies: 344 s. - Median file: 6.8 s fixed against 1.2 s of tests. The per-file import of the module graph is the lever, and a shared setup removes it. - Outlier, not touched here: `autosaveSwitch-11232` takes 94 s, 72 s of it inside its tests (19 real 2.5 s debounce sleeps). That is not setup cost. ## Before / after (same command, same box, `--maxWorkers=2`, shared-box seconds) | | files | tests | fixed CPU | test CPU | total CPU | wall | |---|---|---|---|---|---|---| | before (f143cd8) | 95 | 656 | 678.3 s | 343.8 s | 1022.1 s | 528.4 s | | after (76d53f2) | 91 | 656 | 644.9 s | 335.3 s | 980.2 s | 507.0 s | | the five pins alone | 5 → 1 | 25 → 25 | 34.4 s → 7.3 s | 3.7 s → 3.0 s | 38.1 s → 10.3 s | | The family-level test CPU moves by about ±10 s from run to run on this shared box. The per-file rows are the clean reading: each folded file saves about 5 to 6 s of fixed cost. ## Issue number → describe (reviewer check: no assertion dropped) | former file | describe in `StudioDesignSurface.railLabels.test.tsx` | tests | |---|---|---| | `StudioDesignSurface.railLabelInherits-11196.test.tsx` | `StudioDesignSurface.railLabelInherits-11196` (objectui#11196) | 3 | | `StudioDesignSurface.surfaceLabelInherits-11196.test.tsx` | `StudioDesignSurface.surfaceLabelInherits-11196` (objectui#11196) | 5 | | `StudioDesignSurface.surfaceIdentity.test.tsx` | `StudioDesignSurface.surfaceIdentity` | 4 | | `StudioDesignSurface.navRailLabels-11862.test.tsx` | `StudioDesignSurface.navRailLabels-11862` (objectui#11862) | 6 | | `StudioDesignSurface.railSeparatorBadge-11791.test.tsx` | `StudioDesignSurface.railSeparatorBadge-11791` (objectui#11791) | 7 | Each block keeps its former file's header comment, fixtures, hooks and inner `describe` names verbatim, indented one level. The mechanical check against the five files at f143cd8 gives the same `it` titles, 25 of 25 as an identical sorted list, and the same `expect(` count, 70 against 70. The run reports 25 tests passed in the folded file, the same 25 the five files reported. What changed besides the indentation: - The three `vi.mock` factories read `studio.client`, a `vi.hoisted` slot, instead of each file's `mockClient`. Each block's first `beforeEach` sets the slot to its own `mockClient`. The `fetchPackages` and `useAdapter` doubles were identical in all five files. - Three comments named a test file this PR deletes, and now name the block that replaced it: two inside the folded blocks, and one in `StudioDesignSurface.interfacesRailLabelMap-11158.test.tsx`. - `NavTree`'s JSDoc in `StudioDesignSurface.tsx` names the folded file. tsc keeps comments, so the published `dist` changes by that one comment, and the PR carries a `patch` changeset for `@object-ui/app-shell`. Isolation: RTL `cleanup()` and react-i18next's global reset run after every test, as before. No block in the file registers into a metadata or component registry. ## Not in this PR - **The other five rail pins**: they go in the next PR from this branch, once this one merges. - **date-only-zone-pins-10183: premise stale, not split.** `ui/scripts/__tests__/date-only-zone-pins-10183.test.ts` already drives all 26 pins through ONE memoized forked child vitest (73 s measured), so the card's "collapse into one spawn" is already true. Splitting it would only rebalance shard legs, not cut CPU, and the seat ruled it out. - **cli-bin split** (`ui/packages/cli/src/__tests__/cli-bin.test.ts`, 81 s here: a 33 s self-build in `beforeAll` plus 48 serial CLI spawns): this is slice 2, which comes after both rail PRs. ## Acceptance notes - `autosaveSwitch-11232` (94 s, real-time debounce sleeps) is the next-largest single lever in this family. It is noted here and not touched. ## Verification (head 76d53f2) - `pnpm exec vitest run packages/app-shell/src/views/studio-design/StudioDesignSurface --maxWorkers=2` (from `ui/`): 91 files, 656 tests passed. - `tsc -p tsconfig.test.json --noEmit` in `ui/packages/app-shell`: 0 `error TS`. `eslint` on the changed test files: 0 problems. - Derived gates (`node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack`, re-derived with the changeset): 35 derived, 35 run, every one exit 0, and `--ran` reconciles as a derived zero. CI on 76d53f2 is green: all eight required contexts passed, as did Check Changeset and the 16 Test UI legs. No sdui record change: this is test-only in app-shell apart from the comment. --- _Generated by [Claude Code](https://claude.ai/code/session_012Vh1mJSJN3FeocpnWPNdH1)_ https://claude.ai/code/session_012Vh1mJSJN3FeocpnWPNdH1 --- _Generated by [Claude Code](https://claude.ai/code)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 9c922b5 commit 697a307

9 files changed

Lines changed: 785 additions & 818 deletions
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
---
4+
5+
test(app-shell): five Interfaces rail label pins share one Studio design-surface harness
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
Five `StudioDesignSurface.*` test files that rendered the Interfaces pillar over the same mocks now share one file and one module load. The only shipped change is a JSDoc line on the internal `NavTree` in `StudioDesignSurface.tsx`, which now names the test that pins its separator and badge drawing. No behaviour, export or type changes.

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
* same text.
1717
*
1818
* The pillar is the real `InterfacesPillar` over a mocked metadata client (the
19-
* harness of `StudioDesignSurface.surfaceIdentity.test.tsx`). Every nav item
19+
* harness of the `StudioDesignSurface.surfaceIdentity` block in
20+
* `StudioDesignSurface.railLabels.test.tsx`). Every nav item
2021
* of the fixture parses against the spec, so each map is an input the
2122
* designer must handle. The plain-string item is the control in every case.
2223
*/

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

Lines changed: 0 additions & 175 deletions
This file was deleted.

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

Lines changed: 0 additions & 124 deletions
This file was deleted.

0 commit comments

Comments
 (0)