Broaden Definition of Done testing rule beyond core
All checks were successful
CI / check (pull_request) Successful in 2m47s
CI / test (pull_request) Successful in 3m54s
CI / audit (pull_request) Successful in 14s

Require unit tests for non-trivial logic project-wide (db query/filter
logic, non-passthrough server::services code), not just core's pure
functions, per feedback that the original scope was too narrow. Thin
passthrough wrappers stay exempt, and genuinely DB/network-bound cases
must be called out explicitly rather than silently skipped.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PqTJmazHBQK878vjQ4JnnF
This commit is contained in:
Austin Schaefer 2026-09-03 16:55:52 +02:00
parent 22d0e4f537
commit 4846ab3bd6

View file

@ -24,9 +24,16 @@ A change is done when all of the following hold, not just when it compiles.
## Testing
- New logic in `core` (scoring, affinity math) ships with unit tests —
that crate is the one place pure functions make this cheap, and it's
already the pattern (`crates/core/src/affinity.rs`).
- All non-trivial logic ships with unit tests wherever practical — not
just `core`'s pure functions (scoring, affinity math — the existing
pattern in `crates/core/src/affinity.rs`), but query/filter logic in
`db` and non-passthrough logic in `web`'s `server::services`. "Non-trivial"
excludes thin wrappers (a `#[server]` fn or service function that's just
`db.some_query(args).await?` with no branching of its own) and glue code
whose only failure mode is a compiler error.
- When a DB/network dependency makes a case genuinely impractical to unit
test (e.g. a Diesel query's SQL correctness), say so in the PR rather
than silently skipping it — that's a real gap to track, not a pass.
- Test rationale goes in a `///` doc comment above `#[test] fn`, not
inline in the body.
- A bug fix includes a regression test that fails on the old code.