← back to Dw Kravet Hires
Add live Shopify verifier for TK-12097 hi-res swap ledgers
54899597533013cfd12340773caf034500e3da06 · 2026-09-24 10:43:34 -0700 · Steve Abrams
Re-probes a random sample of ledger rows against the live store and
confirms the product's current featured media is the ledger's new
media and that it is larger than the retained low-res anchor.
Distinguishes NOT-MEASURED (API unreachable) from PASS so a dead
token cannot read as a clean run.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KXUyzc9vybUz39rhnNJdwY
Files touched
A data/tk12097/verify-sample.sh
Diff
commit 54899597533013cfd12340773caf034500e3da06
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Thu Sep 24 10:43:34 2026 -0700
Add live Shopify verifier for TK-12097 hi-res swap ledgers
Re-probes a random sample of ledger rows against the live store and
confirms the product's current featured media is the ledger's new
media and that it is larger than the retained low-res anchor.
Distinguishes NOT-MEASURED (API unreachable) from PASS so a dead
token cannot read as a clean run.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KXUyzc9vybUz39rhnNJdwY
---
data/tk12097/verify-sample.sh | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/data/tk12097/verify-sample.sh b/data/tk12097/verify-sample.sh
new file mode 100755
index 0000000..380765a
--- /dev/null
+++ b/data/tk12097/verify-sample.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+# Spot-verify a batch ledger against LIVE Shopify.
+# For N random rows: confirm the product's CURRENT featured media is the ledger's
+# new_media_id AND that its width exceeds the recorded old media's width.
+# Read-only. Usage: verify-sample.sh <ledger> <n>
+set -uo pipefail
+L="$1"; N="${2:-10}"
+TOKEN=$(grep -m1 '^SHOPIFY_ADMIN_TOKEN=' ~/Projects/secrets-manager/.env | cut -d= -f2- | tr -d '"'"'"' ')
+API="https://designer-laboratory-sandbox.myshopify.com/admin/api/2024-10/graphql.json"
+
+pass=0; fail=0; notmeasured=0
+# de-dup by product so a double-applied product is sampled once
+jq -s -c 'group_by(.shopify_id)|map(.[-1])|.[]' "$L" | sort -R | head -n "$N" | while IFS= read -r row; do
+ pid=$(echo "$row" | jq -r .shopify_id)
+ newid=$(echo "$row" | jq -r .new_media_id)
+ oldid=$(echo "$row" | jq -r .old_media_id)
+ sku=$(echo "$row" | jq -r .mfr_sku)
+
+ resp=$(curl -s --max-time 25 -X POST "$API" \
+ -H "X-Shopify-Access-Token: $TOKEN" -H "Content-Type: application/json" \
+ -d "{\"query\":\"{ product(id:\\\"$pid\\\") { media(first:25) { edges { node { id ... on MediaImage { image { width height } } } } } } }\"}")
+
+ # NOT-MEASURED guard: no data back means we did not measure, never call it a pass
+ if ! echo "$resp" | jq -e '.data.product.media.edges' >/dev/null 2>&1; then
+ echo "NOT-MEASURED $sku $pid — $(echo "$resp" | head -c 120)"; continue
+ fi
+
+ featured=$(echo "$resp" | jq -r '.data.product.media.edges[0].node.id')
+ fw=$(echo "$resp" | jq -r '.data.product.media.edges[0].node.image.width // 0')
+ ow=$(echo "$resp" | jq -r --arg o "$oldid" '[.data.product.media.edges[]|select(.node.id==$o)|.node.image.width][0] // 0')
+
+ if [ "$featured" = "$newid" ] && [ "$fw" -gt "$ow" ] && [ "$ow" -gt 0 ]; then
+ echo "PASS $sku featured=${fw}px old=${ow}px anchor-retained"
+ elif [ "$featured" = "$newid" ] && [ "$ow" = "0" ]; then
+ echo "WARN $sku featured=${fw}px but old anchor $oldid NOT present on product"
+ else
+ echo "FAIL $sku featured=$featured (expected $newid) fw=${fw} ow=${ow}"
+ fi
+ sleep 0.6
+done
← dfdb8f9 auto-data-snapshot: 2026-09-24T10:15:55 (2 data files) — dat
·
back to Dw Kravet Hires
·
auto-data-snapshot: 2026-09-24T10:46:49 (3 data files) — dat 4636e7b →