[object Object]

← back to Marketing Command Center

TK-11856 rc-propagation (RSYNC): mcc-clients-refresh propagates extract/crawl/enrich/manifest/rsync rc

af0204bc2b9a40dd9200e22920547645ac97c9a9 · 2026-09-26 09:22:35 -0700 · Steve

Exit-code ONLY, no behavior change (Steve ruling 2026-09-26 Q1/Q2): every step still runs as
before; the wrapper now exits with the first nonzero rc of its side-effecting step(s) instead of
swallowing it, so cron-fire-canary's exit corroboration can see a failed run. No heartbeat file added.
Revert: git -C /Users/macstudio3/Projects/marketing-command-center revert <this sha>

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YaiWjfgEuKQLTb5cdDreS3

Files touched

Diff

commit af0204bc2b9a40dd9200e22920547645ac97c9a9
Author: Steve <steve@designerwallcoverings.com>
Date:   Sat Sep 26 09:22:35 2026 -0700

    TK-11856 rc-propagation (RSYNC): mcc-clients-refresh propagates extract/crawl/enrich/manifest/rsync rc
    
    Exit-code ONLY, no behavior change (Steve ruling 2026-09-26 Q1/Q2): every step still runs as
    before; the wrapper now exits with the first nonzero rc of its side-effecting step(s) instead of
    swallowing it, so cron-fire-canary's exit corroboration can see a failed run. No heartbeat file added.
    Revert: git -C /Users/macstudio3/Projects/marketing-command-center revert <this sha>
    
    Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_01YaiWjfgEuKQLTb5cdDreS3
---
 scripts/refresh-clients.sh | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/scripts/refresh-clients.sh b/scripts/refresh-clients.sh
index 1e41a38..87bb803 100755
--- a/scripts/refresh-clients.sh
+++ b/scripts/refresh-clients.sh
@@ -21,14 +21,25 @@ exec >>"$LOG" 2>&1
 if ! mkdir "$LOCKDIR" 2>/dev/null; then echo "$(date '+%F %T') already running — skip"; exit 0; fi
 trap 'rmdir "$LOCKDIR" 2>/dev/null' EXIT
 echo "===== $(date '+%F %T') mcc-clients-refresh START ====="
+# TK-11856 rc-propagation (exit-code ONLY, no behavior change): every step still runs exactly as
+# before (failures stay non-fatal, the rsync still runs); we only REMEMBER the first nonzero rc of a
+# side-effecting step (FM extract / crawl / enrich / manifest / rsync-to-Kamatera) and exit with it at
+# the end instead of exit 0. Undo: git revert.
+FIRST_RC=0
+note_rc() { if [ "$1" -ne 0 ] && [ "$FIRST_RC" -eq 0 ]; then FIRST_RC="$1"; fi; }
 cd "$PROJ" || exit 1
 
 # 1. FileMaker clients (43k) → public/data/clients-fm.json
 echo "-- FM clients"
-node "$HOME/Projects/filemaker-mcp/scripts/fetch-clients.js" || echo "!! FM extract failed (keeping prior clients-fm.json)"
+node "$HOME/Projects/filemaker-mcp/scripts/fetch-clients.js" || { r=$?; echo "!! FM extract failed rc=$r (keeping prior clients-fm.json)"; note_rc "$r"; }
 
 # 2. Google-Places CSVs → contact-email enrichment (skips any source not present)
-crawl(){ local src; src=$(ls $1 2>/dev/null | head -1); [ -n "$src" ] && python3 scripts/crawl-csv-emails.py "$src" --slug "$2" --workers 14 || echo "-- skip $2 (no source csv)"; }
+# (same control flow as the old `[ -n src ] && python3 || echo skip`, but a python FAILURE is now logged
+#  as a failure + remembered, instead of being mislabelled "no source csv")
+crawl(){ local src r; src=$(ls $1 2>/dev/null | head -1)
+  if [ -n "$src" ]; then
+    python3 scripts/crawl-csv-emails.py "$src" --slug "$2" --workers 14 || { r=$?; echo "!! crawl $2 failed rc=$r"; note_rc "$r"; }
+  else echo "-- skip $2 (no source csv)"; fi; }
 crawl "$SRC/*2000LAArchitects*dataset_crawler-google-places*"            la-architects
 crawl "$SRC/*2000_arch.id.plus.LosAngeles*dataset_crawler-google-places*" la-arch-interior-design
 crawl "$SRC/*1138architects-SF*dataset_crawler-google-places*"           sf-architects
@@ -41,18 +52,19 @@ crawl "$SRC/dataset_crawler-google-places_2026-07-10_07-01-32-993* $SRC/*_07-01-
 echo "-- browser + local-model enrichment"
 shopt -s nullglob
 for pj in public/data/prospects-*.json; do
-  node scripts/enrich-contacts-browser.mjs "$pj" --workers 6 --model qwen2.5:latest || echo "!! enrich failed: $pj"
+  node scripts/enrich-contacts-browser.mjs "$pj" --workers 6 --model qwen2.5:latest || { r=$?; echo "!! enrich failed rc=$r: $pj"; note_rc "$r"; }
 done
 
 # 3. Manifest the panel reads
 echo "-- manifest"
-node scripts/build-clients-manifest.js
+node scripts/build-clients-manifest.js || { r=$?; echo "!! manifest build failed rc=$r"; note_rc "$r"; }
 
 # 4. Push refreshed data to the live MCC (behind Basic auth; not customer-facing)
 echo "-- rsync data → Kamatera"
 RP="root@45.61.58.125:/root/DW-Agents/marketing-command-center/public/data/"
 shopt -s nullglob   # so an empty prospects-*.json glob drops out instead of failing rsync
 FILES=(public/data/clients-fm.json public/data/prospects-*.json public/data/clients-manifest.json)
-rsync -az "${FILES[@]}" "$RP" && echo "-- data pushed (${#FILES[@]} files)" || echo "!! rsync to Kamatera failed"
+rsync -az "${FILES[@]}" "$RP" && echo "-- data pushed (${#FILES[@]} files)" || { r=$?; echo "!! rsync to Kamatera failed rc=$r"; note_rc "$r"; }
 
-echo "===== $(date '+%F %T') mcc-clients-refresh DONE ====="
+echo "===== $(date '+%F %T') mcc-clients-refresh DONE rc=$FIRST_RC ====="
+exit "$FIRST_RC"

← f88c44a follow-counts: read Norma auth from secrets-manager IG_AGENT  ·  back to Marketing Command Center  ·  auto-data-snapshot: 2026-09-26T09:40:15 (1 data files) — pub 25c7678 →