Skip to content

feat: support resumable SSE recovery - #271

Merged
everpcpc merged 2 commits into
masterfrom
feat/sse-resume-reset
Oct 24, 2026
Merged

everpcpc merged 2 commits into
masterfrom
feat/sse-resume-reset

Conversation

@everpcpc

@everpcpc everpcpc commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Add boot-scoped, monotonically increasing IDs to domain events and retain the most recent 1024 events in memory.
  • Resume native EventSource connections with Last-Event-ID only when the complete event sequence is still available.
  • Start with live events without replay when continuity cannot be proven; no custom recovery event is added to the SSE protocol.
  • Keep the web UI unchanged: it applies events as they arrive and does not automatically refresh all state after a reconnect.

Recovery semantics

  • Subscribing to live events and choosing whether to replay are atomic, so events cannot fall between replay and live delivery.
  • Replay preserves the existing administrator and per-user event scopes.
  • Heartbeats and TaskQueueStatus snapshots do not advance the recovery cursor.
  • A lagging stream closes so the browser can reconnect and either replay or continue live.
  • Replay is best-effort: events outside the retained history and one-off notifications during a gap can be missed. Users can reload the page if they notice stale state.
  • Recovery is limited to the current browser connection lifecycle; no event IDs are persisted across page loads.

Validation

  • cargo nextest run --workspace — 1226 passed, 1 skipped
  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • corepack pnpm build and corepack pnpm lint in webui/
  • Regression tests were shown to fail before the corresponding replay and recovery changes.
  • Browser verification: after a server restart and out-of-band database rename, the open page kept showing Before Reconnect; after a manual reload, it showed After Reconnect.

Documentation

@everpcpc
everpcpc marked this pull request as ready for review October 24, 2026 02:57
@everpcpc
everpcpc merged commit 7a7a4b9 into master Oct 24, 2026
9 checks passed
@everpcpc
everpcpc deleted the feat/sse-resume-reset branch October 24, 2026 03:25
everpcpc added a commit to kmworks/website that referenced this pull request Oct 24, 2026
- Document complete-only SSE replay, the live fallback for incomplete history, and best-effort recovery limits.
- Link the recovery guide from the enhancements overview and public-route verification checklist.

Related to kmworks/kmrs#271.
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.

1 participant