api/observable-behavior-contract

observable behavior contract Shipped

What this lens looks for

Hyrum's Law — with enough consumers, every observable behavior becomes a depended-on contract (SHOULD-level). Observable behavior includes iteration/response ordering, exact error messages/codes/stack text, timing/latency/concurrency, float precision/rounding/hashes/tie-breaking, null-vs-absent/whitespace/serialization quirks, and side-effect order. Consuming (review focus): flag code depending on unpromised behavior — assertions on exact error text, reliance on response/iteration ordering, hard-coded timing/sleep, parsing free-form provider strings; tests assert documented contract (status code, typed error category, declared fields); isolate unavoidable coupling behind a documented adapter. Designing: document guarantees and state non-guarantees, make unpromised behavior visibly unstable (chaos), version and deprecate with discipline.

What its verifier checks

No consumer code depends on undocumented observable behavior; reviewer flags assertions on exact error-message text, reliance on response/iteration ordering, hard-coded timing/sleep, and parsing of free-form provider strings; tests assert documented contract (status code, typed error category, declared fields) rather than incidental output; unavoidable coupling to unspecified behavior is isolated behind an adapter and documented so it's greppable/reversible. For interfaces being designed: guaranteed behaviors documented and the rest stated as non-guarantees; relied-upon changes deprecated with announcement + migration path, not broken silently.