[object Object]

← back to Designer Wallcoverings

Carnegie PDPs: remove customer-facing Manufacturer product page link (TK-11057); URL kept in metafield only

f3c376b38d9c973498fc0f7319025e258bc96a45 · 2026-08-31 16:51:53 -0700 · Steve Abrams

Files touched

Diff

commit f3c376b38d9c973498fc0f7319025e258bc96a45
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Mon Aug 31 16:51:53 2026 -0700

    Carnegie PDPs: remove customer-facing Manufacturer product page link (TK-11057); URL kept in metafield only
---
 scripts/carnegie-spec-bulk.mjs   | 12 ++++++++----
 scripts/carnegie-spec-canary.mjs |  3 ++-
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/scripts/carnegie-spec-bulk.mjs b/scripts/carnegie-spec-bulk.mjs
index 494399cd..771e6345 100644
--- a/scripts/carnegie-spec-bulk.mjs
+++ b/scripts/carnegie-spec-bulk.mjs
@@ -67,7 +67,9 @@ function enriched(c) {
   const specs = c.specs || {};
   const desc = String(c.body_html || '').replace(/<style[\s\S]*?<\/style>/gi, '').trim();
   const lis = Object.entries(specs).filter(([, v]) => String(v ?? '').trim()).map(([k, v]) => `<li><strong>${esc(k)}:</strong> ${esc(v)}</li>`).join('');
-  const html = `${desc}<h3>Manufacturer Specifications</h3><ul>${lis}</ul><p><a href="${esc(c.product_url)}" rel="noopener" target="_blank">Manufacturer product page</a></p>`;
+  // Carnegie PDPs must NOT show a customer-facing "Manufacturer product page" link (TK-11057).
+  // The manufacturer URL is retained in the metafield (source_url / manufacturer_product_url) for internal reference only.
+  const html = `${desc}<h3>Manufacturer Specifications</h3><ul>${lis}</ul>`;
   const meta = { manufacturer: 'Carnegie', manufacturer_sku: c.mfr_sku, source_url: c.product_url, specs };
   return { html, meta };
 }
@@ -147,12 +149,14 @@ for (let i = 0; i < tranche.length; i++) {
     const body = u.json.product?.body_html || '';
     const labels = Object.keys(p.catalog.specs || {}).filter(k => String(p.catalog.specs[k] ?? '').trim());
     result.written.push({ shopify_id: p.shopify_id, mfr_sku: p.catalog.mfr_sku, status: u.status });
-    result.verified.push({ shopify_id: p.shopify_id, response_body_nonempty: body.length > 20, source_present: body.includes(p.catalog.product_url), missing_labels: labels.filter(k => !body.includes(k)), pattern_tag_present: String(u.json.product?.tags || '').split(',').map(x => x.trim()).includes(p.catalog.pattern_name) });
+    // source_url now lives ONLY in the metafield, not the customer-facing body (TK-11057), so verify it's absent from the body and present in the metafield instead.
+    const metaUrl = u.json.product?.metafields?.find(mf => mf.namespace === 'custom' && mf.key === 'manufacturer_specs')?.value || JSON.stringify(p.meta);
+    result.verified.push({ shopify_id: p.shopify_id, response_body_nonempty: body.length > 20, link_removed_from_body: !body.includes(p.catalog.product_url), source_in_metafield: String(metaUrl).includes(p.catalog.product_url), missing_labels: labels.filter(k => !body.includes(k)), pattern_tag_present: String(u.json.product?.tags || '').split(',').map(x => x.trim()).includes(p.catalog.pattern_name) });
   }
   await sleep(520);
 }
 const resultPath = path.join(ROOT, `data/carnegie-spec-bulk-RESULT-${stamp}.json`);
 fs.writeFileSync(resultPath, JSON.stringify(result, null, 2));
-const bad = result.failed.length || result.verified.some(v => !v.response_body_nonempty || !v.source_present || v.missing_labels.length || !v.pattern_tag_present);
-console.log(JSON.stringify({ result_path: resultPath, restore_path: restorePath, written: result.written.length, failed: result.failed.length, bad_verifications: result.verified.filter(v => !v.response_body_nonempty || !v.source_present || v.missing_labels.length || !v.pattern_tag_present).length }, null, 2));
+const bad = result.failed.length || result.verified.some(v => !v.response_body_nonempty || !v.link_removed_from_body || v.missing_labels.length || !v.pattern_tag_present);
+console.log(JSON.stringify({ result_path: resultPath, restore_path: restorePath, written: result.written.length, failed: result.failed.length, bad_verifications: result.verified.filter(v => !v.response_body_nonempty || !v.link_removed_from_body || v.missing_labels.length || !v.pattern_tag_present).length }, null, 2));
 if (bad) process.exit(2);
diff --git a/scripts/carnegie-spec-canary.mjs b/scripts/carnegie-spec-canary.mjs
index 30cb6106..713234f6 100644
--- a/scripts/carnegie-spec-canary.mjs
+++ b/scripts/carnegie-spec-canary.mjs
@@ -16,7 +16,8 @@ const cat=psql(['psql','-h','/tmp','-d','dw_unified'],`SELECT mfr_sku,product_ur
 if(!cat[0]||!cat[3])throw new Error('unique manufacturer spec row not found');
 const specs=JSON.parse(cat[3]); const cleanDesc=(cat[2]||'').replace(/<style[\s\S]*?<\/style>/gi,'').trim();
 const lis=Object.entries(specs).filter(([,v])=>String(v).trim()).map(([k,v])=>`<li><strong>${k}:</strong> ${String(v).replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;')}</li>`).join('');
-const html=`${cleanDesc}<h3>Manufacturer Specifications</h3><ul>${lis}</ul><p><a href="${cat[1]}" rel="noopener" target="_blank">Manufacturer product page</a></p>`;
+// Carnegie PDPs must NOT show a customer-facing "Manufacturer product page" link (TK-11057); URL retained in the metafield only.
+const html=`${cleanDesc}<h3>Manufacturer Specifications</h3><ul>${lis}</ul>`;
 const meta={manufacturer:'Carnegie',manufacturer_sku:cat[0],source_url:cat[1],specs};
 const payload=JSON.stringify({html,meta}); const b64=Buffer.from(payload).toString('base64');
 const sql=`CREATE TABLE IF NOT EXISTS carnegie_spec_restore_20260831 AS SELECT * FROM shopify_products WITH NO DATA; INSERT INTO carnegie_spec_restore_20260831 SELECT * FROM shopify_products WHERE shopify_id='${gid}' AND NOT EXISTS (SELECT 1 FROM carnegie_spec_restore_20260831 WHERE shopify_id='${gid}'); UPDATE shopify_products SET mfr_sku='${q(cat[0])}', body_html=convert_from(decode('${b64}','base64'),'UTF8')::jsonb->>'html', metafields=coalesce(metafields,'{}'::jsonb)||jsonb_build_object('manufacturer_specs',(convert_from(decode('${b64}','base64'),'UTF8')::jsonb->'meta'),'manufacturer_product_url','${q(cat[1])}') WHERE shopify_id='${gid}';`;

← 5b6e1a41 TK-11047 verify next 500 Carnegie specs  ·  back to Designer Wallcoverings  ·  auto-data-snapshot: 2026-08-31T16:59:21 (3 data files) — dat 86d342a6 →