Skip to content

Conversation

gitauto-ai[bot]
Copy link
Contributor

@gitauto-ai gitauto-ai bot commented Oct 17, 2025

Resolves #1978

Summary

Add comprehensive unit tests for services/anthropic/trim_messages.py to achieve full line/statement/function coverage and exercise previously uncovered branch logic.

Test Patterns

  • No-op passthrough when messages are already within the limit
  • Trimming to fit a strict limit while preserving required ordering/invariants
  • Retaining the most recent exchange and dropping older context as needed
  • Empty input and single-message input handling
  • Mixed roles and content structures (e.g., string vs segmented content) preserved after trimming
  • Invalid inputs (missing role/content, unsupported role/type, non-list input) raise expected errors
  • Boundary conditions where the budget is exactly met
  • Behavior when every message individually exceeds the budget (minimal viable output or expected error path)
  • Exercises both sides of the previously uncovered if branch at line 32 (block 0) and the opposite path
git fetch origin
git checkout gitauto/issue-1978-20251017-000101-bp4l
git pull origin gitauto/issue-1978-20251017-000101-bp4l

@gitauto-ai gitauto-ai bot requested a review from hiroshinishio as a code owner October 17, 2025 00:03
Copy link
Contributor Author

gitauto-ai bot commented Oct 17, 2025

Finished fixing the build check run error!

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.

Schedule: Add unit tests to services/anthropic/trim_messages.py

0 participants