Skip to content

Commit 69e69aa

Browse files
Programcodeclaude
andcommitted
docs(agents): say which behavior deserves a test
Agents prove changes by using the app and add tests only where a regression would be costly or hard to notice: auth, RLS, billing, quotas, migrations, concurrency, parsers and fixed bugs. Lists the low-value tests not to write and keeps coverage thresholds Adam's call. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent 918b58d commit 69e69aa

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

‎AGENTS.md‎

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,30 @@ The skill is maintained code. A change that breaks it or makes it stale must upd
106106

107107
Never weaken a recipe's assertions to make it pass.
108108

109+
## What to test
110+
111+
Prove a change by using it: `npm run lint`, `npm run typecheck`, `npm run build`, then drive the feature in the real app with `verify-debatelab`. New tests are not a substitute for that, and a test-heavy diff is harder to review.
112+
113+
Write a test only when a regression would be costly or hard to notice by using the app:
114+
115+
- auth, sessions, RLS and pgTAP policies, and cross-user or cross-debate isolation;
116+
- billing, Stripe webhooks, quotas, daily limits, and cost accounting;
117+
- migrations and data integrity, concurrency, and the collaboration service;
118+
- parsers, validators, schemas at a trust boundary, prompt routing in the fake provider, and stream accounting;
119+
- a fixed bug that could plausibly come back.
120+
121+
Do not write tests that:
122+
123+
- restate a TypeScript type or a schema's shape;
124+
- check that a removed feature stays removed, or that a column, file, export, route, or translation key exists (the i18n catalog check already covers keys);
125+
- assert static copy, or only that a component renders;
126+
- only exercise mocks, or can never fail.
127+
128+
Keep a PR's test diff small enough to read next to the change. Deleting a test that cannot catch a real regression is not weakening tests; deleting or loosening one to make a failing run pass is. Never lower a coverage threshold in `vitest.config.ts` without Adam's approval.
129+
109130
## Hard boundaries
110131

111-
- Start bug fixes with a failing test or repeatable browser reproduction when a suitable test layer exists.
132+
- Start bug fixes with a failing test when the bug is in behavior listed under [What to test](#what-to-test), otherwise with a repeatable browser reproduction.
112133
- Stub sessions prove rendering only. Do not call them authenticated backend proof.
113134
- Never put staging or production credentials in jobs, logs, traces, screenshots, commits, comments, or docs. Two scoped exceptions reach jobs only through GitHub Actions secrets:
114135
- the protected staging values;

‎docs/testing.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ npx vitest run src/test/security/url-validation.test.ts
4848

4949
For a bug, watch the reproduction fail for the expected reason before implementing the fix.
5050

51+
Which behavior deserves a test, and which tests not to write, is in [AGENTS.md](../AGENTS.md#what-to-test). The short version: test specs where a regression is costly or invisible (auth, RLS, billing, quotas, migrations, concurrency, parsers, regressions of fixed bugs), and prove everything else by using the app.
52+
5153
## Collaboration service tests
5254

5355
```bash

0 commit comments

Comments
 (0)