Skip to content

test(mcp): cross-cutting test-infra — integration-level serde_helpers string-coercion + shared test-policy helpers #1001

@joshrotenberg

Description

@joshrotenberg

Summary

Surfaced by the 3-toolset MCP test-coverage audit (redis #993/#996/#999/#1000, cloud #991/#994/#997, enterprise #989/#990/#992/#995/#998). Two test-infrastructure gaps span all toolsets and are better fixed once, centrally, than repeated per-issue.

Gap 1 — serde_helpers string-coercion is never exercised end-to-end

MCP clients commonly send numeric arguments as JSON strings (e.g. "ex": "3600", "subscription_id": "123", "memory_size": "1073741824"). The serde_helpers deserializers exist to coerce these, and their unit tests cover the branches (remaining unit-level gaps tracked in #1000). But no integration / request-shape test sends a string-encoded number through a tool — so the wiring that proves each tool actually uses the tolerant deserializer is unverified across redis, cloud, and enterprise.

Desired state: add string-encoded numeric inputs to at least one test per tool class — one redis key-write with "ex": "3600", one cloud call with a string id, one enterprise call with a string memory_size.

Gap 2 — no shared test-policy helpers

Write/destructive tool tests construct policy state inconsistently. AppState::test_write_policy() exists, but there is no test_full_policy() / test_destructive_policy() (or state_readonly() / state_write() / state_full()) — so destructive-tier tests are ad hoc, and several destructive tools have no guard assertion at all (called out in #989, #990, #992).

Desired state: a shared test-support module exposing explicit state_readonly() / state_write() / state_full() constructors, reused across all toolset test files. Enterprise already has tests/support/mod.rs (from #940) — extend that pattern workspace-wide.

Already tracked (do not duplicate)

Priority

Medium. The coercion logic exists (low break risk), but string-number inputs are real MCP-client behavior, and the shared helpers directly unblock the destructive-guard assertions the high-priority issues (#989/#990/#992) need.

Implementation notes

Metadata

Metadata

Assignees

No one assigned

    Labels

    mcpRelated to the MCP servertestingRelated to tests and test coverage

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions