fix(ui): support external bearer-auth websocket hosts#166
Conversation
|
Final report for What changed:
Local validation:
Review / PR status:
PR is ready for merge from my side. |
👍 GitRank PR AnalysisScore: 20 points
Eligibility Checks
Impact SummaryThis PR fixes WebSocket authentication for external Spritz API hosts by adding support for bearer token propagation in WebSocket URLs and implementing auth token refresh on connection failures. The changes enable the UI to connect to remote API servers with proper authentication, supporting both same-origin and cross-origin deployment scenarios. Comprehensive test coverage is added for chat and terminal WebSocket connections with various authentication configurations. Analysis DetailsComponent Classification: This PR affects the UI layer's WebSocket connectivity and authentication handling, which doesn't fit neatly into a specific business component category. It's a cross-cutting infrastructure improvement for external API integration. Severity Justification: This is a Medium (P2) severity fix addressing a functional bug where external bearer-auth WebSocket connections were not properly supported. The issue has a workaround (same-origin connections) and doesn't cause data loss or complete service failure, but it does prevent legitimate use cases for external API hosts. Eligibility Notes: Issue: True - PR title indicates a bug fix ('support external bearer-auth websocket hosts'). Fix Implementation: True - code changes align with the stated goal of adding bearer token support and WebSocket URL construction for external hosts. PR Linked: True - detailed description with TL;DR, summary, review focus, and test plan. Tests: True - 387 lines of test additions across chat.test.tsx and terminal.test.tsx. Tests Required: True - this is a bug fix in business logic (authentication and WebSocket connectivity) that requires regression testing to ensure the fix works correctly and doesn't break existing same-origin scenarios. Analyzed by GitRank 🤖 |
TL;DR
This fixes the external-UI auth path in the Spritz web client. Chat and terminal WebSockets now honor an absolute Spritz API base URL and can authenticate with the configured bearer token instead of assuming same-origin cookie auth.
Summary
Review focus
/apimode versus absolute external API hostsTest plan
pnpm --dir /Users/onur/repos/spritz/ui test src/pages/chat.test.tsx src/pages/terminal.test.tsxpnpm --dir /Users/onur/repos/spritz/ui testpnpm --dir /Users/onur/repos/spritz/ui typecheckpnpm --dir /Users/onur/repos/spritz/ui build