-
Notifications
You must be signed in to change notification settings - Fork 60
LCORE-815: fixed issues found by Pyright #663
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LCORE-815: fixed issues found by Pyright #663
Conversation
WalkthroughTests updated to reformat two calls to config_endpoint_handler into multiline style and add a pyright ignore comment for reportArgumentType. No functional code changes, no behavior or public API modifications. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (1)
tests/unit/app/endpoints/test_config.py (1)
77-79: Same as above: remove suppression by fixing the auth type.Mirror the change here after switching to MOCK_AUTH or a properly typed AuthTuple.
Apply this diff:
- response = await config_endpoint_handler( - auth=auth, request=request # pyright:ignore[reportArgumentType] - ) + response = await config_endpoint_handler( + auth=auth, request=request + )As per coding guidelines
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
tests/unit/app/endpoints/test_config.py(2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.py: All modules start with descriptive module-level docstrings explaining purpose
Use logger = logging.getLogger(name) for module logging after import logging
Define type aliases at module level for clarity
All functions require docstrings with brief descriptions
Provide complete type annotations for all function parameters and return types
Use typing_extensions.Self in model validators where appropriate
Use modern union syntax (str | int) and Optional[T] or T | None consistently
Function names use snake_case with descriptive, action-oriented prefixes (get_, validate_, check_)
Avoid in-place parameter modification; return new data structures instead of mutating arguments
Use appropriate logging levels: debug, info, warning, error with clear messages
All classes require descriptive docstrings explaining purpose
Class names use PascalCase with conventional suffixes (Configuration, Error/Exception, Resolver, Interface)
Abstract base classes should use abc.ABC and @AbstractMethod for interfaces
Provide complete type annotations for all class attributes
Follow Google Python docstring style for modules, classes, and functions, including Args, Returns, Raises, Attributes sections as needed
Files:
tests/unit/app/endpoints/test_config.py
tests/{unit,integration}/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
tests/{unit,integration}/**/*.py: Use pytest for all unit and integration tests
Do not use unittest in tests; pytest is the standard
Files:
tests/unit/app/endpoints/test_config.py
tests/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
tests/**/*.py: Use pytest-mock to create AsyncMock objects for async interactions in tests
Use the shared auth mock constant: MOCK_AUTH = ("mock_user_id", "mock_username", False, "mock_token") in tests
Files:
tests/unit/app/endpoints/test_config.py
🧬 Code graph analysis (1)
tests/unit/app/endpoints/test_config.py (1)
src/app/endpoints/config.py (1)
config_endpoint_handler(63-85)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: build-pr
- GitHub Check: e2e_tests (ci)
- GitHub Check: e2e_tests (azure)
| await config_endpoint_handler( | ||
| auth=auth, request=request # pyright:ignore[reportArgumentType] | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
🧩 Analysis chain
Prefer fixing the auth type over suppressing Pyright.
Use the shared MOCK_AUTH (or cast to AuthTuple) so we can drop the ignore. Then remove the suppression.
Apply this diff after correcting the auth value above:
- await config_endpoint_handler(
- auth=auth, request=request # pyright:ignore[reportArgumentType]
- )
+ await config_endpoint_handler(
+ auth=auth, request=request
+ )Example options (pick one):
- If a shared constant exists:
from tests.unit.utils.auth_helpers import MOCK_AUTH
auth = MOCK_AUTH - Or with typing:
from typing import castReplace with the actual import path for AuthTuple
from app..types import AuthTuple
auth = cast(AuthTuple, ("mock_user_id", "mock_username", False, "mock_token"))
Verify where MOCK_AUTH/AuthTuple live:
As per coding guidelines
🏁 Script executed:
#!/bin/bash
rg -nP --type=py -C3 '\bMOCK_AUTH\s*='
rg -nP --type=py -C3 '\bAuthTuple\b'Length of output: 22349
🏁 Script executed:
#!/bin/bash
# Check shared auth_helpers for MOCK_AUTH
if [ -f tests/unit/utils/auth_helpers.py ]; then
sed -n '1,200p' tests/unit/utils/auth_helpers.py
else
echo "File tests/unit/utils/auth_helpers.py not found."
fiLength of output: 978
Remove Pyright suppression by casting auth to AuthTuple.
Import cast and AuthTuple, wrap the auth argument in cast(AuthTuple, auth), then drop the # pyright:ignore[reportArgumentType].
Example diff:
-from typing import cast
-from authentication.interface import AuthTuple
+from typing import cast
+from authentication.interface import AuthTuple
await config_endpoint_handler(
- auth=auth, request=request # pyright:ignore[reportArgumentType]
+ auth=cast(AuthTuple, auth),
+ request=request
)Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In tests/unit/app/endpoints/test_config.py around lines 29 to 31, replace the
pyright suppression by importing cast and AuthTuple at the top of the file and
wrapping the auth argument with cast(AuthTuple, auth) when calling
config_endpoint_handler; then remove the trailing "#
pyright:ignore[reportArgumentType]" comment. Ensure the imports are added (e.g.,
from typing import cast and the module that provides AuthTuple) and the auth
parameter is passed as cast(AuthTuple, auth).
Description
LCORE-815: fixed issues found by Pyright
Type of change
Related Tickets & Documents
Summary by CodeRabbit