Skip to content

test: increase test coverage from 88% to 99%#27

Open
jordanrburger wants to merge 2 commits into
mainfrom
test/improve-coverage
Open

test: increase test coverage from 88% to 99%#27
jordanrburger wants to merge 2 commits into
mainfrom
test/improve-coverage

Conversation

@jordanrburger
Copy link
Copy Markdown
Collaborator

Summary

  • Add 46 new tests (222 → 268), raising overall coverage from 88% to 99%
  • Ensures API contract changes in the Kai backend are caught by failing tests early
  • Covers critical previously-untested paths: v6 tool approval flow, SSE stream parsing edge cases, CLI interactive mode, error handling branches

Coverage changes

Module Before After
client.py 80% 99%
sse.py 83% 100%
cli.py 86% 97%
exceptions.py 100% 100%
models.py 100% 100%
types.py 100% 100%
Total 88% 99%

Key areas covered

client.py — v6 tool approval flow (send_tool_approval_response, approve_tool, reject_tool), from_storage_api connection errors, lazy client init, non-JSON HTTP errors, _parse_vote isUpvoted format, ending_before pagination

sse.pyparse_sse_stream (empty data, [DONE] marker, SSE comments, event:/id:/retry: fields, StreamClosed, RemoteProtocolError), tool approval request parsing, approval metadata, consume_stream

cli.py — v6 approval flow (auto-approve, user approve, user reject), interactive mode (exit/quit/empty input), display_tool_result_events with errors and JSON, MCP dict format edge case

Test plan

  • All 268 tests pass locally
  • No changes to source code, only test files

🤖 Generated with Claude Code

jordanrburger and others added 2 commits March 18, 2026 16:24
Add 46 new tests covering previously untested code paths to ensure
API contract changes in the Kai backend are caught by failing tests.

Key areas covered:
- V6 tool approval flow (send_tool_approval_response, approve/reject_tool)
- SSE stream parsing edge cases (empty data, [DONE], comments, field types)
- from_storage_api connection error handling
- CLI interactive mode, v6 approval UI, display_tool_result_events
- _parse_vote isUpvoted format, get_history ending_before pagination

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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