diff --git a/docs/guides/tdd-workflow.md b/docs/guides/tdd-workflow.md index d450120..265ab34 100644 --- a/docs/guides/tdd-workflow.md +++ b/docs/guides/tdd-workflow.md @@ -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` 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.