Pyright checker#157
Conversation
|
Warning Review limit reached
More reviews will be available in 53 minutes and 58 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses rolling per-developer review limits. Reviews become available again as older review attempts age out of the rolling limit window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (51)
📝 WalkthroughWalkthroughThe PR migrates the static type checker from mypy to Pyright across the entire codebase. CI is updated to replace the mypy job with a Changesmypy → Pyright migration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (2 warnings, 1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #157 +/- ##
=======================================
Coverage 91.35% 91.35%
=======================================
Files 41 41
Lines 3437 3437
Branches 342 342
=======================================
Hits 3140 3140
Misses 252 252
Partials 45 45
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (3)
tests/directors/test_coordinator_director.py (1)
37-39: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick winFix misleading variable name in
coordinator_directorfixture.The local variable is named
data_logger_directorin a fixture calledcoordinator_director. This appears to be a copy-paste artifact fromtest_data_logger_director.py. While the code is functional, the confusing name violates readability and maintenance standards.🔧 Proposed fix
`@pytest.fixture` def coordinator_director(): - data_logger_director = FakeCoordinatorDirector(remote_class=Coordinator) # pyright: ignore[reportArgumentType] - return data_logger_director + coordinator_director = FakeCoordinatorDirector(remote_class=Coordinator) # pyright: ignore[reportArgumentType] + return coordinator_directorOr for better clarity:
`@pytest.fixture` def coordinator_director(): - data_logger_director = FakeCoordinatorDirector(remote_class=Coordinator) # pyright: ignore[reportArgumentType] - return data_logger_director + director = FakeCoordinatorDirector(remote_class=Coordinator) # pyright: ignore[reportArgumentType] + return director🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/directors/test_coordinator_director.py` around lines 37 - 39, The local variable in the coordinator_director fixture is incorrectly named data_logger_director, which is a misleading copy-paste artifact from another test file. Rename the variable data_logger_director to coordinator_director (or a similar name that clearly indicates it holds a coordinator director instance) to match the fixture name and improve code clarity. This change should be made in the fixture function where FakeCoordinatorDirector is instantiated.tests/directors/test_locking_director.py (1)
37-39: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick winLocal variable name does not match function name.
The fixture
locking_director()defines a local variable nameddata_logger_director(line 38), which appears to be copy-pasted fromtest_data_logger_director.py. Rename the variable tolocking_directorfor consistency and clarity.🔧 Proposed fix
def locking_director() -> LockingDirector: - data_logger_director = FakeLockingDirector(remote_class=LockingActor) # pyright: ignore[reportArgumentType] - return data_logger_director + locking_director = FakeLockingDirector(remote_class=LockingActor) # pyright: ignore[reportArgumentType] + return locking_director🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/directors/test_locking_director.py` around lines 37 - 39, In the locking_director fixture function, rename the local variable data_logger_director to locking_director on line 38 to match the function name and improve code clarity. Update the variable reference in the return statement accordingly to use the new variable name instead of data_logger_director.tests/directors/test_starter_director.py (1)
37-39: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick winLocal variable name does not match function name.
The fixture
starter_director()defines a local variable nameddata_logger_director(line 38), which appears to be copy-pasted fromtest_data_logger_director.py. Rename the variable tostarter_directorfor consistency and clarity.🔧 Proposed fix
def starter_director() -> StarterDirector: - data_logger_director = FakeStarterDirector(remote_class=Starter) # pyright: ignore[reportArgumentType] - return data_logger_director + starter_director = FakeStarterDirector(remote_class=Starter) # pyright: ignore[reportArgumentType] + return starter_director🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/directors/test_starter_director.py` around lines 37 - 39, In the starter_director fixture function, rename the local variable from data_logger_director to starter_director to match the fixture name and improve code clarity. The variable is assigned the FakeStarterDirector instance and is the return value of the fixture, so using a consistent name will make the code more maintainable and avoid confusion from what appears to be a copy-paste error from another test file.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/pyleco_CI.yml:
- Around line 68-73: Replace the GitHub Actions references from tag-based
versions to immutable full commit SHAs to reduce supply-chain risk. For the
astral-sh/ruff-action currently using `@v4.0.0`, replace the version tag with its
corresponding full commit SHA. Similarly, for the jakebailey/pyright-action
currently using `@v2`, replace the version tag with its corresponding full commit
SHA. This ensures the workflow uses specific, immutable commits rather than
mutable tag references.
- Line 9: The docs job in the workflow file currently relies on default token
permissions instead of explicitly defining required permissions, which violates
least-privilege security practices. Add an explicit permissions block to the
docs job that specifies only the minimal permissions needed for the job to
function (typically contents: read for accessing the repository). This ensures
the workflow adheres to hardened CI policy by explicitly declaring what
permissions are necessary rather than inheriting potentially overly broad
defaults.
In `@tests/utils/test_message_handler.py`:
- Around line 686-687: The Pyright suppression code on the line with the
`test_class.payload_in = additional_payload` assignment is using the wrong error
type code. This is a type assignment incompatibility issue (the assignment is
trying to assign a `list[bytes] | None` value to an attribute typed as
`list[bytes]`), not an attribute access issue. Replace the current suppression
`# pyright: ignore[reportAttributeAccessIssue]` with `# pyright:
ignore[reportAssignmentType]` to correctly suppress the actual type mismatch
warning.
---
Nitpick comments:
In `@tests/directors/test_coordinator_director.py`:
- Around line 37-39: The local variable in the coordinator_director fixture is
incorrectly named data_logger_director, which is a misleading copy-paste
artifact from another test file. Rename the variable data_logger_director to
coordinator_director (or a similar name that clearly indicates it holds a
coordinator director instance) to match the fixture name and improve code
clarity. This change should be made in the fixture function where
FakeCoordinatorDirector is instantiated.
In `@tests/directors/test_locking_director.py`:
- Around line 37-39: In the locking_director fixture function, rename the local
variable data_logger_director to locking_director on line 38 to match the
function name and improve code clarity. Update the variable reference in the
return statement accordingly to use the new variable name instead of
data_logger_director.
In `@tests/directors/test_starter_director.py`:
- Around line 37-39: In the starter_director fixture function, rename the local
variable from data_logger_director to starter_director to match the fixture name
and improve code clarity. The variable is assigned the FakeStarterDirector
instance and is the return value of the fixture, so using a consistent name will
make the code more maintainable and avoid confusion from what appears to be a
copy-paste error from another test file.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 6f5e28fd-339e-47a0-b7dc-0b2fd4b1d7fb
📒 Files selected for processing (55)
.github/workflows/pyleco_CI.yml.gitignoreAGENTS.mddocs/conf.pypyleco/__init__.pypyleco/actors/actor.pypyleco/coordinators/coordinator.pypyleco/coordinators/proxy_server.pypyleco/core/leco_protocols.pypyleco/directors/transparent_director.pypyleco/management/data_logger.pypyleco/management/starter.pypyleco/management/test_tasks/test_task.pypyleco/test.pypyleco/utils/coordinator_utils.pypyleco/utils/message_handler.pypyleco/utils/pipe_handler.pypyleco/utils/qt_listener.pypyleco/utils/rpc_handler.pypyleco/utils/zmq_log_handler.pypyproject.tomltests/actors/test_actor.pytests/actors/test_locking_actor.pytests/coordinators/test_coordinator.pytests/coordinators/test_data_coordinator.pytests/coordinators/test_proxy_server.pytests/core/test_internal_protocols.pytests/directors/test_coordinator_director.pytests/directors/test_data_coordinator_director.pytests/directors/test_data_logger_director.pytests/directors/test_director.pytests/directors/test_locking_director.pytests/directors/test_starter_director.pytests/directors/test_transparent_director.pytests/integration_tests/test_data_coordinator_live.pytests/integration_tests/test_multi_node_smoke.pytests/integration_tests/test_proxy_server_live.pytests/integration_tests/test_starter_live.pytests/json_utils/test_json_objects.pytests/json_utils/test_json_parser.pytests/json_utils/test_rpc_server.pytests/management/test_data_logger.pytests/management/test_starter.pytests/test_test.pytests/utils/test_base_communicator.pytests/utils/test_communicator.pytests/utils/test_coordinator_utils.pytests/utils/test_data_publisher.pytests/utils/test_extended_message_handler.pytests/utils/test_listener.pytests/utils/test_message_handler.pytests/utils/test_pipe_handler.pytests/utils/test_qt_listener.pytests/utils/test_rpc_handler.pytests/utils/test_zmq_log_handler.py
💤 Files with no reviewable changes (1)
- docs/conf.py
b06e846 to
4e05c62
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/pyleco_CI.yml:
- Line 57: The actions/setup-python action is pinned to a mutable version tag
`@v6` on line 57, which poses a supply chain risk because the tag can point to
different commits over time. Replace the mutable version tag `@v6` with an
immutable commit SHA by looking up the specific commit hash for the desired
release version (such as v6.2.0) from the GitHub actions/setup-python releases
page, then update the action reference from actions/setup-python@v6 to
actions/setup-python@<commit-sha> to ensure consistent and reproducible builds.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 682bf92c-9cfa-42ec-a8b0-2be9efa13fa3
📒 Files selected for processing (3)
.github/workflows/pyleco_CI.ymlpyleco/management/data_logger.pypyleco/utils/qt_listener.py
✅ Files skipped from review due to trivial changes (2)
- pyleco/utils/qt_listener.py
- pyleco/management/data_logger.py
4e05c62 to
9c7eb98
Compare
9c7eb98 to
c38f9a9
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/pyleco_CI.yml:
- Around line 57-74: The workflow file uses mutable version tags for GitHub
Actions instead of immutable commit SHAs, creating security vulnerabilities.
Replace the three action references with their full commit hashes: change
setup-python@v6 to its corresponding commit SHA from the actions/setup-python
releases, change ruff-action@v4.0.0 to its commit SHA from astral-sh/ruff-action
releases, and change pyright-action@v2 to its commit SHA from
jakebailey/pyright-action releases. Use the format
actions/owner/action@<full-40-character-commit-sha> for each action to ensure
they are pinned to immutable commit references.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 1f70df33-2dfd-4644-8e7a-9cda84d56d68
📒 Files selected for processing (55)
.github/workflows/pyleco_CI.yml.gitignoreAGENTS.mddocs/conf.pypyleco/__init__.pypyleco/actors/actor.pypyleco/coordinators/coordinator.pypyleco/coordinators/proxy_server.pypyleco/core/leco_protocols.pypyleco/directors/transparent_director.pypyleco/management/data_logger.pypyleco/management/starter.pypyleco/management/test_tasks/test_task.pypyleco/test.pypyleco/utils/coordinator_utils.pypyleco/utils/message_handler.pypyleco/utils/pipe_handler.pypyleco/utils/qt_listener.pypyleco/utils/rpc_handler.pypyleco/utils/zmq_log_handler.pypyproject.tomltests/actors/test_actor.pytests/actors/test_locking_actor.pytests/coordinators/test_coordinator.pytests/coordinators/test_data_coordinator.pytests/coordinators/test_proxy_server.pytests/core/test_internal_protocols.pytests/directors/test_coordinator_director.pytests/directors/test_data_coordinator_director.pytests/directors/test_data_logger_director.pytests/directors/test_director.pytests/directors/test_locking_director.pytests/directors/test_starter_director.pytests/directors/test_transparent_director.pytests/integration_tests/test_data_coordinator_live.pytests/integration_tests/test_multi_node_smoke.pytests/integration_tests/test_proxy_server_live.pytests/integration_tests/test_starter_live.pytests/json_utils/test_json_objects.pytests/json_utils/test_json_parser.pytests/json_utils/test_rpc_server.pytests/management/test_data_logger.pytests/management/test_starter.pytests/test_test.pytests/utils/test_base_communicator.pytests/utils/test_communicator.pytests/utils/test_coordinator_utils.pytests/utils/test_data_publisher.pytests/utils/test_extended_message_handler.pytests/utils/test_listener.pytests/utils/test_message_handler.pytests/utils/test_pipe_handler.pytests/utils/test_qt_listener.pytests/utils/test_rpc_handler.pytests/utils/test_zmq_log_handler.py
💤 Files with no reviewable changes (1)
- docs/conf.py
✅ Files skipped from review due to trivial changes (47)
- tests/integration_tests/test_starter_live.py
- tests/directors/test_coordinator_director.py
- tests/utils/test_listener.py
- tests/directors/test_locking_director.py
- tests/directors/test_transparent_director.py
- tests/integration_tests/test_data_coordinator_live.py
- tests/core/test_internal_protocols.py
- tests/directors/test_data_coordinator_director.py
- tests/integration_tests/test_proxy_server_live.py
- tests/directors/test_starter_director.py
- pyleco/init.py
- tests/utils/test_rpc_handler.py
- pyleco/coordinators/coordinator.py
- tests/utils/test_zmq_log_handler.py
- AGENTS.md
- tests/directors/test_data_logger_director.py
- pyleco/management/starter.py
- pyleco/management/test_tasks/test_task.py
- tests/json_utils/test_json_parser.py
- pyleco/coordinators/proxy_server.py
- pyleco/utils/zmq_log_handler.py
- tests/utils/test_data_publisher.py
- pyleco/test.py
- tests/integration_tests/test_multi_node_smoke.py
- tests/coordinators/test_proxy_server.py
- pyleco/utils/coordinator_utils.py
- pyleco/directors/transparent_director.py
- pyleco/utils/qt_listener.py
- tests/test_test.py
- pyleco/utils/message_handler.py
- pyleco/core/leco_protocols.py
- pyleco/utils/pipe_handler.py
- tests/coordinators/test_data_coordinator.py
- pyleco/utils/rpc_handler.py
- .gitignore
- pyleco/actors/actor.py
- tests/actors/test_locking_actor.py
- tests/utils/test_qt_listener.py
- tests/json_utils/test_json_objects.py
- tests/management/test_starter.py
- tests/utils/test_pipe_handler.py
- tests/utils/test_coordinator_utils.py
- tests/directors/test_director.py
- tests/json_utils/test_rpc_server.py
- tests/utils/test_base_communicator.py
- tests/utils/test_message_handler.py
- tests/coordinators/test_coordinator.py
🚧 Files skipped from review as they are similar to previous changes (3)
- pyproject.toml
- tests/actors/test_actor.py
- tests/utils/test_communicator.py
No description provided.