Skip to content

[cc] add snapshot test for tools/list bytes (prompt-cache regression catch) #83

@anipotts

Description

@anipotts

Source: Apr 2026 conventions audit

Problem

cc 3.1's prompt-cache stability relies on tools/list returning byte-identical bytes across sessions. A future PR could subtly change the output (a new `description` field, reordered properties, schema dialect bump) and silently invalidate every prompt-cache entry that includes the cc tool. There's no test catching this.

Fix

`tests/snapshot.test.ts` that:

  1. Spawns the bun MCP server via stdio
  2. Sends initialize + tools/list
  3. Hashes the response and compares to a checked-in fixture (`tests/fixtures/tools-list.sha256`)
  4. Fails on hash mismatch with a clear "regenerate fixture" message

Bonus

Also snapshot:

  • `initialize` response (includes instructions field)
  • A canonical `cc(action='check')` empty-state response

Acceptance criteria

  • Test fails when tool description / schema changes
  • Failure message includes the diff and the regen command
  • CI runs the snapshot test on every PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpluginsPlugin code or plugin guide

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions