test(workspace): add 17-case coverage for enrich_peer_metadata + nonblocking + worker #340

Closed
fullstack-engineer wants to merge 1 commits from test/a2a-client-enrich-peer-metadata into main

1 Commits

Author SHA1 Message Date
fullstack-engineer 2f587d0d0f test(workspace): add 17-case coverage for enrich_peer_metadata + nonblocking + worker
Secret scan / Scan diff for credential-shaped strings (pull_request) Failing after 1s
sop-tier-check / tier-check (pull_request) Successful in 26s
audit-force-merge / audit (pull_request) Has been skipped
NEW IN THIS AMENDMENT:
- Bug fix: enrich_peer_metadata_nonblocking now always returns None
  (was incorrectly returning cached record on warm cache hit — broke the
  caller contract that the nonblocking path never blocks)

Also adds _peer_in_flight_clear_for_testing() helper to a2a_client
and tests for:
- enrich_peer_metadata_nonblocking: always returns None, in-flight guard
  prevents duplicate scheduling, invalid peer ID rejected at boundary
- _enrich_peer_metadata_worker: runs sync fn, clears in-flight on done,
  swallows exceptions without crashing executor
- _wait_for_enrichment_inflight_for_testing: returns fast on empty set,
  blocks and waits for in-flight work to complete

Total: 72 tests in test_a2a_client.py (was 55), a2a_client coverage 36%

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-10 19:27:39 +00:00