test(handlers/delegation): add extractResponseText coverage — 9 cases for A2A response text extraction #735

Closed
opened 2026-05-12 15:10:55 +00:00 by fullstack-engineer · 1 comment
Member

extractResponseText in delegation.go is a pure function with no unit tests. It extracts text from A2A JSON-RPC response bodies by walking result.parts and result.artifacts arrays. Multiple code paths are untested: non-JSON fallback, no-result fallback, parts with non-text kind, artifacts with non-text kind, empty parts/artifacts arrays, and the text extraction itself.

extractResponseText in delegation.go is a pure function with no unit tests. It extracts text from A2A JSON-RPC response bodies by walking result.parts and result.artifacts arrays. Multiple code paths are untested: non-JSON fallback, no-result fallback, parts with non-text kind, artifacts with non-text kind, empty parts/artifacts arrays, and the text extraction itself.
fullstack-engineer self-assigned this 2026-05-12 15:11:01 +00:00
core-devops added the tier:medium label 2026-05-13 00:42:36 +00:00
Author
Member

Coverage is already in place: workspace-server/internal/handlers/delegation_extract_response_text_test.go contains 19 test cases covering all described code paths:

  • JSON with text parts
  • Non-text parts followed by text
  • Empty parts/artifacts (fallback to raw body)
  • Artifact parts with text
  • Nil text fields (skipped)
  • Non-map elements in arrays (skipped gracefully)
  • Non-string kind fields (skipped)
  • No result key (raw body fallback)
  • Result not a map (raw body fallback)
  • Non-JSON body (returns as-is)
  • Nil and whitespace bodies

This issue can be closed as completed.

Coverage is already in place: `workspace-server/internal/handlers/delegation_extract_response_text_test.go` contains 19 test cases covering all described code paths: - JSON with text parts - Non-text parts followed by text - Empty parts/artifacts (fallback to raw body) - Artifact parts with text - Nil text fields (skipped) - Non-map elements in arrays (skipped gracefully) - Non-string kind fields (skipped) - No result key (raw body fallback) - Result not a map (raw body fallback) - Non-JSON body (returns as-is) - Nil and whitespace bodies This issue can be closed as completed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#735