Skip to content

Conversation

@tisnik
Copy link
Contributor

@tisnik tisnik commented Oct 13, 2025

Description

LCORE-740: fixed types in test_query.py

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 explicit type annotations across numerous unit tests to improve clarity and maintainability. No functional or runtime behavior changes.
  • Chores

    • Minor cleanup in test helpers and setup logic to standardize typing and reduce ambiguity. No impact on user-facing features.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 13, 2025

Walkthrough

The PR updates tests in tests/unit/app/endpoints/test_query.py by adding explicit return type annotations (-> None) to many test and helper functions and introducing a few inline local variable type hints. No behavioral logic or imports are changed.

Changes

Cohort / File(s) Summary
Add explicit return annotations to tests
tests/unit/app/endpoints/test_query.py
Added -> None return types to numerous test and helper functions; introduced some inline local variable type hints (e.g., list[ReferencedDocument]); no behavioral changes.
Inline local variable typing
tests/unit/app/endpoints/test_query.py
Added inline annotations for locals like referenced_documents; limited to typing clarity within tests.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Suggested reviewers

  • manstis
  • umago

Poem

Hop, tap, type—no logic to hone,
Just tidy tails of -> None.
Carrots aligned, tests in a row,
My paws approve the typing glow.
Thump-thump—annotation 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 includes the ticket number and directly states the primary change of fixing type annotations in test_query.py, so it clearly relates to the modifications introduced.
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 ee1b00b and 34369b7.

📒 Files selected for processing (1)
  • tests/unit/app/endpoints/test_query.py (52 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_query.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_query.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_query.py
🧬 Code graph analysis (1)
tests/unit/app/endpoints/test_query.py (4)
tests/unit/app/endpoints/test_streaming_query.py (9)
  • mock_metrics (84-89)
  • mock_database_operations (68-81)
  • test_retrieve_response_vector_db_available (415-455)
  • test_retrieve_response_no_available_shields (458-496)
  • test_retrieve_response_one_available_shield (499-548)
  • test_retrieve_response_four_available_shields (606-672)
  • test_retrieve_response_with_one_attachment (675-724)
  • test_retrieve_response_with_two_attachments (727-785)
  • test_retrieve_response_with_mcp_servers (1132-1206)
tests/unit/app/endpoints/test_conversations.py (1)
  • dummy_request (30-40)
src/models/responses.py (1)
  • ReferencedDocument (164-176)
src/app/endpoints/query.py (2)
  • parse_metadata_from_text_item (519-549)
  • get_rag_toolgroups (766-793)
⏰ 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 (azure)
  • GitHub Check: e2e_tests (ci)

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 c7aeb9d into lightspeed-core:main Oct 13, 2025
18 of 20 checks passed
asimurka pushed a commit to asimurka/lightspeed-stack that referenced this pull request Oct 13, 2025
…pes-in-test-query.py

LCORE-740: fixed types in test_query.py
asimurka pushed a commit to asimurka/lightspeed-stack that referenced this pull request Oct 13, 2025
…pes-in-test-query.py

LCORE-740: fixed types in test_query.py
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