feat(events): SSE event bus + browser auto-reconciliation (BUNYIP-145) #176

Merged
YousifShkara merged 1 commit from feat/bunyip-145-sse-event-bus into main 2026-06-20 01:51:36 +02:00
Owner

Introduces a tokio::sync::broadcast-backed in-process EventBus on bunyip-api with per-user and global channels, and a long-lived GET /v1/events SSE endpoint subscribed to it. Six admin handlers (update_user_status, update_user_role, grant_membership, revoke_membership, grant_lifetime_membership, revoke_lifetime_membership) now publish ClaimsChanged or SessionRevoked events alongside the existing rt-revocation from BUNYIP-144, so a Brendon-style lifetime grant or an admin deactivation propagates to the user's browser within milliseconds. The bunyip-web dashboard and admin shells inject a tiny inline EventSource subscriber that opens against bunyip-api with credentials, reloads the page on claims_changed / profile_changed / applications_changed / resync, and redirects to /login on session_revoked. The browser-facing api origin is pinned into the layout module at startup via install_sse_api_origin so the script reaches every authenticated shell without threading config through 45 handler call sites. Keepalive frames every 25 s keep proxies (Cloudflare, Traefik) from killing the stream.

#BUNYIP-145

Introduces a tokio::sync::broadcast-backed in-process EventBus on bunyip-api with per-user and global channels, and a long-lived GET /v1/events SSE endpoint subscribed to it. Six admin handlers (update_user_status, update_user_role, grant_membership, revoke_membership, grant_lifetime_membership, revoke_lifetime_membership) now publish ClaimsChanged or SessionRevoked events alongside the existing rt-revocation from BUNYIP-144, so a Brendon-style lifetime grant or an admin deactivation propagates to the user's browser within milliseconds. The bunyip-web dashboard and admin shells inject a tiny inline EventSource subscriber that opens against bunyip-api with credentials, reloads the page on claims_changed / profile_changed / applications_changed / resync, and redirects to /login on session_revoked. The browser-facing api origin is pinned into the layout module at startup via install_sse_api_origin so the script reaches every authenticated shell without threading config through 45 handler call sites. Keepalive frames every 25 s keep proxies (Cloudflare, Traefik) from killing the stream. #BUNYIP-145
feat(events): SSE event bus + browser auto-reconciliation (BUNYIP-145)
All checks were successful
Create release / Create release from merged PR (pull_request) Has been skipped
Check / fmt / clippy / build / test (pull_request) Successful in 2m37s
47d5fc9cb5
Introduces a tokio::sync::broadcast-backed in-process EventBus on bunyip-api with per-user and global channels, and a long-lived GET /v1/events SSE endpoint subscribed to it. Six admin handlers (update_user_status, update_user_role, grant_membership, revoke_membership, grant_lifetime_membership, revoke_lifetime_membership) now publish ClaimsChanged or SessionRevoked events alongside the existing rt-revocation from BUNYIP-144, so a Brendon-style lifetime grant or an admin deactivation propagates to the user's browser within milliseconds. The bunyip-web dashboard and admin shells inject a tiny inline EventSource subscriber that opens against bunyip-api with credentials, reloads the page on claims_changed / profile_changed / applications_changed / resync, and redirects to /login on session_revoked. The browser-facing api origin is pinned into the layout module at startup via install_sse_api_origin so the script reaches every authenticated shell without threading config through 45 handler call sites. Keepalive frames every 25 s keep proxies (Cloudflare, Traefik) from killing the stream.

#BUNYIP-145
YousifShkara deleted branch feat/bunyip-145-sse-event-bus 2026-06-20 01:51:36 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/bunyip!176
No description provided.