Federated from workspace ·
PRD-001·Dental Clinic Revenue Operating System/docs/technical/CLINIC_CAPABILITY_COVERAGE_TESTING.mdDo not edit canonical truth here — update the source repo, then re-runnpm run docs:sync.
Clinic Capability Coverage Testing
Status: Implemented (2026-07-05)
Authority: App\Modules\AI\Application\Coverage
Purpose
Intent coverage testing ensures every natural-language variant for a registered capability resolves to the same capability key — the pattern used by OpenAI evals, Cursor agent routing tests, and similar systems.
Example for clinic.operations.daily_report:
- Show today's report
- Today's report
- Daily report
- Report today
- Can I see today's report?
All must resolve to clinic.operations.daily_report.
Pipeline
ClinicCapabilityCoverageCatalog ← capability key + seed phrases
↓
ClinicCapabilityCoveragePhraseGenerator ← template expansion
↓
ClinicIntentUnderstandingEngine ← signals (LLM off in tests)
↓
CapabilityMatcher (PL-003) ← same matcher as production
↓
Assert capability keyAdding coverage for a capability
Edit ClinicCapabilityCoverageCatalog::definitions():
'clinic.operations.daily_report' => [
'seeds' => ['today\'s report', 'daily report'],
'extras' => ['Report today', 'Can I see today\'s report?'],
],Default templates (override with templates key):
{seed}Show {seed}Give me {seed}{seed} pleaseCan I see {seed}?
Run
php artisan test app/Modules/AI/Tests/Unit/ClinicCapabilityCoverageTest.phpFailures indicate routing gaps — fix Intent Engine / catalog, not the test expectation.
Components
| Component | Role |
|---|---|
ClinicCapabilityCoverageCatalog | Registered capabilities + seeds |
ClinicCapabilityCoveragePhraseGenerator | Expands seeds into phrase matrix |
ClinicCapabilityCoverageResolver | Phrase → intent signals → matched capability |