[object Object]

← back to Hollywood Import

hollywood-create-resume: add kill-switch + variant-budget gate

dc5b6ae87a471ad144f1ba9a3a766fd7e9d2b0bd · 2026-06-19 14:14:15 -0700 · Steve

Was ignoring both the shared ~/.dw-fixer-stop kill-switch and the budget.cjs
ledger. Now checks the kill-switch, takes a grant from the shared 'upload' pool
(== global ~864/day Shopify ceiling minus osborne), and clamps phase-1 creates
via --limit so it can't collectively blow the daily variant cap with the other
DW writers. 0 grant = exit clean. PATH export added for launchd minimal PATH.

Files touched

Diff

commit dc5b6ae87a471ad144f1ba9a3a766fd7e9d2b0bd
Author: Steve <steve@designerwallcoverings.com>
Date:   Fri Jun 19 14:14:15 2026 -0700

    hollywood-create-resume: add kill-switch + variant-budget gate
    
    Was ignoring both the shared ~/.dw-fixer-stop kill-switch and the budget.cjs
    ledger. Now checks the kill-switch, takes a grant from the shared 'upload' pool
    (== global ~864/day Shopify ceiling minus osborne), and clamps phase-1 creates
    via --limit so it can't collectively blow the daily variant cap with the other
    DW writers. 0 grant = exit clean. PATH export added for launchd minimal PATH.
---
 hollywood-create-resume.sh | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/hollywood-create-resume.sh b/hollywood-create-resume.sh
index 90250ae..f787e4f 100755
--- a/hollywood-create-resume.sh
+++ b/hollywood-create-resume.sh
@@ -3,11 +3,29 @@
 # products under Shopify's daily variant-creation cap. Idempotent (skips already-CREATED via
 # audit) and cap-aware (the node runner exits 3 when the daily cap is hit, resuming next run).
 # Install is Steve-gated. Mirrors the sample-split-resume / schu-build-resume pattern.
+# launchd minimal-PATH fix (node/budget.cjs need /usr/local/bin) — mirrors run-cadence-hourly.sh.
+export PATH="/usr/local/bin:/opt/homebrew/bin:/opt/homebrew/opt/postgresql@14/bin:$PATH"
 cd "$HOME/Projects/hollywood-import" || exit 1
 ts="$(date '+%Y-%m-%d %H:%M %Z')"
 echo "=== $ts drip start ===" >> hollywood-create.log
-# Phase 1: create the 67 absent products (cap-aborts exit 3 → resume tomorrow).
-/usr/bin/env node hollywood-create.mjs --apply >> hollywood-create.log 2>&1
+
+# Shared kill-switch (2026-06-19): this job previously ignored it entirely.
+[ -f "$HOME/.dw-fixer-stop" ] && { echo "=== $ts kill-switch present — skip ===" >> hollywood-create.log; exit 0; }
+
+# Shared variant-budget gate (2026-06-19): draw from the live 'upload' pool (== global ~864/day
+# Shopify ceiling minus osborne) so Hollywood's create can't collectively blow the daily variant
+# cap. take returns min(req, upload-remaining, global-remaining); 0 grant = no budget → exit clean.
+# Grant (variants) → product limit (2 variants/product: Roll + Sample); --limit caps phase-1 creates.
+BUDGET="$HOME/Projects/designerwallcoverings/scripts/variant-budget/budget.cjs"
+HW_VARS=$(node "$BUDGET" take upload 40 2>/dev/null || echo 40)
+HW_PRODUCTS=$(( HW_VARS / 2 ))
+if [ "${HW_PRODUCTS:-0}" -lt 1 ]; then
+  echo "=== $ts no variant budget this run (grant=$HW_VARS) — exit clean ===" >> hollywood-create.log
+  exit 0
+fi
+echo "=== $ts budget grant=$HW_VARS variants → create up to $HW_PRODUCTS products ===" >> hollywood-create.log
+# Phase 1: create the absent products (cap-aborts exit 3 → resume tomorrow), capped at the grant.
+/usr/bin/env node hollywood-create.mjs --apply --limit="$HW_PRODUCTS" >> hollywood-create.log 2>&1
 p1=$?
 echo "=== $ts phase1 (create) exit $p1 ===" >> hollywood-create.log
 # Phase 2 ONLY after Phase 1 fully done (exit 0) — both share the daily variant cap.

← 5e1cfb6 Move Hollywood create/yard drip to 8:00am so sample-split(6:  ·  back to Hollywood Import  ·  fix: budget-take + --limit on hollywood phase-2 (add-yard) s 3f08fb5 →