Skip to content

docs(testing): drop the CRAP gate, keep the complexity limit - #40

Merged
mosobande merged 2 commits into
orifrom
chore/remove-crap-gate
Oct 21, 2026
Merged

mosobande merged 2 commits into
orifrom
chore/remove-crap-gate

Conversation

@mosobande

@mosobande mosobande commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Removes the CRAP gate from the testing practice and keeps the complexity limit. Also adds two entries that point tests at real regressions and keep the domain core free of adapters.

Why

CRAP is complexity² × (1 − coverage)³ + complexity, so it is a coverage gate in another form: an untested function with complexity 6 or more fails, and any test that merely executes the code makes it pass. We already decided on 2026-10-06 not to gate coverage. We want tests whose failure signals a real regression, not tests that raise a coverage number.

What CRAP was guarding is covered elsewhere:

  • Function size and branching: the complexity limit (warn above 10, fail above 15), unchanged.
  • Whether tests actually catch defects: hand-run mutation testing on risky modules, unchanged.

Changes

  • practices/testing.md: removes the CRAP formula and the "CRAP gate" section. The complexity rule now says the way out of a failure is to separate pure decision logic from I/O, not to chop code into arbitrary tiny functions.
  • practices/ci-change-selection.md: removes the per-shard coverage export note that only served the gate.
  • practices/architecture.md: module-boundary tools now also enforce direction (the domain core imports no adapter, framework or UI module), naming the tool per stack: Boundary, ArchUnit beside Spring Modulith, Oxlint no-restricted-imports scoped to core files (dependency-cruiser rejected, to reuse the stack's linter), and separate Rust crates. Verified against official docs on 2026-10-21.
  • practices/testing.md: mocking your own modules is rejected. Use a fake behind a port, checked by the same contract tests as the real adapter; tests coupled to internals fail on refactors, not regressions.
  • Changesets: rewords the pending test-hygiene changeset so it no longer announces the gate, and adds a patch changeset for the removal.

Checks

mise run check:full passes: lint with zero errors, 7 tests passing, actionlint and zizmor with no findings.

Projects that adopted the gate keep running it until they remove it themselves.

@mosobande
mosobande marked this pull request as ready for review October 21, 2026 07:45
@mosobande
mosobande merged commit ae3babf into ori Oct 21, 2026
5 checks passed
@mosobande
mosobande deleted the chore/remove-crap-gate branch October 21, 2026 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant