-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Overview
The authorization flow has insufficient error handling and doesn't properly handle edge cases like dialog cancellation or network failures.
Location
File: intellij-plugin/hs-core/src/org/hyperskill/academy/learning/stepik/hyperskill/HyperskillRestService.kt
Functions: withUserIdCheck (lines 102-146), askToReLogin (line 188+)
Problems
askToReLoginmakes an API call withgetUser(userId)that can fail, but error handling is minimal- Line 194:
getInEdtis used without proper exception handling - if user closes dialog unexpectedly, state is inconsistent - No timeout handling for API calls
- If re-login is initiated (line 140), the original action is never retried if authorization fails
What needs to be fixed
- Add proper timeout and retry logic for
getUserAPI call - Handle dialog cancellation and window close events properly
- Add logging for authorization flow steps (useful for debugging user issues)
- Ensure
doAuthorizecallback is properly invoked even if re-login fails - Add a state machine or explicit states for authorization flow to prevent inconsistencies
Tests understanding of
- REST API error handling patterns
- Dialog state management
- EDT operations with dialogs (
getInEdt) - Callback patterns and error propagation
- User interaction flow design
- Network resilience and timeout handling
Validation
- Simulate network failures (disconnect during authorization)
- Cancel dialog at various stages
- Test with invalid credentials
- Ensure consistent state and proper error messages
- Verify original action is retried after successful re-login
Estimated time
4-5 hours
Metadata
Metadata
Assignees
Labels
No labels