You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0058704
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: AGENTS.md
+22-1Lines changed: 22 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -111,9 +111,30 @@ The skill is maintained code. A change that breaks it or makes it stale must upd
111
111
112
112
Never weaken a recipe's assertions to make it pass.
113
113
114
+
## What to test
115
+
116
+
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.
117
+
118
+
Write a test only when a regression would be costly or hard to notice by using the app:
119
+
120
+
- auth, sessions, RLS and pgTAP policies, and cross-user or cross-debate isolation;
121
+
- billing, Stripe webhooks, quotas, daily limits, and cost accounting;
122
+
- migrations and data integrity, concurrency, and the collaboration service;
123
+
- parsers, validators, schemas at a trust boundary, prompt routing in the fake provider, and stream accounting;
124
+
- a fixed bug that could plausibly come back.
125
+
126
+
Do not write tests that:
127
+
128
+
- restate a TypeScript type or a schema's shape;
129
+
- 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);
130
+
- assert static copy, or only that a component renders;
131
+
- only exercise mocks, or can never fail.
132
+
133
+
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.
134
+
114
135
## Hard boundaries
115
136
116
-
- Start bug fixes with a failing test or repeatable browser reproduction when a suitable test layer exists.
137
+
- 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.
117
138
- Stub sessions prove rendering only. Do not call them authenticated backend proof.
118
139
- 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:
Copy file name to clipboardExpand all lines: docs/testing.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,6 +53,8 @@ npx vitest run src/test/security/url-validation.test.ts
53
53
54
54
For a bug, watch the reproduction fail for the expected reason before implementing the fix.
55
55
56
+
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.
0 commit comments