Notification in her inbox
Bell icon shows a count. She opens it.
🔔 "DEV-2026-000412 is ready for closure approval."
Behind the scenes
Broadcast pool — all
deviation_closure_authority holders at site Chennai pinged. First-claimer-wins (same pattern as Sai→QA at step 7).
Click the notification
Opens directly to the deviation record at /deviations/DEV-2026-000412.
Behind the scenes
Route guard:
withAuthority({key:'deviation_closure_authority', scopeSource:'context', requiresEsign:true}). Closure tab opens — pre-closure gate evaluation triggers
now.
Reviews the pre-closure checklist
All green; if any blocker existed, the Close button would be disabled.
Pre-closure checklist
Root cause documented — "Paperwork lag during shift handover"
Investigation conclusion signed by Ravi · 30-May 14:22
Severity = Minor → no CAPA required
No batch impact (batch is an optional reference selected from the seeded-batch typeahead — URS-23 reference rows; batch hold/disposition control is Phase-3)
All review comments resolved
SoD pass — Anita ≠ Sai (reporter), Anita ≠ Ravi (investigator)
Behind the scenes · checklist is SERVER-COMPUTED, not human-ticked
Anita reads — does NOT tick. Server runs
evaluate_closure_gate(deviation_id, actor) on page open, returns structured result; UI paints it. Each check evaluated against DB state in real time:
- Root cause →
root_cause_summary IS NOT NULL
- Conclusion signed → join
electronic_signatures + validateEsignatureForRecord()
- CAPA gate → severity-based rule eval
- Batch reference → optional, selected from the seeded-batch typeahead (URS-23 reference rows, search component); no batch hold/disposition control in Phase-1 (deferred to Phase-3)
- Comments →
count(comments WHERE status='open') = 0
- SoD →
actor.id ≠ discoverer_id AND ≠ investigator_id
Any check fails →
Close button disabled with tooltip naming the failing rule. Anita cannot override; she must fix the underlying condition (re-route to Ravi etc.). Audit:
DEVIATION_CLOSURE_GATE_EVALUATED on each open (forensic trail).
Reads the investigation summary
Scannable summary: symptom, immediate containment, evidence, root cause, conclusion. Anita reads to confirm she agrees with the closure rationale.
Behind the scenes · human judgment
This is the only purely manual step. Green checks confirm rules pass; whether root cause is
good is Anita's call. If she disagrees: add a comment (creates open comment → blocks closure) or reassign back to Ravi.
Click Close Deviation
Controlled Approval Modal opens.
Behind the scenes
Button only enabled if gate evaluation returned
all_pass=true. Defense-in-depth — server will re-evaluate when she signs (see step 28).
Fill the Controlled Approval Modal
Controlled Approval — Closure of DEV-2026-000412
Signing as
Anita Sharma · deviation_closure_authority
Meaning of signature
Approval — closure
Reason
"Closure approved — investigation complete, no CAPA required for Minor."
Click Sign & Close
Modal confirms; spinner; few seconds.
Sign & Close ▶
Behind the scenes · defense in depth
Server
re-runs evaluate_closure_gate() before applying the signature. If anything changed since step 24 (new comment, signature invalidated, SoD changed) →
409 CLOSURE_GATE_CHANGED; UI refreshes checklist. Otherwise:
validateEsignatureForRecord() binds e-sig to
closed_e_sig_id in same transaction; state machine transitions
investigating → closed.
Sees confirmation — state flips to CLOSED
INVESTIGATING→CLOSED
✅ "DEV-2026-000412 closed. Record is now immutable."
Behind the scenes · immutability cascade
Audit:
DEVIATION_CLOSED + bound
electronic_signatures row.
Parent + child rows all immutable (DEC-16-08) — header, impact_areas, affected_documents, comments. Any mutation attempt →
DEVIATION_IMMUTABLE_FINAL_STATE. URS-06 hash chain seals record. URS-30 fires single closure notification to Sai (reporter loop-closure).
DONE · Anita's part is over. Total time: ~3–5 minutes.