[object Object]

← back to Designer Wallcoverings

chore: session-close quality gate — hoist sleep/isSample to module scope, align API_VERSION fallback to 2024-10, version bump

91304e0528d95d753cad1d8b6f29a3c8c0fafc4d · 2026-07-13 08:41:56 -0700 · Steve

Files touched

Diff

commit 91304e0528d95d753cad1d8b6f29a3c8c0fafc4d
Author: Steve <steve@designerwallcoverings.com>
Date:   Mon Jul 13 08:41:56 2026 -0700

    chore: session-close quality gate — hoist sleep/isSample to module scope, align API_VERSION fallback to 2024-10, version bump
---
 package.json                             |  2 +-
 scripts/houston-mfr-fix.js               |  2 +-
 scripts/pr-quote-only-tag.js             |  2 +-
 shopify/package.json                     |  2 +-
 shopify/scripts/sync-shopify-products.js | 11 +++++++----
 5 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/package.json b/package.json
index 031721a1..23c10726 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "designer-wallcoverings",
-  "version": "1.2.1",
+  "version": "1.2.2",
   "description": "Designer Wallcoverings Shopify Management",
   "scripts": {
     "build": "tsc --noEmit",
diff --git a/scripts/houston-mfr-fix.js b/scripts/houston-mfr-fix.js
index a5bbc753..af25008a 100644
--- a/scripts/houston-mfr-fix.js
+++ b/scripts/houston-mfr-fix.js
@@ -54,6 +54,7 @@ function cleanMfr(raw) {
 }
 
 const norm = s => (s || '').toUpperCase().replace(/-/g, '');
+const sleep = ms => new Promise(r => setTimeout(r, ms));
 
 async function main() {
   if (!SHOP || !TOKEN) { console.error('Missing SHOPIFY creds in .env'); process.exit(1); }
@@ -118,7 +119,6 @@ async function main() {
   if (!EXECUTE) { console.log(`\n(dry run — no Shopify writes. re-run with --execute to push)\n`); await pool.end(); return; }
 
   // 2. GATED execution path — throttle-aware + retry + HONEST accounting
-  const sleep = ms => new Promise(r => setTimeout(r, ms));
   let ok = 0, err = 0; const failed = [];
   for (const m of manifest) {
     const gid = m.shopify_id.startsWith('gid://') ? m.shopify_id : `gid://shopify/Product/${m.shopify_id}`;
diff --git a/scripts/pr-quote-only-tag.js b/scripts/pr-quote-only-tag.js
index 0d1d4b57..0a87b4d9 100644
--- a/scripts/pr-quote-only-tag.js
+++ b/scripts/pr-quote-only-tag.js
@@ -18,6 +18,7 @@ require('dotenv').config({ path: path.join(__dirname, '..', '.env') });
 const { mirrorWriteThrough } = require('../shopify/scripts/lib/mirror-write-through');
 
 const EXECUTE = process.argv.includes('--execute');
+const sleep = ms => new Promise(r => setTimeout(r, ms));
 const pool = new Pool({ connectionString: process.env.DATABASE_URL || 'postgresql://dw_admin@127.0.0.1:5432/dw_unified' });
 const SHOP = process.env.SHOPIFY_STORE_DOMAIN, TOKEN = process.env.SHOPIFY_ADMIN_ACCESS_TOKEN;
 const API = process.env.SHOPIFY_ADMIN_API_VERSION || '2024-10';
@@ -45,7 +46,6 @@ async function main() {
   console.log(`  cost       : $0 (local + Shopify Admin API)`);
   if (!EXECUTE) { console.log('\n(dry run — no Shopify writes)\n'); await pool.end(); return; }
 
-  const sleep = ms => new Promise(r => setTimeout(r, ms));
   let ok = 0, err = 0; const failed = [];
   for (const r of rows) {
     const gid = r.shopify_id.startsWith('gid://') ? r.shopify_id : `gid://shopify/Product/${r.shopify_id}`;
diff --git a/shopify/package.json b/shopify/package.json
index 2ede26a8..f8e04539 100644
--- a/shopify/package.json
+++ b/shopify/package.json
@@ -1,6 +1,6 @@
 {
   "name": "dw-metafields-migration",
-  "version": "1.1.0",
+  "version": "1.1.1",
   "description": "Migrate Metafields Manager data to native Shopify product metafields",
   "main": "dist/server.js",
   "scripts": {
diff --git a/shopify/scripts/sync-shopify-products.js b/shopify/scripts/sync-shopify-products.js
index 2d42e073..ef66e353 100644
--- a/shopify/scripts/sync-shopify-products.js
+++ b/shopify/scripts/sync-shopify-products.js
@@ -24,13 +24,19 @@ require('dotenv').config({ path: require('path').join(__dirname, '..', '..', '.e
 // the daily 6am sync silently from 2026-07-07 (mirror froze at 07-06). Use global fetch.
 const fetch = globalThis.fetch;
 
+// classify a variant as a SAMPLE by title OR -sample sku OR (single variant at $4.25 leak)
+const isSample = (v, only) => /sample/i.test(v.title || '') || /-sample$/i.test(v.sku || '') || (only && parseFloat(v.price) === 4.25 && !/sample/i.test(v.title || ''));
+
 const pool = new Pool({
   connectionString: (process.env.DATABASE_URL || 'postgresql://dw_admin@127.0.0.1:5432/dw_unified')
 });
 
 const SHOPIFY_STORE = process.env.SHOPIFY_STORE_DOMAIN || 'designer-laboratory-sandbox.myshopify.com';
 const SHOPIFY_TOKEN = process.env.SHOPIFY_ADMIN_ACCESS_TOKEN || process.env.SHOPIFY_ADMIN_TOKEN;
-const API_VERSION = process.env.SHOPIFY_ADMIN_API_VERSION || '2024-01';
+// Align the fallback with the two write scripts (houston-mfr-fix / pr-quote-only-tag both
+// default '2024-10'). Only bites when .env lacks SHOPIFY_ADMIN_API_VERSION; keeping three
+// files on one version avoids a silent stale-API drift on the token-less path.
+const API_VERSION = process.env.SHOPIFY_ADMIN_API_VERSION || '2024-10';
 
 async function shopifyGraphQL(query, variables = {}) {
   const response = await fetch(
@@ -69,9 +75,6 @@ async function syncProducts(quickMode = false) {
       ADD COLUMN IF NOT EXISTS has_product_variant boolean,
       ADD COLUMN IF NOT EXISTS has_description boolean;
   `);
-  // classify a variant as a SAMPLE by title OR -sample sku OR (single variant at $4.25 leak)
-  const isSample = (v, only) => /sample/i.test(v.title || '') || /-sample$/i.test(v.sku || '') || (only && parseFloat(v.price) === 4.25 && !/sample/i.test(v.title || ''));
-
   // Get last sync time for quick mode
   let lastSync = null;
   if (quickMode) {

← 615561a2 drain self-heal round 2: missing playwright browsers treated  ·  back to Designer Wallcoverings  ·  auto-save: 2026-07-13T08:53:46 (11 files) — DW-Programming/I 7e9160d7 →