## TL;DR
The agent added cleanup to the victim test, but the leak comes from the polluter, so every other test in the file still gets hit. Find the test that actually leaks (the one after which others fail), put the cleanup in its teardown, and verify the entire file passes, not just the victim.

## The symptom
```text
agent added cleanup to the victim test instead of the polluter  -  the leak still hits every other test in the file
```

## Steps
### 1. Identify the true polluter
Bisect the file: run halves until you find the test after which subsequent tests fail. The polluter is the last passing test before the failures start.
Expected: The polluting test identified.

### 2. Move cleanup to the polluter
Remove the victim-side workaround and add proper teardown to the polluting test: close connections, clear caches, reset globals.
Expected: Cleanup where the leak originates.

### 3. Verify the whole file
Run the entire test file, not just the victim. Every test should pass, including the ones that were silently affected.
Expected: Full file green.

### 4. Add leak detection
Fail on leaked resources after each test so the next polluter is caught at its source.
Expected: Polluters attributed correctly going forward.

## When to use
- Cleanup was added to a failing test but others still fail
- The leak affects multiple tests in one file
- The 'fix' only helped one test

## When not to use
- The victim genuinely needs defensive cleanup too (do both, but fix the polluter first)
- No single polluter exists (then it is shared-fixture state)
- Each test already cleans up (look for fixture-order issues)

## Why it happens
Cleaning the victim treats the symptom at one location while the polluter keeps leaking into every test that runs after it. It is whack-a-mole: each newly affected test gets its own workaround while the source keeps polluting. Cleanup belongs where the mess is made.

## Edge cases
- Polluter in a different file: the leak crosses file boundaries; check suite-wide.
- Fixture-level leaks: the fixture, not any single test, is the polluter.
- Teardown that throws: a failing teardown can itself become the polluter.

## Provenance

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