← back to Designer Wallcoverings
guard TK-11299: skip $0 quote-only variants in the 6-hourly stock-2026-guard
23987f86654c4782fd34988d65f51a06689810fc · 2026-09-10 07:47:53 -0700 · Steve
stock-2026-guard.js is the second, previously-unguarded re-inflater of the
$0-orderable defect (lineage TK-10825/10965/11140/11301/11357). It runs via
launchd com.steve.dw-stock-2026-guard every 21600s WITH --commit, scans
products(query:"status:active inventory_total:<1"), and sets on_hand=2026 on
every TRACKED variant at <=0 — fetching no price and applying no $0 filter.
That predicate is exactly the output of any qty->0 stopgap: a zeroed ACTIVE
TRACKED $0 variant matches it by construction, so the job re-arms the variant
to availableForSale=true (orderable at $0) within 6h of any fix. Commit
5d73ddff guarded the sibling hourly newest-1000 sweep; this closes the same
hole in the 6-hourly job.
Narrowly scoped — Steve's 2026-06-20 "active products are never out of stock"
rule is preserved for PRICED variants. Proven by fixture harness
/tmp/tk11299-proof/predicate-proof.mjs (4/4), which extracts the real filter
expression from both revisions: the $0 variant is no longer stocked; a
legitimately oversold priced product is still restored; a mixed product stocks
its priced variant only and skips the $0 rider; untracked POD/sample unchanged.
Reversible: git revert.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BdcHznmTWgjvykR2f4XvPb
Files touched
M shopify/scripts/cadence/stock-2026-guard.js
Diff
commit 23987f86654c4782fd34988d65f51a06689810fc
Author: Steve <steve@designerwallcoverings.com>
Date: Thu Sep 10 07:47:53 2026 -0700
guard TK-11299: skip $0 quote-only variants in the 6-hourly stock-2026-guard
stock-2026-guard.js is the second, previously-unguarded re-inflater of the
$0-orderable defect (lineage TK-10825/10965/11140/11301/11357). It runs via
launchd com.steve.dw-stock-2026-guard every 21600s WITH --commit, scans
products(query:"status:active inventory_total:<1"), and sets on_hand=2026 on
every TRACKED variant at <=0 — fetching no price and applying no $0 filter.
That predicate is exactly the output of any qty->0 stopgap: a zeroed ACTIVE
TRACKED $0 variant matches it by construction, so the job re-arms the variant
to availableForSale=true (orderable at $0) within 6h of any fix. Commit
5d73ddff guarded the sibling hourly newest-1000 sweep; this closes the same
hole in the 6-hourly job.
Narrowly scoped — Steve's 2026-06-20 "active products are never out of stock"
rule is preserved for PRICED variants. Proven by fixture harness
/tmp/tk11299-proof/predicate-proof.mjs (4/4), which extracts the real filter
expression from both revisions: the $0 variant is no longer stocked; a
legitimately oversold priced product is still restored; a mixed product stocks
its priced variant only and skips the $0 rider; untracked POD/sample unchanged.
Reversible: git revert.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BdcHznmTWgjvykR2f4XvPb
---
shopify/scripts/cadence/stock-2026-guard.js | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/shopify/scripts/cadence/stock-2026-guard.js b/shopify/scripts/cadence/stock-2026-guard.js
index 8bd91748..763ed494 100644
--- a/shopify/scripts/cadence/stock-2026-guard.js
+++ b/shopify/scripts/cadence/stock-2026-guard.js
@@ -54,7 +54,7 @@ async function gql(query, variables) {
const SCAN = `query($cursor:String){ products(first:100, after:$cursor, query:"status:active inventory_total:<1"){
pageInfo{ hasNextPage endCursor }
- nodes{ id title vendor variants(first:50){ nodes{ sku inventoryQuantity inventoryItem{ id tracked } } } }
+ nodes{ id title vendor variants(first:50){ nodes{ sku price inventoryQuantity inventoryItem{ id tracked } } } }
} }`;
const INV_SET = `mutation($input:InventorySetQuantitiesInput!){ inventorySetQuantities(input:$input){ userErrors{ field message code } } }`;
@@ -68,7 +68,12 @@ const INV_SET = `mutation($input:InventorySetQuantitiesInput!){ inventorySetQuan
if (!conn) { console.error('[stock-2026-guard] scan error:', JSON.stringify(j.errors || j)); break; }
for (const p of conn.nodes) {
scanned++;
- const trackedVars = p.variants.nodes.filter(v => v.inventoryItem && v.inventoryItem.tracked && v.inventoryItem.id);
+ // GUARD TK-11299: never re-stock a $0 quote-only variant. Setting on_hand=2026 on a $0 variant
+ // flips availableForSale=true → orderable at $0 (real revenue defect; TK-10825/10965/11140/11301/11357).
+ // The "active products are never out of stock" rule is for PRICED sellable variants — a $0
+ // placeholder's 0 is intentional, exactly like the untracked POD/sample case handled below.
+ const trackedVars = p.variants.nodes.filter(v => v.inventoryItem && v.inventoryItem.tracked && v.inventoryItem.id
+ && Number(v.price) > 0);
// only act when a TRACKED variant is actually <= 0 (skip untracked POD/sample items)
const hasZero = trackedVars.some(v => (v.inventoryQuantity ?? 0) <= 0);
if (hasZero && trackedVars.length) {
← 6197515e TK-10899: add in-place PJ Fall 2026 CC draft updater (dry-ru
·
back to Designer Wallcoverings
·
TK-10899: serve the PJ mailer images at ?quality=100 1422e4d8 →