test: cover stabilized logout, provider rename, and session/delete - #18
Draft
cursor[bot] wants to merge 1 commit into
Draft
test: cover stabilized logout, provider rename, and session/delete#18cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
v1andv2type namespaces.1.
logout(stabilized in agentclientprotocol#1273) — previously zero direct testsAGENT_METHOD_NAMES.logout,LOGOUT_METHOD_NAME).ClientRequest::LogoutRequest(...).method()routing.LogoutRequest/LogoutResponse(de)serialization, including_metaround-trip and the empty-object shape that on-the-wire peers depend on.auth.logoutcapability advertisement ({}/None) onAgentAuthCapabilities.DefaultOnErrorfault-tolerance contract onauth.logout: a malformed value (string, number, bool, array, wrong-typed_meta) must fall back toNoneinstead of poisoning the entireinitializeresponse. 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 testAGENT_METHOD_NAMES.providers_{list,set,disable}and their constants.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-tripv1 <-> v2conversion round-trip forDeleteSessionRequestandDeleteSessionResponse(including_meta) so gateways bridging the two namespaces can't silently drop the payload.Bonus: cross-namespace round-trips
LogoutRequest/LogoutResponseround-trips (v1 <-> v2, with and without_meta).AgentAuthCapabilitiesround-trips both with and without thelogoutcapability (the latter guards againstNoneflipping toSome(default), which would silently flip every agent into "supports logout").SetProviderRequest/DisableProviderRequestround-trips.Test files added/updated
src/v1/agent.rs— 5 new tests intest_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-gatedsession/delete, and feature-gated provider set/disable.Why these tests materially reduce regression risk
initializeandAGENT_METHOD_NAMES. A method-name drift or a malformed capability silently disables a feature for everyone, not just one caller.providers/set/providers/disableconstants or enum-routing would have shipped without complaint. Now it fails the test suite.v1 <-> v2conversion 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 --lib→ 283 passed (was 268).cargo test --lib(default features) → 45 passed.cargo test --features unstable_llm_providers --libandcargo test --features unstable_session_delete --libboth green for the feature-gated tests.cargo clippy --all-features --lib --tests→ clean.cargo fmt -- --check→ clean (post-format).No production code was changed.
Summary by cubic
Add regression tests for stabilized logout, singular provider methods, and session/delete across
v1andv2to lock in wire method names, request/response{}shapes and_meta, and ClientRequest routing. Assertsauth.logoutcapability behavior (advertised as{}, missing →None, malformed →Nonevia DefaultOnError) and addsv1↔v2round-trips for logout, capabilities, provider set/disable, and session/delete; no production code changed.Written for commit 4bf249d. Summary will update on new commits.
Note
Add test coverage for logout, provider rename, and session delete across v1/v2
LogoutRequest/LogoutResponsein both v1 and v2, verifying wire method names and_metaround-trips.AgentCapabilitiesauth logout serialization, including fault-tolerant deserialization of malformed values viaDefaultOnError.unstable_session_delete), and provider set/disable (unstable_llm_providers).ClientRequestrouting under theunstable_llm_providersfeature flag.Macroscope summarized 4bf249d.