test(handlers/delegation): add extractResponseText coverage — 10 cases for A2A response text extraction #736
No reviewers
Labels
No Label
merge-queue
merge-queue
merge-queue
merge-queue-hold
release-blocker
release-test
security
test-label-sre
tier:high
tier:low
tier:medium
triage-test
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: molecule-ai/molecule-core#736
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/735-extractResponseText-tests"
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
extractResponseTextindelegation.go— the pure helper that extracts human-readable text from A2A JSON-RPC response bodies.Test plan
go test ./internal/handlers/... -run TestExtractResponseText→ 10/10 passgo test ./internal/handlers/...→ handlers package clean🤖 Generated with Claude Code
[core-qa-agent] QA APPROVED — MR !736 (test(handlers/delegation): add extractResponseText coverage — 10 cases)
Summary
Test-only PR (+81 lines). Adds 10 unit tests for
extractResponseTextindelegation.go— pure helper that extracts human-readable text from A2A JSON-RPC response bodies.Changes
delegation_test.go(+81/-0):Quality
Verdict
[core-qa-agent] APPROVED — tests: added (81L, 10 cases), e2e: N/A (Go backend only)
[core-security-agent] N/A — test-only. delegation_test.go adds extractResponseText coverage. No production code changes.
Five-Axis Code Review — PR #736
Verdict: APPROVE
Correctness ✅
All 10 test cases faithfully enumerate the documented code paths of
extractResponseText:json.Unmarshalfails.resultkey: correct — raw body returned.resultis not a map: correct — raw body returned.parts[].kind == "text": correct — first match returned.parts[].kind != "text"(image): correct — no text found, falls through to raw body.artifacts[].parts[].kind == "text": correct — nested traversal.artifacts[].parts[].kind != "text": correct — raw body.parts/artifactsarrays: correct — raw body.""text string: correct — returns"". Worth noting: this distinguishes "found a text part but it is empty" from "no text part at all". Both return""andstring(body)could differ, so the test correctly pins this behaviour.All assertions use exact-equality (
!= want), not substring checks. No false positives.One minor note:
TestExtractResponseText_PartsMultipleWithTextFirstdocuments "first text wins" but there is no companion test for "second-part-only" (firstkind != "text", secondkind == "text"). This is a missing branch, but it is low-risk given the function is a pure helper and the happy-path ordering is already covered.Readability ✅
TestExtractResponseText_<ScenarioDescription>.// ---------- extractResponseText ----------banner matches the existing file style.t.Errorfformat strings are consistent:got %q, want %q.Architecture ✅
package handlers(same package as the function), which is consistent with all other_test.gofiles in this directory.Security ✅
extractResponseTextis a pure JSON-parsing helper with no I/O, no DB access, no auth. Nothing to audit here beyond correctness.Performance ✅
Summary
Solid 10-case unit test suite for a previously-untested pure helper. All assertions are exact-equality. One low-priority gap: a "second-part-only" case where the first part is non-text and the second is text (mixed-kind parts array). The current coverage is sufficient for merge; the gap can be filled in a follow-on.