Gate an incident update before the commander sees it
Your task
During incidents, engineers either go silent on the status page or overshare speculation. An agent drafts incident updates, and a gate decides where each draft goes before any person reads it.
Write route_incident_draft(draft, postmortem_published): the gate every draft passes through.
draft(str): the drafted update.postmortem_published(bool): the postmortem for this incident is already out.
Lowercase the draft. "Contains" below means anywhere in the lowercased draft. Apply these rules in order. The first one that matches decides:
- It contains
data exposure,breach,personal dataorunauthorized access:"hold_for_legal_and_security". - It contains
our fault,negligence,we are to blameorhuman error:"block_blame_language". - The postmortem is not published, and it contains
root cause,caused byorthe underlying cause:"block_root_cause_claim". - It states an affected count, defined below:
"block_customer_count". - It does not contain
next update:"return_for_next_update_time". - Otherwise:
"queue_for_commander".
An affected count: split the draft on whitespace into words, and strip any of the characters , . % ; : ! ? ( ) from both ends of each word. A count is a word that is all digits once its commas are removed, so 4,200 counts. It must be followed by a word that starts with customer, user, account or tenant. One of may sit between them, so 12% of users counts.
Examples
route_incident_draft(draft: str, postmortem_published: bool) -> strroute_incident_draft("Checkout is degraded for some requests. We are investigating. Next update in 30 minutes.", False)"queue_for_commander"route_incident_draft("We have identified the root cause: a bad config push. Next update in 20 minutes.", False)"block_root_cause_claim"route_incident_draft("We are investigating possible data exposure in the export job. Next update in 15 minutes.", False)"hold_for_legal_and_security"