Skip to content

Feature: Automated Stale Cassette Detection and Regeneration Tool #2821

@samyak1729

Description

@samyak1729

Problem

When Mirascope's internal implementation changes, HTTP requests sent to LLM providers may change slightly. This causes VCR cassettes to become "stale" - they no longer match the actual requests being made.

Current pain points:

  • Tests fail with CannotOverwriteExistingCassetteException
  • Developers must manually identify and delete stale cassettes one by one
  • Alternative is deleting ALL cassettes and regenerating (slow, costly API usage)
  • No way to selectively regenerate only stale cassettes

Proposed Solution

Implement a pytest plugin that automatically detects stale cassettes during test runs and regenerates them.

  • Detects stale cassettes by catching CannotOverwriteExistingCassetteException
  • Only regenerates stale cassettes, not all of them
  • Shows which cassettes were regenerated

Question

  • How exactly do I make this work alongside --hard-refresh (snapshots) and --fix (inline-snapshot). Currently I'm still trying to wrap my head around this. will ask questions on discord if any of them pops up

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions