--- id: 01-define-feature-helper epic: conformance-system-v1 title: defineFeature helper + Instrumented/Captured/Audited brands type: technical-story status: done feature: core-shared depends-on: [] blocks: [02-boot-assertions] --- ## Goal Manifest helper + brand types enable type-level enforcement that every use-case binding is wrapped with `withSpan` + `withCapture` (and `withAudit` when mutating with audits declared). ## Why Compile-time feedback is the cheapest layer and the foundation every other milestone reads. ## Done when Compile-time TS2322 fires when an unwrapped factory is bound through `ProductionUseCase<...>`, and `auth.signIn` is rebound through the new slot. ## In scope - `Instrumented` and `Captured` brand types in `@repo/core-shared/conformance` - Brand attachment in `withSpan` and `withCapture` - `Audited` brand and `withAudit` wrapper in `@repo/core-audit` - `defineFeature` helper + `FeatureManifest` / `UseCaseManifest` types - `ProductionUseCase` branded slot type - `authManifest` declaring `signIn`, `signUp`, `signOut` - `auth.signIn` rebound through the branded slot ## Out of scope - `auth.signUp` / `auth.signOut` rebinding through branded slots (separate tasks within this story or a follow-up story; signUp requires `Audited` once we declare its `audits`) - Boot-time `assertConformance` (story 02) - ESLint rules reading the manifest (story 03) - Generator emitting manifest stubs (story 05) ## Tasks - [x] Brand types: `Instrumented` and `Captured` - [x] `withSpan` attaches `Instrumented` - [x] `withCapture` attaches `Captured` - [x] `defineFeature` helper + manifest types - [x] `ProductionUseCase` slot type - [x] `withAudit` wrapper + `Audited` brand - [x] `authManifest` declaration - [x] `auth.signIn` rebound through branded slot - [x] Negative test: unwrapped factory rejected at type level