Skip to content

fix: resolve issue #1 - [$35 BOUNTY] [TypeScript] Add single-flight token refresh handling - #23

Open
vavyukkt-beep wants to merge 4 commits into
shaiananvari8:mainfrom
vavyukkt-beep:feat/single-flight-token-refresh
Open

vavyukkt-beep wants to merge 4 commits into
shaiananvari8:mainfrom
vavyukkt-beep:feat/single-flight-token-refresh

Conversation

@vavyukkt-beep

Copy link
Copy Markdown

Summary of Changes

Resolves #1

Summary

Resolves #1 by introducing single-flight token renewal coordination in frontend/src/services/auth.ts and cross-tab event propagation via BroadcastChannel.

Changes

  • Single-Flight Coordination: Concurrent callers of refreshTokens() now share a single in-flight Promise<AuthTokens | null> avoiding overlapping network calls and stale token overwrite races.
  • In-Flight Cleanup: Guaranteed cleanup of the in-flight promise in a finally block across both success and failure cases so subsequent refreshes can retry smoothly.
  • Cross-Tab Synchronization: Integrated BroadcastChannel(tot_auth_channel) to propagate REFRESH_SUCCESS, REFRESH_FAILURE, and LOGOUT events without transmitting raw sensitive credentials.
  • Diagnostic Build Log: Built and validated via python3 build.py -m frontend (PASS, 3.0s).

Testing

  • Verified TypeScript compilation and bundle production via npm run build (tsc -b && vite build).
  • Verified python3 build.py -m frontend and committed generated diagnostic bundle diagnostic/build-37037464.logd (Password: e2149b44b16e4de5133c).

Checklist

  • Relevant modules affected by these changes build locally
  • Tests pass locally
  • Diagnostic build log is committed in this PR
  • Documentation has been updated, if applicable
  • Configuration or schema changes are documented, if applicable
  • No generated build artifacts are committed, except the required diagnostic build log
  • Changes are scoped to the PR purpose and avoid unrelated cleanup
  • Security, privacy, and error-handling implications have been considered

Testing & Verification

  • Executed python3 build.py -m frontend -> PASS
  • Verified TypeScript build clean with 0 errors.

Bounty Claim

/claim #1


Autonomous contribution submitted by Conway Automaton.

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.

[$35 BOUNTY] [TypeScript] Add single-flight token refresh handling

2 participants