Skip to content

Conversation

@tisnik
Copy link
Contributor

@tisnik tisnik commented Jul 20, 2025

Description

LCORE-391: Refactoring: proper Llama Stack config name

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

Summary by CodeRabbit

  • Bug Fixes

    • Corrected the capitalization of the configuration class name across the application and tests to ensure consistency and prevent import errors.
  • Tests

    • Updated all test files to reference the corrected configuration class name for improved reliability and clarity.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 20, 2025

Walkthrough

All occurrences of the class name LLamaStackConfiguration were corrected to LlamaStackConfiguration across the codebase, including imports, class declarations, type annotations, and test files. These changes ensure consistent naming and resolve capitalization discrepancies, without altering any logic, control flow, or error handling.

Changes

File(s) Change Summary
src/models/config.py Renamed class and type annotations from LLamaStackConfiguration to LlamaStackConfiguration.
src/client.py, src/configuration.py Updated imports and type annotations to use LlamaStackConfiguration instead of the old name.
tests/unit/models/test_config.py,
tests/unit/test_client.py,
tests/unit/utils/test_common.py
Updated test imports and usages to reference LlamaStackConfiguration consistently.

Poem

A rabbit hopped with gentle grace,
To fix a name in every place.
"Two L's? No, just one will do!"
Now code is neat, and tests run true.
With every hop, the bugs take flight—
Consistent names, a coder’s delight!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.

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: 0

🔭 Outside diff range comments (2)
src/client.py (2)

22-34: load() silently overwrites an already-initialised singleton

The refactor touched the type annotation, but the method will still happily create a new client every time it’s called.
Because the holder is a process-wide singleton, a double initialisation – especially from concurrent threads – can race and lead to unpredictable behaviour.

     def load(self, llama_stack_config: LlamaStackConfiguration) -> None:
         """Retrieve Llama stack client according to configuration."""
+        if self._lsc is not None:
+            logger.debug("LlamaStackClient already initialised – skipping.")
+            return

Adding this cheap guard (and possibly a threading.Lock) will protect against inadvertent re-initialisation.


58-70: Same re-initialisation / race issue for the async holder

Replicate the early-exit guard in the async variant to keep both code paths consistent and safe:

     async def load(self, llama_stack_config: LlamaStackConfiguration) -> None:
         """Retrieve Async Llama stack client according to configuration."""
+        if self._lsc is not None:
+            logger.debug("AsyncLlamaStackClient already initialised – skipping.")
+            return
🧹 Nitpick comments (5)
tests/unit/test_client.py (1)

22-24: Fix typo in docstring (‘remove’ → ‘remote’).

The docstring still says “remove client (server) mode”.
A tiny wording tweak keeps the test description clear.

-    """Test if Llama Stack can be initialized in remove client (server) mode."""
+    """Test if Llama Stack can be initialized in remote client (server) mode."""
src/models/config.py (1)

57-85: Update error-message strings to the new class spelling.

With the class now called LlamaStackConfiguration, the validator still emits messages starting with “LLama…”.
Keeping naming consistent avoids confusion when users see validation errors.

-                    "LLama stack URL is not specified and library client mode is not specified"
+                    "Llama stack URL is not specified and library client mode is not specified"
@@
-                    "LLama stack URL is not specified and library client mode is not enabled"
+                    "Llama stack URL is not specified and library client mode is not enabled"
@@
-                    "LLama stack library client mode is enabled but a configuration file path is not specified"
+                    "Llama stack library client mode is enabled but a configuration file path is not specified"
tests/unit/models/test_config.py (1)

58-63: Synchronise docstring with new class name.

Docstring still refers to LLamaStackConfiguration.

-"""Test the LLamaStackConfiguration constructor."""
+"""Test the LlamaStackConfiguration constructor."""
src/client.py (2)

1-1: Doc-string still uses the old “LLama” spelling

Tiny nit: the header comment wasn’t updated, so the very first place a reader looks still contains the inconsistent capitalisation the refactor set out to remove.

-"""LLama stack client retrieval."""
+"""Llama stack client retrieval."""

12-12: Consider a relative import to avoid shadowing third-party models packages

Using the top-level models import can back-fire if the project is installed in an environment that already contains a models package. A relative import is safer and makes the intent explicit:

-from models.config import LlamaStackConfiguration
+from .models.config import LlamaStackConfiguration

(Adjust the leading dot to match the real package hierarchy.)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c7ccc96 and 88ecb0b.

📒 Files selected for processing (6)
  • src/client.py (3 hunks)
  • src/configuration.py (2 hunks)
  • src/models/config.py (2 hunks)
  • tests/unit/models/test_config.py (10 hunks)
  • tests/unit/test_client.py (6 hunks)
  • tests/unit/utils/test_common.py (7 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (5)
tests/unit/utils/test_common.py (1)
src/models/config.py (1)
  • LlamaStackConfiguration (57-85)
tests/unit/test_client.py (1)
src/models/config.py (1)
  • LlamaStackConfiguration (57-85)
tests/unit/models/test_config.py (2)
src/models/config.py (1)
  • LlamaStackConfiguration (57-85)
src/configuration.py (1)
  • llama_stack_configuration (63-68)
src/client.py (1)
src/models/config.py (1)
  • LlamaStackConfiguration (57-85)
src/configuration.py (1)
src/models/config.py (1)
  • LlamaStackConfiguration (57-85)
🔇 Additional comments (3)
tests/unit/test_client.py (1)

6-19: Rename looks consistent – no further issues.

All imports and instantiations now reference LlamaStackConfiguration; tests will import the right symbol.
No other functional changes – good work.

Also applies to: 52-63, 67-75, 80-92

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

15-18: LGTM – rename applied cleanly.

The updates are purely mechanical; all tests keep their intent and compile correctly.

Also applies to: 38-46, 80-88, 122-130, 170-178, 224-232, 268-276

src/configuration.py (1)

8-15: Import/property rename applied correctly – no action needed.

Also applies to: 63-68

@tisnik tisnik merged commit 9173a28 into lightspeed-core:main Jul 20, 2025
17 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Jul 21, 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