docs(guides): tdd-workflow links conformance gates

This commit is contained in:
2026-05-13 07:28:16 +02:00
parent efcb65e726
commit 798281dd14

View File

@@ -704,3 +704,16 @@ expect(logger.captures[0]).toMatchObject({
For an end-to-end example (controller → use case → repo, all wrapped, asserting no double-capture across layers), see `packages/blog/tests/r44-no-double-capture.test.ts`.
**Default mocks** (when you don't need assertions): construct `new MockArticlesRepository()` with no args — the constructor defaults bind `NoopTracer` + `NoopLogger`.
---
## Conformance gates (post-TDD)
After your tests are green and the impl is committed, four gates check that the new code stays consistent with the feature's manifest:
1. **TypeScript brands** — the `ProductionUseCase<I, O, M>` slot in `bind-production.ts` only accepts factories wrapped through `withSpan` + `withCapture` + (if mutating with audits) `withAudit`.
2. **ESLint rules** — five `conformance/*` rules check manifest ↔ code drift; see `docs/guides/conformance-quickref.md`.
3. **Boot assertion**`assertFeatureConformance` runs at the tail of every `bindProductionX(ctx)`; `pnpm dev` refuses to start on drift.
4. **CI drift gate**`pnpm conformance` runs after `pnpm lint` in CI; fails on orphan event consumers across features.
The TDD red-green cycle covers behavioural correctness; the conformance gates cover architectural correctness.