[object Object]

← back to Justin David Pricing 2026

Revert weight backfill: contrarian caught that grams=checkout-shipping on a weight-based store (not feed-only); restored all 3946 variants to prior 0g, 0 errors. GMC weight fix must go feed-only (gmc-weight-override.js) or shipping-config — both gated

31fe685671756883625d798679b791e004e85b35 · 2026-07-16 13:12:55 -0700 · Steve Abrams

Files touched

Diff

commit 31fe685671756883625d798679b791e004e85b35
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Thu Jul 16 13:12:55 2026 -0700

    Revert weight backfill: contrarian caught that grams=checkout-shipping on a weight-based store (not feed-only); restored all 3946 variants to prior 0g, 0 errors. GMC weight fix must go feed-only (gmc-weight-override.js) or shipping-config — both gated
---
 revert_weights.mjs | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/revert_weights.mjs b/revert_weights.mjs
new file mode 100644
index 0000000..cc0596f
--- /dev/null
+++ b/revert_weights.mjs
@@ -0,0 +1,30 @@
+// revert_weights.mjs — restore the prior variant weights the backfill changed.
+// Reads dw_unified.shopify_weight_backfill and PUTs each variant back to prior_grams (all 0).
+// Undoes the unapproved checkout-shipping-charge change. Idempotent + resumable.
+import { execFileSync } from 'node:child_process';
+const SHOP = process.env.DW_SHOP || 'designer-laboratory-sandbox.myshopify.com';
+const API = '2024-10';
+const TOKEN = execFileSync('bash', ['-lc',
+  `grep -m1 '^SHOPIFY_ADMIN_TOKEN=' "$HOME/Projects/secrets-manager/.env" | cut -d= -f2- | tr -d '"'"'"'\\r'`],
+  { encoding: 'utf8' }).trim();
+const DBURL = process.env.DW_UNIFIED_URL || 'postgresql:///dw_unified?host=/tmp';
+const DRY = !process.argv.includes('--apply');
+const DELAY = 300;
+const sleep = ms => new Promise(r => setTimeout(r, ms));
+function q(sql){ const o=execFileSync('psql',[DBURL,'-At','-F','\t','-c',sql],{encoding:'utf8',maxBuffer:1<<27}); return o.trim()?o.trim().split('\n').map(r=>r.split('\t')):[]; }
+function qx(sql){ execFileSync('psql',[DBURL,'-q','-c',sql],{stdio:'ignore'}); }
+async function api(method,path,body){ const url=`https://${SHOP}/admin/api/${API}/${path}`;
+  for(let i=0;i<6;i++){ const res=await fetch(url,{method,headers:{'X-Shopify-Access-Token':TOKEN,'Content-Type':'application/json'},body:body?JSON.stringify(body):undefined});
+    if(res.status===429){await sleep(2000*(i+1));continue;} const t=await res.text(); if(!res.ok) throw new Error(`HTTP ${res.status}: ${t.slice(0,120)}`); return t?JSON.parse(t):{}; }
+  throw new Error('429 exhausted'); }
+
+const rows = q(`SELECT variant_id, prior_grams FROM shopify_weight_backfill ORDER BY variant_id`);
+console.log(`[revert] mode=${DRY?'DRY-RUN':'APPLY'} · rows=${rows.length} · restoring prior_grams`);
+let done=0,err=0;
+for (const [vid,prior] of rows){
+  if (DRY){ done++; continue; }
+  try { await api('PUT',`variants/${vid}.json`,{variant:{id:+vid,grams:+prior}});
+    qx(`DELETE FROM shopify_weight_backfill WHERE variant_id=${vid}`); done++; await sleep(DELAY); }
+  catch(e){ err++; if(err<=15) console.log(`  ✗ ${vid}: ${String(e.message).slice(0,100)}`); }
+}
+console.log(`\n[revert] done · restored=${done} errors=${err} · remaining in log=${q('SELECT count(*) FROM shopify_weight_backfill')[0][0]}`);

← 8837012 GMC remediation: variant-aware weight backfill (set_weights.  ·  back to Justin David Pricing 2026  ·  chore: add am_report.sh morning GMC report + finalize sessio 9cdb99a →