Skip to content

refactor: update ACTS test suite specifications to standardize error formats, include header inspection, and refine transport requirements - #2227

Open
JakubWorek wants to merge 4 commits into
conformance-specfrom
conformance-spec-adjustments
Open

JakubWorek wants to merge 4 commits into
conformance-specfrom
conformance-spec-adjustments

Conversation

@JakubWorek

@JakubWorek JakubWorek commented Sep 11, 2026 •

Copy link
Copy Markdown
Member

ACTS corpus adjustments

Follow-up to #1882. Fixes the parts of the ACTS corpus that disagreed with the normative A2A sources, were asserted by checks that could not fail, or named a feature the grammar had no way to express.

1. Spec (docs/acts-specification.md)

Corrected against the normative A2A sources. Error tables rebuilt from A2A 5.4 and 9.5 (9 A2A codes corrected, several HTTP mappings fixed, 5 JSON-RPC errors split into their own table). Operation table (4.1) realigned with 5.3. Part and push-config params flattened to the proto shape. State transitions in 7.1 de-contradicted (illegal transitions enumerated; SUBMITTED -> COMPLETED and SUBMITTED -> REJECTED declared legal). File-layout in 16 now matches the real tree.

Error-table details:

  • VersionNotSupportedError -32006 -> -32009. Added InvalidAgentResponseError (-32006), ExtendedAgentCardNotConfiguredError (-32007), ExtensionSupportRequiredError (-32008). Removed the invented StreamingNotSupportedError and ExtendedCardNotSupportedError.
  • HTTP mappings 409/405/415/406/501 -> 400.
  • Status is not injective (several error types share one status), so runners MUST identify errors by JSON-RPC error.code or google.rpc.ErrorInfo.reason, never by status.

Grammar additions that legalize shapes the corpus already used: items (5 sites), one_of over assertions, expect_stream on raw steps (12 sites), optional error_type, details as an assertion (not a map).

New capabilities. expect.headers for response metadata that never reaches the body (gRPC excluded by transport filter). expect_webhook as a new step kind (7.2) because a push notification is a request the SUT makes, not a reply to one, so the other assertion blocks cannot reach it. expect_stream.streams and disconnect_after (7.3) for the "two subscribers to one task" and "one hangs up mid-stream" requirements that no single-stream read can observe. preconditions.authentication as the top-level gate the auth tests need. 12.2 table of runner-provided variables ({{insufficientAuthToken}}, {{otherUserTaskId}}, {{webhookUrl}}) that the corpus referenced but no document defined.

Declarative runner_requirements. Three tests demanded capabilities in description only, so every runner quietly executed a weaker variant and reported a pass. Now explicit: a test opening more than one stream MUST declare concurrent_streams, using disconnect_after MUST declare stream_disconnect, using expect_webhook MUST declare webhook_endpoint, naming a 12.2 variable MUST declare its requirement. A runner lacking any of them MUST skip. Section 7.3 adds five sibling rules preventing a deliberate cut from making a stream's assertions unfailable.

Clarifications, no grammar change. 4.4 (raw sent as written, no auto A2A-Version or messageId), 6.1 (gRPC status is the canonical transcoding), 7 (both oneof addressing styles and both spellings), 10 (runner rewrites JSON-RPC id in wire_payload), 11.2 (tck-auth-required documented).

2. Corpus (tests/acts/)

Mechanical conformance to the corrected grammar. 13 code: -> error_type:. 18 push-op renames (set_push_notification_config -> create_push_config x 12, plus get/list/delete to short forms). 11 raw-body messageId adds. 12 push-param flattenings and 12 taskId/contextId relocations into message. Nested file: parts flattened to proto shape.

Semantic corrections.

  • REST-PD-001 asserted RFC 7807, but A2A 11.6 mandates google.rpc.Status.
  • VER-NEG-002 expected a successful v1.0 response to a request with no A2A-Version; A2A 3.6.2 makes an absent header mean 0.3, so a 1.0 interface must refuse it. Now -32009 or -32601.
  • VER-NEG-001 asserts -32009 per the corrected table.
  • CARD-CACHE-001, JSONRPC-CT-001, REST-CT-001 were named for header checks but had no headers key to assert on. Fixed, and they declare runner_requirements: [header_inspection] (first use in the corpus).
  • CARD-CACHE-001 tightened further: 8.6.1 names two independent SHOULDs; the first fix accepted either, now requires all_of and that Cache-Control carries max-age.
  • HTTP+JSON replaces REST where the spec spells it that way. CORE-CTX-001 rewritten as a raw step. Four AgentSkill objects in client-parsing gained the REQUIRED description and tags.

Tests that passed without testing anything. Nine of them, green on all three transports against every reference SDK.

  • 5 push-delivery tests (PUSH-DELIV-001/002/003, SEC-PUSH-001/002) registered a config and stopped. Now assert on the delivered request via expect_webhook. Two check Authorization per A2A 4.3.3; deliberately not X-A2A-Notification-Token (A2A defines the token but no carrier header).
  • webhookUrl was a document literal at https://example.com/.... Moved to the 12.2 runner-provided table.
  • STREAM-MULTI-001/002 and STREAM-RESUB-001 demanded concurrency and disconnect in prose only; -002 was byte-identical to -001, RESUB had no disconnect. All three now use streams/disconnect_after on tck-long-running.
  • CORE-ERR-009 fetched two absent ids and never looked at the "unauthorized" half. Now fetches {{otherUserTaskId}} and requires both to name TaskNotFoundError.
  • Positive controls added to SEC-EXTCARD-001/002/004 and REST-STATUS-001.

Authentication. Five SEC-AUTH-* gated on preconditions.capabilities.authentication, which does not exist on AgentCapabilities, so they were unrunnable against any SUT. Re-gated on the new top-level preconditions.authentication. Positive controls added to SEC-AUTH-001/002/004/006. SEC-AUTH-003 was vacuous (both steps asserted only message: {type: string}); now both require TaskNotFoundError, which is the substance of the no-disclosure requirement. SEC-EXTCARD-001/002/004 deliberately keep no gate because A2A mandates the extended card unconditionally.

REST SubscribeToTask method ambiguity (new). Proto says GET at /tasks/{id}:subscribe, markdown 5.3/11.3.2 say POST. The ecosystem splits:

SDK Server accepts Client sends
python GET + POST POST
go GET + POST POST
js GET + POST POST
rust GET + POST GET
java POST only POST
dotnet POST only POST

One pairing has no overlap: a client following the proto (a2a-rs) against a server following only the markdown (a2a-java, a2a-dotnet). This surfaced as a 6h nightly hang on a2a-rs once dotnet joined the ITK matrix. Added REST-SUB-GET-001 and REST-SUB-POST-001 in transport-bindings.acts.yaml: raw GET and raw POST on a WORKING tck-long-running task, expect 200 + terminal SSE event. SHOULD rather than MUST (following only one source is defensible). The task-state check is deliberate: subscribing to a terminal task is a legitimate UnsupportedOperationError. First-event-is-Task MUST stays covered by STREAM-SSE-004 via the abstract op. Verified locally against a2a-rs (both pass) and a2a-dotnet (GET fails with 404 from the GetTask fall-through, POST passes). No spec changes here; the GET/POST contradiction requires separate PR.

Spec refs. CARD-CACHE-001 points at #8.6.1. Three DM-FMT-* tests moved from #2.3 to #5.5 / #4.1.4; DM-FMT-003 renamed to "Message response omits taskId and carries contextId", which is what it asserts.

…formats, include header inspection, and refine transport requirements
@JakubWorek
JakubWorek requested review from a team as code owners September 11, 2026 11:29
JakubWorek added a commit to a2aproject/a2a-itk that referenced this pull request Sep 16, 2026
…condition (#67)

## Summary

Takes the corpus from [A2A#2227](a2aproject/A2A#2227), where the defects this runner used to patch at load time have been fixed at source. With them fixed, `test_suite/acts/compat.py` has nothing left to do and is **deleted** — the corpus now loads 111 tests, 0 errors, strictly, with no rewriting.

That removal is the point of the PR, and everything else follows from it: the schema catches up to what the corrected corpus needs, the runner gains the one precondition A2A actually supports for authentication, and two runner bugs that the cleaner corpus made visible are fixed.

## `compat.py` had stopped being a safety net

Three of its four rules already fired zero times. The fourth, `expect-field-outside-body`, had started matching the corrected corpus's new `expect.headers` blocks and relocating them into `expect.body` — so the three header tests would have passed **without checking a header**, and blamed the SDK for nothing. A rewrite layer that silently reinterprets a fixed corpus is worse than no layer at all.

Gone with it: the `compat=` parameter, `LoadedSuite.rewrites`, five package exports, `test_acts_compat.py`, and `wire_map`'s `aliases` mechanism — which existed only to accept `StreamingNotSupportedError` and `ExtendedCardNotSupportedError`, two error names A2A does not define and #2227 removes.

## Authentication: a precondition that can be met

Five tests — `SEC-AUTH-001/002/003/004/006`, four MUST and one SHOULD — gated on `preconditions.capabilities.authentication`. `AgentCapabilities` has exactly four members and none of them is `authentication`, so those tests were **unrunnable against any agent on any binding**, and no SUT configuration could
change that. They had been reporting as unsatisfiable since #64 added the diagnostic that caught them.

A2A#2227 moves them to a top-level `preconditions.authentication`, read off the card's `securitySchemes` **and** `securityRequirements`, presence only. This adds the matching branch to `_unmet_precondition`, and the branch was proved to fail in both directions before the corpus was pointed at it — the lesson from `expect.headers`, which sat in the schema unread for a release.

The precondition is not a way of letting an agent off: A2A conditions the server's obligation on *"its declared authentication requirements"*, so a rejection test genuinely does not apply to an agent that declares none. The one exception is `Get Extended Agent Card`, whose authentication A2A mandates unconditionally — which is why `SEC-EXTCARD-001/002/004` deliberately do not carry the gate.

A corpus guard now fails if any test ever again gates on a capability `AgentCapabilities` does not define. That assertion would have caught this the day it was written.

## Reaching the auth tests: a second deviation

`_rerun_capability_skips` becomes a **`Deviation` table** — `env_var`, `skip_pattern`, `log_name`, `took_effect` — with two rows. The reduced-capability pass from #64 is the first; an `ITK_ACTS_AUTH` pass is the second, and it is a table row rather than a second copy of fifty lines.

The reasoning is the same shape as before. One agent cannot both require and not require a credential: an absent `Authorization` header means "reject me" in `SEC-AUTH-001` and "serve me" in `JSONRPC-ENV-001`, and no server can tell those two requests apart. Enforcing during the main pass costs **fourteen** raw steps that must be served, measured. So the pass runs *only* the tests whose skip it can clear, and those fourteen never meet the enforcing SUT.

Every `SEC-AUTH-*` now carries a real verdict on every binding it applies to; the only remaining skips there are transport filters.

Two properties worth reviewing specifically:

- **The pass verifies from the card that the deviation took effect**, and leaves the original skip in place when it did not, so a SUT that ignores the switch is not credited with a verdict nobody produced. a2a-python exercised exactly this path before its fixture PR: warn, keep the skips, score unchanged.
- **A failed extra pass no longer loses the report.** `_run_pass` was called unguarded, so an agent that would not start in a deviated mode took the whole binding's report with it, surfacing as `error (jsonrpc): …` and exit 2. An `ActsRunError` now warns and keeps the original skips; anything else still propagates. Pinned by a test asserting a `ZeroDivisionError` is *not* swallowed.

`TestResult` gained an optional `configuration`, recording which deviation produced a spliced verdict. It is omitted when unset, so a run with no deviations is byte-identical to before. **Flagging for review:** ACTS §13.3 does not define that key, and the deviation mechanism is deliberately ours rather than the spec's — happy to drop it if that drift is unwelcome.

## Two runner bugs the corrected corpus exposed

**A refused stream is a conformant answer.** `CORE-CAP-002` and `STREAM-SUB-003` failed on *every* SDK because the runner treated any non-SSE reply to a streaming call as "wrong content type" and discarded the body. A2A requires an agent that does not advertise streaming to answer `UnsupportedOperationError`, and says the same of subscribing to an already-terminal task — so the *conformant* reply is an ordinary error document and no stream at all. `StreamNotOpened` now carries the parsed reply, so `expect_error` can be evaluated against it. `http_base` opens the stream by hand rather than through `aconnect_sse`, which checks the content type inside its own `client.stream` block and closes the response before the body can be read; `grpc.stream` parses the `AioRpcError` when nothing was streamed.

**`RUNNER_VARIABLES` never reached the service.** `run_acts.py` passed them and `POST /run-acts` did not, so `{{insufficientAuthToken}}` was unresolved on the service path and `SEC-EXTCARD-002` **errored** — a harness fault reported against the SDK. They are now merged inside `acts_runner.run()`, where every front end gets them, and a caller can still override.

## Schema catch-up

`expect.headers` (wired into `evaluate_headers`, not merely declared), `preconditions.authentication`, `ErrorType` carrying exactly A2A's names, `details` as an assertion over the error array rather than a map, `data` removed. `_observed_error` now exposes `details` as the array it is.

@aeoess aeoess left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

§12.2 now ties insufficientAuthToken and otherUserTaskId to the auth_credentials runner requirement, but the three tests that reference them do not declare it:

  • SEC-AUTH-002 → {{insufficientAuthToken}}
  • SEC-AUTH-003 → {{otherUserTaskId}}
  • SEC-EXTCARD-002 → {{insufficientAuthToken}}

Without the declaration, a runner that cannot supply the fixture reaches the unresolved-variable failure path instead of the skip behavior §12.2 defines.

The first two are in this diff, so I left suggestions there. SEC-EXTCARD-002 is outside the changed lines and needs the same addition after its tags line:

runner_requirements: [auth_credentials]

Comment thread tests/acts/auth-security.acts.yaml Resolved
Comment thread tests/acts/auth-security.acts.yaml Resolved

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants