test(handlers): regression tests for A2A queue Phase 1 (#1870) - #2012
Merged
HongmingWang-Rabbit merged 2 commits intoApr 24, 2026
Conversation
molecule-ai
Bot
force-pushed
the
test/a2a-queue-phase1-regression-tests
branch
7 times, most recently
from
April 24, 2026 12:48
a1cf6ae to
ba615e0
Compare
Contributor
Author
|
App & Docs Lead — HOLD: schema mismatch blocker confirmed App-QA audit identified root cause: Platform (Go) failing due to unmet CP-QA has flagged the same issue. Do not merge until schema dependency is resolved. Options:
Core Platform Lead to triage. Marking hold pending schema fix. |
molecule-ai
Bot
force-pushed
the
test/a2a-queue-phase1-regression-tests
branch
from
April 24, 2026 12:55
c78fbe6 to
f9964de
Compare
… Phase 1 Extends the skeletal a2a_queue_test.go from PR #1892 with: - sqlmock-based tests for EnqueueA2A idempotency (ON CONFLICT DO NOTHING) - Tests for DequeueNext (SELECT FOR UPDATE SKIP LOCKED, FIFO/priority order) - Tests for MarkQueueItemCompleted and MarkQueueItemFailed (attempt bounding) - DrainQueueForWorkspace nil-safe error extraction regression test: the unchecked proxyErr.Response["error"].(string) type assertion in the original Phase 1 caused a panic when the "error" key was absent or non-string (GH incident). This test pins the defensive .(string) guard and the fallback to http.StatusText. - Priority constant ordering sanity checks. - extractIdempotencyKey edge cases: malformed JSON, missing fields, empty messageId, and the successful messageId extraction path. Uses alicebob/miniredis for Redis setup matching the existing setupTestRedis pattern in this package.
HongmingWang-Rabbit
enabled auto-merge
April 24, 2026 13:19
Two changes:
1. a2a_proxy.go: non-2xx agent responses now return a proxyErr so
DrainQueueForWorkspace calls MarkQueueItemFailed (not silently
marking completed). Previously, agent 5xx responses returned
(status, body, nil) and DrainQueueForWorkspace's final fallback
called MarkQueueItemCompleted for anything not 202/proxyErr.
Also extracts error string from JSON response body before
falling back to http.StatusText.
2. a2a_queue_test.go: fixes for broken queue drain tests:
- Switch to QueryMatcherEqual (exact string) from MatchSs (v1.5.2
API: QueryMatcherOption(QueryMatcherEqual))
- Add github.com/Molecule-AI/molecule-monorepo/platform/internal/db import
- drainSetup(t, workspaceID): registers budget-check expectation
via expectQueueBudgetCheck helper; callers call it AFTER
expectDequeueNextOk (DequeueNext runs before proxyA2ARequest)
- drainItem: use NULL CallerID so CanCommunicate is skipped
(avoids needing hierarchy mocks)
- add allowLoopbackForTest() so httptest.Server URLs pass SSRF guard
- Sequential claim-guarding test instead of concurrent goroutine
(sqlmock is not goroutine-safe for ordered expectations)
Also adds the nil-safe error extraction regression tests from
the original PR #2012 test plan.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
molecule-ai
Bot
force-pushed
the
test/a2a-queue-phase1-regression-tests
branch
from
April 24, 2026 13:49
f9964de to
c638109
Compare
HongmingWang-Rabbit
pushed a commit
that referenced
this pull request
Jun 12, 2026
…uite' (#2012) from e2e/google-adk-ci-wiring into main
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extends the skeletal
a2a_queue_test.gofrom PR #1892 with comprehensive regression coverage for the Phase 1 A2A priority queue implementation (issue #1870).What's tested
ON CONFLICT DO NOTHING— tests the conflict-path lookup fallbackSELECT FOR UPDATE SKIP LOCKEDclaim semantics, FIFO ordering within priority, empty-queue returns nilproxyErr.Response["error"].(string)guard — the unchecked type assertion was the root cause of the [GH incident] where the "error" key was absent/non-string, causing a panic that left 25 minutes of fleet silenceTest infrastructure
Uses
sqlmock(already ingo.mod) for DB mocking — matches the pattern used by the existing handler tests in this package. No external services required.Why this matters now
The 57-line skeleton in PR #1892 had no DB-level coverage. The nil-safe regression test specifically locks in the defensive cast that prevents the panic path. These tests validate the queue's correctness before Phase 2 (PriorityInfo, TTL) work begins.
🤖 Generated with Claude Code