OPER-199
HV-3: Charter generator -- packages/qa/src/charter.ts + nightly quality eval
Suggested
Justin Cooke
Body
---
feature_id: FEAT-studio-qa
size: M
module: qa
phi_in_scope: true
has_migration: false
write_sets:
- packages/qa/src/charter.ts
- packages/qa/src/charter-eval.ts
- apps/web/src/app/api/cron/charter-quality/route.ts
---
## Context
Parent: OPER-196.
AI-authored Human Verification Charter generated from the dossier (HV-2) + `TestCase.tags[]` feature-type. Uses the same triage classifier plumbing OPER-177 already ships (`packages/qa/src/ai-triage.ts`). Charter output logs to `AiTriageLog` with `kind = CHARTER` (extend `AiTriageLogKind` enum).
Shankar dissent from the PDT memo requires shipping `charterQualityScore` in the same ticket: a nightly cron that reads each new charter's claims and checks whether they are grounded in the referenced code diff. Ungrounded claims decrement the score.
## Acceptance Criteria
- `generateCharter({ dossier, featureType }): Promise<Charter>` in `packages/qa/src/charter.ts`
- Extend `AiTriageLogKind` enum with `CHARTER` value in `qa.prisma` (additive migration)
- Cron route `/api/cron/charter-quality` runs nightly, scores each new charter, writes `charterQualityScore` back to the `AiTriageLog` row
- Feature-type vocabulary lives in `packages/qa/src/feature-types.ts` as a validated string set (`clinical-workflow`, `data-entry`, `report`, `automation`, `phi-sensitive`, `family-facing`, `money`, `bulk`)
- Vitest tests cover charter generation for each of the eight feature types
---
<!-- planner-rescope: phi_no_reviewer -->
**Planner rescope (phi_no_reviewer):** Task has phiInScope=true but no PHI-eligible reviewer is available. Register a reviewer worker advertising the `phi` capability before admitting PHI work.
Attachments
Loading attachments…
Comments
Loading comments…