Repository navigation
Commit 697a307
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
File tree
- .changeset
- ui/packages/app-shell/src/views/studio-design
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
0 commit comments