# 25.6 Revising from a failing regression case, and keeping it closed (/building-ai-workers/prompts-and-structured-output/revising-from-a-failing-case)

---
type: Document
title: "25.6 Revising from a failing regression case, and keeping it closed"
description: "Six steps from one red case to one change, with the whole suite run before the merge and the case kept in the set."
status: stable
order: 325.06
ksor:
  owner: team:panaversity
  audience:
    - public
  approval:
    by: process:panaversity
    at: 2026-11-30T00:02:23Z
chapter: '25'
part: III
expert_status: co-build
concepts: [ "25.6" ]
last_verified: '2026-11-29'
sources:
  - id: anthropic-cookbook-prompt-versioning
    title: 'Managed Agents tutorial: prompt versioning and rollback, Claude Cookbook (verified 2026-11-29)'
    resource: https://platform.claude.com/cookbook/managed-agents-cma-prompt-versioning-and-rollback
  - id: anthropic-prep-course-prompting-craft
    title: Claude Certified Developer, Foundations prep path, Module 2, Prompting Craft, Anthropic Partner Academy (sign-in needed, read 2026-11-29)
    resource: https://anthropic-partners.skilljar.com/path/claude-certified-developer-foundations/production-grade-prompting-agents-tool-use/486743/scorm/3k33sihfb1tww
  - id: anthropic-ccdv-f-exam-guide
    title: Claude Certified Developer - Foundations Exam Guide, version 1.1, effective December 7, 2026 (read 2026-11-29)
    resource: https://cc.sj-cdn.net/instructor/6nizmqk8tpzpfjvt6qmmav7rh/public/1794946771/Claude_Certified_Developer_-_Foundations_Exam_Guide_Updated_Dec_7.pdf
generated:
  at: 2026-11-30T00:02:23Z
  by: esl-rewrite/1.2.0+ksor.1
trust_tier: unverified
build_id: sha256:cc6fd9ac5f72207d4365ecbda63d87d1b64f99e05519b358a45b9f5d9bfd6f8f
dirty: true
ksor_version: 0.0.60
---

**In everyday life.** A school's timetable has a clash. One class has two lessons at 10:00 on Tuesday. The secretary moves one lesson and the clash is gone. But the teacher of that lesson now has two classes at once, and a room is booked twice. A careful secretary changes one thing, then checks the whole timetable, not only the class that complained.

**What you will learn.** You practice this in Lab 25, Tasks 1 and 2.

- What are the steps?
- How do I name the failure?
- How do I find the missing piece?
- What does the builder do before the prompt changes?
- What is the one change?
- Why the whole suite, when one case failed?
- What does "keeping it closed" mean?
- What does this cost?

**Why it matters.** A person who changed a prompt read the next answers again. Nobody reads 41 answers again, so nobody sees a fix that breaks another case.

**At work.** Monday, April 19, 2027. Ana Morales has read the morning report, and INV-8340 waits, and 25.7 takes it up. First the builder runs the suite as Lab 24 left it, all 41 cases. One is red: the red case.

<!-- EDITOR: the concept sections tell the two fixes in the lab's order, the red case first (25.6) and the schema second (25.7), so the page tells one order. The other option: the spec's worked run, where the schema comes first and the red case is fixed after it. -->

### What are the steps?

**There are six, and the order matters.**

1. *Reproduce it.* Run the failing case alone and see it fail. The exam guide's words are a gap "that regression evaluations have exposed".[^anthropic-ccdv-f-exam-guide] A regression case is a case in the suite that is there to show when something that worked stops working.
2. *Name the failure.* Say what went wrong in the answer.
3. *Find the missing piece.* Say what the prompt lacks.
4. *Change one thing* (25.1).
5. *Run the whole suite.* Not the one case.
6. *Keep the case.* It stays in the suite, so every later change is read against it.

Anthropic's prep course for the exam teaches the middle steps in four words: diagnose before you re-prompt. To diagnose is to find the cause. A missed output is not fixed by more words. A prompt that grows longer with each try is a sign that nobody named the failure. After three failed tries in a row, the course says, stop adding text.[^anthropic-prep-course-prompting-craft]

### How do I name the failure?

**With one of 24.7's six names, where one fits.** The six are hallucination, refusal, under-acting, context loss, format drift and inconsistent output. In a hallucination, the answer states what no source holds. A refusal is what this book calls a decline. In under-acting, the model does less than asked. In context loss, it leaves out a rule or a fact it was given. In inconsistent output, the decision changes from run to run. The "Net 30 days" answer fits well. The terms came back in words the code did not expect, which is **format drift**: the answer left the form.

The red case fits none of the six well. It is not format drift, because the shape is right. It is not a hallucination, because the number is printed on the invoice. The six names say what went wrong in the answer. They do not say what the prompt was missing, and that is what you must change.

### How do I find the missing piece?

**Match what you see to a row of the prep course's table.** Each kind of failure points to one missing piece of the prompt.[^anthropic-prep-course-prompting-craft] The last column is this book's, and shows where the six names meet it.

| What you see | What the prompt lacks | Nearest of the six names |
| --- | --- | --- |
| The wrong shape: a sentence where a label was expected, prose where JSON was expected | An output constraint: the form, the field names, where to stop (25.3) | Format drift |
| The content drifts: the scope, the tone, a wider question answered, worse as the conversation goes on | A system prompt, or a more specific one (25.2) | Context loss, when it gets worse as the conversation grows |
| The task is right and the structure is invented | Examples: one correct pair of input and output shows the exact shape (25.4) | Format drift, or a hallucination when a field is invented |
| Clean on the tested inputs, broken on a variant | A constraint or an example that names the variant | None of the six |

The table has no row for a decline, for under-acting or for inconsistent output. More words in the prompt are not their usual fix, and 24.9 gives a recovery for each cause.

The red case is in the last row. The prompt was clean on the other 14 extraction cases and broke on this one. The builder reads the prompt beside the invoice and finds the gap: the prompt asks for "the total" and never says which amount that is. The instruction was unclear. The exam guide's name for the fix is instruction clarity.

### What does the builder do before the prompt changes?

**The builder adds the check that would have stopped this answer live.** It is plain code: the total must be the subtotal plus tax. The red case is now stopped at that check (25.9 builds the rest of it).

### What is the one change?

**Four words in one instruction: "the total, including tax".** The builder changes nothing else. The whole suite runs, and every case passes.

### Why the whole suite, when one case failed?

**Because a change that fixes one case can break others, and only the suite re-reads them.** Anthropic's own worked example shows it. A second version of a prompt added a broad rule, "Apply this rule before any other consideration". It fixed the tickets it was written for. Scored against a labeled test set of 20 tickets, it made the billing tickets worse. So the tutorial rolls it back, which means it returns to the earlier version.[^anthropic-cookbook-prompt-versioning]

In Lab 25 you see the same thing on Brightline's suite. A recorded run shows a broad rewrite that turns the red case green and turns two passing cases red. Run on the one case, that rewrite looks finished.

<!-- OPEN: the words of the lab key's broad revision, and which two cases it breaks, are not in the spec or the lab plan (3-lab-changes.md, Lab 25, step 2). They must be decided in specs/labs/ and recorded as a real run before this paragraph can name them. -->

Figure 25.6 shows what the full run finds.

<!-- EDITOR: Figure 25.6 and Figure 25.9 keep their section's number, because the spec lists the figures by section (the overview, 25.2, 25.6, 25.9). The other option: number them in order, as Chapters 23 and 24 do, which makes them Figure 25.3 and Figure 25.4 in the text, the captions and the comments. -->

<!-- FIGURE 25.6: One change, the whole suite. Left: a box labeled "The prompt", with one line marked "one change". An arrow runs right from the prompt to a box labeled "The whole suite", drawn as a grid of small squares, one per case. Most squares are green. One square, labeled "the failing case", has turned from red to green. Two other squares, labeled "passed before", have turned from green to red. Under the grid: "Run on one case: looks fixed. Run on all: 1 fixed, 2 broken." One arrow runs from the suite back left to the prompt, labeled "red: revise again, one thing". No arrow leaves the suite toward "merge" while any square is red. A small box under the suite, "the failing case stays in the set", with an arrow from the fixed square down into it. -->

*Figure 25.6. One change, the whole suite. The revision fixes the failing case and breaks two others, and only the full run shows it.*

### What does "keeping it closed" mean?

**The case stays in the suite permanently.** The red case was already there, with Ana's values. A failure found in live work joins the set the same way: Ana labels it, as she does for INV-8340 in 25.7. From then on, every change to the prompt, by anyone, is read against it. That is the exam guide's "closing the gap and keeping it closed".

### What does this cost?

**Money and a wait.** Each full run calls the model once for every extraction case. Running only the failing case is fine while you look for the cause, in step 1. It is never the last run before a change is merged.

**The operating rule:** reproduce the failure, name it, find the one piece the prompt lacks, change that one thing, run the whole suite, and keep the case.

**Do this now.** Ask your coding agent to show you a failing case before anyone edits anything. Copy this line:

> Run only the extraction case that is red. Show me the invoice's text, the extraction prompt and the model's answer side by side, and Ana's value for each field. Change nothing.

Before you ask for a fix, write two lines in your notes. The first is the name of the failure, or "none of the six fits". The second is the one piece the prompt lacks. Check: your second line names a row of the table above.

[^anthropic-ccdv-f-exam-guide]: Claude Certified Developer - Foundations Exam Guide, version 1.1, Anthropic.
[^anthropic-prep-course-prompting-craft]: Claude Certified Developer, Foundations prep path, Module 2, Prompting Craft, Anthropic Partner Academy.
[^anthropic-cookbook-prompt-versioning]: Managed Agents tutorial: prompt versioning and rollback, Claude Cookbook.
