Conversation
Member
appleboy
commented
Feb 22, 2026
- Remove performBrowserFlow and performDeviceFlow functions, likely to centralize flow handling elsewhere
- Refactor various if-else chains to switch statements for improved clarity and maintainability
- Update TUI models to handle key and update events more robustly, ignoring irrelevant messages for each flow
- Add //nolint:exhaustive comments to clarify key handling logic
- Make minor code quality improvements, such as correcting modulus assignment syntax and cleanup in displaying token expiration information
- Explicitly distinguish between browser and device flow specific events to avoid handling them in the wrong context
- Remove performBrowserFlow and performDeviceFlow functions, likely to centralize flow handling elsewhere - Refactor various if-else chains to switch statements for improved clarity and maintainability - Update TUI models to handle key and update events more robustly, ignoring irrelevant messages for each flow - Add //nolint:exhaustive comments to clarify key handling logic - Make minor code quality improvements, such as correcting modulus assignment syntax and cleanup in displaying token expiration information - Explicitly distinguish between browser and device flow specific events to avoid handling them in the wrong context Signed-off-by: appleboy <appleboy.tw@gmail.com>
There was a problem hiding this comment.
Pull request overview
This PR refactors authentication flow handling and improves code maintainability across the TUI components. The changes centralize flow handling by removing legacy flow functions and standardize control flow patterns using switch statements instead of if-else chains. Event handling is also improved with explicit filtering to prevent browser and device flow events from being processed in the wrong context.
Changes:
- Removed legacy
performBrowserFlowandperformDeviceFlowfunctions that have been replaced by update-based variants - Converted all if-else chains to switch statements for improved readability and consistency
- Added explicit event filtering in TUI models to ignore flow-specific events in the wrong context
- Simplified token expiration display logic and corrected modulus assignment syntax
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| browser_flow.go | Removed legacy performBrowserFlow function |
| device_flow.go | Removed legacy performDeviceFlow function |
| tui/simple_manager.go | Converted if-else chains to switch statements, added event filtering, simplified token expiration display |
| tui/device_view.go | Corrected modulus assignment operator usage |
| tui/device_model.go | Added nolint comment for key handling, added browser flow event filtering |
| tui/browser_model.go | Added nolint comment for key handling, added device flow event filtering |
| tui/browser_view.go | Converted if-else chain to switch statement |
| tui/components/step_indicator.go | Converted if-else chains to switch statements in both View methods |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.