--- id: 04-migrate-media-binders epic: binder-wrap-helper title: Migrate media feature binders to wireUseCase type: technical-story status: todo feature: media depends-on: [01-wire-use-case-helper] blocks: [08-holistic-validation] --- ## Goal Replace the inline `withSpan + withCapture (+ optional withAudit)` blocks in `packages/media/src/di/bind-production.ts` and `packages/media/src/di/bind-dev-seed.ts` with `wireUseCase` calls for all three media use cases (getMedia, listMedia, deleteMedia). ## Why Media's binder pair contributes one of the five top-ten `pnpm fallow` clone groups. `deleteMedia` is likely audit-bearing; the helper consolidates the conditional wrapping. ## Done when - `bind-production.ts` and `bind-dev-seed.ts` call `wireUseCase` for getMedia, listMedia, and deleteMedia — no inline `withSpan(... withCapture(...))` pattern remains. - Audit-bearing use cases (per manifest check) pass `auditLog` + audit schema; non-audit use cases omit it. - `pnpm test --filter @repo/media` green. - `pnpm typecheck --filter @repo/media` green. - `assertFeatureConformance` does not throw at boot for media. ## In scope - `packages/media/src/di/bind-production.ts` — use-case binding blocks only. - `packages/media/src/di/bind-dev-seed.ts` — use-case binding blocks only. - Repository and service bindings stay as-is. - Controller bindings stay as-is. ## Out of scope - Controller bindings — deferred follow-up per PRD. - Changes to media use-case implementations, schemas, or tests outside the binder. ## Tasks - [ ] Read `packages/media/src/feature.manifest.ts` — identify audit-bearing vs non-audit use cases - [ ] Read `packages/media/src/di/bind-production.ts` — understand inline wrap shape and deps - [ ] Read `packages/media/src/di/bind-dev-seed.ts` — same for dev-seed mode - [ ] Update `packages/media/src/di/bind-production.ts` — replace three inline wrap blocks with `wireUseCase` calls - [ ] Update `packages/media/src/di/bind-dev-seed.ts` — same - [ ] Run `pnpm test --filter @repo/media` — verify all tests pass - [ ] Run `pnpm typecheck --filter @repo/media` — verify no type regressions