Operant Studio
OPER-122

[OPER-QA-1] Portico feature-map autogen pass to seed ~1500 DRAFT TestCase rows

Band
MEDIUM
Suggested
Justin Cooke

Body

feature_id: FEAT-studio-qa

## Context

Autogen module `packages/qa/src/autogen.ts` that iterates Portico feature-map v7.0 (511 features across 30 modules) plus the 82 API route groups, 42 UI modules, `@PHI`-annotated Prisma models, and `AiProvider` call sites — and materializes DRAFT `TestCase` rows with the correct `kind` per source: api_contract from route + Zod, e2e_playwright from menu entry, rls_probe from `@PHI`, agent_eval from AiProvider. Ratified by the [REDACTED-DOB] QA-primitive PDT (Jordan dissent mitigation).

Runs as a Ledger-dispatched cron task, not a build-time script — idempotent by `(feature_id, kind, source_hash)` so re-running only backfills gaps.

## Acceptance Criteria

- `packages/qa/src/autogen.ts` exports `autogenTestCasesForProduct(productSlug: string): Promise<{ inserted: number; skipped: number; details: {...}[] }>`
- Scans Portico's `products/portico/feature-map.md` + `apps/platform/src/app/api/**/route.ts` + Prisma schema (`@PHI` annotations) + `AiProvider` call sites
- Emits DRAFT TestCase rows with `status='DRAFT'`, correct `kind` enum, `featureId` foreign-key, and a content-addressable `sourceHash` for idempotency
- Idempotency: re-run of the same input inserts zero new rows and reports skipped counts
- Vitest coverage: (a) empty product → zero inserts; (b) 100-feature fixture → 100+ rows with correct kind distribution; (c) re-run is no-op
- Ledger cron task registered via existing dispatch mechanism; runs weekly
- Output count on first Portico run is >= 1000 rows (bounded by feature-map + route count)

Attachments

Loading attachments…

Comments

Loading comments…