diff --git a/AGENTS.md b/AGENTS.md index 6685e48d4..00d130cd1 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -141,6 +141,15 @@ Before considering any implementation complete, perform a minimization pass over * Before finalizing, explicitly report the regression surface: list the existing files and existing runtime paths whose behavior changed, and explain why each change is unavoidable. * During review, treat an unnecessarily modified legacy path as a review finding even if tests pass and the rewritten behavior appears equivalent. +### Corner cases raised in review + +A refactor added to cover a corner case rarely converges. Each new counter, timestamp, cache or eviction/expiry rule interacts with state that existing code relies on, and the next review round finds the problems it introduced. + +* A corner case is still worth fixing when the fix is easy and low-risk: a local change of a few lines that adds no state and changes no existing lookup, such as moving a check or refusing bad input earlier. +* When the only fix needs new state, a new lifecycle rule or a restructure, and the code already fails cleanly there or behaves as master does, document it as a known limit in the PR instead. Anything beyond the easy fix needs the maintainer's explicit go-ahead first. +* Before adding state that reorders, expires or reuses existing data, list every lookup that reads that data and check each one still holds. +* Prefer a clean failure, where the operation reports an error, over machinery that tries to make a rare case succeed. + ## Reviewing a PR * Review only what the diff introduces. Verify ownership with `gh pr diff` before reporting a finding — if the offending lines are untouched context, it is a pre-existing problem, not this PR's.