[object Object]

← back to Designerwallcoverings

TK-11750: fix re-run guard — match rehosted image by basename not source domain

0b4294299f5408a9de553c252794b1d4789fa102 · 2026-09-15 11:23:36 -0700 · Steve Abrams

productCreateMedia rehosts on Shopify CDN, so the assets.mayaromanoff.com
domain check never matched and re-ran a duplicate on the canary product.
Now guards on the real image basename. (Duplicate on maya-50039 already cleaned.)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0145uBwAMQGsYkhx1rrDUfbW

Files touched

Diff

commit 0b4294299f5408a9de553c252794b1d4789fa102
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Tue Sep 15 11:23:36 2026 -0700

    TK-11750: fix re-run guard — match rehosted image by basename not source domain
    
    productCreateMedia rehosts on Shopify CDN, so the assets.mayaromanoff.com
    domain check never matched and re-ran a duplicate on the canary product.
    Now guards on the real image basename. (Duplicate on maya-50039 already cleaned.)
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_0145uBwAMQGsYkhx1rrDUfbW
---
 scripts/maya-romanoff-logohero-fix/apply.mjs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scripts/maya-romanoff-logohero-fix/apply.mjs b/scripts/maya-romanoff-logohero-fix/apply.mjs
index f72d82a..9c392d3 100644
--- a/scripts/maya-romanoff-logohero-fix/apply.mjs
+++ b/scripts/maya-romanoff-logohero-fix/apply.mjs
@@ -81,7 +81,10 @@ for (const row of rows) {
   if (!p) { console.log(`  ✗ ${row.dw_sku}: product not found`); failed++; continue; }
   const media = p.media?.nodes || [];
   const hasLogo = media.some(m => m.id === row.logo_media_id);
-  const hasReal = media.some(m => (m.image?.url || '').includes('assets.mayaromanoff.com'));
+  // productCreateMedia REHOSTS the source on Shopify's CDN (keeping the filename),
+  // so guard on the real image's BASENAME, not the mayaromanoff.com domain.
+  const realBase = row.real_url.split('/').pop().replace(/\.[a-z]+$/i, '');
+  const hasReal = media.some(m => (m.image?.url || '').includes(realBase));
   if (hasReal) { console.log(`  ⏭  ${row.dw_sku}: already has a mayaromanoff.com image — SKIP (guard)`); skipped++; continue; }
   if (!hasLogo) { console.log(`  ⏭  ${row.dw_sku}: logo media ${row.logo_media_id} no longer present — SKIP (state changed)`); skipped++; continue; }
 

← 0785058 auto-data-snapshot: 2026-09-15T09:48:56 (1 data files) — dat  ·  back to Designerwallcoverings  ·  auto-data-snapshot: 2026-09-15T15:48:53 (1 data files) — dat 9fc1c16 →