Skip to content

refactor(navigator_client): type _log_retry's retry_state as tenacity.RetryCallState - #292

Merged
dhruvbatra merged 1 commit into
mainfrom
claude/admiring-hawking-mtbb8s
Aug 23, 2026
Merged

refactor(navigator_client): type _log_retry's retry_state as tenacity.RetryCallState#292
dhruvbatra merged 1 commit into
mainfrom
claude/admiring-hawking-mtbb8s

Conversation

@dhruvbatra

@dhruvbatra dhruvbatra commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

What

NavigatorClient._log_retry in src/frontend_visualqa/navigator_client.py is registered as tenacity's before_sleep callback (AsyncRetrying(..., before_sleep=self._log_retry, ...)). Tenacity always invokes this callback with a tenacity.RetryCallState instance — a concrete type this file already imports from — but the parameter was annotated Any. The body already relies on RetryCallState's real attributes (attempt_number, next_action.sleep).

This adds RetryCallState to the existing from tenacity import ... line and updates the annotation from Any to RetryCallState.

Why it's safe

  • Annotation-only change; Python doesn't enforce type hints at runtime, so no execution path changes.
  • Any is still used elsewhere in the file (11 other call sites), so the import stays necessary.
  • Matches the same mechanical "replace leftover Any with the concrete type the value actually is" pattern already applied and merged repeatedly in this repo.
  • ruff check / ruff format --check pass, and tests/test_navigator_client.py (18 tests) passes unchanged.

Scope

1 file changed (src/frontend_visualqa/navigator_client.py), 2 lines.


Generated by Claude Code


Note

Low Risk
Type-hint-only change with no execution-path or API impact.

Overview
Types NavigatorClient._log_retry's retry_state as tenacity's RetryCallState instead of Any, matching the before_sleep callback tenacity actually passes.

Annotation-only; no runtime behavior change.

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

Summary by CodeRabbit

  • Refactor
    • Improved internal retry logging type annotations for better code quality and maintainability.

….RetryCallState

The before_sleep callback tenacity invokes is always a RetryCallState
instance (already imported from tenacity elsewhere in this file), and the
body relies on its real attribute_number/next_action attributes, but the
parameter was annotated Any. Annotation-only change, no behavior change.
@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a5898a98-a088-442a-99a6-d81878566e60

📥 Commits

Reviewing files that changed from the base of the PR and between 3f7ba96 and bd4508e.

📒 Files selected for processing (1)
  • src/frontend_visualqa/navigator_client.py

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The change imports Tenacity’s RetryCallState and replaces the _log_retry parameter annotation previously typed as Any. Runtime behavior remains unchanged.

Changes

Retry callback typing

Layer / File(s) Summary
Retry state annotation
src/frontend_visualqa/navigator_client.py
_log_retry now uses Tenacity’s RetryCallState type. The required import was added.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to bd450

This localized type-hint change does not alter runtime behavior or user-facing functionality, and no actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: juanpin

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the annotation-only refactor for _log_retry and names the new tenacity.RetryCallState type.
Docstring Coverage ✅ Passed Docstring check was indeterminate for this PR — some files could not be analyzed in time. Not blocking.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/admiring-hawking-mtbb8s

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@dhruvbatra
dhruvbatra merged commit 2a36b75 into main Aug 23, 2026
4 checks passed
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