← back to Ticket System
auto-save: 2026-07-30T09:16:33 (1 files) — tk10002-resku/
a8381131cf0a0f883985572254c9f07f38186c28 · 2026-07-30 09:16:34 -0700 · Steve Abrams
Files touched
A tk10002-resku/build-proposals.mjsA tk10002-resku/probe-variants.mjs
Diff
commit a8381131cf0a0f883985572254c9f07f38186c28
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Thu Jul 30 09:16:34 2026 -0700
auto-save: 2026-07-30T09:16:33 (1 files) — tk10002-resku/
---
tk10002-resku/build-proposals.mjs | 184 ++++++++++++++++++++++++++++++++++++++
tk10002-resku/probe-variants.mjs | 20 +++++
2 files changed, 204 insertions(+)
diff --git a/tk10002-resku/build-proposals.mjs b/tk10002-resku/build-proposals.mjs
new file mode 100644
index 00000000..98d10468
--- /dev/null
+++ b/tk10002-resku/build-proposals.mjs
@@ -0,0 +1,184 @@
+#!/usr/bin/env node
+/* READ-ONLY. Build re-SKU proposals for the 23 live false-collision groups and
+ verify each proposed variant SKU is collision-free under the EXACT guard logic
+ (skuTakenOnActiveProduct: case-folded UPPER compare over variant_sku/sku/dw_sku
+ against any NON-ARCHIVED product, base + base-% suffix). No writes. */
+import fs from 'fs';
+import pg from 'pg';
+const { Pool } = pg;
+const pool = new Pool({ connectionString: 'postgresql://dw_admin@127.0.0.1:5432/dw_unified' });
+
+// Mirror of the hardened guard (sku-registry.js). Returns {taken, byProductId, byStatus, matchedSku}.
+async function skuTaken(dwSku, ignoreVariantId=null) {
+ if (!dwSku) return { taken:false };
+ const { rows } = await pool.query(
+ `SELECT id, shopify_id, status, variant_sku, sku, dw_sku
+ FROM shopify_products
+ WHERE (UPPER(variant_sku)=UPPER($1) OR UPPER(variant_sku) LIKE UPPER($2)
+ OR UPPER(sku)=UPPER($1) OR UPPER(sku) LIKE UPPER($2)
+ OR UPPER(dw_sku)=UPPER($1) OR UPPER(dw_sku) LIKE UPPER($2))
+ AND UPPER(COALESCE(status,''))<>'ARCHIVED'`,
+ [dwSku, dwSku + '-%']);
+ // The mirror is 1-row-per-product; the colliding product's own row will legitimately
+ // match. We only care about a match that is NOT the product we're fixing.
+ const foreign = rows.filter(r => String(r.shopify_id) !== String(ignoreVariantId));
+ if (foreign.length) {
+ const r = foreign[0];
+ return { taken:true, byProductId:r.shopify_id, byStatus:r.status,
+ matchedSku:r.variant_sku||r.sku||r.dw_sku, hits:foreign.length };
+ }
+ return { taken:false };
+}
+
+/* Each group: colliding variant SKU (the ONE stray/shared variant SKU that collides),
+ members = [{gid, ownBase, proposedVariantSku, title}].
+ ownBase = the product's own correct base (from its 15 non-colliding variants).
+ For STRAY groups the proposed SKU = ownBase + the correct variant suffix.
+ For FULL-DUP groups both members share the base internally → REVIEW (needs color suffix). */
+const groups = [
+ // ---- STRAY single-variant collisions (fix = re-SKU that one variant to own base) ----
+ { key:'Dig-1100-25-type-2-vinyl-Sample', class:'STRAY',
+ members:[
+ { gid:'7664512794675', ownBase:'DIG-1952-25', variantSuffix:'-type-2-vinyl-Sample', proposed:'DIG-1952-25-type-2-vinyl-Sample', title:'Classic Cherries Jubilee' },
+ { gid:'7664512827443', ownBase:'Vin-1100-25', variantSuffix:'-type-2-vinyl-Sample', proposed:'Vin-1100-25-type-2-vinyl-Sample', title:'Classic green floral vintage' },
+ ]},
+ { key:'Dig-171053-25-type-2-vinyl-Sample', class:'STRAY',
+ members:[
+ { gid:'7664490512435', ownBase:'DIG-171053-25', variantSuffix:'-type-2-vinyl-Sample', proposed:'DIG-171053-25-type-2-vinyl-Sample', title:"Charlotte's blush pink" },
+ { gid:'7664490545203', ownBase:'DIG-171052-25', variantSuffix:'-type-2-vinyl-Sample', proposed:'DIG-171052-25-type-2-vinyl-Sample', title:"Charlotte's black & blush" },
+ ]},
+ { key:'Dig-2400089-25-type-2-vinyl-Sample', class:'STRAY',
+ members:[
+ { gid:'7664462233651', ownBase:'DIG-2400089-25', variantSuffix:'-type-2-vinyl-Sample', proposed:'DIG-2400089-25-type-2-vinyl-Sample', title:'Blushed Marble Mural' },
+ { gid:'7664462364723', ownBase:'DIG-2400085-25', variantSuffix:'-type-2-vinyl-Sample', proposed:'DIG-2400085-25-type-2-vinyl-Sample', title:'Blush Tide Mural' },
+ ]},
+ { key:'Dig-240407-25-type-2-vinyl-Sample', class:'STRAY',
+ members:[
+ { gid:'7664493002803', ownBase:'DIG-2400065-25', variantSuffix:'-type-2-vinyl-Sample', proposed:'DIG-2400065-25-type-2-vinyl-Sample', title:'Minimalist Simple Leaves' },
+ { gid:'7664584884275', ownBase:'DIG-74118-25', variantSuffix:'-type-2-vinyl-Sample', proposed:'DIG-74118-25-type-2-vinyl-Sample', title:'Fairfield Happy Days 1970s' },
+ ]},
+ { key:'Dig-240416-25-type-2-vinyl-Sample', class:'STRAY',
+ members:[
+ { gid:'7664512237619', ownBase:'DIG-68000-25', variantSuffix:'-type-2-vinyl-Sample', proposed:'DIG-68000-25-type-2-vinyl-Sample', title:'Boudoir Ladies Pink' },
+ { gid:'7664512663603', ownBase:'DIG-98621-25', variantSuffix:'-type-2-vinyl-Sample', proposed:'DIG-98621-25-type-2-vinyl-Sample', title:'Cello Damask Sepia Beige' },
+ ]},
+ { key:'Dig-25-25-type-2-vinyl-Sample', class:'STRAY',
+ members:[
+ { gid:'7664513646643', ownBase:'DIG_10082002-25', variantSuffix:'-type-2-vinyl-Sample', proposed:'DIG_10082002-25-type-2-vinyl-Sample', title:'Deep Reef Mural' },
+ { gid:'7664586686515', ownBase:'DIG-439241 Sample-25', variantSuffix:'-type-2-vinyl-Sample', proposed:'DIG-439241 Sample-25-type-2-vinyl-Sample', title:'Thug Stripe Cream Gun', note:'own base literally contains " Sample" (space) — ugly but unique; REVIEW-soft' },
+ ]},
+ { key:'Dig-40021-25-type-2-vinyl-Sample', class:'STRAY',
+ members:[
+ { gid:'7664512073779', ownBase:'DIG-40021-25', variantSuffix:'-type-2-vinyl-Sample', proposed:'DIG-40021-25-type-2-vinyl-Sample', title:'Bottles by Jordan Carlyle' },
+ { gid:'7664512434227', ownBase:'DIG-85335-25', variantSuffix:'-type-2-vinyl-Sample', proposed:'DIG-85335-25-type-2-vinyl-Sample', title:'Cello Damask Charcoal Grey' },
+ ]},
+ { key:'Dig-240417-25-type-2-vinyl-Sample', class:'STRAY',
+ members:[
+ { gid:'7664489529395', ownBase:'Dig-240416-Sample25', variantSuffix:'-type-2-vinyl-Sample', proposed:'Dig-240416-Sample25-type-2-vinyl-Sample', title:'Calm Elegance Watercolor', note:'own base is Dig-240416-Sample25 (already odd but internally consistent across 15 variants)' },
+ { gid:'7774188404787', ownBase:'Dig-240416-Sample25', variantSuffix:'-type-2-vinyl-Sample', proposed:'Dig-240416-Sample25-type-2-vinyl-Sample', title:'Nocturnal Anthurium', note:'SAME own base as its collision partner → FULL-DUP inside; REVIEW (settlement: Tropical/Anthurium)' },
+ ], overrideClass:'REVIEW-FULLDUP' },
+ { key:'Dig-7700743-25-type-2-vinyl-Sample', class:'STRAY',
+ members:[
+ { gid:'7664488218675', ownBase:'Dig-240426-Sample-25', variantSuffix:'-type-2-vinyl-Sample', proposed:'Dig-240426-Sample-25-type-2-vinyl-Sample', title:'Cranes in the Cherry Blossom (Japonisme)', note:'stray vinyl-sample carries 7700743 base; own base is 240426' },
+ { gid:'7664586915891', ownBase:'Dig-7700743-25', variantSuffix:'-type-2-vinyl-Sample', proposed:'Dig-7700743-25-type-2-vinyl-Sample', title:'Geomino 1970s Geometric' },
+ ]},
+ { key:'Dig-770089-25-type-2-vinyl-Sample', class:'STRAY',
+ members:[
+ { gid:'7664584851507', ownBase:'DIG-740108-25', variantSuffix:'-type-2-vinyl-Sample', proposed:'DIG-740108-25-type-2-vinyl-Sample', title:'Fitzwilliam 1970s Pop Art' },
+ { gid:'7664636100659', ownBase:'DIG-435086-25', variantSuffix:'-type-2-vinyl-Sample', proposed:'DIG-435086-25-type-2-vinyl-Sample', title:'Willington 1940s Chinoiserie' },
+ ]},
+
+ // ---- FULL-DUP internal collisions (both members share the SAME base internally) → REVIEW ----
+ { key:'-25-gold-2x27', class:'REVIEW-FULLDUP',
+ members:[
+ { gid:'7664591568947', ownBase:'-25', title:"Fiona's 1920's Floral", note:'EMPTY base "-25" across ALL variants — broken/empty prefix; needs a real DW SKU minted' },
+ { gid:'7664592289843', ownBase:'-25', title:"Hilly's Hippo Vintage 1970's", note:'EMPTY base "-25" across ALL variants — broken/empty prefix; needs a real DW SKU minted' },
+ ]},
+ { key:'AIDIG-4350142-25-gold-2x27_Flame_Scarlet_Orange_&_Autumn_Glaze_Orange', class:'REVIEW-FULLDUP',
+ members:[
+ { gid:'7675395145779', ownBase:'AIDIG-4350142-25', title:"Piermont 1940's Retro", note:'entire AIDIG-4350142 variant set shared with partner; needs color/name-suffix or new base' },
+ { gid:'7675395178547', ownBase:'AIDIG-4350142-25', title:"Piermont 1940's Cody Retro", note:'entire AIDIG-4350142 variant set shared with partner' },
+ ]},
+ { key:'DIG-2400069-25-type-2-vinyl-2x27', class:'REVIEW-FULLDUP',
+ members:[
+ { gid:'7664493068339', ownBase:'DIG-2400069-25', title:'Ethereal Dreamy White Clouds', note:'both members carry DIG-2400069-25 across ALL variants' },
+ { gid:'7664493101107', ownBase:'DIG-2400069-25', title:'Hand-Drawn White and Green Stripes' },
+ ]},
+ { key:'DIG-2400093', class:'REVIEW-FULLDUP',
+ members:[
+ { gid:'7589565300787', ownBase:'DIG-2400093', title:'Playform Mural', note:'2-variant roll+sample; both share DIG-2400093 / DIG-2400093-SAMPLE' },
+ { gid:'7589588402227', ownBase:'DIG-2400093', title:'Watercolor Dots Mural' },
+ ]},
+ { key:'Dig-240420', class:'REVIEW-FULLDUP',
+ members:[
+ { gid:'7502400847923', ownBase:'Dig-240420', title:'Golden Peaks Majestic Mural', note:'2-variant roll+sample; both share Dig-240420 / Dig-240420-Sample' },
+ { gid:'7502401634355', ownBase:'Dig-240420', title:'Lavender Mist Peaks Mural' },
+ ]},
+ { key:'DIG-320255-mural', class:'REVIEW-FULLDUP',
+ members:[
+ { gid:'7547203026995', ownBase:'DIG-320255', title:'Royal Lady Frames Gold Mural Pop Art', note:'dw_skus already distinct (320255 vs 320256); only the roll variant_sku DIG-320255-mural is shared. Straightforward per-variant re-SKU but base collides w/ existing 320255 sample → REVIEW-soft' },
+ { gid:'7548957392947', ownBase:'DIG-320256', title:'Royal Lady Frames Gold Mural Half Drop' },
+ ]},
+ { key:'DIG-5531287-25-type-2-vinyl-2x27', class:'REVIEW-FULLDUP',
+ members:[
+ { gid:'7664593338419', ownBase:'DIG-5531287-25', title:"Wanda's Wandering Wisteria (Mid-Century)", note:'both members carry DIG-5531287-25 across ALL variants' },
+ { gid:'7664593371187', ownBase:'DIG-5531287-25', title:"Wanda's Wandering Wisteria (Floral)" },
+ ]},
+ { key:'DIG-553801-25-type-2-vinyl-2x27', class:'REVIEW-FULLDUP',
+ members:[
+ { gid:'7664593633331', ownBase:'DIG-553801-25', title:"Rosie's Roses (Traditional)", note:'both members carry DIG-553801-25 across ALL variants — likely genuine same-design near-dup; SKU-analyst call' },
+ { gid:'7664629514291', ownBase:'DIG-553801-25', title:"Rosie's Roses 1950's" },
+ ]},
+ { key:'DIG-762124-Sample-25-type-2-vinyl-2x27', class:'REVIEW-FULLDUP',
+ members:[
+ { gid:'7664598614067', ownBase:'DIG-762124-Sample-25', title:'Gregorious Gulls Yellow Coastal', note:'both share DIG-762124-Sample-25 across variants; the one stray Type2Vinyl variant is Dig-762124-25-type-2-vinyl-Sample (missing -Sample-). Two distinct designs → color-suffix REVIEW' },
+ { gid:'7664616800307', ownBase:'DIG-762124-Sample-25', title:'Zepellin Zebras Yellow' },
+ ]},
+ { key:'Dig-770064-25-type-2-vinyl-2x27', class:'REVIEW-FULLDUP',
+ members:[
+ { gid:'7664638427187', ownBase:'Dig-770064-25', title:"Hanover 1970's Geometric", note:'both members carry Dig-770064-25 across ALL variants' },
+ { gid:'7664638459955', ownBase:'Dig-770064-25', title:'Bailey Bottles of Booze 1970s' },
+ ]},
+ { key:'DIG-977081-Sample-25-type-2-vinyl-2x27', class:'REVIEW-FULLDUP',
+ members:[
+ { gid:'7664592814131', ownBase:'Dig-977081-25', title:"Riley's Rainbow Of Retro", note:'both members carry Dig-977081-25 across ALL variants' },
+ { gid:'7664592846899', ownBase:'Dig-977081-25', title:'Fremont 1970S Fern' },
+ ]},
+
+ // ---- 3-member group ----
+ { key:'DIG-240434-vinyl-2x1-sample', class:'REVIEW-FULLDUP',
+ members:[
+ { gid:'7663707619379', ownBase:'DIG-240434', title:'Rosé Luxe Mural', note:'THREE products all carry DIG-240434-* across every variant (peel/gold/silver/vinyl). dw_sku suffix -peel-sample vs -peel-Sample only differs by case. Needs 2 of 3 re-based (color-suffix) — SKU-analyst call' },
+ { gid:'7663711354931', ownBase:'DIG-240434', title:'Soft Nude Gradient Mural' },
+ { gid:'7663711682611', ownBase:'DIG-240434', title:'Watercolor Dots Mural' },
+ ]},
+
+ // ---- MEMO-SAMPLE TWIN route-out (NOT re-SKU) ----
+ { key:'DIG-4350959-Periwinkle - Sample', class:'ROUTE-MEMO-TWIN',
+ members:[
+ { gid:'6707947208755', ownBase:'DIG-4350959-Periwinkle', title:"Cici's Periwinkle Traditional", note:'REAL product (vendor Architectural Wallcoverings, multi/sample variant, CONTINUE)' },
+ { gid:'7801847447603', ownBase:null, title:"Cici's Periwinkle Wallcovering | DW Bespoke Studios", note:'MEMO-SAMPLE TWIN: single Default-Title variant, inventoryPolicy=DENY, dw_sku NULL, vendor "DW Bespoke Studios", created 2026-03-23. Route to null-Sample/memo-sample PR merge project — do NOT mint (minting orphans the twin).' },
+ ]},
+];
+
+// Verify each proposed corrected SKU (STRAY class) is collision-free under the guard.
+const out = [];
+for (const g of groups) {
+ const cls = g.overrideClass || g.class;
+ for (const m of g.members) {
+ let verdict = null;
+ if (cls === 'STRAY' && m.proposed) {
+ const chk = await skuTaken(m.proposed, m.gid);
+ verdict = chk.taken
+ ? `GUARD-BLOCKED (matched ${chk.matchedSku} on product ${chk.byProductId} [${chk.byStatus}], ${chk.hits} hit(s))`
+ : 'GUARD-CLEAR';
+ }
+ out.push({ group:g.key, class:cls, gid:m.gid, title:m.title,
+ ownBase:m.ownBase, proposed:m.proposed||null, verdict, note:m.note||null });
+ }
+}
+console.log(JSON.stringify({ generated_at:new Date().toISOString(), n_groups:groups.length,
+ n_products:out.length, rows:out }, null, 2));
+fs.writeFileSync('/Users/macstudio3/Projects/ticket-system/tk10002-resku/proposals.json',
+ JSON.stringify({ generated_at:new Date().toISOString(), rows:out }, null, 2));
+await pool.end();
diff --git a/tk10002-resku/probe-variants.mjs b/tk10002-resku/probe-variants.mjs
new file mode 100644
index 00000000..411eb94f
--- /dev/null
+++ b/tk10002-resku/probe-variants.mjs
@@ -0,0 +1,20 @@
+#!/usr/bin/env node
+// READ-ONLY: pull live Shopify variant structure for a list of product ids.
+import fs from 'fs';
+const envTxt = fs.readFileSync('/Users/macstudio3/Projects/secrets-manager/.env','utf8');
+const TOKEN = (envTxt.match(/^SHOPIFY_ADMIN_TOKEN=(.*)$/m)||[])[1];
+const DOMAIN = 'designer-laboratory-sandbox.myshopify.com';
+const ids = process.argv.slice(2);
+const q = (id) => `{ product(id:"gid://shopify/Product/${id}"){ title status handle variants(first:20){ nodes{ title sku price inventoryPolicy } } } }`;
+for (const id of ids) {
+ const r = await fetch(`https://${DOMAIN}/admin/api/2024-10/graphql.json`, {
+ method:'POST',
+ headers:{'X-Shopify-Access-Token':TOKEN,'Content-Type':'application/json'},
+ body: JSON.stringify({query:q(id)})
+ });
+ const d = await r.json();
+ const p = d?.data?.product;
+ if (!p){ console.log(`=== ${id} === (not found)`, JSON.stringify(d).slice(0,200)); continue; }
+ console.log(`=== ${id} === ${p.title} | ${p.status}`);
+ for (const v of p.variants.nodes) console.log(` ${v.title} | sku=${JSON.stringify(v.sku)} | $${v.price} | ${v.inventoryPolicy}`);
+}
← 175fdf24 TK-10002 Arte: sample-only gate applied to 45 DWC-Arte-* (ro
·
back to Ticket System
·
TK-10002 re-SKU plan: 23 live false-collision groups (10 STR 935fe1a2 →