Skip to content

test: add regression coverage for logout, provider methods, and tool-call merges - #28

Open
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/missing-test-coverage-a69f
Open

test: add regression coverage for logout, provider methods, and tool-call merges#28
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/missing-test-coverage-a69f

Conversation

@cursor

@cursor cursor Bot commented Jul 6, 2026

Copy link
Copy Markdown

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 logout method (PR agentclientprotocol#1273)

logout was promoted from unstable_logout to the stable API without any accompanying tests. A silent break here would affect every client that upgrades.

  • logout method-name constant and AGENT_METHOD_NAMES.logout value.
  • ClientRequest::LogoutRequest(...).method() dispatch.
  • LogoutRequest / LogoutResponse empty-object wire format and round-trip.
  • LogoutResponse: Default contract (relied on by AgentResponse's #[serde(default)]).
  • AgentAuthCapabilities default omits logout; .logout(LogoutCapabilities::new()) emits { "logout": {} }.
  • Malformed auth.logout value is silently ignored via the DefaultOnError guard.
  • Backwards compat: AgentCapabilities deserializes with auth absent.

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_NAME constants.
  • ClientRequest method dispatch for ListProvidersRequest, SetProviderRequest, DisableProviderRequest.

ToolCall merge semantics and wire-format guards

ToolCall / ToolCallUpdate drive 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::update applies all provided fields and leaves untouched fields alone (including the tricky raw_input/raw_output streaming case).
  • Empty ToolCallUpdateFields leaves the call unchanged.
  • Content and location collections are overwritten (per docs), not extended.
  • TryFrom<ToolCallUpdate> for ToolCall errors with InvalidParams + the documented message when title is missing; uses defaults for every other field.
  • ToolCall -> ToolCallUpdate -> ToolCall round-trips through TryFrom losslessly.
  • Default ToolKind / ToolCallStatus are skipped on serialization (compact wire format, older-client compat); non-default values still round-trip.
  • Unknown kind values decode to ToolKind::Other via #[serde(other)] (forward compat).
  • Malformed entries in content / locations streams are skipped by VecSkipError rather 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: new tests module 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-features and cargo fmt --check also pass. The only prettier warning (AGENTS.md) predates this branch and is unrelated to these changes.

Why these tests materially reduce regression risk

  • Wire-format lock-in on newly-stable methods. Once logout is 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.
  • Guards against reintroducing the plural provider names that PR fix(unstable): Rename provider method types to singular agentclientprotocol/agent-client-protocol#1272 explicitly fixed.
  • Semantic contract lock-in on 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.
  • Deserialization robustness. Tests exercise the DefaultOnError and VecSkipError serde guards on paths that receive untrusted input from a peer implementation, ensuring one malformed entry from a bad agent can't crash the client.
Open in Web View Automation 

Summary by cubic

Adds 48 regression tests to lock down the stabilized logout method, singular provider methods, and ToolCall merge and wire-format behavior across v1 and v2. Also fixes AGENTS.md table formatting to satisfy Prettier; no production code changes.

  • Test Coverage

    • logout: confirms constant and dispatch are "logout", empty-object request/response, default AgentAuthCapabilities, ignores malformed auth.logout, and tolerates missing auth.
    • Providers: enforces providers/list, providers/set, providers/disable constants and ClientRequest dispatch (singular form).
    • ToolCall: verifies update applies fields, overwrites collections, preserves absent raw_input/raw_output; TryFrom requires title and otherwise uses defaults; ToolCall <-> ToolCallUpdate round-trip; skips default kind/status on serialize; unknown kindOther; skips malformed content/locations entries.
  • Bug Fixes

    • AGENTS.md: formatted the commands table to pass Prettier.

Written for commit 54aa5b0. Summary will update on new commits.

Review in cubic

Note

Add regression test coverage for logout, auth capabilities, provider methods, and tool-call merges

  • Adds tests in src/v1/agent.rs and src/v2/agent.rs covering logout method constants, LogoutRequest/LogoutResponse serialization round-trips, auth capability defaults, and provider method name constants (providers/list, providers/set, providers/disable) under the unstable_llm_providers feature flag.
  • Adds tests in src/v1/tool_call.rs and src/v2/tool_call.rs covering ToolCall::update field application, collection overwrite behavior, TryFrom<ToolCallUpdate> error on missing title, serialization of default/non-default fields, unknown ToolKind fallback, and DefaultOnError skipping 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.

logout stabilization (PR agentclientprotocol#1273): Tests in agent.rs assert the "logout" method name and ClientRequest dispatch, empty-object serde for LogoutRequest/LogoutResponse, AgentAuthCapabilities default vs { "logout": {} }, malformed auth.logout ignored via DefaultOnError, and missing auth on AgentCapabilities.

Provider rename (PR agentclientprotocol#1272): Behind unstable_llm_providers, tests pin singular wire names providers/list, providers/set, and providers/disable plus matching ClientRequest method strings.

Tool calls: New tests modules in tool_call.rs cover ToolCall::update (partial fields, collection overwrite, preserving raw_input when absent), TryFrom<ToolCallUpdate> title requirement, round-trips, default kind/status omitted on serialize, unknown kindOther, and skipping bad content/locations entries.

Docs: AGENTS.md command 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.

cursoragent and others added 2 commits July 6, 2026 10:09
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>
@marekdkropiewnicki-dotcom
marekdkropiewnicki-dotcom marked this pull request as ready for review July 11, 2026 00:39
Copilot AI review requested due to automatic review settings July 11, 2026 00:39
@cursor

cursor Bot commented Jul 11, 2026

Copy link
Copy Markdown
Author

Bugbot couldn't run - usage limit reached

Bugbot 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)

Copilot AI 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.

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 logout wire format, method dispatch, and capability defaulting/robust deserialization.
  • Add v1/v2 tests (behind unstable_llm_providers) pinning provider method names and ClientRequest dispatch strings to the singular forms.
  • Add new ToolCall test modules in v1/v2 covering ToolCall::update, TryFrom<ToolCallUpdate>, default-field serialization skipping, unknown-kind fallback, and VecSkipError handling.
  • Reformat the AGENTS.md commands 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.

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.

4 participants