Skip to main content

Service Readiness Gates

Execution-layer artifact. Companion to ROADMAP.md. Defines "ready" for each service at each milestone.

1. Level Definitions

LevelNameDefinitionEscalation
L0Not startedNo code exists
L1SkeletonDomain model + basic API; unit tests only; not customer-facingTeam lead reviews
L2InternalFunctional for internal use; integration tests; staging-deployableEng manager reviews
L3Customer-facing MVPMeets target SLOs; security review passed; FHIR conformance verified; offline sync operational (if applicable); production-deployableArchitecture + Security sign-off
L4Feature-completeAll spec FRs implemented; full test coverage (80%+); pen-test clean; load-tested; runbook completeVP Eng sign-off for GA

Escalation rule: A service cannot regress. If a service was L3 at M1, it must remain L3+ at M2. Regressions require incident review.


2. Eight Canonical Gates

G1 — Domain Ready

  • All aggregate roots have invariants codified in constructor + command methods.
  • Pure TypeScript domain layer; no framework imports.
  • FHIR resource mapping verified (if service owns FHIR resources).
  • Unit test coverage ≥ 80% on domain layer.
  • Tenant scoping enforced on all entities.

G2 — API Ready

  • FHIR endpoints (if applicable) conform to FHIR R4 spec.
  • REST endpoints follow API baseline (OpenAPI 3.1, problem-json errors, cursor pagination).
  • Idempotency on all state-changing endpoints.
  • Versioned (URL path or header).
  • Contract tests against API specs.

G3 — Events Ready

  • All domain events published via NATS JetStream outbox.
  • CloudEvents envelope with correct source, type, tenantId.
  • Event schemas registered in schema registry.
  • All consumers idempotent (inbox pattern).
  • DLQ configured for failed consumption.
  • Contract tests between publisher and known consumers.

G4 — Sync Ready (applicable services only)

  • Service registers replicable aggregates with sync engine.
  • Conflict resolution policy declared per aggregate (LWW, server-authority, merge).
  • SQLite offline schema defined and frozen.
  • Idempotent mutation replay verified.
  • Device binding enforced (only registered devices sync).
  • Stale-data age propagated to UI.

G5 — AI Ready (applicable services only)

  • All AI consumption goes through AIClient port → AI orchestrator gateway.
  • Provenance invariant enforced (model, prompt version, timestamp on all AI outputs).
  • Prompts registered + versioned in prompt registry.
  • Safety classifier active for AI-generated content.
  • PII redaction before cloud AI calls.
  • Graceful degradation when AI unavailable.
  • Per-tenant AI budget respected.

G6 — Observability Ready

  • SLOs defined (latency p50/p95/p99, error rate, availability).
  • OTel instrumentation end-to-end (trace ID propagation).
  • Prometheus metrics exported.
  • Grafana dashboard created.
  • Runbook written (alert → diagnosis → remediation).
  • Health probes (/health/live, /health/ready) functional.

G7 — Performance Ready

  • Load test meeting SLO targets (API p95 < 500ms, page load < 2s).
  • Degradation plan documented (what happens under 2x, 5x, 10x load).
  • Connection pooling configured.
  • Caching strategy documented and implemented.
  • No N+1 queries.

G8 — Security Ready

  • Tenant isolation test green (cross-tenant access attempt rejected).
  • Threat model updated for service's attack surface.
  • Pen-test findings closed (if applicable at this milestone).
  • Audit events emitted for all PHI access/modification.
  • PHI encrypted at rest.
  • Kong JWT validation on all public routes.
  • Rate limiting configured.
  • No hardcoded secrets.
  • ModuleEntitlementGuard on all public controllers.

3. Service × Milestone × Level Matrix

Platform Services

ServiceM0M1M2M3M4M5
iamG1–G8: L3L3L3L4 (MFA depth)L4L4
tenantG1–G8: L3L3L3L4L4L4
hierarchyG1–G8: L3L3L3L4L4L4
licensingG1–G8: L3L3L3L4L4L4
access-policyG1–G3,G6–G8: L2; G4–G5: N/AL3L3L4 (ABAC full)L4L4
auditG1–G3,G6–G8: L3L3L3L4L4L4
config-resolverG1–G3,G6–G8: L3L3L3L3L4L4
fhir-gatewayG1–G2: L2; G6–G8: L2L3L3L4L4L4
terminologyG1–G2: L2L3 (seed)L4 (full)L4L4L4
ai-orchestratorG1–G3,G5: L2L3L3L3L4 (ONNX)L4
platform-adminG1–G2: L2L3L3L3L4L4

Clinical Services

ServiceM0M1M2M3M4M5
registrationG1–G4,G6–G8: L3L3L4L4L4
schedulingG1–G4,G6–G8: L3L3L4L4L4
provider-directoryG1–G3,G6–G8: L3L3L4L4L4
facility-managementG1–G3,G6–G8: L3L3L4L4L4
patient-chartG1–G4,G6–G8: L3L3L4L4L4
clinical-notesG1–G5,G6–G8: L3L3L4L4L4
vitalsG1–G4,G6–G8: L3L3L4L4L4
problem-listG1–G3,G6–G8: L3L3L4L4L4
allergiesG1–G3,G6–G8: L3L3L4L4L4
medication-managementG1–G5,G6–G8: L3L3L4L4L4

Diagnostic & Financial Services

ServiceM0M1M2M3M4M5
orders-cpoeG1–G4,G6–G8: L3L3L4L4
resultsG1–G4,G6–G8: L3L3L4L4
billingG1–G2,G6–G8: L2L3L4L4
document-managementG1–G4,G6–G8: L3L3L4L4
laboratory-lisG1–G4,G6–G8: L3L4L4
pharmacyG1–G4,G6–G8: L3L4L4
ghasi-e-prescribing-gwG1–G3,G6–G8: L3L4L4
insuranceG1–G2,G6–G8: L2L4L4

Engagement & Population Health Services

ServiceM0M1M2M3M4M5
patient-portal-apiG1–G4,G6–G8: L3L4L4
digital-communicationG1–G3,G6–G8: L3L4L4
radiology-pacsG1–G4,G6–G8: L3L4
claimsG1–G3,G6–G8: L3L4
health-populationG1–G3,G5–G8: L3L4
immunizationsG1–G3,G6–G8: L3L4
care-plansG1–G3,G6–G8: L3L4
hl7v2-interopG1–G3,G6–G8: L3L4

Desktop & Infrastructure

ServiceM0M1M2M3M4M5
desktop-electronDESK-01,02: L3DESK-03: L3+orders: L3+LIS,pharm: L3+imaging,billing,pophealth,AI: L3DESK-11: L4
seed-runnerL2L3L3L3L3L3

4. Milestone Exit Summary

MilestoneServices that must reach L3+Services that must reach L4
M0iam, tenant, hierarchy, licensing, audit, config-resolver, desktop-electron (shell+sync)
M1+ registration, scheduling, provider-directory, facility-management, patient-chart, clinical-notes, vitals, problem-list, allergies, medication-management, fhir-gateway, terminology, ai-orchestrator
M2+ orders-cpoe, results, document-managementterminology
M3+ laboratory-lis, pharmacy, ghasi-e-prescribing-gw, patient-portal-api, digital-communicationiam, tenant, hierarchy, licensing, registration, scheduling, provider-directory, facility-management, patient-chart, clinical-notes, vitals, problem-list, allergies, medication-management
M4+ radiology-pacs, claims, health-population, immunizations, care-plans, hl7v2-interop, billing (full), insurance (full)All M3 L4 services + orders-cpoe, results, document-management, laboratory-lis, pharmacy, ghasi-e-prescribing-gw, ai-orchestrator
M5All services L4

5. Governance

Change control

  • Level assignments reviewed at each milestone gate.
  • Level change requires PR to this document with justification.
  • Architecture team owns the matrix; eng managers own individual service levels.

Regressions

  • A service cannot drop below its previous milestone level.
  • If a regression is detected (e.g., failing gate tests), the service owner has 1 sprint to remediate.
  • Unremediated regressions block the milestone gate.

Exceptions

  • Exceptions require VP Eng approval + documented risk acceptance.
  • Exception expiry: next milestone. Must be resolved or re-approved.