Skip to content

Conversation

@tisnik
Copy link
Contributor

@tisnik tisnik commented Sep 21, 2025

Description

LCORE-298: updated configuration diagram

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

Summary by CodeRabbit

  • New Features

    • Added configurable conversation cache with support for in-memory, SQLite, and PostgreSQL backends.
    • Introduced a limit for in-memory cache entries to control memory usage.
    • Added support for custom profiles, including loading prompts from an external path.
    • Added a profile path setting to simplify profile management.
  • Documentation

    • Updated configuration documentation/diagrams to reflect new cache and custom profile options.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 21, 2025

Walkthrough

The configuration model and docs were updated to introduce conversation cache support (memory/sqlite/postgres), a custom profile facility with prompts loading, and an in-memory cache configuration. The UML diagram was refreshed to reflect new classes and fields added to Configuration and Customization.

Changes

Cohort / File(s) Summary
Docs UML update
docs/config.puml
Updated diagram to include ConversationCache, InMemoryCacheConfig, CustomProfile, and new fields on Configuration and Customization.
Config model additions
src/.../models/config.py
Added classes: ConversationCache (with check_cache_configuration()), InMemoryCacheConfig (max_entries), CustomProfile (get_prompts()). Added fields: Configuration.conversation_cache, Customization.custom_profile, Customization.profile_path.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant App
  participant Configuration
  participant ConversationCache
  participant CacheBackend as Cache Backend
  participant Customization
  participant CustomProfile

  App->>Configuration: load()
  alt conversation_cache present
    Configuration->>ConversationCache: check_cache_configuration()
    ConversationCache-->>Configuration: validated type (memory/sqlite/postgres)
    opt type = memory
      Configuration->>CacheBackend: init InMemory(max_entries)
    end
    opt type = sqlite/postgres
      Configuration->>CacheBackend: init SQL(ds config)
    end
  else no conversation_cache
    Note over Configuration: Proceed without cache
  end

  alt custom_profile present
    Configuration->>Customization: get custom_profile
    Customization->>CustomProfile: get_prompts()
    CustomProfile-->>Customization: prompts dict
  else no custom_profile
    Note over Customization: Use defaults
  end

  Configuration-->>App: ready(configured services)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

In burrows of config, I hop with care,
New caches stocked, with mem’ry to spare.
Profiles custom, prompts lined neat,
Diagrams bloom—what a tidy feat!
With thumps of joy, I merge and dash,
A rabbit’s work: swift as a flash. 🐇✨

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-298: updated configuration diagram" accurately and concisely reflects the PR objective and file-level summary: the change updates docs/config.puml and is classified as a documentation update, so the title highlights the main change and includes the ticket reference for context. It is specific, non-generic, and readable for teammates scanning history.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

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

🧹 Nitpick comments (5)
docs/config.puml (5)

32-32: Add a composition edge for conversation_cache for consistency.

Configuration embeds ConversationCache but there’s no composition arrow like the ones for service and user_data_collection.

Apply this diff near the relations section:

+src.models.config.ConversationCache --* src.models.config.Configuration : conversation_cache

46-52: Document one-of constraint and add backend composition edges.

Make it explicit that exactly one backend is configured and show the owned parts.

Apply:

 class "ConversationCache" as src.models.config.ConversationCache {
   memory : Optional[InMemoryCacheConfig]
   postgres : Optional[PostgreSQLDatabaseConfiguration]
   sqlite : Optional[SQLiteDatabaseConfiguration]
   type : Literal['memory', 'sqlite', 'postgres'] | None
   check_cache_configuration() -> Self
 }
+note right of src.models.config.ConversationCache
+Exactly one backend must be configured (memory | sqlite | postgres).
+`type` must match the configured backend.
+end note

And in the relations block:

+src.models.config.InMemoryCacheConfig --* src.models.config.ConversationCache : memory
+src.models.config.PostgreSQLDatabaseConfiguration --* src.models.config.ConversationCache : postgres
+src.models.config.SQLiteDatabaseConfiguration --* src.models.config.ConversationCache : sqlite

53-57: Missing inheritance arrow for CustomProfile (verify the base class).

Per our config conventions, config models extend ConfigurationBase. If CustomProfile does, add the inheritance arrow; if it’s a plain data model (BaseModel), leave as-is.

Proposed relation (only if it extends ConfigurationBase):

+src.models.config.CustomProfile --|> src.models.config.ConfigurationBase

59-62: Clarify overlap between custom_profile.path and profile_path.

Two fields appear to represent the profile path. If both must exist for backward compatibility, add a note or mark profile_path as legacy; otherwise, remove one to avoid ambiguity.

Optional note:

+note right of src.models.config.Customization
+`profile_path` is legacy; prefer `custom_profile.path`.
+end note

73-75: Consider making base type explicit for Annotated.

To reduce ambiguity, show the base type: Annotated[int, …]. If you keep “Annotated” elsewhere (e.g., port, workers), you can defer for consistency.

Possible tweak:

-class "InMemoryCacheConfig" as src.models.config.InMemoryCacheConfig {
-  max_entries : Annotated
-}
+class "InMemoryCacheConfig" as src.models.config.InMemoryCacheConfig {
+  max_entries : Annotated[int]
+}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9a5d506 and 4442e1b.

⛔ Files ignored due to path filters (2)
  • docs/config.png is excluded by !**/*.png
  • docs/config.svg is excluded by !**/*.svg
📒 Files selected for processing (1)
  • docs/config.puml (5 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-09-18T16:46:33.353Z
Learnt from: CR
PR: lightspeed-core/lightspeed-stack#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-18T16:46:33.353Z
Learning: Applies to src/{models/config.py,configuration.py} : All configuration uses Pydantic models extending ConfigurationBase

Applied to files:

  • docs/config.puml
📚 Learning: 2025-09-18T16:46:33.353Z
Learnt from: CR
PR: lightspeed-core/lightspeed-stack#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-18T16:46:33.353Z
Learning: Applies to src/models/**/*.py : Pydantic models: use BaseModel for data models and extend ConfigurationBase for configuration

Applied to files:

  • docs/config.puml
📚 Learning: 2025-09-18T16:46:33.353Z
Learnt from: CR
PR: lightspeed-core/lightspeed-stack#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-18T16:46:33.353Z
Learning: Applies to src/{models/config.py,configuration.py} : Configuration base models must set model_config with extra="forbid" to reject unknown fields

Applied to files:

  • docs/config.puml
⏰ 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: build-pr
  • GitHub Check: e2e_tests
🔇 Additional comments (3)
docs/config.puml (3)

160-160: LGTM: ConversationCache inherits ConfigurationBase.


163-163: LGTM: InMemoryCacheConfig inherits ConfigurationBase.


175-175: LGTM: Composition link from Customization to CustomProfile is correct.

@tisnik tisnik merged commit 1f2311a into lightspeed-core:main Sep 21, 2025
18 of 19 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Sep 21, 2025
15 tasks
@coderabbitai coderabbitai bot mentioned this pull request Sep 29, 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