feat(transport): transport SSOT phase 1 — server-authoritative state#432
feat(transport): transport SSOT phase 1 — server-authoritative state#432dimakis wants to merge 2 commits into
Conversation
…ecovery, SSE default Transport SSOT Phase 0: additive foundation, no behavior change. - Add ClientSessionState type and SessionStateEvent interface (types.ts) - Emit session_state_changed event from setSessionState() with 7→3 state mapping - Sync is_active from state on every transition (backwards-compatible) - Add recoverStaleSessions() to mark ACTIVE/STARTING/DETACHED/SUSPENDED → ENDED on startup - Call recoverStaleSessions() in server startup (index.ts) - Add state field to /api/sessions/:id/meta response (app.ts) - Flip SSE to default transport, WS opt-in via localStorage (client-store.ts) - Add session_state_changed case to protocol parser (no-op, ready for P1) Design doc: docs/design/transport-ssot.md (on design/transport-ssot branch) Telos: 97361f814c5f54df Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…with session_state_changed Transport SSOT Phase 1: client reads running state from server events only. Server: - handleReconnect uses getSessionState() instead of getSession().isActive - Remove redundant markSessionInactive() in query-loop (setSessionState syncs is_active) - Remove running field from reconnected and session_switched messages - connection-registry isSessionActive uses state instead of is_active column Client: - Activate session_state_changed handler to dispatch SESSION_STATE_CHANGED action - Replace SET_RUNNING action with SESSION_STATE_CHANGED (derives running from state) - Remove syncRunningState() REST polling and foreground call site - Remove running field handling from reconnected/session_switched/takeover/subscribed parsers - handleStop uses SESSION_STATE_CHANGED instead of SET_RUNNING Dead code removed: SET_RUNNING action type, syncRunningState(), runningSyncInFlight, running field in reconnected summaries and session_switched messages. Design doc: docs/design/transport-ssot.md (on design/transport-ssot branch) Depends on: PR #431 (P0 foundation) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Centaur ReviewFound 7 issue(s) (1 critical) (4 warning).
|
e830856 to
9e2fcbc
Compare
Summary
session_state_changedeventsSET_RUNNINGaction withSESSION_STATE_CHANGED— running derived fromstate === 'running'syncRunningState()REST polling (state events make it unnecessary)runningfield fromreconnectedandsession_switchedserver messagesis_activereaders to usestatecolumn (handleReconnect, connection-registry, query-loop)Dead code removed
SET_RUNNINGaction type and reducer casesyncRunningState()function andrunningSyncInFlightflagrunningfield in reconnected summaries and session_switched messagesmarkSessionInactive()call in query-loop (redundant with setSessionState)Context
Design doc: PR #430 (
design/transport-ssotbranch)Depends on: PR #431 (P0 foundation)
Telos: 97361f814c5f54df
Test plan
🤖 Generated with Claude Code