Repository navigation
Coverage Policy
Canonical source:
testing/coverage-policy.md— this page is rendered from it on every publish; edit the source.
Coverage is proportional to blast radius. High enough everywhere to prove edge cases were considered; exhaustive on the pure logic where a wrong branch is catastrophic.
The enforced numbers — declared thresholds, the floors CI enforces, the
changed-lines target and the dated path to 92 % — live in one place:
rules/22 rule 2, backed by
tools/coverage/thresholds.json. This page
does not restate them.
| Scope | statements | lines | functions | branches |
|---|---|---|---|---|
| Pure critical logic (see list) | 100% | 100% | 100% | 100% branch |
Pure critical logic (no I/O, high blast radius) — must reach 100% branch:
- Zod schemas / DTO validators
- Mappers (BE↔wire, entity↔DTO, event payload builders)
- Permission / ownership decision functions
- Query-key builders (frontend TanStack Query keys)
- Event-payload validators (RabbitMQ consumers)
These are cheap to test exhaustively and expensive to get wrong (an untested branch here
is a data leak, a broken cache, or a swallowed event). See
../memory/testing-strategy.md.
- CI runs every workspace suite with
--coverageand the workspace's floor (rules/22 rule 2); a metric below it fails the build, and the lines a pull request changes must meetchangedLineson their own. - Pure-critical modules that must hit 100% branch carry their own stricter per-path
entry under vitest
coverage.thresholds(a glob key) so a regression there fails. - Coverage is ratcheted, never lowered. If a change drops a folder below its
threshold, fix the test gap before merging — never edit the threshold down to land the
change (
../memory/testing-strategy.md).
High coverage of trivial glue is not quality; it can hide untested risk. The number is a proxy for "did you think about the edge cases?" — pair it with risk-based design (testing-strategy) and reject the fixed-count-quota anti-pattern. Skip only trivial getters/setters and framework boilerplate.
- Lowering a vitest
coverage.thresholdsvalue, a floor orchangedLinesto land a change. -
.toBeDefined()-only assertions to inflate line coverage without asserting behavior. -
xit/.skipto dodge a failing-but-real test. - Excluding a real logic file from coverage collection to hide a gap.
Coverage is reported per workspace by the CI test job (and coverage-merge for a sharded
suite); npm run coverage:measure reports it locally (quality-gates). New code
in a change should not drop the workspace's existing coverage.
-
Quality gates · Unit testing ·
ADR-063 coverage-targets ·
../memory/testing-strategy.md
ClawAI Wiki · source-controlled under wiki/ · generated/mirrored from the current repository knowledge layer.
ClawAI Wiki
Product
- Product-Vision
- Flagship-Features
- Business-Overview
- Requirements-Register
- Drift-Log
- Runtime-Managed-Connector-Providers
- Threads
- ADR-Index
Architecture
- System-at-a-Glance
- Architecture-Map
- System-Architecture
- Message-Flow
- End-to-End-Data-Flow
- Routing-Engine
- Event-Bus
- Security-Architecture
Platform
- Backend-Services
- Frontend-Architecture
- Shared-Packages
- Database-Reference
- API-Reference
- Provider-Catalog
- Memory-and-Context-Architecture
- File-Support-Architecture
- Research-and-Web-Crawling
Runtime & Ops
- Docker-Guide
- Nginx-Reference
- CI-CD-Pipeline
- Logging-and-Observability
- Operational-Runbooks
- Troubleshooting
Quality
Engineering OS
- AI-Native-Engineering-OS
- Generated-Manifests
- Rules-Catalog
- Skills-Catalog
- Context-Layer
- Engineering-Memory
- Tooling-and-Automation
- Scripts-and-Operations
- ESLint-and-Architecture-Enforcement
- Extended-Work-Skills
Agents
Reference