Skip to content

fix(ui): fire streaming capability announce after authenticate()#2005

Open
kgabryje wants to merge 2 commits into
mainfrom
fix-streaming-announce-trigger
Open

fix(ui): fire streaming capability announce after authenticate()#2005
kgabryje wants to merge 2 commits into
mainfrom
fix-streaming-announce-trigger

Conversation

@kgabryje

Copy link
Copy Markdown
Member

The client-side session-streams capability announce was wired only to client.on('authenticated'), an event the real Feathers v5 client never emits (it emits login; useBoardPresenceRoom only survives because it also wires client.io.on('connect'), masking the same dead listener). Because the announce never fired in prod, no connection was ever marked session-streams aware, so #1896's daemon owner-fallback gate never engaged and idle home/board tabs kept receiving the full streaming firehose.

Fix: replace the listener with a plain announceSessionStreamsCapability(client) and fire it explicitly after every successful authenticate() — initial auth, reconnect re-auth, reconnect refresh-fallback, and in-place token-refresh reauth. Firing once per (re)auth is correct (each is a connection to mark aware; the server side is idempotent). The announce stays post-auth because a pre-auth call would 401 and trigger refresh churn.

Daemon gate unchanged — it is already correct and deployed. Proven in prod: manually firing the announce in a live idle tab dropped the streaming firehose from ~18 events/15s to 0.

Tests: the old test emitted a mock authenticated event, so the announce fired in-test and went green while prod was broken (false green). Replaced with (1) a unit test of announceSessionStreamsCapability and (2) a real renderHook seam test that drives the actual connect→authenticate flow with a controllable authenticate() promise, asserting the announce fires after authenticate resolves and not before (guards the pre-auth 401 regression). Verified this seam test goes red when the post-auth announce is removed.

🤖 Generated with Claude Code

kgabryje and others added 2 commits July 23, 2026 16:36
The announce was wired to client.on('authenticated'), which never fires
in the real Feathers v5 client, so #1896's owner-fallback gate never
engaged and idle tabs still got the streaming firehose. Fire it
explicitly after each successful authenticate (initial/reconnect/refresh).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The seam test covered only the initial-auth announce. Add renderHook
tests for the reconnect direct re-auth, reconnect refresh-fallback, and
in-place token-refresh reauth paths so dropping any announce site goes red.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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