Skip to content

LCORE-1328 Replace Optional[] with X | None, update test mocks#1207

Merged
tisnik merged 1 commit intolightspeed-core:mainfrom
max-svistunov:lcore-1328-fix-optional-import
Feb 24, 2026
Merged

LCORE-1328 Replace Optional[] with X | None, update test mocks#1207
tisnik merged 1 commit intolightspeed-core:mainfrom
max-svistunov:lcore-1328-fix-optional-import

Conversation

@max-svistunov
Copy link
Contributor

@max-svistunov max-svistunov commented Feb 24, 2026

Description

Replace Optional[] with X | None, update test mocks.

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
  • Benchmarks improvement

Tools used to create PR

Identify any AI code assistants used in this PR (for transparency and review context)

  • Assisted-by: Claude Opus 4.6
  • Generated by: Claude Opus 4.6

Related Tickets & Documents

  • Related Issue # LCORE-1328
  • Closes # LCORE-1328

Checklist before requesting a review

  • I have performed a self-review of my code.
  • PR has passed all pre-merge test jobs.
  • If it is a core feature, I have added thorough tests.

Testing

See CI results.

Summary by CodeRabbit

  • Refactor

    • Updated internal method signatures to use modern Python type annotations.
  • Tests

    • Streamlined unit test mocking approach for improved test maintainability.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 24, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 541c20d and 703e1ac.

📒 Files selected for processing (2)
  • src/utils/responses.py
  • tests/unit/utils/test_responses.py

Walkthrough

This PR modernizes type hint syntax in the MCP header-building utility function from Optional[...] notation to the ... | None style, and refactors test mocking strategy to use a single configuration mock instead of multiple patches.

Changes

Cohort / File(s) Summary
Type Hint Modernization
src/utils/responses.py
Updated _build_provider_data_headers method signature to use modern `...
Test Mock Refactoring
tests/unit/utils/test_responses.py
Replaced multiple mock patches (configuration, select_model_and_provider_id, evaluate_model_hints) in prepare_responses_params tests with a single mock configuration object, changing how test dependencies are faked.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • ldjebran
  • tisnik
🚥 Pre-merge checks | ✅ 3
✅ 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 directly reflects the main changes: replacing Optional[] with X | None syntax and updating test mocks to match.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • 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

@tisnik tisnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tisnik tisnik merged commit fa3b46c into lightspeed-core:main Feb 24, 2026
19 of 22 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.

2 participants