Skip to content

refactor: extract _failure_result helper in run_login_flow#136

Merged
dhruvbatra merged 1 commit into
mainfrom
claude/cool-brahmagupta-j0swgi
Jun 17, 2026
Merged

refactor: extract _failure_result helper in run_login_flow#136
dhruvbatra merged 1 commit into
mainfrom
claude/cool-brahmagupta-j0swgi

Conversation

@dhruvbatra

@dhruvbatra dhruvbatra commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Extracts a _failure_result(error, *, auth_url, api_key) helper in yutori/auth/flow.py
  • Replaces 9 repeated LoginResult(success=False, ...) constructions across run_login_flow with calls to this helper
  • No behavior change — purely structural, reduces repetition and noise in the error paths

Test plan

  • All 442 existing tests pass (pytest tests/ -q)
  • _failure_result correctly forwards all fields to LoginResult

🤖 Generated with Claude Code

https://claude.ai/code/session_01Vnp9wfHm41iGtaXozEEhFV


Generated by Claude Code


Note

Low Risk
Structural refactor only; failure payloads and success paths are unchanged.

Overview
Introduces _failure_result(error, *, auth_url, api_key) in yutori/auth/flow.py as the single place to build failed LoginResult values (success=False plus optional auth_url / api_key).

run_login_flow now uses that helper for every error return (callback server startup, timeout, OAuth callback errors, state mismatch, missing code, config save failure, HTTP errors, and other exceptions) instead of repeating inline LoginResult construction. Success paths are unchanged.

Reviewed by Cursor Bugbot for commit 8ffaff1. Bugbot is set up for automated code reviews on this repo. Configure here.

Reduces 9 repeated LoginResult(success=False, ...) constructions to a
single helper, making the error paths in the OAuth login flow more concise.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vnp9wfHm41iGtaXozEEhFV
@dhruvbatra dhruvbatra merged commit 1b248b8 into main Jun 17, 2026
9 checks passed
@dhruvbatra dhruvbatra deleted the claude/cool-brahmagupta-j0swgi branch June 17, 2026 13:09
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.

2 participants