Skip to content

Conversation

@tisnik
Copy link
Contributor

@tisnik tisnik commented Oct 13, 2025

Description

LCORE-815: fixed issues found by Pyright

Type of change

  • Refactor
  • New feature
  • Bug fix
  • CVE fix
  • Optimization
  • Documentation Update
  • Configuration Update
  • Bump-up service version
  • Bump-up dependent library
  • Bump-up library or tool used for development (does not change the final image)
  • CI configuration change
  • Konflux configuration change
  • Unit tests improvement
  • Integration tests improvement
  • End to end tests improvement

Related Tickets & Documents

  • Related Issue #LCORE-815

Summary by CodeRabbit

  • Tests
    • Reformatted unit test calls for improved readability and consistency.
    • Added targeted type-check suppression comments to address static analysis noise.
    • No changes to application behavior, error handling, or returned data.
    • Enhances maintainability of the test suite without affecting production functionality.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 13, 2025

Walkthrough

Tests 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

Cohort / File(s) Summary of changes
Test formatting and type-check suppression
tests/unit/app/endpoints/test_config.py
Reformatted two function calls to multiline, added # pyright: ignore[reportArgumentType] comments. No behavioral changes.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

I nudge my tests with gentle paws,
Line breaks hop like springtime thaw.
A whisper to pyright—shh, ignore—
The carrots still compile as before.
In tidy burrows of indents neat,
My code-path trails remain complete. 🥕

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly identifies the main purpose of the changeset as addressing issues reported by Pyright and includes the tracking ID for context, so it accurately reflects the core update without extraneous detail.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between d1427be and fe02ae8.

📒 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)

Comment on lines +29 to +31
await config_endpoint_handler(
auth=auth, request=request # pyright:ignore[reportArgumentType]
)
Copy link
Contributor

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 cast

    Replace 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."
fi

Length 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).

@tisnik tisnik merged commit a47c98a into lightspeed-core:main Oct 13, 2025
18 of 20 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.

1 participant