Skip to content

test(proto): cover MCP and agent wire encoding - #3446

Open
Qalipso wants to merge 1 commit into
charmbracelet:mainfrom
Qalipso:proto_test_coverage
Open

test(proto): cover MCP and agent wire encoding#3446
Qalipso wants to merge 1 commit into
charmbracelet:mainfrom
Qalipso:proto_test_coverage

Conversation

@Qalipso

@Qalipso Qalipso commented Jul 28, 2026

Copy link
Copy Markdown

internal/proto is at 12.0% statement coverage. It is the client/server wire format, and most of it is pure encoding logic that can be tested directly.

This adds tests for:

  • MCPState: String, text round-trip for every state, the unknown fallback for an out-of-range value, that an unrecognised name is rejected, and that it encodes as its text form inside JSON rather than as its numeric value
  • MCPEventType, AgentEventType, MessageRole and FinishReason text round-trips
  • MCPEvent, MCPClientInfo and AgentEvent JSON round-trips, including that the error field (which is not a JSON type) crosses the wire as its message and is rebuilt on decode, and that it is omitted when nil
  • that AgentEvent's optional fields (run_id, session_id, session_title, progress, done) stay off the wire when unset

Coverage goes from 12.0% to 34.3%. No non-test code is changed; go vet and go test -race pass.

internal/proto was at 12.0% statement coverage. This covers the
serialization boundary: MCPState text/JSON encoding and its unknown
value, the MCP and agent event types, and the custom MarshalJSON/
UnmarshalJSON pairs that carry a non-JSON error field across the wire
as a string and rebuild it on the other side.

Coverage goes from 12.0% to 34.3%. No non-test code is changed.
@charmcli

charmcli commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@Qalipso

Qalipso commented Jul 28, 2026

Copy link
Copy Markdown
Author

I have read the Contributor License Agreement (CLA) and hereby sign the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants