Skip to content

[Air #1403] Filter Stream Deck Zoom Navigator dial to active workspaces - #1405

Merged
amrmelsayed merged 8 commits into
mainfrom
builder/air-1403
Aug 11, 2026
Merged

amrmelsayed merged 8 commits into
mainfrom
builder/air-1403

Conversation

@amrmelsayed

Copy link
Copy Markdown
Collaborator

Summary

Closes #1403. Rotating the Stream Deck Zoom Navigator at the workspace altitude walked every registered workspace, dormant ones included. Dormant entries are dead stops on the dial: zooming into one yields no overview, and any action from there fails because Tower commands require the workspace active. This filters the plugin store's workspace list to active === true (strict filter, owner-ratified 2026-08-11).

What changed

All in apps/streamdeck/src/store.ts — the fix lives entirely in how the store populates its list; cursor.ts, the action layer, and the SDK are untouched.

  • fetchActiveWorkspaces() (new private): wraps client.listWorkspaces() and keeps only active entries. Both fetch sites route through it — refresh() and the stale-list re-fetch inside syncToWorkspace(). Filtering happens at fetch time, not per-render, because the zoom cursor and selectedWorkspacePath() index into the stored array; filtering per-render would desync the indices.
  • Cursor clamp in refresh(): when a workspace deactivates while it is the current selection, the next refresh drops it and the cursor could point past the end of the shorter list. refresh() snaps cursor.workspace back to 0 so selectedWorkspacePath() stays valid.
  • syncToWorkspace() (focus-follow): a dormant registration is filtered out, so its path stays unfound and falls through to the existing no-op — a registered-but-dormant path now behaves exactly like an unknown path (e.g. a builder-worktree window). Docstring + inline comment updated.

Tests

New describe('CodevStore active-workspace filtering') in apps/streamdeck/src/__tests__/actions.test.ts:

  • refresh() stores only active workspaces, and the dial cycles the active ones alone (clamped, dormant skipped) — the requested regression test with a mix of active + dormant entries.
  • Cursor clamps to a valid index when the selected workspace deactivates mid-session.
  • syncToWorkspace treats a dormant registration like an unknown path (no-op, no overview fetch).

Existing tests that set store.workspaces directly with dormant fixtures are unaffected — the filter runs only at fetch time, not on hand-assigned arrays.

Verification

  • pnpm check-types — clean
  • pnpm build (esbuild) — OK
  • pnpm test — 66/66 pass

(check-types needs @cluesmith/codev-types and @cluesmith/codev-sdk built first in a fresh worktree so their dist/ type declarations resolve.)

Notes / lessons

  • The TowerWorkspace.active field was already delivered on every /api/workspaces response and simply never consulted — this wires up existing data, no API change.
  • The dial clamps rather than wraps (per cursor.ts), so the regression test asserts clamp-at-end + reverse, not wrap-around.

Protocol

AIR — small, fully described in the issue, no architectural decisions. ~83 LOC of source change. No spec/plan/review files (AIR produces none; this PR body is the review).

…rkspaces

The plugin store kept every registered workspace, so rotating the Zoom
Navigator at the workspace altitude walked dormant entries — dead stops
with no overview where every command fails (commands require the workspace
active in Tower).

Filter the store's workspace list to active === true at fetch time (not
per-render) so the zoom cursor and selectedWorkspacePath() indices stay
coherent. Clamp the cursor when the selected workspace deactivates, and let
syncToWorkspace treat a dormant path like an unknown one (no-op).
@amrmelsayed

Copy link
Copy Markdown
Collaborator Author

Domain-owner review (streamdeck architect): approach, focus-follow fall-through, and tests match #1403. One fix requested before the pr gate: the deactivation clamp ({ ...this.cursor, workspace: 0 }) carries the old builder index into the fallback workspace; if that workspace has enough builders, selectedBuilder() silently points at an unrelated builder and slot/dev keys act on the wrong one. moveCursor already resets builder: 0 on workspace change — the clamp should too, plus a test for it. Sent to the builder via afx.

… active workspace

Addresses CMAP (claude) and architect PR review:
- Deactivation clamp now resets builder/file, not just workspace, so the
  cursor can't carry a stale builder index into the fallback workspace (which
  would make slot/dev keys act on an unrelated builder). Matches rotate() and
  syncToWorkspace().
- refreshOverview() returns early when no workspace is active, instead of
  calling getOverview(undefined) — with the strict filter, zero active
  workspaces is now routine, and the undefined-path fetch made Tower serve an
  arbitrary dormant workspace's overview onto a dial with nothing to act on.
@amrmelsayed
amrmelsayed merged commit 94d99d3 into main Aug 11, 2026
7 checks passed
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.

Stream Deck: Zoom Navigator cycles dormant workspaces; filter the dial to active ones

1 participant