refactor: separate board projection from cache, SSE, and restage logic in board.ts #1139

Closed
opened 2026-05-13 21:28:05 +00:00 by claude-desktop · 0 comments
Collaborator

As a developer working on the pipeline view, I want domain/views/board.ts split by concern, so that the core board projection is readable and testable without tracing through cache invalidation, SSE fanout, restage logic, and kick operations.

Decomposition

  • domain/views/board-projection.ts — pure: derive BoardCard[] from issues + tasks + PR state; no I/O, no cache
  • domain/views/board-cache.ts — cache invalidation, TTL, _deps map, _cache map
  • domain/views/board-sse.ts — SSE listener registration (_sseListenerRegistered), event fanout
  • Restage + kick operations stay in board.ts or move to board-actions.ts

Mutable state

  • Eliminate the 6 module-level let variables (_deps, _cache, _sseListenerRegistered, _agentInstancesCache, _restageDeps, _kickDeps)
  • Encapsulate in a class or closure returned by an init() function

Tests

  • board-projection is unit-testable with pure inputs (no DB, no SSE)

Out of scope

  • Changing board API response shape
  • PR state resolution algorithm

References

  • apps/server/src/domain/views/board.ts (1817 lines)
  • 6 mutable module-level let variables
  • Codebase audit 2026-05-13
As a developer working on the pipeline view, I want `domain/views/board.ts` split by concern, so that the core board projection is readable and testable without tracing through cache invalidation, SSE fanout, restage logic, and kick operations. ### Decomposition - [ ] `domain/views/board-projection.ts` — pure: derive `BoardCard[]` from issues + tasks + PR state; no I/O, no cache - [ ] `domain/views/board-cache.ts` — cache invalidation, TTL, `_deps` map, `_cache` map - [ ] `domain/views/board-sse.ts` — SSE listener registration (`_sseListenerRegistered`), event fanout - [ ] Restage + kick operations stay in `board.ts` or move to `board-actions.ts` ### Mutable state - [ ] Eliminate the 6 module-level `let` variables (`_deps`, `_cache`, `_sseListenerRegistered`, `_agentInstancesCache`, `_restageDeps`, `_kickDeps`) - [ ] Encapsulate in a class or closure returned by an `init()` function ### Tests - [ ] `board-projection` is unit-testable with pure inputs (no DB, no SSE) ### Out of scope - Changing board API response shape - PR state resolution algorithm ### References - `apps/server/src/domain/views/board.ts` (1817 lines) - 6 mutable module-level `let` variables - Codebase audit 2026-05-13
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/agent-hooks#1139
No description provided.