Skip to content

Conversation

@tisnik
Copy link
Contributor

@tisnik tisnik commented Oct 7, 2025

Description

LCORE-740: More type hints

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

Summary by CodeRabbit

  • Tests
    • Added comprehensive type annotations (parameters and explicit return types) across unit tests to improve clarity.
    • Expanded test coverage for tool parser behavior and handling of tool calls in completion messages.
    • Minor formatting adjustments to test method signatures.
    • No changes to product functionality; improvements are limited to test reliability and maintainability.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 7, 2025

Walkthrough

Type annotations were added to two test modules. tests/unit/utils/test_checks.py gained typed fixtures, parameter types, and explicit None returns; tests/unit/utils/test_types.py added explicit None return annotations to several test methods and minor signature formatting. No logic, behavior, or control flow was changed.

Changes

Cohort / File(s) Summary
Type annotations in test_checks
tests/unit/utils/test_checks.py
Added typing imports; annotated fixtures with Path params and str returns; added parameter types and -> None to test functions; introduced Dict[str, Any] for a local variable. No logic changes.
Return annotations in test_types
tests/unit/utils/test_types.py
Added -> None to multiple test methods and adjusted one multiline parameter list formatting. No behavioral changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A nibble of types in the test-burrow’s light,
I twitch my whiskers—annotations just right.
Fixtures now typed, methods neatly defined,
No paths disturbed, all carrots aligned.
Thump-thump! I hop through green fields of None—
Small hints added, and then I’m done. 🥕✨

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 “LCORE-740: More type hints” directly references the ticket and succinctly summarizes the main change of adding type hints across the codebase without unnecessary detail or ambiguity. It is clear, concise, and aligned with the PR objectives.
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 72ea8cd and 383f0b2.

📒 Files selected for processing (2)
  • tests/unit/utils/test_checks.py (11 hunks)
  • tests/unit/utils/test_types.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/utils/test_types.py
  • tests/unit/utils/test_checks.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_types.py
  • tests/unit/utils/test_checks.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_types.py
  • tests/unit/utils/test_checks.py
🧬 Code graph analysis (2)
tests/unit/utils/test_types.py (1)
src/utils/types.py (3)
  • GraniteToolParser (33-70)
  • get_parser (53-70)
  • get_tool_calls (36-50)
tests/unit/utils/test_checks.py (2)
tests/unit/utils/test_endpoints.py (1)
  • input_file_fixture (22-27)
src/utils/checks.py (3)
  • file_check (38-57)
  • InvalidConfigurationError (11-12)
  • directory_check (60-87)
⏰ 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). (2)
  • GitHub Check: e2e_tests (ci)
  • GitHub Check: build-pr
🔇 Additional comments (7)
tests/unit/utils/test_types.py (2)

11-11: LGTM! Type hints correctly added.

The -> None return type annotations properly document that these test methods don't return values, aligning with the coding guidelines.

Also applies to: 17-17, 23-23, 28-28, 34-34


44-46: LGTM! Return type annotation added.

The -> None return type annotation is correct for this test method.

tests/unit/utils/test_checks.py (5)

8-8: LGTM! Import supports type annotations.

The typing.Any import is appropriately used for the test dictionary type annotation on line 35.


16-21: LGTM! Fixture correctly typed.

The type annotations accurately reflect that the fixture receives a Path object from pytest's tmp_path fixture and returns a string path.


25-29: LGTM! Fixture correctly typed.

The type annotations accurately reflect that the fixture receives a Path object and returns a string path to the created directory.


32-46: LGTM! Type annotations correctly added.

The test function signatures now include complete type annotations:

  • Return type -> None for test methods
  • Parameter type str for the input_file fixture parameter
  • Variable annotation dict[str, Any] for the test dictionary

These changes align with the coding guidelines requiring complete type annotations.


48-171: LGTM! All test functions properly typed.

All test function signatures now include complete type annotations with -> None return types and properly typed fixture parameters (input_file: str, input_directory: str). This consistently applies type hints across the entire test module as per the coding guidelines.


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 force-pushed the lcore-740-more-type-hints branch from d63226e to 383f0b2 Compare October 7, 2025 07:51
@tisnik tisnik merged commit d977a2b into lightspeed-core:main Oct 7, 2025
18 of 19 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