← back to Commercialrealestate
TK-11856 rc-propagation (EMAIL): CRE residential/morning/afternoon/condos reports propagate build/send rc
6abfd335f63bf38d72a06b9c0ea993a88b8216dd · 2026-09-26 09:22:36 -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/commercialrealestate 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
M scripts/run-afternoon-report.shM scripts/run-condos-report.shM scripts/run-morning-report.shM scripts/run-residential-report.sh
Diff
commit 6abfd335f63bf38d72a06b9c0ea993a88b8216dd
Author: Steve <steve@designerwallcoverings.com>
Date: Sat Sep 26 09:22:36 2026 -0700
TK-11856 rc-propagation (EMAIL): CRE residential/morning/afternoon/condos reports propagate build/send 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/commercialrealestate revert <this sha>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YaiWjfgEuKQLTb5cdDreS3
---
scripts/run-afternoon-report.sh | 14 ++++++++++++--
scripts/run-condos-report.sh | 16 +++++++++++++---
scripts/run-morning-report.sh | 13 ++++++++++++-
scripts/run-residential-report.sh | 11 +++++++++--
4 files changed, 46 insertions(+), 8 deletions(-)
diff --git a/scripts/run-afternoon-report.sh b/scripts/run-afternoon-report.sh
index 2934c26..959cd8f 100755
--- a/scripts/run-afternoon-report.sh
+++ b/scripts/run-afternoon-report.sh
@@ -13,6 +13,13 @@ export CC_NAV="Van Nuys,North Hollywood,Reseda,Northridge,Panorama City"
cd "$HOME/Projects/commercialrealestate" || exit 1
LOG=/tmp/cre-afternoon-report.log
echo "===== afternoon run $(date) =====" >> "$LOG"
+# TK-11856 rc-propagation (exit-code ONLY, no behavior change): every step still runs as before
+# (the scrape stays non-fatal); we only REMEMBER the first nonzero rc of a side-effecting step
+# (scrape / re-rank / report build+George send — afternoon-report.js exits 1 on a failed send) and exit
+# with it at the end instead of the closing echo's 0. git commit's "nothing to commit" is NOT counted.
+# Undo: git revert.
+FIRST_RC=0
+note_rc() { if [ "$1" -ne 0 ] && [ "$FIRST_RC" -eq 0 ]; then FIRST_RC="$1"; fi; }
# 1) Snapshot listing ids BEFORE the scrape so the report can diff "what's new since morning".
/opt/homebrew/bin/node -e '
@@ -24,16 +31,19 @@ echo "===== afternoon run $(date) =====" >> "$LOG"
# 2) Re-scrape Crexi (appends new in-band SFV listings, deduped). Non-fatal: if Browserbase is down we still
# re-rank + report the red-hot deals on existing data.
-/opt/homebrew/bin/node scripts/refresh-listings.js >> "$LOG" 2>&1 || echo "refresh-listings failed (continuing)" >> "$LOG"
+/opt/homebrew/bin/node scripts/refresh-listings.js >> "$LOG" 2>&1 || { r=$?; echo "refresh-listings failed rc=$r (continuing)" >> "$LOG"; note_rc $r; }
# 3) Re-rank (local Qwen, cached -> fresh only for genuinely new listings).
/opt/homebrew/bin/node scripts/analyze.js >> "$LOG" 2>&1
+note_rc $?
# 4) Build the afternoon report HTML and email it to both recipients (self-contained send).
/opt/homebrew/bin/node scripts/afternoon-report.js >> "$LOG" 2>&1
+note_rc $?
# 5) Commit the day's data + report.
git -c user.email=steve@designerwallcoverings.com -c user.name="Steve" add -A >> "$LOG" 2>&1
git -c user.email=steve@designerwallcoverings.com -c user.name="Steve" commit -q -m "afternoon CRE update $(date +%Y-%m-%d)" >> "$LOG" 2>&1 || echo "nothing to commit" >> "$LOG"
-echo "===== done $(date) =====" >> "$LOG"
+echo "===== done $(date) rc=$FIRST_RC =====" >> "$LOG"
+exit "$FIRST_RC"
diff --git a/scripts/run-condos-report.sh b/scripts/run-condos-report.sh
index eff68e1..391639b 100755
--- a/scripts/run-condos-report.sh
+++ b/scripts/run-condos-report.sh
@@ -9,19 +9,27 @@ export NODE_PATH="$HOME/.claude/skills/browserbase/node_modules"
cd "$HOME/Projects/commercialrealestate" || exit 1
LOG=/tmp/cre-condos-report.log
echo "===== condos run $(date) =====" >> "$LOG"
+# TK-11856 rc-propagation (exit-code ONLY, no behavior change): every step still runs as before
+# (fetch + enrich stay non-fatal); we only REMEMBER the first nonzero rc of a side-effecting step and
+# exit with it at the end instead of the closing echo's 0. git commit's "nothing to commit" is NOT
+# counted. CAVEAT: `claude -p` exits 0 when the model runs even if its George send tool failed, so
+# this catches crashes/auth failures, NOT a model-level send failure. Undo: git revert.
+FIRST_RC=0
+note_rc() { if [ "$1" -ne 0 ] && [ "$FIRST_RC" -eq 0 ]; then FIRST_RC="$1"; fi; }
# 1) Refresh + re-classify LA County condos from Redfin (hard-capped ~$3.20). Non-fatal: if Browserbase is
# down we still build + email off the last classified snapshot so the report always goes out.
-/opt/homebrew/bin/node scripts/fetch-condos-redfin.js >> "$LOG" 2>&1 || echo "fetch-condos-redfin failed (continuing on last snapshot)" >> "$LOG"
+/opt/homebrew/bin/node scripts/fetch-condos-redfin.js >> "$LOG" 2>&1 || { r=$?; echo "fetch-condos-redfin failed rc=$r (continuing on last snapshot)" >> "$LOG"; note_rc $r; }
# 1.5) Enrich NEW listings with broker + firm + DRE# + phones (--only-missing: only listings without
# broker data are scraped — usually a handful/week). The DRE# is hooked into the full CA DRE
# record. Non-fatal. --browser = LOCAL real Chrome ($0, TK-10655; residential IP clears the
# Redfin WAF — was --browserbase, now retired).
-/opt/homebrew/bin/node scripts/enrich-condo-brokers.js --only-missing --browser --delay 900 >> "$LOG" 2>&1 || echo "enrich-condo-brokers failed (continuing; report falls back to Redfin deep links)" >> "$LOG"
+/opt/homebrew/bin/node scripts/enrich-condo-brokers.js --only-missing --browser --delay 900 >> "$LOG" 2>&1 || { r=$?; echo "enrich-condo-brokers failed rc=$r (continuing; report falls back to Redfin deep links)" >> "$LOG"; note_rc $r; }
# 2) Build the unwarrantable-condos HTML (fha_expired only; overlays the persistent broker cache).
REPORT_DATE="$(date +%Y-%m-%d)" /opt/homebrew/bin/node scripts/condos-report.js > data/condos-report.html 2>> "$LOG"
+note_rc $?
# 3) Email the report as-is (separate from the multifamily CRE Top-10).
TODAY="$(date +%Y-%m-%d)"
@@ -30,9 +38,11 @@ PROMPT="Read /Users/macstudio3/Projects/commercialrealestate/data/condos-report.
env -u ANTHROPIC_API_KEY -u ANTHROPIC_AUTH_TOKEN "$HOME/.npm-global/bin/claude" -p "$PROMPT" \
--allowedTools "Read" "mcp__george__gmail_send" \
--dangerously-skip-permissions >> "$LOG" 2>&1
+note_rc $?
# 4) Persist data + report.
git -c user.email=steve@designerwallcoverings.com -c user.name="Steve" add -A >> "$LOG" 2>&1
git -c user.email=steve@designerwallcoverings.com -c user.name="Steve" commit -q -m "weekly unwarrantable-condos report $(date +%Y-%m-%d)" >> "$LOG" 2>&1 || echo "nothing to commit" >> "$LOG"
-echo "===== done $(date) =====" >> "$LOG"
+echo "===== done $(date) rc=$FIRST_RC =====" >> "$LOG"
+exit "$FIRST_RC"
diff --git a/scripts/run-morning-report.sh b/scripts/run-morning-report.sh
index c96afcd..12c6e20 100755
--- a/scripts/run-morning-report.sh
+++ b/scripts/run-morning-report.sh
@@ -6,9 +6,18 @@ export PATH="/usr/local/bin:/opt/homebrew/bin:$HOME/.npm-global/bin:$HOME/.claud
cd "$HOME/Projects/commercialrealestate" || exit 1
LOG=/tmp/cre-morning-report.log
echo "===== run $(date) =====" >> "$LOG"
+# TK-11856 rc-propagation (exit-code ONLY, no behavior change): every step still runs as before; we
+# only REMEMBER the first nonzero rc (re-rank / report build / claude -p send) and exit with it at
+# the end instead of the closing echo's 0. CAVEAT: `claude -p` exits 0 when the model runs even if its
+# George send tool failed, so this catches crashes/auth failures, NOT a model-level send failure.
+# Undo: git revert.
+FIRST_RC=0
+note_rc() { if [ "$1" -ne 0 ] && [ "$FIRST_RC" -eq 0 ]; then FIRST_RC="$1"; fi; }
/opt/homebrew/bin/node scripts/analyze.js >> "$LOG" 2>&1
+note_rc $?
REPORT_DATE="$(date +%Y-%m-%d)" /opt/homebrew/bin/node scripts/morning-report.js > data/morning-report.html 2>> "$LOG"
+note_rc $?
TODAY="$(date +%Y-%m-%d)"
PROMPT="Read /Users/macstudio3/Projects/commercialrealestate/data/morning-report.html and send its FULL contents as the HTML body of an email using the mcp__george__gmail_send tool with account 'steve-office' to 'steve@designerwallcoverings.com, steveabramsdesigns@gmail.com'. Subject: 'SFV CRE - Top 10 Opportunities ($TODAY)'. Send the HTML exactly as-is; do not summarize, truncate, or modify it. Sending that one email is the ONLY action to take."
@@ -16,5 +25,7 @@ PROMPT="Read /Users/macstudio3/Projects/commercialrealestate/data/morning-report
env -u ANTHROPIC_API_KEY -u ANTHROPIC_AUTH_TOKEN "$HOME/.npm-global/bin/claude" -p "$PROMPT" \
--allowedTools "Read" "mcp__george__gmail_send" \
--dangerously-skip-permissions >> "$LOG" 2>&1
+note_rc $?
-echo "===== done $(date) =====" >> "$LOG"
+echo "===== done $(date) rc=$FIRST_RC =====" >> "$LOG"
+exit "$FIRST_RC"
diff --git a/scripts/run-residential-report.sh b/scripts/run-residential-report.sh
index 9497963..656b943 100755
--- a/scripts/run-residential-report.sh
+++ b/scripts/run-residential-report.sh
@@ -28,5 +28,12 @@ jq -Rn --arg account steve-office --arg to "$TO" --arg subject "$SUBJ" --rawfile
'{account:$account,to:$to,subject:$subject,body:$body}' > tmp/res-report-payload.json
RESP="$(curl -sS --max-time 45 "$GEORGE_URL$GEORGE_PFX/api/send" \
-H "Authorization: Basic $GEORGE_BASIC_AUTH" -H "Content-Type: application/json" --data @tmp/res-report-payload.json)"
-echo "$RESP" | grep -q '"success":true' && echo "[$(date '+%T')] sent -> $TO" >> "$LOG" \
- || echo "[$(date '+%T')] SEND FAILED: $RESP" >> "$LOG"
+# TK-11856 rc-propagation (exit-code ONLY, no behavior change): same send + same log lines; a failed
+# send now exits NONZERO (was: the SEND FAILED echo made the script exit 0, so a dropped report read
+# green). Undo: git revert.
+if echo "$RESP" | grep -q '"success":true'; then
+ echo "[$(date '+%T')] sent -> $TO" >> "$LOG"
+else
+ echo "[$(date '+%T')] SEND FAILED: $RESP" >> "$LOG"
+ exit 1
+fi
← 0d1c4f8 TK-11856 rc-propagation (RSYNC): crcp-loan-officers exits no
·
back to Commercialrealestate
·
auto-data-snapshot: 2026-09-26T09:40:15 (3 data files) — dat 1aad8c7 →