[CLAUDE] Docs: chốt rule timing unit test (1 bảng 5-row compact)
- rules.md §7: thêm section "Khi nào viết test — timing rule" 4 case (feature mới/bug fix/critical algorithm/spec change) + 1 skip list - CLAUDE.md root: 1 dòng quick reference timing rule - User confirm pattern Phase 1-8 (test-after pragmatic) là default cho solo dev - Test-before BẮT BUỘC chỉ khi: bug fix (regression test) + critical algorithm - Spec change KHÔNG ngừng test — update test cũ + code, commit chung Commit MD-only → CI skip (path filter gotcha #41), 0s deploy. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@ -89,7 +89,7 @@ tests/
|
||||
dotnet test SolutionErp.slnx # chạy cả 2 test project
|
||||
```
|
||||
|
||||
**Quy tắc:** mỗi feature mới có guard logic / business rule → thêm test trước khi commit. Bug found in production → 1 regression test added before merge. Detail xem `docs/architecture.md §11` + `docs/rules.md §7`.
|
||||
**Quy tắc timing test:** feature mới = test-after (UAT ổn → viết). Bug fix = test-before BẮT BUỘC (reproduce → fix). Critical algorithm (codegen/guard/financial/security) = test-before merge. Spec change = update test cũ + code chung commit. Skip: DTO mapping, CRUD master, FE snapshot. Detail `docs/rules.md §7`.
|
||||
|
||||
### CI/CD pipeline (3 fix lớn 29/04)
|
||||
|
||||
|
||||
@ -291,6 +291,16 @@ Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
||||
❌ E2E (Playwright) — KHÔNG làm (brittle cho solo dev)
|
||||
```
|
||||
|
||||
### Khi nào viết test — timing rule
|
||||
|
||||
| Tình huống | Quy tắc |
|
||||
|---|---|
|
||||
| **Feature mới** | **Test-after**: UAT 2-3 lần ổn → viết test (≤1 commit theo sau). Pattern Phase 1-8 đã làm. |
|
||||
| **Bug fix** | **Test-before BẮT BUỘC**: reproduce bug bằng test failing → fix → green. "1 bug = 1 regression test before merge". |
|
||||
| **Critical algorithm** (code generator atomic, workflow guard, financial calc, security check) | **Test-before merge** — edge case nhiều, race condition đắt nếu break prod. |
|
||||
| **Spec change** (không phải bug) | Update test cũ + code, commit chung. **KHÔNG xóa, KHÔNG skip** test cũ. Coverage chỉ tăng. |
|
||||
| **Skip test** | DTO mapping, CRUD master đơn giản, FE component snapshot, wrapper passthrough, migration backfill idempotent. |
|
||||
|
||||
### Quy tắc bổ sung mỗi feature mới
|
||||
|
||||
- **Domain entity / enum** → 0 test (compile check đủ)
|
||||
|
||||
Reference in New Issue
Block a user