TL;DR
The error is in the consumer, but the bug is in the polluter two tests earlier. Trace the corrupted state backward from the failure instead of debugging the test that happened to notice it.

```text
agent blamed the wrong test because the error surfaced in the consumer, not the polluter two tests earlier
```

## Steps
1. Read the error as a symptom, not a location. The consumer failed because it observed bad state; write down exactly what state was wrong (which row, which global, which file content).
   Expected: a precise description of the corrupted state, e.g. "the users table had a duplicate row".
2. Walk backward through the tests that ran before it. For each preceding test, ask: could it have produced this state? Focus on tests that touch the same tables, globals, or files.
   Expected: a shortlist of one or two earlier tests with write access to the corrupted state.
3. Prove it with a pair run. Run each suspect together with the consumer (suspect then consumer); the pair that reproduces the failure names the polluter.
   Expected: exactly one earlier test reproduces the corruption when run before the consumer.
4. Fix the polluter's teardown (or the consumer's isolation). The polluter should clean up what it created; the consumer should not depend on a pristine world it never set up.
   Expected: the pair passes in order, and the consumer passes in the full suite.
5. Add a state assertion or leak check between tests if the suite keeps growing these.
   Expected: the next polluter fails at its own doorstep instead of two tests later.

## Use this when
- the failing test's code looks correct and its own fixtures are fine
- the error describes corrupted shared state (duplicate rows, stale globals, dirty files)
- an earlier test touches the same state the consumer reads
- the agent keeps "fixing" the consumer without effect

## Not for this skill when
- the bug is genuinely in the failing test's own logic
- no shared state exists between the tests (separate DBs, fresh processes)
- the failure is timing-based rather than state-based
- only one test touches the resource in question

## Variant phrasings
- "wrong test blamed for the failure, real culprit ran earlier"
- "error surfaced in consumer test but polluter test leaked state"
- "how to find which earlier test corrupted shared state"

## Why it happens
State corruption is silent; detection is loud. The polluter writes the bad row and passes. Two tests later the consumer reads it and explodes. Agents debug forward from the error, so they land on the consumer every time - the test that noticed the fire gets blamed for starting it.

## Edge cases
- The polluter may be in a different file that runs earlier; check the full execution order, not just the current file.
- Fixture finalizers that fail silently are a classic polluter: teardown "ran" but did not actually clean up.
- Multiple polluters can stack; if fixing one reveals another, keep walking backward.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_emT2xUljGnuzJSsyQqtQ5Q
