text
| 1 | # Stop Conditions |
| 2 | |
| 3 | Check these after every iteration (Step 6 of `loop.md`). Stop the loop and report as |
| 4 | soon as any of these is true — do not keep iterating past them. |
| 5 | |
| 6 | ## Hard stops (always stop) |
| 7 | |
| 8 | - `max_iterations` reached. |
| 9 | - The full test suite is red and the harness cannot get it green again after a |
| 10 | reasonable attempt (e.g. 2 focused retries) — stop and report the failure rather |
| 11 | than leaving the repo in a broken state. |
| 12 | - A behavior requires infrastructure not available in this environment (a live |
| 13 | database, an external API with no test double, network access) and no reasonable |
| 14 | mock/fixture can be constructed — record it as a deferred gap, don't fake a pass. |
| 15 | - A behavior gap turns out to require a product/design decision the harness can't |
| 16 | infer from the code, docs, or issue tracker (e.g. undefined behavior on conflicting |
| 17 | input with no spec) — stop and ask the user rather than guessing. |
| 18 | |
| 19 | ## Soft stops (stop and report, this is success) |
| 20 | |
| 21 | - Coverage for the targeted module reaches a clear plateau: two consecutive iterations |
| 22 | with no meaningful coverage increase (e.g. < 1%) because remaining uncovered lines |
| 23 | are trivial (simple getters, defensive code that can't realistically be reached). |
| 24 | - All identified untested behaviors in the targeted scope have been covered — don't |
| 25 | invent artificial tests just to keep the loop running. |
| 26 | - Diminishing returns: the last 2-3 iterations added tests for increasingly contrived |
| 27 | edge cases with low real-world likelihood. Note these as candidates but stop. |
| 28 | |
| 29 | ## Explicitly not a stop condition |
| 30 | |
| 31 | - Reaching a specific coverage percentage number (e.g. "80%") — coverage percentage is |
| 32 | a signal, not a goal; a module can be well-tested at 70% (all the real branches |
| 33 | covered) or poorly tested at 95% (assertion-free tests padding the number). Judge by |
| 34 | behavior coverage, not the raw metric. |
| 35 |