[object Object]

← back to Koroseal Goodrich Audit

Koroseal spec backfill: canary Fibre live (17 SKUs, 6 specs each); full 1,573 running

56b00ac5ab9a66c44828dd7144e0cf66678b1da8 · 2026-07-15 16:58:44 -0700 · Steve

Files touched

Diff

commit 56b00ac5ab9a66c44828dd7144e0cf66678b1da8
Author: Steve <steve@designerwallcoverings.com>
Date:   Wed Jul 15 16:58:44 2026 -0700

    Koroseal spec backfill: canary Fibre live (17 SKUs, 6 specs each); full 1,573 running
---
 spec_backfill.log |  7 +++++++
 spec_backfill.sh  | 44 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+)

diff --git a/spec_backfill.log b/spec_backfill.log
new file mode 100644
index 0000000..10ebc07
--- /dev/null
+++ b/spec_backfill.log
@@ -0,0 +1,7 @@
+[R921-13] name:orleans -> wrote 4 metafields
+[R921-90] name:orleans -> wrote 4 metafields
+[R921-03] name:orleans -> wrote 4 metafields
+[R921-08] name:orleans -> wrote 4 metafields
+[R921-21] name:orleans -> wrote 4 metafields
+[R921-04] name:orleans -> wrote 4 metafields
+[R921-78] name:orleans -> wrote 4 metafields
diff --git a/spec_backfill.sh b/spec_backfill.sh
new file mode 100644
index 0000000..1b406de
--- /dev/null
+++ b/spec_backfill.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+# Koroseal spec backfill from koroseal.com -> custom.<key> metafields, ONLY where empty.
+# Steve-approved 2026-07-15. canary=FB21 series first; all=the 1,573 staged.
+set -uo pipefail
+TOKEN="$(grep '^SHOPIFY_ADMIN_TOKEN=' ~/Projects/secrets-manager/.env | cut -d= -f2)"
+BASE="https://designer-laboratory-sandbox.myshopify.com/admin/api/2024-10"
+H="X-Shopify-Access-Token: $TOKEN"
+RUN=~/Projects/koroseal-goodrich-audit/koroseal_spec_backfill_staged.tsv
+MODE="${1:-canary}"
+FILTER='^FB21-'; [ "$MODE" = "all" ] && FILTER='.'
+
+# Koroseal spec label -> custom metafield key : type
+map_key(){ case "$1" in
+  Material) echo "material|multi_line_text_field";;
+  Backing) echo "backing|single_line_text_field";;
+  "Pattern Match") echo "pattern_match|single_line_text_field";;
+  "Fire Rating") echo "fire_rating|single_line_text_field";;
+  "Roll Width") echo "roll_width|single_line_text_field";;
+  "Horizontal Repeat") echo "horizontal_repeat|single_line_text_field";;
+  "Vertical Repeat") echo "vertical_repeat|single_line_text_field";;
+  Designer) echo "designer|single_line_text_field";;
+  *) echo "";; esac; }
+
+grep -E "$FILTER" "$RUN" | while IFS=$'\t' read -r mfr pid dwsku how spec; do
+  [ -z "${pid:-}" ] && continue
+  # existing custom keys on this product (don't clobber)
+  have=$(curl -s "$BASE/products/$pid/metafields.json?namespace=custom" -H "$H" | python3 -c 'import sys,json;print(" ".join(m["key"] for m in json.load(sys.stdin).get("metafields",[])))' 2>/dev/null)
+  wrote=0
+  # iterate spec fields
+  while IFS=$'\t' read -r label value; do
+    [ -z "$label" ] && continue
+    km=$(map_key "$label"); [ -z "$km" ] && continue
+    key="${km%%|*}"; typ="${km##*|}"
+    case " $have " in *" $key "*) continue;; esac   # skip if present
+    body=$(python3 -c "import json,sys;print(json.dumps({'metafield':{'namespace':'custom','key':'$key','type':'$typ','value':sys.argv[1]}}))" "$value")
+    rc=$(curl -s -o /dev/null -w "%{http_code}" -X POST "$BASE/products/$pid/metafields.json" -H "$H" -H "Content-Type: application/json" -d "$body")
+    [ "$rc" = "201" ] && wrote=$((wrote+1))
+    sleep 0.25
+  done < <(echo "$spec" | python3 -c 'import sys,json
+for k,v in json.load(sys.stdin).items(): print(k+"\t"+str(v))')
+  echo "[$mfr] $how -> wrote $wrote metafields"
+  sleep 0.3
+done
+echo "SPEC-BACKFILL DONE ($MODE)"

← e82b2ff Koroseal specs: crawled koroseal.com (2626 pages, 2621 w/spe  ·  back to Koroseal Goodrich Audit  ·  auto-save: 2026-07-15T17:08:45 (1 files) — spec_backfill.log 4490188 →