From 4846ab3bd626090ec34c616ef8b7df9fbfd8cc53 Mon Sep 17 00:00:00 2001 From: Austin Schaefer Date: Thu, 3 Sep 2026 16:55:52 +0200 Subject: [PATCH] Broaden Definition of Done testing rule beyond core 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 Claude-Session: https://claude.ai/code/session_01PqTJmazHBQK878vjQ4JnnF --- DEFINITION_OF_DONE.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/DEFINITION_OF_DONE.md b/DEFINITION_OF_DONE.md index f26494b..c3113ad 100644 --- a/DEFINITION_OF_DONE.md +++ b/DEFINITION_OF_DONE.md @@ -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.