← back to Designer Wallcoverings
cadence wrapper: refund unused upload grant on 429/exit-3 + partial slots (DTD-A)
8d58a8d4b3acfa1cb922b95b89b714cd15f608aa · 2026-06-20 09:15:56 -0700 · Steve
Files touched
M shopify/scripts/cadence/run-cadence-hourly.sh
Diff
commit 8d58a8d4b3acfa1cb922b95b89b714cd15f608aa
Author: Steve <steve@designerwallcoverings.com>
Date: Sat Jun 20 09:15:56 2026 -0700
cadence wrapper: refund unused upload grant on 429/exit-3 + partial slots (DTD-A)
---
shopify/scripts/cadence/run-cadence-hourly.sh | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/shopify/scripts/cadence/run-cadence-hourly.sh b/shopify/scripts/cadence/run-cadence-hourly.sh
index bc110f48..78deba02 100755
--- a/shopify/scripts/cadence/run-cadence-hourly.sh
+++ b/shopify/scripts/cadence/run-cadence-hourly.sh
@@ -48,6 +48,25 @@ echo "cadence-import exit $RC (3 = daily variant cap hit, resumes next slot)"
# → posts no-op silently until Steve refreshes the Slack token).
SUMMARY=$(printf '%s' "$OUT" | grep -oE 'CREATED [0-9]+ \([^)]*\), linked-existing [0-9]+ \([^)]*\), failed [0-9]+' | tail -1)
CREATED=$(printf '%s' "$SUMMARY" | grep -oE '^CREATED [0-9]+' | grep -oE '[0-9]+')
+
+# ── refund the unused upload grant (budget-integrity, 2026-06-20; DTD verdict A) ──
+# We took GRANT variants UP FRONT (line ~33) to size --max, but the importer consumes only
+# 2 variants per product actually CREATED. A Shopify-429 / exit-3 slot creates 0 (refund the
+# whole grant); a partial slot (vendor out of net-new) creates fewer (refund the remainder).
+# Without this the unused grant silently drains the daily 864 upload slice and starves the
+# productive window once Shopify's rolling cap clears. linked-existing products create NO new
+# variants, so only CREATED counts. GUARD: refund ONLY when the 'CREATED N' summary line was
+# found ($SUMMARY non-empty) — a SIGKILLed importer that printed no summary keeps its debit
+# (conservative; never over-refunds → never over-grants against Shopify's real cap).
+if [ -n "$SUMMARY" ]; then
+ USED=$(( ${CREATED:-0} * 2 ))
+ REFUND=$(( GRANT - USED ))
+ if [ "$REFUND" -gt 0 ]; then
+ GOT=$(node "$BUDGET" refund upload "$REFUND" 2>/dev/null || echo 0)
+ echo "budget refund: grant=$GRANT used=$USED (created ${CREATED:-0}×2) → refunded $GOT upload variants to ledger"
+ fi
+fi
+
if [ "${CREATED:-0}" -gt 0 ]; then
bash "$(dirname "$0")/slack-notify.sh" "📦 DW all-day uploader · slot ${SLOT} $(date '+%a %H:%M') — ${SUMMARY}" || true
fi
← 912696ae activation compliance: all-channels publish + inventory 2026
·
back to Designer Wallcoverings
·
Add activated-items viewer: live Shopify pull, grouped by ac afcf25ff →