---
id: 08-discovery-feature
epic: walking-skeleton
title: discovery feature — registry snapshots, getRegistry, scan ingestion
type: technical-story
status: todo
feature: discovery
depends-on: [07-runner-lifecycle-events-and-realtime]
blocks: [10-web-next-wiring]
created: 2026-07-12T10:24:14Z
---

## Goal

Ship the minimal `discovery` feature: registry snapshot storage, a `getRegistry` use case, and a scan-event handler that ingests the runner's scan results — so the editor has one real component (name + props) to render (skeleton bar; full `ComponentMeta` fidelity comes with `discovery-and-library`).

## Why

Discovery is its own vertical — the registry outlives any single runner session, and later PRDs (`discovery-and-library`) grow it heavily. Ingestion arrives as a cross-feature reaction to the scan event `workspaces` publishes (rule E0); the handler stays private (rule E1) while `getRegistry` is the public read surface the editor route consumes.

## Done when

- `pnpm turbo gen feature discovery` scaffold is green.
- Registry snapshot storage + `getRegistry` use case land manifest-first (contracts, unit tests with direct mock injection, DI wiring, tRPC procedure); the registry exposes one component with name + props from the fixture scan.
- The scan-event handler (`events/handlers/`, never re-exported) ingests scan results into a registry snapshot; `consumes` is declared in `feature.manifest.ts`.
- `pnpm conformance` cross-feature event closure passes — no orphan consumer.
- Coverage bands: template defaults (PRD Implementation decisions).
- Boot assertion green in dev-seed mode.
- `pnpm typecheck && pnpm lint && pnpm test && pnpm conformance && pnpm fallow:audit && pnpm coverage:diff` all pass after each task.

## In scope

- Feature scaffold, registry snapshot storage, `getRegistry`, scan-event handler + manifest `consumes` declaration.
- Dev-seed binder with a seeded registry so the editor works in dev-seed mode.

## Out of scope

- Full `ComponentMeta` fidelity, watch/HMR re-scan, perf-500 budgets (`discovery-and-library`).
- Any write surface beyond event ingestion.

## Tasks

- [ ] Run `pnpm turbo gen feature discovery` → green feature scaffold (manifest, contracts, binders, controllers, tests, dev-seed).
- [ ] Add registry snapshot storage + the `getRegistry` use case — manifest entry, contracts, red test → green impl, DI wiring, tRPC procedure; registry exposes one component with name + props; dev-seed provides a seeded registry.
- [ ] Run `pnpm turbo gen event` for the scan-event handler (`events/handlers/on-workspaces-*.handler.ts`, never re-exported per rule E1): ingest scan results into a registry snapshot; manifest `consumes` declaration; `pnpm conformance` event closure green; handler test.
