Skip to content

Conversation

@tisnik
Copy link
Contributor

@tisnik tisnik commented Nov 17, 2025

Description

LCORE-703: rename conversation cache to conversation history

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

Summary by CodeRabbit

Release Notes

  • Documentation

    • Updated API specifications and configuration documentation for consistency and clarity.
  • Refactor

    • Improved internal configuration handling and related infrastructure components.
  • Tests

    • Updated test fixtures and validation checks to align with configuration changes.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 17, 2025

Walkthrough

The PR renames ConversationCacheConfiguration to ConversationHistoryConfiguration throughout the codebase, adding a type field and validation method to the renamed class. All imports, type hints, fixture return types, and instantiations across configuration models, factory code, and tests are updated consistently.

Changes

Cohort / File(s) Summary
Model Configuration
src/models/config.py
Class ConversationCacheConfiguration renamed to ConversationHistoryConfiguration; Configuration.conversation_cache field type updated; type field and check_cache_configuration() validation method added to the renamed class
Documentation
docs/config.puml, docs/openapi.json
Plantuml diagram and OpenAPI schema updated to reference ConversationHistoryConfiguration instead of ConversationCacheConfiguration with identical field structure
Cache/Configuration Factories
src/cache/cache_factory.py, src/configuration.py
Imports updated and type annotations changed from ConversationCacheConfiguration to ConversationHistoryConfiguration in function signatures and property return types
Unit Tests
tests/unit/cache/test_cache_factory.py, tests/unit/models/config/test_conversation_history.py
Fixture return types, test parameter annotations, and class instantiations updated to use ConversationHistoryConfiguration; no logic changes

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Consistency check: Verify all references to the old class name were updated across imports and type hints
  • Fixture correctness: Confirm fixture constructors in test files match the new class signature and instantiation requirements
  • Schema alignment: Ensure OpenAPI schema and Plantuml diagram structures match the implementation in config.py

Possibly related PRs

  • PR #563: Likely introduced the original ConversationCacheConfiguration class that is being renamed in this PR
  • PR #576: Directly affected by this rename as it references ConversationCacheConfiguration in cache-related code
  • PR #734: Uses ConversationCacheConfiguration in conversation cache tests that require updates due to this class rename

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 accurately describes the main change: renaming ConversationCacheConfiguration to ConversationHistoryConfiguration across the codebase, which is reflected in all modified files.
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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a846060 and b1807a1.

📒 Files selected for processing (2)
  • tests/unit/cache/test_cache_factory.py (10 hunks)
  • tests/unit/models/config/test_conversation_history.py (15 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
tests/unit/models/config/test_conversation_history.py (1)
src/models/config.py (2)
  • ConversationHistoryConfiguration (514-552)
  • InMemoryCacheConfig (81-84)
tests/unit/cache/test_cache_factory.py (2)
src/models/config.py (3)
  • ConversationHistoryConfiguration (514-552)
  • InMemoryCacheConfig (81-84)
  • SQLiteDatabaseConfiguration (75-78)
src/cache/cache_factory.py (2)
  • CacheFactory (16-49)
  • conversation_cache (20-49)
⏰ 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). (4)
  • GitHub Check: Konflux kflux-prd-rh02 / lightspeed-stack-on-pull-request
  • GitHub Check: build-pr
  • GitHub Check: e2e_tests (ci)
  • GitHub Check: e2e_tests (azure)
🔇 Additional comments (1)
tests/unit/models/config/test_conversation_history.py (1)

1-206: LGTM! Rename applied consistently.

All references to ConversationCacheConfiguration have been correctly updated to ConversationHistoryConfiguration throughout this test file. The changes are limited to the class name, imports, and docstring—test logic remains unchanged, which is appropriate for a rename refactor.


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

🧹 Nitpick comments (6)
tests/unit/models/config/test_conversation_cache.py (2)

1-16: Rename in tests is consistent; consider aligning names/docs with new class

Importing ConversationHistoryConfiguration here matches the model rename and keeps tests pointed at the right type. As a follow‑up, consider updating the module docstring (and potentially the file name) to reference ConversationHistoryConfiguration instead of ConversationCacheConfiguration to avoid confusion.


19-52: Core validation tests still correctly exercise ConversationHistoryConfiguration

The tests for “no type”, “unknown type”, and “type without backend config” now construct ConversationHistoryConfiguration and still match the validator behavior (Literal enforcement plus check_cache_configuration). Everything here looks consistent with the new class name. Note: the subtest label "SQLite cache" for the PostgreSQL branch (line 48) is slightly misleading; you may want to rename it to "PostgreSQL cache" when convenient.

src/configuration.py (1)

140-146: Type annotation on conversation_cache_configuration matches underlying model

Annotating conversation_cache_configuration as ConversationHistoryConfiguration while continuing to return self._configuration.conversation_cache keeps things type‑safe and consistent with Configuration in models.config. If the long‑term goal is to shift external terminology fully to “conversation history”, you might eventually consider introducing a conversation_history_configuration alias and deprecating the old property name, but that’s not required for this refactor.

src/cache/cache_factory.py (1)

3-49: Factory now correctly typed against ConversationHistoryConfiguration

Updating the import and signature to use ConversationHistoryConfiguration keeps CacheFactory.conversation_cache in sync with the model layer and with AppConfig.conversation_cache. The control flow and validation semantics are unchanged and remain consistent with the ConversationHistoryConfiguration validator.

Minor nit: the invalid cache type error message concatenation (lines 46‑48) is slightly awkward/misalquoted ("'{constants.CACHE_TYPE_MEMORY} or {constants.CACHE_TYPE_NOOP}'"); consider tightening that string when you next touch this area.

src/models/config.py (1)

514-552: ConversationHistoryConfiguration definition is coherent with existing cache semantics

The ConversationHistoryConfiguration model cleanly encapsulates the cache backend selection (type) plus backend‑specific configs (memory/sqlite/postgres) and enforces consistent combinations via check_cache_configuration. This matches how CacheFactory.conversation_cache and the unit tests exercise it, so the rename looks behaviorally neutral.

Given the class name now uses “History” while the docstring and error text still say “Conversation cache configuration” / “Conversation cache type…”, you may eventually want to align the wording with the new terminology for clarity, but it’s not required for correctness.

docs/openapi.json (1)

2123-2177: ConversationHistoryConfiguration schema matches the model; optional wording tweak

The new ConversationHistoryConfiguration component correctly exposes type, memory, sqlite, and postgres with the expected enums and references, mirroring the Pydantic model.

The description still reads “Conversation cache configuration.”; if the intent is to emphasize “history” across the public surface, consider updating this text in a follow‑up.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 39ed500 and a846060.

⛔ 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 (7)
  • docs/config.puml (3 hunks)
  • docs/openapi.json (2 hunks)
  • src/cache/cache_factory.py (2 hunks)
  • src/configuration.py (2 hunks)
  • src/models/config.py (2 hunks)
  • tests/unit/cache/test_cache_factory.py (10 hunks)
  • tests/unit/models/config/test_conversation_cache.py (14 hunks)
🧰 Additional context used
🧬 Code graph analysis (5)
src/models/config.py (2)
src/cache/cache_factory.py (1)
  • conversation_cache (20-49)
src/configuration.py (1)
  • conversation_cache (162-170)
src/configuration.py (1)
src/models/config.py (1)
  • ConversationHistoryConfiguration (514-552)
src/cache/cache_factory.py (2)
src/models/config.py (2)
  • config (140-146)
  • ConversationHistoryConfiguration (514-552)
src/configuration.py (1)
  • conversation_cache (162-170)
tests/unit/models/config/test_conversation_cache.py (1)
src/models/config.py (2)
  • ConversationHistoryConfiguration (514-552)
  • InMemoryCacheConfig (81-84)
tests/unit/cache/test_cache_factory.py (2)
src/models/config.py (3)
  • ConversationHistoryConfiguration (514-552)
  • InMemoryCacheConfig (81-84)
  • SQLiteDatabaseConfiguration (75-78)
src/cache/cache_factory.py (2)
  • CacheFactory (16-49)
  • conversation_cache (20-49)
⏰ 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). (4)
  • GitHub Check: build-pr
  • GitHub Check: Konflux kflux-prd-rh02 / lightspeed-stack-on-pull-request
  • GitHub Check: e2e_tests (ci)
  • GitHub Check: e2e_tests (azure)
🔇 Additional comments (6)
tests/unit/models/config/test_conversation_cache.py (2)

55-125: Backend-config vs type interaction tests remain valid after rename

The “no type but configured” and “multiple configurations” tests now use ConversationHistoryConfiguration but keep the same expectations as the model validator (requiring type when any backend config is present and forbidding mixed backends). The rename here is purely mechanical and preserves behavior.


127-205: Per-backend happy-path and misconfiguration tests correctly target ConversationHistoryConfiguration

All backend‑specific tests (memory/sqlite/postgres) now instantiate ConversationHistoryConfiguration and still:

  • Assert correct wiring for valid configs, and
  • Expect ValidationError for invalid or missing/incorrect sub‑configs.

The changes are consistent and behaviorally neutral.

src/configuration.py (1)

10-24: Import update to ConversationHistoryConfiguration is correct

Switching the import to ConversationHistoryConfiguration aligns this module with the renamed config model and the type of Configuration.conversation_cache.

src/models/config.py (1)

596-613: Configuration.conversation_cache now correctly references ConversationHistoryConfiguration

Setting conversation_cache: ConversationHistoryConfiguration = Field(default_factory=ConversationHistoryConfiguration) keeps configuration construction simple and ensures a well‑typed default object is always present. This is consistent with how AppConfig and CacheFactory consume it and with the updated OpenAPI schema.

No functional issues spotted here.

docs/openapi.json (1)

1875-1949: OpenAPI Configuration now points conversation_cache to ConversationHistoryConfiguration

Updating the conversation_cache property to $ref #/components/schemas/ConversationHistoryConfiguration keeps the spec aligned with the renamed model while preserving the field name for backward compatibility. This wiring looks correct.

docs/config.puml (1)

41-41: Terminology mismatch is intentional; rename only if part of broader cache→history initiative.

The field conversation_cache (48+ references across source code, tests, configs, and documentation) intentionally distinguishes between the configuration object (ConversationHistoryConfiguration) and its cache implementation. However, the field conversation_cache references the type ConversationHistoryConfiguration, creating a terminology mismatch.

This distinction is deliberate:

  • conversation_cache_configuration property returns ConversationHistoryConfiguration (the data structure)
  • conversation_cache property returns Cache (the implementation)
  • CacheFactory.conversation_cache() method uses "cache" terminology

If this PR is not part of a systematic cache→history rename, leave the naming as-is (it's consistent with factory methods and distinguishes configuration from implementation). If this PR is renaming cache to history throughout, you'll need to rename this field to conversation_history and update all 48+ references (configuration model, properties, endpoints, tests, example configs, and documentation).

@tisnik tisnik merged commit 00821f3 into lightspeed-core:main Nov 17, 2025
21 of 23 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