[object Object]

← back to Designer Wallcoverings

fix: launchd bare-node PATH bug in two DW scheduled jobs

e107ff3ef238634873ec3e3b28ae0471dc2e980b · 2026-07-13 10:30:12 -0700 · Steve

- push-drafts-drip.sh: pin Homebrew PATH (node+psql were 'command not found'
  but swallowed by out=$(...), so it exited 0 while creating ZERO drafts).
- anna-french drain.sh: pin PATH + define $SDIR (was undefined; set -u aborted
  the script before node, so it never logged under launchd).

Files touched

Diff

commit e107ff3ef238634873ec3e3b28ae0471dc2e980b
Author: Steve <steve@designerwallcoverings.com>
Date:   Mon Jul 13 10:30:12 2026 -0700

    fix: launchd bare-node PATH bug in two DW scheduled jobs
    
    - push-drafts-drip.sh: pin Homebrew PATH (node+psql were 'command not found'
      but swallowed by out=$(...), so it exited 0 while creating ZERO drafts).
    - anna-french drain.sh: pin PATH + define $SDIR (was undefined; set -u aborted
      the script before node, so it never logged under launchd).
---
 scripts/wallquest-refresh/push-drafts-drip.sh            | 5 +++++
 shopify/scripts/anna-french-priceout-2026-06-25/drain.sh | 8 +++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/scripts/wallquest-refresh/push-drafts-drip.sh b/scripts/wallquest-refresh/push-drafts-drip.sh
index 6fddd57a..ff3f67b5 100755
--- a/scripts/wallquest-refresh/push-drafts-drip.sh
+++ b/scripts/wallquest-refresh/push-drafts-drip.sh
@@ -5,6 +5,11 @@
 # Idempotent (skips created), settlement-clean (push skips settlement_flag rows).
 # Token via grep (dodges the .env line-83 source bug). Run manually or from launchd.
 set -u
+# launchd runs with a minimal PATH that excludes Homebrew, so bare `node` (and
+# `psql` below) fail "command not found" — but because their output is captured in
+# out=$(...), the script kept going and silently created ZERO drafts while exiting
+# 0 (false-green, seen 2026-07-12/13). Pin PATH so node + psql resolve.
+export PATH="/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin"
 BASE=/Users/macstudio3/Projects/Designer-Wallcoverings/scripts/wallquest-refresh
 SLOT_LIMIT=${SLOT_LIMIT:-20}
 LOG=$BASE/data/pr-drip.log; mkdir -p $BASE/data
diff --git a/shopify/scripts/anna-french-priceout-2026-06-25/drain.sh b/shopify/scripts/anna-french-priceout-2026-06-25/drain.sh
index 8b0af213..b78c80c1 100755
--- a/shopify/scripts/anna-french-priceout-2026-06-25/drain.sh
+++ b/shopify/scripts/anna-french-priceout-2026-06-25/drain.sh
@@ -4,7 +4,13 @@
 # whatever the shared 'roll' budget grants and STAGES the rest. Self-disables
 # (bootout) once 0 remain staged.
 set -uo pipefail
-cd "/Users/macstudio3/Projects/Designer-Wallcoverings/shopify/scripts/anna-french-priceout-2026-06-25"
+# launchd runs with a minimal PATH that excludes Homebrew → bare `node` fails.
+# Pin PATH so both node calls below resolve.
+export PATH="/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin"
+SDIR="/Users/macstudio3/Projects/Designer-Wallcoverings/shopify/scripts/anna-french-priceout-2026-06-25"
+cd "$SDIR"
+# NB: $SDIR was previously undefined here — under `set -u` the script aborted on
+# this line BEFORE reaching node, so no log was ever written under launchd.
 LOG="$SDIR/drain.log"
 echo "[$(date '+%F %T')] drain run start" >> "$LOG"
 DW_ROLL_CAP=160 node 03-add-roll-variants.js --apply --report data/run-report.json >> "$LOG" 2>&1

← b20f45ae extraction goes LOCAL-FIRST (EXTRACT_PREFER_LOCAL=1, hermes3  ·  back to Designer Wallcoverings  ·  drain hardening: INT/TERM traps now exit (bare cleanup trap 2409e85d →