Skip to content

Conversation

@tisnik
Copy link
Contributor

@tisnik tisnik commented Oct 3, 2025

Description

LCORE-775: removed duplicated fields

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

Summary by CodeRabbit

  • Refactor
    • Updated conversations API response format: removed top-level "query" and "response" fields. Responses now include provider, model, and a messages array (first user content, then assistant content). Clients may need to adjust parsing.
  • Tests
    • Added unit tests to validate the new response structure, ensuring provider/model are present and messages contain correctly ordered user and assistant entries.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 3, 2025

Walkthrough

Removed top-level query and response fields from the transformed chat message payload in conversations_v2, returning only provider, model, and a messages list containing the user and assistant contents. Added unit tests that validate the new payload shape. No function signature or control-flow changes.

Changes

Cohort / File(s) Summary
Endpoint Transform
src/app/endpoints/conversations_v2.py
Adjusted transform_chat_message to omit top-level query and response, emitting only provider, model, and messages derived from entry.query and entry.response.
Unit Tests
tests/unit/app/endpoints/test_conversations_v2.py
Added tests asserting presence of provider and model, and that messages contains two entries: a user message with the query and an assistant message with the response.

Sequence Diagram(s)

sequenceDiagram
    participant Caller as Caller / Test
    participant Transformer as transform_chat_message
    participant CacheEntry as CacheEntry (entry)

    Note over Caller,Transformer: Call with CacheEntry containing provider, model, query, response
    Caller->>Transformer: transform_chat_message(entry)
    Transformer->>CacheEntry: read provider, model, query, response
    Transformer-->>Caller: { provider, model, messages:[ {type:user,content:query}, {type:assistant,content:response} ] }
    Note over Caller,Transformer: No top-level `query` or `response` in output
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I thump my paws: two messages neat,
User squeaks a query, bot replies in beat.
No extra carrots, fields trimmed light,
Provider, model—kept just right.
In tidy burrows, tests now cheer 🥕✨

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 succinctly captures the primary change of removing duplicated fields and aligns with the PR’s focus on eliminating the redundant query and response fields, making it clear and relevant to the code updates described.
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 9f9f7a0 and 6dd9ea7.

📒 Files selected for processing (2)
  • src/app/endpoints/conversations_v2.py (0 hunks)
  • tests/unit/app/endpoints/test_conversations_v2.py (1 hunks)
💤 Files with no reviewable changes (1)
  • src/app/endpoints/conversations_v2.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/unit/app/endpoints/test_conversations_v2.py
⏰ 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

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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b6698ed and 9f9f7a0.

📒 Files selected for processing (2)
  • src/app/endpoints/conversations_v2.py (0 hunks)
  • tests/unit/app/endpoints/test_conversations_v2.py (1 hunks)
💤 Files with no reviewable changes (1)
  • src/app/endpoints/conversations_v2.py
🧰 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_conversations_v2.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_conversations_v2.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_conversations_v2.py
🧬 Code graph analysis (1)
tests/unit/app/endpoints/test_conversations_v2.py (2)
src/app/endpoints/conversations_v2.py (1)
  • transform_chat_message (241-250)
src/models/cache_entry.py (1)
  • CacheEntry (6-19)
⏰ 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 (1)
tests/unit/app/endpoints/test_conversations_v2.py (1)

12-33: LGTM! Thorough validation of the transformed payload structure.

The test comprehensively validates the new payload shape:

  • Verifies provider and model are present at the top level
  • Confirms the messages list contains exactly two entries
  • Validates each message has the correct type and content fields

This aligns perfectly with the PR objective of removing duplicated top-level query and response fields in favor of a messages list structure.

@tisnik tisnik force-pushed the lcore-775-removed-duplicated-fields branch from 9f9f7a0 to 6dd9ea7 Compare October 3, 2025 08:26
@tisnik tisnik merged commit f72b573 into lightspeed-core:main Oct 3, 2025
18 of 19 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