PermissionGuard checks deviations:create. Server returns form schema + GMP module_options for the classification dropdown.
DEV-2026-000418 race-safe. State draft → investigating. Audit: DEVIATION_CREATED · DEVIATION_SUBMITTED (URS-06 hash chain).
qa_reviewer users at site Chennai pinged → Priya claims it
deviation_investigator, scope intersects, training current, ≠ discoverer (SoD-16-01), active status. Direct API bypass → 403 DEVIATION_SOD_VIOLATION_DISCOVERER_CANNOT_INVESTIGATE.
rca.source_deviation_id = DEV-2026-000418. Deviation state stays investigating.
rca:create permission + scope eligibility check. Clicking does NOT create the RCA yet — opens a modal first.
5_why · fishbone · fta) drives the data-entry template on the RCA workspace. Scope is read-only — inherited from source deviation; RCA cannot exceed parent scope without broader authority. RCA Lead defaults to current user but is subject to SoD-17: Lead ≠ deviation discoverer (Vikram ≠ Tanya ✓).
422 if any missing
403 RCA_SOD_VIOLATION on fail
RCA-2026-000098 race-safe (RCA-{YYYY}-{NNNNNN})
rcas row: source_type='deviation', source_id=DEV-2026-000418, technique, problem statement, lead, escalation reason, inherited scope, status=draft
deviation_rca_links (or set deviations.rca_id)
DEVIATION_RCA_ESCALATED + RCA_OPENED
/rcas/RCA-2026-000098
/rcas/RCA-2026-000098 · breadcrumb shows: Deviations › DEV-2026-000418 › RCA-2026-000098investigating state — escalation does NOT transition it. Investigation pauses on deviation side. Both records cross-reference via UI chips. Deviation's Investigation tab now shows: "Root cause: see linked RCA-2026-000098 (in progress)".
/rcas/RCA-2026-000098. The workspace shows the Fishbone template (technique he picked in step 12b). Header shows source linkage to DEV-2026-000418. Lead = Vikram, due +14d.validateEsignatureForRecord() at rca/service.ts:786 (today stores esig_id unverified — WP-8 fix). E-sig bound to approval_signature_id. State rca → conclusion_signed. Event: RCA_CONCLUSION_CREATED. SoD-17: RCA approver ≠ deviation investigator's discoverer (Vikram is investigator + RCA lead; he's not the discoverer Tanya, so SoD passes here).
rca_conclusion_created → creates linked CAPAlinkOrCreateCapa at rca/service.ts:1473. WP-2 wires the subscriber. Auto-populated fields on the new CAPA:
source_type = 'rca', source_id = RCA-2026-000098
title from RCA root-cause statement
scope inherited from RCA (site=Chennai, product=antibiotic-line, batch=B-9342)
status = 'draft', ready for assignment
RCA_CAPA_LINKED · CAPA_CREATED. Notification fan-out to capa_create_authority pool at Chennai (= Priya + Anjali + Karan + Deepika).
draft → open → assigned. Audit: CAPA_ASSIGNED. Direct named-notification to Vikram.
/capas/CAPA-2026-000156 → Actions tabcapa_action_items with action_type (corrective/preventive), assigned_user_id, due_date, status='open'. Mutable until parent CAPA reaches verified or closed (DEC-18-15).
closure_evidence_document_id FK to URS-12. Action status → completed, pending reviewer-sign.
completion_review_signed_e_sig_id.
CAPA_ACTION_COMPLETED ×2 · CAPA_COMPLETED. Gate check: all action items in completed or cancelled state.
CAPA_EFFECTIVENESS_CHECK_SCHEDULED. SoD-18-03 verified at reviewer assignment.
effective → advances to verified. partial → governed disposition (residual plan + e-sig OR linked re-CAPA). ineffective → mandatory re-CAPA; parent stays in_progress.
effectiveness_check → verified transition at capas/service.ts:394–415 has NO e-sig. WP-9 adds substrate-verified e-sig bound to verified_e_sig_id in same transaction. Without WP-9, this is the biggest CSV finding regulators flag.
evaluate_capa_closure_gate(). WP-9 fix: gate now blocks on open capa_action_items (today capas/service.ts:424–434 only blocks on capa_cascade_items). All pass → Close button enabled.
final_quality_approver + practice_lead_gmp co-sign (Suresh signs first, Anita signs second — Phase-1 sequential dual via existing URS-04 engine call site). Server re-evaluates gate; 409 CAPA_CLOSURE_GATE_CHANGED on stale. Both e-sigs substrate-verified. State verified → closed.
CAPA_CLOSED. DEC-18-15 immutability cascade — header + action items + effectiveness checks all locked. The parent deviation's closure gate now satisfies the "linked CAPA closed" requirement; Anita can proceed to close the deviation.
evaluate_closure_gate(deviation_id, actor). CAPA linked-and-closed check passes because of the cross-record relationship.
deviation_closure_authority + QA + practice_lead_gmp. Three substrate-verified signatures bound to closure transaction (WP-4). Server re-evaluates gate before applying.
DEVIATION_CLOSED. DEC-16-08 immutability: deviation header + impact_areas + affected_documents + comments — all locked. Linked records (RCA, CAPA) already closed/immutable. Inspection-ready via URS-22 export.
discoverer_user_id. Tanya wasn't pinged for: triage, investigator assignment, RCA opening, RCA conclusion, CAPA creation, action item progress, effectiveness check, CAPA closure. By design — SoD-16-01 lane separation.