Skip to content

feat(testing): make SellerA2AClient event drain configurable#829

Merged
bokelley merged 1 commit into
mainfrom
bokelley/pr-763-ment-thoughts
May 23, 2026
Merged

feat(testing): make SellerA2AClient event drain configurable#829
bokelley merged 1 commit into
mainfrom
bokelley/pr-763-ment-thoughts

Conversation

@bokelley
Copy link
Copy Markdown
Contributor

Summary

Mirrors the contribution from #763 onto a branch in the base repository so the repository's required CodeQL check can run.

Closes #698.
Supersedes #763.

What changed

  • Adds keyword-only max_events: int = 32 to SellerA2AClient.invoke().
  • Replaces the hardcoded 32-event A2A drain cap with the caller-provided cap.
  • Updates the exhaustion error to report both timeout_seconds and max_events.
  • Adds regression coverage for default-cap exhaustion and success with a larger cap.

Original patch authored by @sangilish in #763.

Testing

  • uv run --extra dev python -m pytest tests/test_seller_a2a_client.py -q
  • uv run --extra dev ruff check src/adcp/testing/harness.py tests/test_seller_a2a_client.py
  • uv run --extra dev mypy src/adcp/testing tests/test_seller_a2a_client.py

Copy link
Copy Markdown

@aao-ipr-bot aao-ipr-bot Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Additive kwarg with a default that preserves the prior range(32) — non-breaking on the public testing surface, conventional-commit prefix matches.

Things I checked

  • src/adcp/testing/harness.py:296 — default max_events=32 matches the prior hardcoded bound. Loop at L356 and error message at L370-L374 are consistent.
  • SellerA2AClient is re-exported from adcp.testing (src/adcp/testing/__init__.py:26,48) — public surface. Change is additive, no ! / BREAKING CHANGE: needed.
  • Regression coverage covers both arms: default-cap exhaustion at tests/test_seller_a2a_client.py:170-177, larger cap success at L181-L191.
  • Incidental supported_billing=("operator",)supported_billing=["operator"] in the shared fixture aligns with the declared list[str] type at src/adcp/decisioning/platform.py:198. Drift cleanup, not a hidden break.

Follow-ups (non-blocking — file as issues)

  • The new error message format "within {timeout_seconds}s x {max_events} events" (src/adcp/testing/harness.py:372) uses a bare x as a separator. Reads fine to humans; a log scanner could mis-tokenize it next to a float. Something like "within {timeout_seconds}s per event, max {max_events} events" would be unambiguous. Purely cosmetic.

Minor nits (non-blocking)

  1. Substring assertion is implicitly format-coupled. tests/test_seller_a2a_client.py:177 asserts "within 0.01s x 32 events". Stable today because CPython's shortest-round-trip repr of 0.01 is "0.01", but if anyone ever adds a format spec to the f-string the test silently passes for 0.01 and breaks for other values. Splitting into separate "x 32 events" and "0.01" substring checks would be more robust.

Mirroring #763 onto the base branch for the CodeQL gate is the right move — happy path is unchanged, regression coverage is in place. Safe to merge.

@bokelley bokelley merged commit 62515d8 into main May 23, 2026
23 checks passed
@bokelley bokelley deleted the bokelley/pr-763-ment-thoughts branch May 23, 2026 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(testing): SellerA2AClient — max_events constructor parameter for event-drain budget

2 participants