test(#2175): guard A2A full-body delivery against silent truncation #2176
Reference in New Issue
Block a user
Delete Branch "test/2175-a2a-full-body-delivery-guard"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adds a regression guard for core#2175 — the A2A full-body delivery guard.
core#2175 RCA: the long-believed "A2A truncation" was a misdiagnosis. A2A message delivery preserves the FULL body on every agent-facing path. Only human-facing DISPLAY previews are capped (activity title 80 runes, broadcast 120, delegation summary 80, canvas
response_preview200 bytes) — those caps are on display/broadcast fields, never on the bytes an agent reads.This PR locks in the correct behaviour so a future change can't silently reintroduce real truncation on a delivery path.
Test added —
a2a_full_body_delivery_guard_test.goTestDequeueNext_PreservesFullBody_NoTruncation— drain/read path (DequeueNext→body::text) returns the enqueued body byte-for-byte for a body well over the 200-byte largest preview cap.TestToolCheckTaskStatus_ReturnsFullResponseBody_NoTruncation—check_task_statusagent-facing path (extractA2ATextover the fullresponse_body) surfaces the complete response text.TestExtractA2AText_FullBodyNoCap— focused extractor guard, both A2A response shapes (artifacts+message), no length cap.All bodies are >200 chars (bigger than the largest preview cap), so any display cap wired into a delivery path fails loudly.
Verification
Matches the sibling
a2a_queue_test.go/mcp_tools_test.gosqlmock style (no integration build tag). Locally:go vet ./internal/handlers/— clean (also clean with-tags=integration)CI's real-PG integration arm additionally exercises the live
body::textround-trip.🤖 Generated with Claude Code
SOP Checklist
core#2175 RCA established that A2A message delivery preserves the FULL body on every agent-facing path — the long-believed "A2A truncation" was a MISDIAGNOSIS. Only human-facing DISPLAY previews are capped (activity title 80 runes, broadcast 120, delegation summary 80, canvas response_preview 200 bytes). Add a regression guard so a future change can't silently reintroduce real truncation on the delivery paths: - TestDequeueNext_PreservesFullBody_NoTruncation: the drain/read path (DequeueNext → body::text) must return the enqueued body byte-for-byte for a body well over the 200-byte largest preview cap. - TestToolCheckTaskStatus_ReturnsFullResponseBody_NoTruncation: the check_task_status agent-facing path (extractA2AText over the full response_body) must surface the complete response text. - TestExtractA2AText_FullBodyNoCap: focused extractor guard, both A2A response shapes, no length cap. Bodies are >200 chars so any display cap wired into a delivery path fails loudly. sqlmock style matching sibling a2a_queue/mcp_tools tests; CI's real-PG arm additionally exercises the live body::text round-trip. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>5-axis review: APPROVED.
Correctness: the new tests directly cover the queue drain/read path, check_task_status response extraction, and both extractA2AText response shapes with bodies well above preview caps, matching the stated regression guard.
Robustness: sqlmock expectations exercise the relevant data flow without adding external dependencies, and the focused extractor test guards both supported JSON shapes.
Security: test-only change; no new runtime/auth surface.
Performance: unit tests are bounded and deterministic.
Readability: test names and comments make the delivery-vs-display distinction clear.
APPROVED — clean regression guard for core#2175.
No blockers. Ship it.