← back to Designerwallcoverings
fix guard.mjs: use full psql path for launchd restricted PATH
5ec49adfdb95b87c7375430fc43f3f05786b5330 · 2026-09-07 04:03:54 -0700 · steve@designerwallcoverings.com
The guard never ran under launchd because psql wasn't on the restricted
PATH (/usr/bin:/bin). Applied the same fix already used for NODE in
daily-batch.sh: resolve to /opt/homebrew/bin/psql explicitly.
Fixes: TK-11294 (4am loop) / part of TK-11201 ecosystem
Files touched
M scripts/sanderson-onboard/guard.mjs
Diff
commit 5ec49adfdb95b87c7375430fc43f3f05786b5330
Author: steve@designerwallcoverings.com <steve@designerwallcoverings.com>
Date: Mon Sep 7 04:03:54 2026 -0700
fix guard.mjs: use full psql path for launchd restricted PATH
The guard never ran under launchd because psql wasn't on the restricted
PATH (/usr/bin:/bin). Applied the same fix already used for NODE in
daily-batch.sh: resolve to /opt/homebrew/bin/psql explicitly.
Fixes: TK-11294 (4am loop) / part of TK-11201 ecosystem
---
scripts/sanderson-onboard/guard.mjs | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/scripts/sanderson-onboard/guard.mjs b/scripts/sanderson-onboard/guard.mjs
index 77dbe5b..77b0863 100644
--- a/scripts/sanderson-onboard/guard.mjs
+++ b/scripts/sanderson-onboard/guard.mjs
@@ -14,7 +14,9 @@ const fresh=done.slice(seen);
fs.writeFileSync(seenFile,String(done.length));
if(!fresh.length){console.log('guard: 0 new publishes, OK');process.exit(0);}
// retail band by mfr
-const retail={};execSync('psql -h /tmp -d dw_unified -tAc "select mfr_sku,retail_usd from sanderson_catalog where retail_usd>0"',{maxBuffer:1e8}).toString().trim().split('\n').forEach(l=>{const[m,r]=l.split('|');retail[m]=+r;});
+// Use full psql path — launchd restricts PATH to /usr/bin:/bin (same fix as NODE in daily-batch.sh)
+const PSQL='/opt/homebrew/bin/psql';
+const retail={};execSync(`${PSQL} -h /tmp -d dw_unified -tAc "select mfr_sku,retail_usd from sanderson_catalog where retail_usd>0"`,{maxBuffer:1e8}).toString().trim().split('\n').forEach(l=>{const[m,r]=l.split('|');retail[m]=+r;});
let anomalies=[];
if(fresh.length>CAP) anomalies.push(`published ${fresh.length} > per-night cap ${CAP}`);
for(const line of fresh){let r;try{r=JSON.parse(line)}catch(e){continue}
← 15d39b7 auto-data-snapshot: 2026-09-07T01:42:31 (4 data files) — scr
·
back to Designerwallcoverings
·
auto-data-snapshot: 2026-09-07T06:12:13 (1 data files) — dat 7f3b36d →