gitcad / docs / adr / 0005

ADR-0005: Three-tier test corpus (invariants over snapshots)

Status: accepted

Context

A self-fixing agent loop generates tests. Unchecked, in 18 months you have

hundreds of thousands of auto-generated snapshot tests that make any architecture

change impossible — the tests encode the current implementation, so changing it

turns the suite red and the project ossifies.

Decision

Tests live in three tiers with different lifetimes:

TierWhatLifetimeLocation
InvariantsProperties that must always hold, kernel-independent (booleans yield watertight solids; identity survives edits; export→import preserves topology)Permanenttests/invariants/
GoldenSmall, curated, hand-written user-visible contractsPermanenttests/golden/
RegressionAuto-generated from reduced bug reprosDisposable, bulk-invalidatabletests/regression/

Rules:

declarable obsolete en masse during a rewrite — no per-test sign-off.

internals cements internals forever — forbidden.

invariants survive an architecture change, so invariants are the real spec.

is recognized.

Consequences

invariants/ + golden/ green, shadow-run the new backend against the corpus.