Skip to content

test: cover stabilized logout, provider rename, and session/delete - #18

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/missing-test-coverage-6551
Draft

test: cover stabilized logout, provider rename, and session/delete#18
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/missing-test-coverage-6551

Conversation

@cursor

@cursor cursor Bot commented Jun 13, 2026

Copy link
Copy Markdown

Risky behavior now covered

Three recently merged code-changing PRs landed with under-tested surfaces. This adds focused regression tests that lock in their wire contracts and fault-tolerance behavior in both v1 and v2 type namespaces.

1. logout (stabilized in agentclientprotocol#1273) — previously zero direct tests

  • Wire method name (AGENT_METHOD_NAMES.logout, LOGOUT_METHOD_NAME).
  • ClientRequest::LogoutRequest(...).method() routing.
  • LogoutRequest / LogoutResponse (de)serialization, including _meta round-trip and the empty-object shape that on-the-wire peers depend on.
  • auth.logout capability advertisement ({} / None) on AgentAuthCapabilities.
  • DefaultOnError fault-tolerance contract on auth.logout: a malformed value (string, number, bool, array, wrong-typed _meta) must fall back to None instead of poisoning the entire initialize response. This is the defensive behavior the field was annotated for, and it had no test.

2. providers/{set,disable} rename to singular (agentclientprotocol#1272) — previously no method-routing test

  • Asserts AGENT_METHOD_NAMES.providers_{list,set,disable} and their constants.
  • Asserts ClientRequest::{ListProviders,SetProvider,DisableProvider}Request.method() returns the renamed wire names. A future accidental rename in either spot now fails loudly instead of breaking the wire silently.

3. session/delete (added in agentclientprotocol#1216, feature-gated) — missing cross-namespace round-trip

  • v1 <-> v2 conversion round-trip for DeleteSessionRequest and DeleteSessionResponse (including _meta) so gateways bridging the two namespaces can't silently drop the payload.

Bonus: cross-namespace round-trips

  • LogoutRequest / LogoutResponse round-trips (v1 <-> v2, with and without _meta).
  • AgentAuthCapabilities round-trips both with and without the logout capability (the latter guards against None flipping to Some(default), which would silently flip every agent into "supports logout").
  • SetProviderRequest / DisableProviderRequest round-trips.

Test files added/updated

  • src/v1/agent.rs — 5 new tests in test_serialization (logout × 4, provider routing × 1).
  • src/v2/agent.rs — same 5 tests mirrored into the v2 type namespace.
  • src/v2/conversion.rs — 5 new round-trip tests covering logout, AgentAuthCapabilities (with and without logout), feature-gated session/delete, and feature-gated provider set/disable.

Why these tests materially reduce regression risk

  • Largest blast radius: every ACP peer reads initialize and AGENT_METHOD_NAMES. A method-name drift or a malformed capability silently disables a feature for everyone, not just one caller.
  • Stabilized surface, zero coverage: logout moved out of the unstable feature flag without picking up a single direct test; this fills that gap before drift accumulates.
  • Singular-rename regression: a future rename or refactor of providers/set/providers/disable constants or enum-routing would have shipped without complaint. Now it fails the test suite.
  • Cross-namespace parity: v1 <-> v2 conversion is the most fragile invariant in this repo (the file is ~9.5k lines of hand-rolled field-by-field code); the new round-trips for logout / capabilities / session-delete / provider messages catch dropped fields and shape drift the moment they appear.

Validation

  • cargo test --all-features --lib283 passed (was 268).
  • cargo test --lib (default features) → 45 passed.
  • cargo test --features unstable_llm_providers --lib and cargo test --features unstable_session_delete --lib both green for the feature-gated tests.
  • cargo clippy --all-features --lib --tests → clean.
  • cargo fmt -- --check → clean (post-format).
  • All new tests are deterministic (pure (de)serialization + type-level assertions, no I/O, no time, no parallelism dependencies).

No production code was changed.

Open in Web View Automation 

Summary by cubic

Add regression tests for stabilized logout, singular provider methods, and session/delete across v1 and v2 to lock in wire method names, request/response {} shapes and _meta, and ClientRequest routing. Asserts auth.logout capability behavior (advertised as {}, missing → None, malformed → None via DefaultOnError) and adds v1v2 round-trips for logout, capabilities, provider set/disable, and session/delete; no production code changed.

Written for commit 4bf249d. Summary will update on new commits.

Review in cubic

Note

Add test coverage for logout, provider rename, and session delete across v1/v2

  • Adds serialization and routing tests for LogoutRequest/LogoutResponse in both v1 and v2, verifying wire method names and _meta round-trips.
  • Adds tests for AgentCapabilities auth logout serialization, including fault-tolerant deserialization of malformed values via DefaultOnError.
  • Adds v1↔v2 conversion round-trip tests in conversion.rs for logout, session delete (unstable_session_delete), and provider set/disable (unstable_llm_providers).
  • Adds provider method name tests asserting singular form constants and correct ClientRequest routing under the unstable_llm_providers feature flag.

Macroscope summarized 4bf249d.

Adds regression tests for three recent code-changing PRs that landed
without sufficient coverage:

* logout method (stabilized in agentclientprotocol#1273): wire name, ClientRequest routing,
  request/response (de)serialization with and without _meta, capability
  advertisement under `auth.logout`, and the DefaultOnError
  fault-tolerance contract that prevents a malformed `auth.logout`
  value from poisoning the entire initialize response.
* providers/{set,disable} rename to singular (agentclientprotocol#1272): asserts both the
  method-name constants and the ClientRequest -> method() routing for
  list/set/disable so a future rename can't silently break the wire.
* session/delete (agentclientprotocol#1216, feature-gated): v1 <-> v2 conversion
  round-trips for the request and response (including _meta) so
  gateways bridging the namespaces can't silently drop the payload.

Also adds v1 <-> v2 round-trip coverage for the logout types and for
SetProviderRequest / DisableProviderRequest.

All assertions are mirrored across v1 and v2 to lock in parity until the
two namespaces intentionally diverge.

Co-authored-by: QuantuM <qumusai@proton.me>
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.

1 participant