Skip to content

Conversation

@tisnik
Copy link
Contributor

@tisnik tisnik commented Jul 22, 2025

Description

LCORE-324: add check for config file run.yaml existence

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

Summary by CodeRabbit

  • Bug Fixes

    • Improved validation to ensure the configuration file for the library client exists and is readable when required.
  • Tests

    • Updated tests to use a valid configuration file path for library client settings.
    • Added a test to verify correct error handling when an invalid configuration file path is provided.
    • Introduced a minimal viable configuration file for testing various stack setups.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 22, 2025

"""

Walkthrough

The changes introduce a file existence and readability check for the library_client_config_path in the LlamaStackConfiguration class. Tests are updated to use a real YAML configuration file, with a new minimal configuration YAML added. A test is added to verify error handling for invalid configuration file paths.

Changes

File(s) Change Summary
src/models/config.py Enhanced validator to check that library_client_config_path exists and is readable using checks.file_check.
tests/configuration/run.yaml Added a new minimal YAML configuration file for Llama stack setup, used in tests.
tests/unit/models/test_config.py Updated tests to use the new YAML path; added a test for invalid file path raising an error.
tests/unit/utils/test_common.py Updated test to use the new YAML path for library_client_config_path.

Sequence Diagram(s)

sequenceDiagram
    participant Tester
    participant LlamaStackConfiguration
    participant checks

    Tester->>LlamaStackConfiguration: Instantiate with use_as_library_client=True and config path
    LlamaStackConfiguration->>checks: file_check(library_client_config_path)
    checks-->>LlamaStackConfiguration: Return success or raise error
    LlamaStackConfiguration-->>Tester: Instance created or InvalidConfigurationError raised
Loading

Estimated code review effort

2 (~15 minutes)

Poem

In the warren of code, a check hops in,
Ensuring config files exist before we begin.
Tests now munch on YAML, crisp and neat,
Catching errors where paths and rabbits meet.
🐇✨ The stack is secure, the burrow complete!
"""


📜 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 46c7fa2 and 91c956f.

📒 Files selected for processing (4)
  • src/models/config.py (2 hunks)
  • tests/configuration/run.yaml (1 hunks)
  • tests/unit/models/test_config.py (12 hunks)
  • tests/unit/utils/test_common.py (1 hunks)
🧬 Code Graph Analysis (2)
src/models/config.py (1)
src/utils/checks.py (1)
  • file_check (22-27)
tests/unit/models/test_config.py (2)
src/utils/checks.py (1)
  • InvalidConfigurationError (9-10)
src/models/config.py (1)
  • LlamaStackConfiguration (58-90)
🧰 Additional context used
🧬 Code Graph Analysis (2)
src/models/config.py (1)
src/utils/checks.py (1)
  • file_check (22-27)
tests/unit/models/test_config.py (2)
src/utils/checks.py (1)
  • InvalidConfigurationError (9-10)
src/models/config.py (1)
  • LlamaStackConfiguration (58-90)
🔇 Additional comments (7)
src/models/config.py (2)

3-3: LGTM: Path import added appropriately.

The Path import is correctly added to support the file existence check.


86-89: LGTM: File existence check implemented correctly.

The implementation properly validates that the configuration file exists and is readable when library client mode is enabled. The check is well-placed after ensuring the path is not None, and uses the existing checks.file_check utility with a descriptive error message.

tests/unit/utils/test_common.py (1)

272-272: LGTM: Test updated to use valid configuration file path.

The update from placeholder path to the actual test configuration file ensures this test continues to work correctly with the new file existence validation.

tests/unit/models/test_config.py (3)

28-28: LGTM: Required import added for new test.

The InvalidConfigurationError import is correctly added to support the new error handling test.


63-64: LGTM: Test paths updated to use valid configuration file.

All test cases correctly updated from placeholder "foo" to the actual test configuration file path "tests/configuration/run.yaml". This ensures tests continue to pass with the new file existence validation.

Also applies to: 316-317, 338-339, 366-367, 389-390, 435-435, 472-473, 513-513, 558-559, 605-605


82-92: LGTM: Comprehensive error handling test added.

The new test properly verifies that an invalid configuration file path raises InvalidConfigurationError with the expected error message. This provides essential coverage for the file existence validation feature.

tests/configuration/run.yaml (1)

1-126: LGTM: Well-structured test configuration file.

This minimal viable Llama stack configuration provides comprehensive coverage of all necessary sections while remaining appropriate for testing purposes. The use of SQLite for data stores and environment variables for sensitive data follows good practices. The configuration will serve well as a valid file for testing the new file existence validation.

✨ Finishing Touches
  • 📝 Docstrings were successfully generated. (🔄 Check again to generate docstrings again)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@tisnik tisnik force-pushed the lcore-324-add-check-for-config-file branch from 87a9f7e to 91c956f Compare July 22, 2025 07:44
@tisnik
Copy link
Contributor Author

tisnik commented Jul 22, 2025

@coderabbitai full review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 22, 2025

✅ Actions performed

Full review triggered.

@tisnik tisnik merged commit b68b78b into lightspeed-core:main Jul 22, 2025
17 checks passed
coderabbitai bot added a commit that referenced this pull request Jul 22, 2025
Docstrings generation was requested by @tisnik.

* #266 (comment)

The following files were modified:

* `src/models/config.py`
* `tests/unit/models/test_config.py`
* `tests/unit/utils/test_common.py`
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 22, 2025

Note

Generated docstrings for this pull request at #267

@coderabbitai coderabbitai bot mentioned this pull request Jul 23, 2025
15 tasks
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