Skip to content

refactor(ui): move routed surfaces and agent-workspace state onto the view scope (RIG-4442) - #1675

Merged
trunk-io[bot] merged 3 commits into
compass-ui/rig-4439-view-scopefrom
compass-ui/rig-4442-surfaces-use-view
Oct 7, 2026
Merged

trunk-io[bot] merged 3 commits into
compass-ui/rig-4439-view-scopefrom
compass-ui/rig-4442-surfaces-use-view

Conversation

@rigel-mintaka

@rigel-mintaka rigel-mintaka commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

This PR is part of a stack containing 7 PRs:

  1. main
  2. refactor(ui): extract parseRoute and add ViewScope with useView (RIG-4439) #1652
  3. "refactor(ui): move routed surfaces and agent-workspace state onto the view scope (RIG-4442)" (this PR)
  4. feat(ui): window layout model, hash sync and session persistence (RIG-4443) #1743
  5. feat(ui): view tab strip with keep-alive and open-in-tab links (RIG-4444) #1755
  6. feat(ui): W leader chords and palette commands for tabs and panes (RIG-4445) #1770
  7. feat(ui): two-pane split with a resizable splitter (RIG-4446) #1780
  8. fix(ui): chrome cleanup: drop ADE and usage bar, Session Log naming, pane edges, row re-measure (RIG-4771) #1811

T2 of the in-window tabs and split views record (docs/designs/ui/compass-in-window-tabs/design.md §T2). Stacked on #1652 (T1). There is still one view per window, so nothing changes for the user.

  • agent-tabs.ts (new): the tab and split model moves out of store.ts unchanged.
  • view-scope.ts: each view owns its agent workspace (tabs, active tab, repo id), keyed on the route's agent. The same agent, or a non-agent route, keeps it; a different agent starts fresh. This is the old agentViewAgentId rule. It adds agentTabs, activeAgentTab, agentSession, openTab, closeTab, splitFocused and workspaceChannel.
  • components/ViewHost.tsx (new): renders a scope's route through appRoutes, so the route table stays the one component map. A non-canonical path renders the *all catch-all, which redirects home as before.
  • store.ts: adds focusedView. view, selectedChannelId, selectedTopicId and activeRepoId now derive from it. The router hash goes to the focused view, and a redirect the view makes itself is pushed back to the URL. applyRoute and the apply*Route functions are gone. Issue selection stays window-wide (§A1) and is re-anchored on each agent entry, as before.
  • App.tsx renders <ViewHost scope={store.focusedView()} /> in <main>. AgentView, LogPanel, TopicView and ChannelView (when it has no channel prop) read useView().

One test deleted: store.test.ts › openAgent › a standalone channel selection does not move the workspace channel. It held a standalone channel and an agent workspace in one view at once. With a view owning its route, openChannel moves the focused view off the agent, so that state can't exist. Per-view independence is now covered by ViewHost.test.tsx. The mirror case (re-opening the agent-view agent shows its home DM…) still passes unchanged.

Tests

  • Red-green ViewHost.test.tsx: two ViewHosts on /agent/acc-compass-ui and /agent/acc-compass-server. Before the change: 0 pass / 2 fail (each view renders its own agent: expected compass-ui, got undefined; opening a terminal tab in one view leaves the other unchanged: expected 1, got 0). After: 2 pass.
  • moon run compass-ui:test: 1213 pass, 0 fail. typecheck and stylelint pass. biome reports 0 errors on the changed files; its 3 complexity warnings in store.ts already exist on the parent.
  • Playwright visual-smoke and dev-boot: 13 passed, with no baseline changes.

Spec-impact: none.
Ledger-impact: none

Co-authored-by: Matt Wilkinson matt@rigel.build

… view scope (RIG-4442)

Co-authored-by: Matt Wilkinson <matt@rigel.build>
@linear-code

linear-code Bot commented Oct 5, 2026

Copy link
Copy Markdown

RIG-4442

@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Compass engineering docs preview: https://compass-ui-rig-4442-surfaces.compass-eng-docs.pages.dev

Deployed from compass-ui/rig-4442-surfaces-use-view at baa006f.

rigel-mintaka and others added 2 commits October 4, 2026 21:24
…allback URL (RIG-4442)

Co-authored-by: Matt Wilkinson <matt@rigel.build>
…-4442)

Co-authored-by: Matt Wilkinson <matt@rigel.build>
@trunk-io

trunk-io Bot commented Oct 7, 2026

Copy link
Copy Markdown

This pull request is queued for merge as part of 1798, which will merge 1652, 1675, 1743, 1755, 1770, 1780, 1787, 1798.

@trunk-io
trunk-io Bot merged commit 8f42d2a into main Oct 7, 2026
19 checks passed
@trunk-io
trunk-io Bot deleted the compass-ui/rig-4442-surfaces-use-view branch October 7, 2026 04:16
@trunk-io

trunk-io Bot commented Oct 7, 2026

Copy link
Copy Markdown

This pull request was merged into main as part of stacked PR 1798.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants