← back to Dw Yolo Loop
cycle 78: BUILD zero-dollar-orderable canary (P1 free-checkout guard, c75 spec + c77 hardening) — active 145 (coverage gate RL=111 PASS) + NEW 8 DRAFT latent landmines (Arte 5/Romo/DW/Thibaut); abort-on-partial + coverage-gate + status-agnostic; exit 3 ALERT
fefd684b9169f16c8e6704866e367a20cfd65ef5 · 2026-06-18 00:54:50 -0700 · Steve Abrams
Files touched
A scripts/zero-dollar-orderable-canary/.gitignoreA scripts/zero-dollar-orderable-canary/zero-dollar-orderable-canary.mjs
Diff
commit fefd684b9169f16c8e6704866e367a20cfd65ef5
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Thu Jun 18 00:54:50 2026 -0700
cycle 78: BUILD zero-dollar-orderable canary (P1 free-checkout guard, c75 spec + c77 hardening) — active 145 (coverage gate RL=111 PASS) + NEW 8 DRAFT latent landmines (Arte 5/Romo/DW/Thibaut); abort-on-partial + coverage-gate + status-agnostic; exit 3 ALERT
---
scripts/zero-dollar-orderable-canary/.gitignore | 1 +
.../zero-dollar-orderable-canary.mjs | 84 ++++++++++++++++++++++
2 files changed, 85 insertions(+)
diff --git a/scripts/zero-dollar-orderable-canary/.gitignore b/scripts/zero-dollar-orderable-canary/.gitignore
new file mode 100644
index 0000000..d9e6a75
--- /dev/null
+++ b/scripts/zero-dollar-orderable-canary/.gitignore
@@ -0,0 +1 @@
+data/latest.json
diff --git a/scripts/zero-dollar-orderable-canary/zero-dollar-orderable-canary.mjs b/scripts/zero-dollar-orderable-canary/zero-dollar-orderable-canary.mjs
new file mode 100644
index 0000000..595b72c
--- /dev/null
+++ b/scripts/zero-dollar-orderable-canary/zero-dollar-orderable-canary.mjs
@@ -0,0 +1,84 @@
+// zero-dollar-orderable-canary — READ-ONLY, $0. Cycle 78 (DTD-B unanimous).
+// A DURABLE standing guard for the most SEVERE class this run found: orderable zero-dollar
+// variants = free-checkout (P1; c67-c71 bounded 145 live). NO standing detector existed.
+// Operationalizes the c75 spec's top line, hardened per c77.
+//
+// Scans status:active + status:draft (STATUS-AGNOSTIC except archived — archived can't be
+// ordered; DRAFT zero-dollar is the latent-activation landmine the c69 officer named).
+// Flags ANY variant priced 0 that is ORDERABLE (availableForSale OR inventoryPolicy=CONTINUE),
+// ANY position. Groups by vendor + status. HEALTHY = 0 active orderable-zero-dollar.
+//
+// c77 hardening / discipline:
+// - ABORT-ON-PARTIAL: if pagination errors mid-scan, a "0 found" is a FALSE-CLEAN → report
+// INCONCLUSIVE, never HEALTHY, on an incomplete scan.
+// - COVERAGE GATE / negative control: the known Ralph Lauren zero-dollar set (~111) MUST be
+// reproduced; if the scan finds ~0 RL, coverage failed (don't trust a clean result).
+// - This is an absolute gate (target count = 0), not a baseline-drift check, so no rerun-
+// confirm needed (a $0 DB state isn't a transient network blip; abort-on-partial covers
+// the under-count risk). exit 3 on live ACTIVE exposure, 0 if clean, 2 if inconclusive.
+// EXCLUDES Phillip Jeffries. Read-only Admin GraphQL; never a mutation.
+import fs from 'fs'; import path from 'path'; import { fileURLToPath } from 'url';
+const ENV=fs.readFileSync('/Users/stevestudio2/Projects/secrets-manager/.env','utf8');
+const TOK=(ENV.match(/^SHOPIFY_ADMIN_TOKEN=(.+)$/m)||[])[1].replace(/['"\r]/g,'').trim();
+const GQL='https://designer-laboratory-sandbox.myshopify.com/admin/api/2024-10/graphql.json';
+const PJ=/phillip[- ]?jeffries/i;
+const BASE_DIR=path.dirname(fileURLToPath(import.meta.url)); const DATA_DIR=path.join(BASE_DIR,'data');
+const sleep=ms=>new Promise(r=>setTimeout(r,ms));
+async function gql(q,v){for(let a=0;a<6;a++){try{const r=await fetch(GQL,{method:'POST',headers:{'X-Shopify-Access-Token':TOK,'Content-Type':'application/json'},body:JSON.stringify({query:q,variables:v})});if(r.status===429||r.status>=500){await sleep(2000*(a+1));continue;}const j=await r.json();if(j.errors&&JSON.stringify(j.errors).includes('Throttled')){await sleep(2500*(a+1));continue;}return j;}catch(e){await sleep(1500*(a+1));}}return null;}
+
+const Q=`query($cursor:String,$q:String!){ products(first:100, after:$cursor, query:$q){ pageInfo{hasNextPage endCursor} edges{node{handle vendor status variants(first:30){edges{node{price position inventoryPolicy availableForSale}}}}} } }`;
+
+async function scanStatus(statusQ){
+ let cursor=null, pages=0, scanned=0, complete=true; const hits=[];
+ while(true){
+ const j=await gql(Q,{cursor,q:statusQ});
+ if(!j||!j.data){ complete=false; break; }
+ const c=j.data.products;
+ for(const e of c.edges){ const n=e.node; if(PJ.test(n.vendor||'')) continue; scanned++;
+ const vs=(n.variants?.edges||[]).map(x=>x.node);
+ const z=vs.filter(v=>parseFloat(v.price)===0 && (v.availableForSale===true || v.inventoryPolicy==='CONTINUE'));
+ if(z.length){ hits.push({h:n.handle,vendor:n.vendor,status:n.status,n:z.length,pos:z.map(v=>v.position)}); }
+ }
+ pages++; if(!c.pageInfo.hasNextPage) break; cursor=c.pageInfo.endCursor;
+ const cost=j.extensions?.cost?.throttleStatus; if(cost&&cost.currentlyAvailable<800) await sleep(1500); else await sleep(220);
+ }
+ return {scanned, pages, complete, hits};
+}
+
+console.log(`=== zero-dollar-orderable-canary (READ-ONLY Admin GraphQL, $0) ===`);
+const act=await scanStatus('status:active');
+const dft=await scanStatus('status:draft');
+const complete = act.complete && dft.complete;
+console.log(`active: scanned ${act.scanned} (${act.pages}p, complete=${act.complete}) | orderable-$0 hits ${act.hits.length}`);
+console.log(`draft: scanned ${dft.scanned} (${dft.pages}p, complete=${dft.complete}) | orderable-$0 hits ${dft.hits.length}`);
+
+// coverage gate (negative control): the known RL $0 set must be reproduced
+const rlActive=act.hits.filter(h=>/ralph/i.test(h.vendor||'')).length;
+const coverageOk = rlActive>=100;
+console.log(`\nCOVERAGE GATE: active Ralph Lauren orderable-$0 = ${rlActive} (c68/c69 = 111) → ${coverageOk?'PASS':'FAIL (scan may be blind)'}`);
+
+// vendor/status breakdown
+function vb(hits){ const m={}; hits.forEach(h=>{const k=`${h.vendor}|${h.status}`; m[k]=(m[k]||0)+1;}); return Object.entries(m).sort((a,b)=>b[1]-a[1]).slice(0,12); }
+console.log(`\nactive orderable-$0 by vendor:`); vb(act.hits).forEach(([k,n])=>console.log(` ${k}: ${n}`));
+if(dft.hits.length){ console.log(`DRAFT orderable-$0 (latent activation landmine) by vendor:`); vb(dft.hits).forEach(([k,n])=>console.log(` ${k}: ${n}`)); }
+
+const alerts=[];
+if(!complete) alerts.push(`INCONCLUSIVE: scan did not complete (active ${act.complete}, draft ${dft.complete}) — a "0 found" cannot be trusted`);
+else {
+ if(!coverageOk) alerts.push(`COVERAGE FAIL: RL orderable-$0=${rlActive} (<100) — scan likely blind, do not trust`);
+ if(act.hits.length>0) alerts.push(`LIVE FREE-CHECKOUT: ${act.hits.length} ACTIVE products with an orderable zero-dollar variant (P1 — gated reprice pending)`);
+ if(dft.hits.length>0) alerts.push(`LATENT: ${dft.hits.length} DRAFT products with an orderable zero-dollar variant (would go live-free on activation)`);
+}
+let verdict;
+if(!complete || (complete && !coverageOk)) verdict='INCONCLUSIVE';
+else if(act.hits.length>0) verdict='ALERT';
+else verdict='HEALTHY';
+console.log(`\n=== VERDICT: ${verdict} ===`);
+if(alerts.length) alerts.forEach(a=>console.log(` 🔴 ${a}`)); else console.log(` 🟢 0 active orderable zero-dollar variants (coverage gate passed)`);
+
+fs.mkdirSync(DATA_DIR,{recursive:true});
+const result={ts:new Date().toISOString(),verdict,activeScanned:act.scanned,draftScanned:dft.scanned,complete,coverageOk,rlActive,activeHits:act.hits.length,draftHits:dft.hits.length,activeByVendor:vb(act.hits),draftByVendor:vb(dft.hits),alerts};
+fs.writeFileSync('/tmp/zero-dollar-orderable-canary.json',JSON.stringify({...result,activeSample:act.hits.slice(0,20),draftSample:dft.hits.slice(0,20)},null,2));
+fs.writeFileSync(path.join(DATA_DIR,'latest.json'),JSON.stringify(result,null,2)); // heartbeat for meta-watchdog
+console.log(`\nwrote /tmp/zero-dollar-orderable-canary.json + data/latest.json`);
+process.exitCode = verdict==='HEALTHY'?0 : verdict==='INCONCLUSIVE'?2 : 3;
← 423d741 cycle 77: officer REVISE sign-off appended (6 hardening item
·
back to Dw Yolo Loop
·
cycle 78: harden zero-dollar canary per officer REVISE — (1) 43256c6 →