← back to Designer Wallcoverings
run inventory-set-2026 sweep after each cadence run
c48c81f48700d730bb0bf03d625dbda7bac1f0a4 · 2026-06-20 10:37:26 -0700 · Steve
Hook the newest-1000 inventory sweep into run-cadence-hourly.sh (runs every
slot right after cadence-import, non-fatal). Script now prefers the exported
SHOPIFY_ADMIN_TOKEN (secrets-manager) over the repo .env.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Files touched
M shopify/scripts/cadence/run-cadence-hourly.shM shopify/scripts/inventory-set-2026-newest.js
Diff
commit c48c81f48700d730bb0bf03d625dbda7bac1f0a4
Author: Steve <steve@designerwallcoverings.com>
Date: Sat Jun 20 10:37:26 2026 -0700
run inventory-set-2026 sweep after each cadence run
Hook the newest-1000 inventory sweep into run-cadence-hourly.sh (runs every
slot right after cadence-import, non-fatal). Script now prefers the exported
SHOPIFY_ADMIN_TOKEN (secrets-manager) over the repo .env.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---
shopify/scripts/cadence/run-cadence-hourly.sh | 12 ++++++++++++
shopify/scripts/inventory-set-2026-newest.js | 9 +++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/shopify/scripts/cadence/run-cadence-hourly.sh b/shopify/scripts/cadence/run-cadence-hourly.sh
index 78deba02..9e26d104 100755
--- a/shopify/scripts/cadence/run-cadence-hourly.sh
+++ b/shopify/scripts/cadence/run-cadence-hourly.sh
@@ -70,4 +70,16 @@ 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
+
+# ── post-cadence inventory sweep (Steve 2026-06-20: "schedule it to run after each cadence run") ──
+# Safety-net the new-products-inventory-2026 rule: ensure the newest 1000 products have BOTH
+# variants tracked + on_hand=2026. cadence-import --activate already does this for products it
+# activates this slot, but products created via OTHER import paths land with tracking OFF
+# (1,615/1,915 newest variants observed untracked 2026-06-20). Inventory sets are cap-free
+# (they don't consume the variant cap) and idempotent, so this is safe every slot; after the
+# first full pass it only touches the slot's new SKUs. Non-fatal — a failure never aborts the run.
+# SHOPIFY_ADMIN_TOKEN is already exported above; the script prefers it over the repo .env.
+echo "── inventory sweep: newest 1000 → both variants on_hand=2026 ──"
+node "$SHOP/scripts/inventory-set-2026-newest.js" --n 1000 || echo "inventory sweep failed (non-fatal)"
+
echo "═══════ done $TS ═══════"
diff --git a/shopify/scripts/inventory-set-2026-newest.js b/shopify/scripts/inventory-set-2026-newest.js
index 1239e742..f8058468 100644
--- a/shopify/scripts/inventory-set-2026-newest.js
+++ b/shopify/scripts/inventory-set-2026-newest.js
@@ -23,8 +23,13 @@ import { fileURLToPath } from 'url';
const __dir = path.dirname(fileURLToPath(import.meta.url));
const ENV_PATH = path.resolve(__dir, '../../.env'); // repo root .env
-const env = fs.readFileSync(ENV_PATH, 'utf8');
-const TOKEN = (env.match(/^SHOPIFY_ADMIN_TOKEN=(.*)$/m) || [])[1]?.replace(/['"]/g, '').trim();
+// Prefer a token already exported in the environment (run-cadence-hourly.sh exports the
+// canonical secrets-manager SHOPIFY_ADMIN_TOKEN); fall back to the repo-root .env.
+let TOKEN = process.env.SHOPIFY_ADMIN_TOKEN;
+if (!TOKEN) {
+ const env = fs.readFileSync(ENV_PATH, 'utf8');
+ TOKEN = (env.match(/^SHOPIFY_ADMIN_TOKEN=(.*)$/m) || [])[1]?.replace(/['"]/g, '').trim();
+}
const STORE = 'designer-laboratory-sandbox.myshopify.com'; // active DW store the cadence writes to
const API = '2024-10';
const LOC = 'gid://shopify/Location/5795643504'; // 15442 Ventura Blvd. (matches cadence-import.js)
← c1e4c9db activated-viewer: essentials audit + width/tag cross-check +
·
back to Designer Wallcoverings
·
DRAFT (no deploy): push-spec-metafields helper + activate-ga 080d706c →