[object Object]

← back to Designer Wallcoverings

schu-activate: normalize mixed pid format (bare-id vs full-gid) + order by numeric pid

e5cc2b10eefe3053cf66c31f6c44bcbad087b12d · 2026-06-11 13:18:26 -0700 · SteveStudio2

Catalog shopify_product_id mixes bare numeric and full gid://; strip-then-prepend avoids
double-gid invalid-id. Order by numeric pid so test batches hit the newest-created DRAFTs.
Test batch of 50 activated live, 0 failures (price+image+title gate passed).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Files touched

Diff

commit e5cc2b10eefe3053cf66c31f6c44bcbad087b12d
Author: SteveStudio2 <stevestudio2@SteveStudio2s-Mac-Studio.local>
Date:   Thu Jun 11 13:18:26 2026 -0700

    schu-activate: normalize mixed pid format (bare-id vs full-gid) + order by numeric pid
    
    Catalog shopify_product_id mixes bare numeric and full gid://; strip-then-prepend avoids
    double-gid invalid-id. Order by numeric pid so test batches hit the newest-created DRAFTs.
    Test batch of 50 activated live, 0 failures (price+image+title gate passed).
    
    Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---
 shopify/scripts/schu-activate.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/shopify/scripts/schu-activate.js b/shopify/scripts/schu-activate.js
index 769c297f..326374b7 100644
--- a/shopify/scripts/schu-activate.js
+++ b/shopify/scripts/schu-activate.js
@@ -32,14 +32,14 @@ async function gqlRetry(q, v) { for (let a = 0; a < 5; a++) { const r = await gq
   if (!TOKEN) { console.error('no token'); process.exit(1); }
   const rows = psql(`SELECT shopify_product_id FROM schumacher_catalog
     WHERE shopify_product_id IS NOT NULL AND shopify_product_id<>'' AND cost>0
-    AND NOT coalesce(excluded,false) ORDER BY shopify_product_id LIMIT ${LIMIT};`).split('\n').filter(Boolean);
+    AND NOT coalesce(excluded,false) ORDER BY (regexp_replace(shopify_product_id,'.*/',''))::bigint DESC LIMIT ${LIMIT};`).split('\n').filter(Boolean);
   console.log(`candidate Schumacher products (costed, not excluded): ${rows.length} | mode: ${COMMIT ? 'COMMIT' : 'DRY'}`);
 
   const Q = `query($id:ID!){product(id:$id){id status title featuredImage{url} variants(first:2){edges{node{price}}}}}`;
   const mUpd = `mutation($input:ProductInput!){productUpdate(input:$input){product{id status} userErrors{field message}}}`;
   let pass = 0, skip = 0, activated = 0, fail = 0, already = 0, n = 0;
   for (const pid of rows) {
-    const gid = `gid://shopify/Product/${pid}`;
+    const gid = `gid://shopify/Product/${String(pid).replace(/.*\//, '')}`; // normalize: catalog mixes bare-id + full-gid
     const r = await gqlRetry(Q, { id: gid });
     const p = r?.data?.product; if (!p) { skip++; continue; }
     if (p.status === 'ACTIVE') { already++; continue; }

← a49bb8e4 Add schu-activate: gated DRAFT→ACTIVE for Schumacher (price+  ·  back to Designer Wallcoverings  ·  fixer: add --max-price hold (park outliers for manual review 1e8a2ff7 →