test: add regression coverage for logout, provider methods, and tool-call merges - #28
Open
cursor[bot] wants to merge 3 commits into
Open
test: add regression coverage for logout, provider methods, and tool-call merges#28cursor[bot] wants to merge 3 commits into
cursor[bot] wants to merge 3 commits into
Conversation
Adds regression tests for two recent protocol changes that previously shipped without dedicated coverage: * PR agentclientprotocol#1273 promoted `logout` from the `unstable_logout` feature gate to the stable API. Lock in the `logout` method-name constant, the `ClientRequest::LogoutRequest` dispatch, request/response wire format (empty JSON objects both ways), and the backwards-compatible defaults on `AgentAuthCapabilities` / `AgentCapabilities.auth` so peers on the older schema still deserialize cleanly. Also verify the `DefaultOnError` guard on `AgentAuthCapabilities.logout` tolerates malformed values from future protocol revisions. * PR agentclientprotocol#1272 renamed the provider method types from plural to singular (`providers/set` / `providers/disable`). Assert the constants and the `ClientRequest` method dispatch report the singular form so any future rename that drifts back to plural fails loudly at test time instead of silently on the wire. Both suites are duplicated for the v1 and v2 modules to match existing test conventions. Co-authored-by: QuantuM <qumusai@proton.me>
`ToolCall`, `ToolCallUpdate`, and their conversions drive the tool execution surface that clients render live to end users. Despite being one of the more logic-heavy parts of the protocol (partial updates, collection overwrite semantics, a title invariant enforced by `TryFrom`), the modules previously had zero unit tests. A quiet regression here would silently corrupt user-visible tool state or break streaming updates from agents. Adds a `tests` module to both `v1/tool_call.rs` and `v2/tool_call.rs` covering: * `ToolCall::update` applies all provided fields and, importantly, leaves `raw_input`/`raw_output` untouched when the update omits them (so streaming updates don't clobber earlier inputs). * Empty `ToolCallUpdateFields` leave the call unchanged. * Content and location collections are overwritten (as documented on `ToolCallUpdate`), not extended. * `TryFrom<ToolCallUpdate> for ToolCall` errors with `ErrorCode::InvalidParams` and the documented message when `title` is missing, and uses defaults for every other field. * `ToolCall -> ToolCallUpdate -> ToolCall` round-trips through `TryFrom` without loss. * Default `ToolKind` (`Other`) and `ToolCallStatus` (`Pending`) are skipped on serialization to keep the wire format compact and backwards-compatible; non-default values still round-trip. * Unknown `kind` values decode to `ToolKind::Other` via the `#[serde(other)]` guard so newer agents don't crash older clients. * Malformed entries inside streamed `content`/`locations` arrays are skipped by the `VecSkipError` deserialize guard rather than failing the whole update. Adds 22 tests (11 per version) with no changes to production code. Co-authored-by: QuantuM <qumusai@proton.me>
Author
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_bf8b00f7-9eb8-4839-b3c4-9d9d0329dd39) |
There was a problem hiding this comment.
Pull request overview
This PR strengthens the protocol schema library’s regression safety by adding targeted unit tests (no production/runtime logic changes) that lock in recently shipped protocol behavior around logout, provider method naming, and ToolCall merge/serde semantics.
Changes:
- Add v1/v2 regression tests for stable
logoutwire format, method dispatch, and capability defaulting/robust deserialization. - Add v1/v2 tests (behind
unstable_llm_providers) pinning provider method names andClientRequestdispatch strings to the singular forms. - Add new
ToolCalltest modules in v1/v2 coveringToolCall::update,TryFrom<ToolCallUpdate>, default-field serialization skipping, unknown-kind fallback, andVecSkipErrorhandling. - Reformat the
AGENTS.mdcommands table to render correctly (and satisfy Prettier).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/v1/agent.rs | Adds logout + provider method-name/dispatch regression tests for v1. |
| src/v2/agent.rs | Mirrors the logout + provider test coverage for v2. |
| src/v1/tool_call.rs | Adds a tests module validating ToolCall merge semantics and wire-format behavior for v1. |
| src/v2/tool_call.rs | Mirrors ToolCall merge/serde regression coverage for v2. |
| AGENTS.md | Fixes markdown table formatting for the key commands section. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
marekdkropiewnicki-dotcom
approved these changes
Jul 12, 2026
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.
Automated test-coverage sweep. Adds 48 new tests (0 changes to production code) targeting recently-changed protocol surfaces that previously shipped without direct unit coverage.
Risky behavior now covered
Newly stabilized
logoutmethod (PR agentclientprotocol#1273)logoutwas promoted fromunstable_logoutto the stable API without any accompanying tests. A silent break here would affect every client that upgrades.logoutmethod-name constant andAGENT_METHOD_NAMES.logoutvalue.ClientRequest::LogoutRequest(...).method()dispatch.LogoutRequest/LogoutResponseempty-object wire format and round-trip.LogoutResponse: Defaultcontract (relied on byAgentResponse's#[serde(default)]).AgentAuthCapabilitiesdefault omitslogout;.logout(LogoutCapabilities::new())emits{ "logout": {} }.auth.logoutvalue is silently ignored via theDefaultOnErrorguard.AgentCapabilitiesdeserializes withauthabsent.Provider method rename (PR agentclientprotocol#1272)
PR agentclientprotocol#1272 renamed provider method types to singular (
providers/set/providers/disable). Locks in the singular form so a future rename can't silently drift back and break already-shipped clients.PROVIDERS_SET_METHOD_NAME/PROVIDERS_DISABLE_METHOD_NAMEconstants.ClientRequestmethod dispatch forListProvidersRequest,SetProviderRequest,DisableProviderRequest.ToolCallmerge semantics and wire-format guardsToolCall/ToolCallUpdatedrive the tool execution surface clients render live to end users, but the module previously had zero unit tests. A quiet regression would corrupt user-visible state.ToolCall::updateapplies all provided fields and leaves untouched fields alone (including the trickyraw_input/raw_outputstreaming case).ToolCallUpdateFieldsleaves the call unchanged.TryFrom<ToolCallUpdate> for ToolCallerrors withInvalidParams+ the documented message whentitleis missing; uses defaults for every other field.ToolCall -> ToolCallUpdate -> ToolCallround-trips throughTryFromlosslessly.ToolKind/ToolCallStatusare skipped on serialization (compact wire format, older-client compat); non-default values still round-trip.kindvalues decode toToolKind::Othervia#[serde(other)](forward compat).content/locationsstreams are skipped byVecSkipErrorrather than failing the whole update.Test files added / updated
src/v1/agent.rs: +10 logout tests, +2 provider-method tests.src/v2/agent.rs: same suite mirrored for v2.src/v1/tool_call.rs: newtestsmodule with 11 tests.src/v2/tool_call.rs: same suite mirrored for v2.Total: 316 tests (up from 268), all deterministic, all pass under
cargo test --all-features.cargo clippy --all-featuresandcargo fmt --checkalso pass. The only prettier warning (AGENTS.md) predates this branch and is unrelated to these changes.Why these tests materially reduce regression risk
logoutis out in released clients, any silent drift in the method name, request/response shape, or capability advertisement breaks every consumer. These tests turn each of those into a compile-time-caught failure.ToolCall::update, which is invoked on every streaming tool update and whose behavior is only otherwise documented in comments. Overwrite-vs-extend and "don't clobber raw input on partial updates" are exactly the kind of subtle behaviors that regress unnoticed.DefaultOnErrorandVecSkipErrorserde guards on paths that receive untrusted input from a peer implementation, ensuring one malformed entry from a bad agent can't crash the client.Summary by cubic
Adds 48 regression tests to lock down the stabilized
logoutmethod, singular provider methods, andToolCallmerge and wire-format behavior across v1 and v2. Also fixesAGENTS.mdtable formatting to satisfy Prettier; no production code changes.Test Coverage
logout: confirms constant and dispatch are "logout", empty-object request/response, defaultAgentAuthCapabilities, ignores malformedauth.logout, and tolerates missingauth.providers/list,providers/set,providers/disableconstants andClientRequestdispatch (singular form).ToolCall: verifiesupdateapplies fields, overwrites collections, preserves absentraw_input/raw_output;TryFromrequirestitleand otherwise uses defaults;ToolCall<->ToolCallUpdateround-trip; skips defaultkind/statuson serialize; unknownkind→Other; skips malformedcontent/locationsentries.Bug Fixes
AGENTS.md: formatted the commands table to pass Prettier.Written for commit 54aa5b0. Summary will update on new commits.
Note
Add regression test coverage for logout, auth capabilities, provider methods, and tool-call merges
LogoutRequest/LogoutResponseserialization round-trips, auth capability defaults, and provider method name constants (providers/list,providers/set,providers/disable) under theunstable_llm_providersfeature flag.ToolCall::updatefield application, collection overwrite behavior,TryFrom<ToolCallUpdate>error on missing title, serialization of default/non-default fields, unknownToolKindfallback, andDefaultOnErrorskipping of invalid entries.Macroscope summarized 54aa5b0.
Note
Low Risk
Test-only and documentation formatting changes; no runtime or schema behavior is modified.
Overview
Adds 48 new unit tests across v1/v2 with no production code changes, locking in protocol behavior that recently shipped without direct coverage.
logoutstabilization (PR agentclientprotocol#1273): Tests inagent.rsassert the"logout"method name andClientRequestdispatch, empty-object serde forLogoutRequest/LogoutResponse,AgentAuthCapabilitiesdefault vs{ "logout": {} }, malformedauth.logoutignored viaDefaultOnError, and missingauthonAgentCapabilities.Provider rename (PR agentclientprotocol#1272): Behind
unstable_llm_providers, tests pin singular wire namesproviders/list,providers/set, andproviders/disableplus matchingClientRequestmethod strings.Tool calls: New
testsmodules intool_call.rscoverToolCall::update(partial fields, collection overwrite, preservingraw_inputwhen absent),TryFrom<ToolCallUpdate>title requirement, round-trips, defaultkind/statusomitted on serialize, unknownkind→Other, and skipping badcontent/locationsentries.Docs:
AGENTS.mdcommand table is reformatted for Prettier alignment only.Reviewed by Cursor Bugbot for commit 54aa5b0. Bugbot is set up for automated code reviews on this repo. Configure here.