Repository navigation
Description
Problem and impact
The application page schedules its fallback polling only while it already knows about an active deployment. An idle page has no periodic reconciliation, even though the SSE contract explicitly requires a slow fallback because a late-committing transaction may carry an event ID older than the stream's cursor.
If a deployment is started elsewhere and its change hint is missed, the idle page can remain stale until a manual refresh or another relevant event. Reopening the SSE connection alone does not reload application state.
Priority: P2, from the 2026-11-25 architecture audit of main 1295e534d7a1c3cd0a492449de8806aa532a4924. Related UI work: #25. This is distinct from closed #345, which addressed server-side SSE buffering/backpressure.
Evidence and reproduction
- SPEC's SSE contract requires slow fallback polling for late commits.
- The server implementation explains the same limitation: events are reload hints, and ID order need not match commit order.
- ApplicationPage.refresh installs its next timeout only inside
if (this.active()). - LiveEvents.onopen updates connection status without requesting a reload.
A bounded fake-clock test extracted and transpiled the exact current refresh method, supplied no active deployment and a connected SSE client, invoked refresh, then advanced time by five minutes. It observed one deployment fetch total and no scheduled timer.
The test proves the absent idle fallback. The missed-event consequence follows from the documented cursor/commit-order limitation; this audit did not reproduce a late PostgreSQL commit through a live browser and SSE server.
Proposed correction
Maintain a slow, bounded fallback while the application page is visible, including when idle, and reconcile state after a stream is established/re-established. Preserve the faster polling used for an active deployment when SSE is unavailable. Avoid overlapping refreshes and stale writes when navigation changes the resource context.
Acceptance criteria
- An idle application page notices a deployment started elsewhere within a documented bounded delay even if its SSE hint is omitted.
- Initial connection/reconnection reconciles authoritative API state without depending on a new change event.
- Active-deployment refresh behavior remains responsive and bounded.
- Timers and requests do not accumulate across reconnections, navigation or destruction; overlapping refreshes are coalesced or safely ordered.
- Tests cover idle state, a deliberately omitted event, reconnect, SSE unavailable, context changes and cleanup.
- Keep the SSE server's existing backpressure and live permission checks intact.
Publication check: main advanced to 2ee78ff1e96118b1732b98bc54c99f5f91b95a32 through #469, which changes only an exec-session test. The production paths above are unchanged.
Activity