Skip to content

Conversation

@tisnik
Copy link
Contributor

@tisnik tisnik commented Oct 14, 2025

Description

LCORE-832: fixed type issues in unit test

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-832

Summary by CodeRabbit

  • Refactor
    • Standardized the initial connection state to a clear boolean value for improved consistency and readability. Ensures predictable defaults without altering runtime behavior.
  • Tests
    • Added explicit return type annotations to connection-related tests, improving clarity, type checking, and maintainability.
    • Strengthened test signatures to be more explicit, aiding static analysis tools.
    • No user-facing changes; behavior remains unchanged.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 14, 2025

Walkthrough

The initial connection state in Connectable.init is set to False instead of None. Two unit tests in tests/unit/utils/test_connection_decorator.py gain explicit return type annotations. The connected() behavior is unchanged.

Changes

Cohort / File(s) Summary of Changes
Tests: type annotations for unit tests
tests/unit/utils/test_connection_decorator.py
Added explicit return type annotations (-> None) to test functions; tests reference behavior where initial _connected is boolean False.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A toggle flips from None to False—click!
I twitch my whiskers, neat and quick.
Tests now speak in typed delight,
Return to None, all signatures right.
With burrowed logs and steady pace,
I thump approval—clean, concise grace.

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 references the JIRA ticket and clearly indicates that the pull request fixes type issues in the unit tests, which matches the changes made to add explicit return annotations in test_connection_decorator.py.
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

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 87f933f and 16594da.

📒 Files selected for processing (1)
  • tests/unit/utils/test_connection_decorator.py (3 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/utils/test_connection_decorator.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/utils/test_connection_decorator.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/utils/test_connection_decorator.py
⏰ 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)
🔇 Additional comments (3)
tests/unit/utils/test_connection_decorator.py (3)

18-18: Good fix for type consistency.

Initializing _connected to False instead of None ensures the attribute is consistently typed as bool, matching the return type of the connected() method.


39-39: Correct return type annotation added.

The -> None annotation properly documents that this test function doesn't return a value, aligning with the coding guideline to provide complete type annotations.


50-50: Correct return type annotation added.

The -> None annotation properly documents that this test function doesn't return a value, aligning with the coding guideline to provide complete type annotations.


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.

@tisnik tisnik merged commit 491b29b into lightspeed-core:main Oct 14, 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