Skip to main content
All guides
Prompt and model changes

How to Turn Production AI Failures into Regression Tests

Preserve a failed interaction, remove sensitive data, confirm the expectation, and add durable coverage.

9 min readUpdated September 2, 2026

Short answer

Capture the complete attributable failure, identify the violated requirement, redact or replace sensitive inputs, reproduce the governing condition, and have a reviewer approve the expected behavior. The new case should fail on the old version and pass on the fix before promotion.

Key takeaways

  • Preserve evidence before logs or external state disappear.
  • Confirm the expected behavior instead of copying user feedback as truth.
  • Prove the case discriminates between the failure and the fix.

Signs this is the problem

Start by confirming the symptom before changing prompts, models, or infrastructure.

  • The incident exists only as a screenshot or support summary.
  • The proposed test strips away the context that caused the failure.
  • A case is added directly to a release suite without privacy or label review.

Step-by-step approach

  1. 1

    Capture the evidence

    Save inputs, context, retrieval, tool calls, outputs, identifiers, and final state under the applicable retention policy.

  2. 2

    Classify the violated contract

    State the expected behavior, observed difference, impact, and confidence without assuming the first theory is correct.

  3. 3

    Create a safe fixture

    Redact sensitive data while preserving the causal structure, or encode an invariant when exact replay is impossible.

  4. 4

    Prove and promote

    Verify fail-before and pass-after behavior, review the label, then add the case to the right protected slice.

What to measure

MetricWhat it measuresHow to use it
Failure conversion rateMaterial incidents that become reviewed coverage or an explicit accepted-risk record.Investigate low conversion as a capture or ownership gap.
Discrimination proofCases that fail before the fix and pass after it.Reject cases that cannot distinguish the change.
Recurrence rateRepeat incidents after coverage is released.Use recurrence to audit suite mapping and deployment identity.

Common mistakes

  • Saving customer data without a retention and redaction decision.
  • Encoding the proposed implementation instead of the expected outcome.
  • Closing the incident because the UI labels the limitation honestly.

Practical checklist

  • Capture the evidence: Save inputs, context, retrieval, tool calls, outputs, identifiers, and final state under the applicable retention policy.
  • Classify the violated contract: State the expected behavior, observed difference, impact, and confidence without assuming the first theory is correct.
  • Create a safe fixture: Redact sensitive data while preserving the causal structure, or encode an invariant when exact replay is impossible.
  • Prove and promote: Verify fail-before and pass-after behavior, review the label, then add the case to the right protected slice.

Frequently asked questions

What should I do first?

Save inputs, context, retrieval, tool calls, outputs, identifiers, and final state under the applicable retention policy

How should the result be measured?

Material incidents that become reviewed coverage or an explicit accepted-risk record. Investigate low conversion as a capture or ownership gap.

When is the change ready to ship?

Ship only after the protected cases pass, the primary metric clears its agreed boundary, and the team reviews the remaining failure modes instead of relying on one aggregate score.

Keep going