[object Object]

← back to Hollywood Import

fix: budget-take + --limit on hollywood phase-2 (add-yard) so it can't exceed the recorded variant grant

3f08fb5bfbfed8c9a0f14d7edcebc20109840c27 · 2026-06-19 16:58:00 -0700 · Steve

Files touched

Diff

commit 3f08fb5bfbfed8c9a0f14d7edcebc20109840c27
Author: Steve <steve@designerwallcoverings.com>
Date:   Fri Jun 19 16:58:00 2026 -0700

    fix: budget-take + --limit on hollywood phase-2 (add-yard) so it can't exceed the recorded variant grant
---
 hollywood-create-resume.sh | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/hollywood-create-resume.sh b/hollywood-create-resume.sh
index f787e4f..ed6862f 100755
--- a/hollywood-create-resume.sh
+++ b/hollywood-create-resume.sh
@@ -29,8 +29,19 @@ echo "=== $ts budget grant=$HW_VARS variants → create up to $HW_PRODUCTS produ
 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.
+# 2026-06-19 (budget fix): phase-2 (yard add = 1 variant/product) was previously UNBUDGETED —
+# no --limit, no budget take — so once the create backlog cleared it could add variants ABOVE the
+# recorded grant (bounded only by Shopify's own daily-cap abort, not the ledger). FIX: take a
+# remaining-aware grant from the 'upload' pool and pass it as --limit so phase-2 can never exceed
+# the shared ledger. take returns min(req, upload-remaining, global-remaining); 0 grant → skip.
 if [ "$p1" -eq 0 ]; then
-  /usr/bin/env node hollywood-add-yard.mjs --apply >> hollywood-create.log 2>&1
-  echo "=== $ts phase2 (add-yard) exit $? ===" >> hollywood-create.log
+  P2_VARS=$(node "$BUDGET" take upload 40 2>/dev/null || echo 0)
+  if [ "${P2_VARS:-0}" -lt 1 ]; then
+    echo "=== $ts phase2 (add-yard) skipped — no variant budget (grant=$P2_VARS) ===" >> hollywood-create.log
+  else
+    echo "=== $ts phase2 (add-yard) budget grant=$P2_VARS variants → --limit=$P2_VARS ===" >> hollywood-create.log
+    /usr/bin/env node hollywood-add-yard.mjs --apply --limit="$P2_VARS" >> hollywood-create.log 2>&1
+    echo "=== $ts phase2 (add-yard) exit $? ===" >> hollywood-create.log
+  fi
 fi
 exit 0

← dc5b6ae hollywood-create-resume: add kill-switch + variant-budget ga  ·  back to Hollywood Import  ·  hollywood wrapper: refund unused upload grant on 429/partial 7c8532d →