refactor(navigator_client): type _log_retry's retry_state as tenacity.RetryCallState - #292
Conversation
….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.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe change imports Tenacity’s ChangesRetry callback typing
Estimated code review effort: 1 (Trivial) | ~2 minutes Merge Risk: ⚪ Minimal · up to 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: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
What
NavigatorClient._log_retryinsrc/frontend_visualqa/navigator_client.pyis registered as tenacity'sbefore_sleepcallback (AsyncRetrying(..., before_sleep=self._log_retry, ...)). Tenacity always invokes this callback with atenacity.RetryCallStateinstance — a concrete type this file already imports from — but the parameter was annotatedAny. The body already relies onRetryCallState's real attributes (attempt_number,next_action.sleep).This adds
RetryCallStateto the existingfrom tenacity import ...line and updates the annotation fromAnytoRetryCallState.Why it's safe
Anyis still used elsewhere in the file (11 other call sites), so the import stays necessary.Anywith the concrete type the value actually is" pattern already applied and merged repeatedly in this repo.ruff check/ruff format --checkpass, andtests/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'sretry_stateas tenacity'sRetryCallStateinstead ofAny, matching thebefore_sleepcallback 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