Purpose: Track missing RLS, unit, integration, and E2E tests for the Clinical (CL) core. Use to prioritize Phase B–D work and manual review (Phase E). See also: SPEC_TEST_COVERAGE.md (spec–test matrix), TESTING_SETUP_AND_RUN.md, .cursor/rules/testing-completion.mdc.
Summary
Quick Reference
RLS: Tables Missing Tests
As of the lastcheck-rls-coverage --missing-only run (with cl_ in CORE_PREFIXES):
CL tables that already have RLS test coverage (via existing
tests/rls/cl/*.rls.test.ts or .from() usage):cl_patient_charts (cl-01), cl_assessments / sections / instruments (cl-02), cl_treatment_plans / goals / interventions / signatures (cl-03), cl_risk_screenings, cl_safety_plans (cl-07), cl_cds_rules / cl_cds_alerts (cl-08), cl_care_teams / cl_transitions (cl-12),
cl_pdmp_* (cl-17), cl_moud_* (cl-21), and others covered by the same test files.
Unit: Gaps
- Covered: CL-01–CL-03 (chart, assessment, treatment plan utils), CL-07 (risk screening), CL-08 (CDS evaluate), CL-09 (lab orders, result parsing, CDS lab monitoring), CL-11 (consent), CL-12 (care coordination), CL-17/CL-21 (via integration), vitals trend, progress note content, export audit, break-glass authorization.
- Gaps: Other CL specs’ hooks and services (e.g. CL-04 progress notes, CL-05/06 meds/e-prescribing, CL-10 outcomes, CL-11 disclosure log, CL-13 crisis, CL-15 reporting, CL-16 FHIR, CL-18/19 SDOH/peer, CL-20 export, CL-22 vitals) — add unit tests as those areas are implemented or touched.
Integration: Gaps
- Covered: CL-01 (chart workflow), CL-02 (assessment workflow), CL-03 (treatment plan workflow), CL-17 (PDMP workflow), CL-21 (MOUD workflow).
- Gaps: CL-04 (progress notes), CL-05/06 (medication/e-prescribing), CL-10–11 (outcomes, consent flows), CL-14 (group therapy), CL-18/19 (SDOH, peer), CL-20 (export), etc. Add integration tests for workflows that cross modules or use Supabase.
E2E: Gaps
- Current: No
tests/e2e/cl/directory; no Playwright specs tagged for CL-only runs. - Recommended: Add E2E for critical CL flows per plan Phase D: consent capture (CL-11), progress note creation (CL-04), risk screening (CL-07), and key dashboards/reporting (CL-15). Create
tests/e2e/cl/and add specs (e.g.consent-capture.spec.ts,progress-note-flow.spec.ts,risk-screening.spec.ts).
Manual Review (Phase E)
After automated tests are in place, a human should:- Confirm test assertions match spec acceptance criteria (no tautological or placeholder assertions).
- Spot-check 2–3 CL specs (e.g. CL-11, CL-15, CL-22) against implemented code and tests.
- Verify REGULATORY_COMPLIANCE_TRACKER.md (or CL-specific compliance notes) for tests that assert compliance-related behavior (e.g. Part 2, PDMP, incident deadlines).
Refreshing This Document
- Run
npm run test:audit:completenessand inspect reports for CL. - Run
npx tsx scripts/check-rls-coverage.ts --missing-onlyand update the “RLS: Tables Missing Tests” table. - Update SPEC_TEST_COVERAGE.md CL Core section when adding or changing tests.