Skip to content

Backfill the flowing lanes' activity buffer on relay reconnect - #753

Merged
xmap merged 1 commit into
mainfrom
relay-buffers-recent-activity
Aug 31, 2026
Merged

xmap merged 1 commit into
mainfrom
relay-buffers-recent-activity

Conversation

@xmap

@xmap xmap commented Aug 31, 2026

Copy link
Copy Markdown
Owner

Summary

  • "activity" was a pure pass-through on the relay, unlike snapshot/run_history/enclosure_timeline: a browser reconnecting (page refresh, resumed SSH tunnel) started from an empty client-side buffer and saw nothing until a new event happened, even though the flowing window is meant to show "the last 15 minutes."
  • The relay now buffers the last _ACTIVITY_BUFFER_SECONDS (15 min, mirroring page.html's FLOWING_WINDOW_MS) of individual events and replays them as one synthetic activity message on /watch connect, in the exact shape page.html's handleActivity already consumes — no client-side change needed.
  • Adds relay._activity_buffer reset to the test harness, and 4 new test_relay.py cases: broadcast, replay-on-late-connect, pruning of stale events, and malformed-payload handling.

Test plan

  • STATUS_RELAY_TOKEN=x apps/api/.venv/bin/python3 infra/status-relay/test_relay.py — 16/16 pass
  • Manually verified against a real relay + fake producer + a real browser: pushed 3 events (Run/Procedure/Caution), confirmed they rendered, then did a full page reload and confirmed all 3 were still there, backfilled from the relay's buffer, across all ten flowing lanes.
  • CI green.

"activity" was a pure pass-through with no relay-side cache, unlike
snapshot/run-history/enclosure-timeline: a browser that reconnected
(page refresh, resumed SSH tunnel) started from an empty buffer and
saw nothing until new events happened, even though the whole point of
the flowing window is "the last 15 minutes." The relay now buffers the
last _ACTIVITY_BUFFER_SECONDS of events and replays them as one
synthetic activity message on watcher connect, in the same shape
page.html's handleActivity already knows how to consume.

Verified against a real relay + fake producer + real browser: refreshing
the page after events had already arrived still showed them, backfilled
from the relay's buffer, across all ten flowing lanes.
@github-actions

Copy link
Copy Markdown

Coverage report

This PR does not seem to contain any modification to coverable code.

@xmap
xmap merged commit 5fe5afe into main Aug 31, 2026
17 checks passed
@xmap
xmap deleted the relay-buffers-recent-activity branch August 31, 2026 02:20
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