Operator UI app.tsx Page Split Design
Issue: #838
Execution brief
- Goal (SMART): Move Operator UI page components into
packages/operator-ui/src/components/pages/, extractDesktopandMemoryinto page components, and reducepackages/operator-ui/src/app.tsxto ≤200 lines (routing + layout only) in this PR, with no behavior change. - Non-goals: UI redesign; new routing library; adding new pages.
- Constraints: Node 24 + pnpm workspace; strict TS/ESM with
.jsimport specifiers; preserve current UI behavior; keep diffs small and avoid duplication. - Plan: Add a structural regression test (pages importable from new paths +
app.tsxline-count budget) → move existingsrc/pages/*.tsxviagit mv→ extractDesktopPage+MemoryPage→ updateapp.tsxand tests to use new imports → verifypnpm test && pnpm typecheck && pnpm lint && pnpm format:check. - Risks & rollback: Risk: missing/incorrect relative imports after moves; rollback via
git revertof the refactor commits. Structural test + existing page tests reduce regression risk.
Context
packages/operator-ui/src/app.tsx currently contains routing/layout plus an inline Desktop setup page implementation, and imports other pages from packages/operator-ui/src/pages/*. This issue aims to:
- keep
OperatorUiAppinapp.tsxas the router/layout component, - move page components under
components/pages/, - keep behavior unchanged while making
app.tsxsmall and readable.
Approaches
Option A (recommended): Move + update imports (no shims)
- Create
packages/operator-ui/src/components/pages/. git mvexistingpackages/operator-ui/src/pages/*.tsxintocomponents/pages/.- Extract the inline Desktop setup UI from
app.tsxintocomponents/pages/desktop-page.tsx. - Add a small
components/pages/memory-page.tsxwrapper aroundMemoryInspector. - Update
app.tsx+ tests to import fromcomponents/pages/*.
Pros: simplest, no duplication, aligns with issue goals.
Cons: any out-of-tree imports of src/pages/* would break (none expected; confirmed by ripgrep).
Option B: Move + keep src/pages/* as re-export shims
Same as Option A, but keep the old src/pages/* modules as re-exports that forward to components/pages/*.
Pros: extra safety for internal consumers.
Cons: extra files and indirection.
Testing strategy
- Add a new regression test that:
- asserts
packages/operator-ui/src/app.tsxis ≤200 lines, and - verifies all expected page modules exist and can be imported from
src/components/pages/*.
- asserts
- Rely on existing operator-ui unit tests (Dashboard/Approvals/Runs/etc.) to detect any behavior regressions from the move.