Skip to content

test(a2a): exercise official SDK JSON-RPC loopback - #151

Merged
imran-siddique merged 3 commits into
agentrust-io:mainfrom
noah-ing:test/a2a-sdk-loopback
Sep 6, 2026
Merged

test(a2a): exercise official SDK JSON-RPC loopback#151
imran-siddique merged 3 commits into
agentrust-io:mainfrom
noah-ing:test/a2a-sdk-loopback

Conversation

@noah-ing

@noah-ing noah-ing commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

What

Add a runnable official Python A2A SDK JSON-RPC loopback example, 18 transport-level regression cases in the existing CI test matrix, and a refreshed integration tutorial linked from the README.

This is a practical follow-up to #130 and a bounded step toward the workstream recorded in #113. It does not complete that workstream or claim TCK/cross-language conformance.

Why

The bridge tests exercise real SDK models, but not an SDK HTTP server, card resolver and client together. The integration tutorial also still described the live peer/policy/sealing path as unbuilt. An adopter needs a working composition of the APIs that now exist.

The example leaves card serving and application routing with the SDK/operator. It does not add another server implementation to ca2a start.

Security impact

No changes under src/, to cryptography, or to core enforcement.

  • An operator-configured root authorizes a two-credential chain. Signed depth and validity bounds survive actual protobuf/JSON serialization with identical canonical credential bytes.
  • The holder answers the server's challenge and binds the exact sealed fixture, capability, record ID and parent link to the callee's channel-key audience. PeerNode.handle() runs before the private lookup handler.
  • A permitted read invokes that handler once. A write granted by the credential but disallowed by local policy does not invoke it.
  • Ordinary A2A receives only public information. Partial opt-in, incomplete metadata, absent holder proof and an untrusted root cannot fall back to protected work. Requiring both HTTP and message opt-in is explicitly this example's routing policy, not a new normative requirement.
  • Tests also cover per-call concurrent header/decision isolation, response context IDs, required card fields, and normal/error/cancellation socket teardown.

The bootstrap is local HTTP with software-only assurance, not authenticated production transport. The payload is public fixture data. Challenges remain repeatable within their TTL; diagnostic records are unsigned. No hardware, key-residency, co-location, runtime-integrity, at-most-once or exactly-once claim.

Test plan

Verified from a fresh checkout of a91ac72f74be01991ab82a4abd4e4718297d46ee, Python 3.12.14:

  • pytest tests/ -q --cov=src: 571 passed, 2 existing hardware-dependent skips, 90.41% runtime coverage. All 18 new loopback cases pass without skips. The normal CI matrix discovers them under tests/unit/.
  • ruff check src/ tests/ examples/a2a-sdk/
  • ruff format --check src/ tests/ examples/a2a-sdk/
  • mypy src/ca2a_runtime/ src/ca2a_verify/ examples/a2a-sdk/loopback.py: 45 source files.
  • Bandit; Gitleaks on this commit; detect-secrets on changed files: no findings.
  • pip-audit: no known dependency vulnerabilities; the local unpublished ca2a-runtime==0.2.1 itself is not in PyPI's audit database.
  • sdist/wheel build, Twine 7 metadata validation, package inventory checks, fresh-wheel import and actual SDK loopback smoke.
  • Manual run: python examples/a2a-sdk/loopback.py prints ordinary response, widget stock, SCOPE_NOT_PERMITTED, one protected invocation, assurance none and caller not_offered.
  • Normal MkDocs build and local link checks. Strict docs builds encounter the same pre-existing missing SPONSORS.md assembly warning on base and head; no new warnings.

The exercised SDK/server versions are pinned in the dev dependencies and example requirements: a2a-sdk[http-server]==1.1.2, uvicorn==0.52.4. This is not a complete transitive lock. SDK protobuf deprecation warnings remain visible rather than suppressed.

Hosted verification on the same head also passes: all six Linux/Windows Python 3.11–3.13 jobs and strict governance, CodeQL, and the Docker PR build. The initial Windows shutdown probes used a one-second connection deadline; the follow-up allows five seconds for refusal while still rejecting timeouts. No test is skipped to accommodate Windows. Maintainer approval is still required.

DCO sign-off

Signed-off-by: Noah Ingwers <98993329+noah-ing@users.noreply.github.com>
@noah-ing
noah-ing requested a review from a team as a code owner September 5, 2026 14:25
@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

🟡 Contributor Check: MEDIUM

Check Result
Profile MEDIUM
Credential LOW
Overall MEDIUM

Automated check by AgenTrust Contributor Check.

@github-actions github-actions Bot added the needs-review:MEDIUM Contributor check flagged MEDIUM risk label Sep 5, 2026
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Signed-off-by: Noah Ingwers <98993329+noah-ing@users.noreply.github.com>

@imran-siddique imran-siddique left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed the complete SDK loopback example, tutorial, dependency changes, and tests. All 18 loopback scenarios pass locally, alongside 50 existing TPM tests. Protected inventory access passes through the real cA2A verifier; ordinary requests cannot dispatch that handler. The documentation accurately limits the example to software assurance, unsigned diagnostics, and loopback HTTP.

@imran-siddique imran-siddique left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed the complete SDK loopback example, tutorial, dependency changes, and tests. All 18 loopback scenarios pass locally, alongside 50 existing TPM tests. Protected inventory access passes through the real cA2A verifier; ordinary requests cannot dispatch that handler. The documentation accurately limits the example to software assurance, unsigned diagnostics, and loopback HTTP.

@imran-siddique
imran-siddique merged commit 7107c68 into agentrust-io:main Sep 6, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-review:MEDIUM Contributor check flagged MEDIUM risk

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants