[object Object]

← back to La Socrata Ingester

Add --testfire button to canary-alert (fires one real CNCP+George alert, synthetic, leaves armed state untouched)

27b3127847d6eaf3f813d1645009e684f1826e13 · 2026-08-12 09:43:42 -0700 · Steve Abrams

Files touched

Diff

commit 27b3127847d6eaf3f813d1645009e684f1826e13
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Wed Aug 12 09:43:42 2026 -0700

    Add --testfire button to canary-alert (fires one real CNCP+George alert, synthetic, leaves armed state untouched)
---
 scripts/canary-alert.sh | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/scripts/canary-alert.sh b/scripts/canary-alert.sh
index 46ea256..834af23 100755
--- a/scripts/canary-alert.sh
+++ b/scripts/canary-alert.sh
@@ -21,11 +21,18 @@ DATA="tmp/canary"; STATE="$DATA/alert-state.json"; LATEST="$DATA/latest.json"; L
 mkdir -p "$DATA"
 log(){ echo "[$(date -Iseconds)] $1" | tee -a "$LOG"; }
 
-SELFTEST=0; [ "${1:-}" = "--selftest" ] && { SELFTEST=1; DRY_RUN=1; }
+SELFTEST=0; TESTFIRE=0
+case "${1:-}" in
+  --selftest) SELFTEST=1; DRY_RUN=1 ;;
+  --testfire) TESTFIRE=1 ;;   # fire ONE real alert (CNCP+George), synthetic, does NOT touch armed state
+esac
 DRY_RUN="${DRY_RUN:-0}"
 
 # ── obtain current problem set ──
-if [ "$SELFTEST" = "1" ]; then
+if [ "$TESTFIRE" = "1" ]; then
+  CUR='["TESTFIRE:delivery-check"]'; VERDICT="WARN"
+  log "testfire: firing ONE real alert (synthetic) — armed state untouched"
+elif [ "$SELFTEST" = "1" ]; then
   CUR='["la_building_permits_raw:STALE"]'
   VERDICT="WARN"
   log "selftest: synthetic current problem set = $CUR"
@@ -43,12 +50,13 @@ fi
 FIRST=0; [ -f "$STATE" ] || FIRST=1
 PREV=$(jq -c '.problems // []' "$STATE" 2>/dev/null || echo '[]')
 [ "$SELFTEST" = "1" ] && { PREV='[]'; FIRST=0; }
+[ "$TESTFIRE" = "1" ] && { PREV='[]'; FIRST=0; }
 
 # new problems = in CUR but not in PREV
 NEW=$(jq -cn --argjson cur "$CUR" --argjson prev "$PREV" '$cur - $prev')
 NEWCOUNT=$(echo "$NEW" | jq 'length')
 
-persist(){ [ "$DRY_RUN" = "1" ] && return 0; jq -n --argjson p "$CUR" --arg ts "$(date -Iseconds)" '{problems:$p, at:$ts}' > "$STATE"; }
+persist(){ { [ "$DRY_RUN" = "1" ] || [ "$TESTFIRE" = "1" ]; } && return 0; jq -n --argjson p "$CUR" --arg ts "$(date -Iseconds)" '{problems:$p, at:$ts}' > "$STATE"; }
 
 if [ "$FIRST" = "1" ]; then log "first run — baseline established, silent"; persist; exit 0; fi
 if [ "$NEWCOUNT" -eq 0 ]; then log "no NEW problems ($PREV -> $CUR) — silent"; persist; exit 0; fi
@@ -56,7 +64,8 @@ if [ "$NEWCOUNT" -eq 0 ]; then log "no NEW problems ($PREV -> $CUR) — silent";
 # ── worsening: a new actionable problem appeared. Alert. ──
 SUMMARY=$(echo "$NEW" | jq -r 'join("; ")')
 log "WORSENING — new problems: $SUMMARY"
-NOTE="[LA DATA CANARY $(date +%Y-%m-%d) $VERDICT] New freshness/rowcount regression on the LA public-data platform: $SUMMARY. Feeds buildingpermits.agentabrams.com. Check the 04:30 refresh job (com.steve.la-data-refresh) + tmp/ingest.log."
+PFX=""; [ "$TESTFIRE" = "1" ] && PFX="[TEST — canary delivery check, ignore] "
+NOTE="${PFX}[LA DATA CANARY $(date +%Y-%m-%d) $VERDICT] New freshness/rowcount regression on the LA public-data platform: $SUMMARY. Feeds buildingpermits.agentabrams.com. Check the 04:30 refresh job (com.steve.la-data-refresh) + tmp/ingest.log."
 
 if [ "$DRY_RUN" = "1" ]; then
   echo "── DRY_RUN: would POST CNCP + email George ──"
@@ -74,7 +83,7 @@ if [ -f "$HOME/.claude/skills/_shared/george-send.sh" ]; then
   . "$HOME/.claude/skills/_shared/george-send.sh"
   TO="${LA_CANARY_TO:-steve@designerwallcoverings.com}"
   BODY="<div style=\"font-family:-apple-system,Helvetica,sans-serif;color:#222\"><h3 style=\"color:#b23b3b\">⚠ LA data canary — $VERDICT</h3><p style=\"color:#888;font-size:13px\">$(date -Iseconds) · buildingpermits.agentabrams.com</p><div style=\"margin:8px 0;padding:8px 12px;border:1px solid #eee;border-radius:6px\">New regression: $SUMMARY</div><p style=\"font-size:13px\">A feed stopped refreshing or a row count dropped. Check the 04:30 refresh job (<code>com.steve.la-data-refresh</code>) and <code>tmp/ingest.log</code>.</p></div>"
-  RESP="$(george_send steve-office "$TO" "⚠ LA data canary — $VERDICT — new: $SUMMARY ($(date +%Y-%m-%d))" "$BODY")"
+  RESP="$(george_send steve-office "$TO" "${PFX}⚠ LA data canary — $VERDICT — new: $SUMMARY ($(date +%Y-%m-%d))" "$BODY")"
   echo "$RESP" > "$DATA/email-last.json"
   echo "$RESP" | grep -q '"success":true' && log "alert emailed to $TO" || log "email failed — see email-last.json"
 fi

← 90cf00f contacts: $0 own-site miner for linkedin/email/phone (NANP-v  ·  back to La Socrata Ingester  ·  contacts: linkedin_source tier (site=authoritative vs search d5b07c9 →