Quality Gates
In one line: Three automated layers catch defects at progressively more expensive stages — and every gate must name its mechanism, because a gate that can't is a wish.
Quality gates catch defects early, where they are cheap. A lint error caught after editing costs seconds; caught at review, minutes; caught in production, hours or days.
Gate admission rule (meta). Every gate or ritual must declare: (a) per-occurrence cost, (b) enforcement mechanism — a hook, CI check, or script ("the agent will remember" is not a mechanism), and (c) retirement condition. A gate that cannot name its mechanism is a wish, and wishes recur as incidents: prose-only rules get violated, sometimes within minutes of being written; mechanized rules hold. New gates without all three fields are rejected at canon review — the PR template carries the fields.
Each layer is independent; no single gate is the sole defense against any defect category.
Gate: live contract smoke. Any feature whose runtime path crosses an external SDK/API boundary ships with a marker-gated live smoke (3-5 calls, real credentials, ~cents) that runs before deploy. Mocked-only coverage of an external boundary is an unverified boundary — an outage can ship behind a fully green suite of mock-based tests precisely because the mock never exercised the real boundary.
Gate: migrated-schema oracle. Integration-test databases are built via the project's migration chain (alembic upgrade head), never via ORM metadata create_all. A create_all schema is a proxy oracle — it lacks migration-only DDL (partial indexes, constraints), so tests can pass against a database production will never run.
Review line: name the oracle. Every review checklist includes: "for each verification claimed, name the production artifact it observes." A check that observes a proxy (a mock, an ORM-created schema, an intermediate frame, a spot-check subset) is recorded as a proxy, and the gap is either closed or accepted in writing. Most green-gate-but-still-broken incidents trace to a gate that measured a proxy.