refactor(desktop): move Workbar ownership below AppShell - #4692
Conversation
Own the Workbar controller in a feature provider, expose only stable shell commands plus the hidden-session projection, and let host/titlebar consumers read scoped contexts. Generated-by: Codex
hqhq1025
left a comment
There was a problem hiding this comment.
Reviewed exact head 14f0a65516ea0ad5e32a03fd1c62f24adf148d93 against base/current main 74a20f60c9a7bb6947e2c428f07ca2e83fad92a1.
I found no actionable P0-P3 issues in the reviewed scope.
The change moves useWorkbarController into the feature-owned provider (apps/desktop/src/renderer/features/workbar/ui/workbar-provider.tsx:70), exposes stable imperative shell commands plus the hidden-session external-store projection (apps/desktop/src/renderer/features/workbar/controller/workbar-shell-bridge.ts:51), and keeps the Session rail subscribed through useSyncExternalStore (apps/desktop/src/renderer/features/session-navigation/controller/use-session-navigation-reads.ts:73). I traced the active-session transition, Terminal cleanup, Side Chat cleanup, bridge publish/disconnect, titlebar/host context reads, AppShell command call sites, and E2E fixture path.
Local validation passed: focused Workbar/Session Navigation tests (25/25), Desktop full test suite under Node 24.18.1 (2062/2062), Desktop typecheck, production Desktop build, renderer architecture checks (71/71), AppShell hook ratchet, lint, format check, ASF headers, and git diff --check. The merge tree is clean and current main equals the PR base.
Hosted CI has not executed: the CI run is terminal action_required with no jobs, and only the label check is green. I also did not run an interactive Electron/macOS smoke test. This is a refactor, so the final design and merge decision remains with a human reviewer.
Automated review notice: This review was produced with AI assistance and does not replace independent human review.
Summary
useWorkbarControllerownership fromAppShellinto a feature-ownedWorkbarProvider.WorkbarHostand the titlebar restore action consume narrow feature contexts instead of receiving the controller model through the shell.Refs #4582
Verification
fnm exec --using=24.16.0 npm run build:testfnm exec --using=24.16.0 npm --workspace @maka/desktop run build:rendererfnm exec --using=24.16.0 npm run typecheckfnm exec --using=24.16.0 npm --workspace @maka/desktop run test:dist— 2,062 passedfnm exec --using=24.16.0 npm run check:renderer-architecture -- --base origin/mainnpm run lint,npm run format:check, Desktop/UI Knip, AppShell hook ratchet, Astryx inventory, and ASF header checkThe aggregate
npm run test:distalso exercises unrelated workspaces. The affected Desktop workspace passed completely; the aggregate remained non-zero because the unchanged Runtime Host testWorkHub correction replaces its link without stopping a shared manual Turnfails locally (this branch has nopackages/runtime-hostdiff). Eval's JavaScript suite passed, and its Python suite passed under Python 3.11 (82 tests, 12 skipped); the systempython3is Python 3.9 and cannot parse the suite'sX | Noneannotations.AI use
Select exactly one:
Tool(s) and scope: OpenAI Codex assisted with implementation, tests, documentation, local validation, and automated review. The affected commit carries the required
Generated-by: Codextrailer.Checklist
Does this PR entail a change in behavior?