[object Object]

← back to Hollywood Import

TK-00109: sanitize single-line metafields (collapse newlines) — fixes Shopify 422 on multi-line fire_rating cert text; completes 20/20 Phase-2 Hollywood canary go-live

427f36188d9d067f6634041eb25ec77331b29ba8 · 2026-07-27 16:17:54 -0700 · Steve Abrams

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

Files touched

Diff

commit 427f36188d9d067f6634041eb25ec77331b29ba8
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Mon Jul 27 16:17:54 2026 -0700

    TK-00109: sanitize single-line metafields (collapse newlines) — fixes Shopify 422 on multi-line fire_rating cert text; completes 20/20 Phase-2 Hollywood canary go-live
    
    Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---
 hollywood-create.mjs | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/hollywood-create.mjs b/hollywood-create.mjs
index aa6a981..2a7ab36 100644
--- a/hollywood-create.mjs
+++ b/hollywood-create.mjs
@@ -48,7 +48,14 @@ function payload(it) {
   // 376 products shipped metafield-less before 2026-07-15 because this step didn't exist.
   const sl = 'single_line_text_field', ml = 'multi_line_text_field';
   const metafields = [];
-  const mf = (namespace, key, value, type = sl) => { const v = scrub(value); if (v) metafields.push({ namespace, key, type, value: v }); };
+  // single_line_text_field metafields reject newlines (Shopify 422 "must be a single line text
+  // string") — collapse whitespace for sl values; ml (multi_line) keeps its newlines. TK-00109
+  // canary caught this on fire_rating cert text (8/20 creates failed before this).
+  const mf = (namespace, key, value, type = sl) => {
+    let v = scrub(value);
+    if (type === sl) v = v.replace(/\s+/g, ' ').trim();
+    if (v) metafields.push({ namespace, key, type, value: v });
+  };
   mf('global', 'width', it.width ? `${it.width}"` : '');
   if (/lb\b/i.test(String(it.weight || ''))) mf('global', 'v_prods_weight', (String(it.weight).match(/[\d.]+/) || [])[0]);
   mf('global', 'unit_of_measure', `Sold Per ${unit}`);

← 44cb1a0 TK-00109: harden wallcovering canary per contrarian gate — e  ·  back to Hollywood Import  ·  auto-save: 2026-07-27T16:21:58 (1 files) — hollywood-create- 15afeb3 →