Skip to content

Comments

refactor: refactor authentication flows and improve event handling#5

Merged
appleboy merged 1 commit intomainfrom
lint
Feb 22, 2026
Merged

refactor: refactor authentication flows and improve event handling#5
appleboy merged 1 commit intomainfrom
lint

Conversation

@appleboy
Copy link
Member

  • 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>
Copilot AI review requested due to automatic review settings February 22, 2026 14:08
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 performBrowserFlow and performDeviceFlow functions 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.

@appleboy appleboy merged commit d35db9e into main Feb 22, 2026
20 checks passed
@appleboy appleboy deleted the lint branch February 22, 2026 14:18
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