Skip to content

feat: permissions widget, bearer-only SSE client, app-level notifications - #1

Merged
xcodeassociated merged 4 commits into
mainfrom
feat/ws-ticket-auth-frontend
Nov 7, 2026
Merged

xcodeassociated merged 4 commits into
mainfrom
feat/ws-ticket-auth-frontend

Conversation

@xcodeassociated

Copy link
Copy Markdown
Owner

Summary

Four commits on top of main: realtime live-updates, a permissions widget, and backend-failure UX rework.

  • App-level notifications provider — single SSE connection (src/providers/notifications.tsx + src/hooks/useSseUsers.ts) gated on auth state; generation-counter supersession, 45s silence watchdog on top of server heartbeats, auto-recovery on online/tab-visible, and the token_expired/logged_out termination contract (remote logout locks every route via expireSession()).
  • Bearer-only SSE transport — fetch-based client sends the access token as a header (no EventSource, no ticket, no credential in URLs); getAccessToken() proactively refreshes before every REST/GraphQL request.
  • Permissions widget — route-less header widget (ShieldCheck → right-side Sheet) doing permission CRUD through Apollo; it is the single permission data layer, shared with the users-page roles combobox. Mutations refetch active documents via refetchQueries; users freshness comes from the server's single USERS_SYNCED SSE broadcast per mutation (no local invalidation racing the async fan-out).
  • Per-component backend-down UX — no global health slice; each surface renders its own error with Try again, keeps previousData on failed refreshes, no toast spam.
  • Users page state in the URL (page/size/sort/desc) and the cross-feature redux event spine removed in favour of the shared data layer + stream invalidation.
  • Misc: nav hover pills + wider home/counter cards, docs for the second test user and .credentials rule.

Validation

  • bun run check — 0 errors (pre-existing warnings only)
  • bun run test — 9 files, 75 tests passed
  • E2E (real stack, two isolated Playwright contexts): login/logout, cross-user live updates (USER_CREATED/UPDATED/DELETED), permission rename/delete → users-table chips update on the single USERS_SYNCED broadcast, reconnect-after-outage catch-up via onConnect revalidation, dark mode, pl/en, responsive at 375–1280 with no horizontal overflow, clean console.

…nd failover

- permissions: header widget (Sheet CRUD, pagination, optimistic-lock version)
  with one shared data layer feeding the users roles combobox; mutations
  refetch via refetchQueries — no redux event spine
- sse: fetch-based bearer client (no EventSource, no tickets, no credentials
  in URLs — BE ADR-0007); generation guard, 45s silence watchdog, wake
  recovery, token_expired/logged_out termination contract; ticket lib removed
- backend-down UX: per-component, no global health state — failed refresh
  keeps cached rows (data ?? previousData) with a short stale notice + Retry;
  nothing cached -> error card + Try again; copy generic and
  production-appropriate; never a Not Found swap, never toast spam
- notifications provider owns the single app-level stream; users page state
  lives in the URL
- tests: 75 passing (Vitest + RTL + MSW); E2E-verified live incl. SIGTERM
  graceful-shutdown badge flip and cross-surface recovery
@xcodeassociated
xcodeassociated merged commit 25c72d0 into main Nov 7, 2026
2 checks passed
@xcodeassociated
xcodeassociated deleted the feat/ws-ticket-auth-frontend branch November 7, 2026 12:15
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