← back to Consulting Designerwallcoverings Com
TK-20: harden APPLY-page-jsonld.sh step[2] — fetch-live + abort-on-drift + append-one-line (vp-dw-commerce REVISE resolved); no blind PUT of stale .PROPOSED
f2191dc0879cb9c5a88d1604063513ac38dd8e44 · 2026-07-26 21:11:13 -0700 · Steve Abrams
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Files touched
M docs/aeo-drafts/theme-snippets/APPLY-page-jsonld.sh
Diff
commit f2191dc0879cb9c5a88d1604063513ac38dd8e44
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Sun Jul 26 21:11:13 2026 -0700
TK-20: harden APPLY-page-jsonld.sh step[2] — fetch-live + abort-on-drift + append-one-line (vp-dw-commerce REVISE resolved); no blind PUT of stale .PROPOSED
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---
.../aeo-drafts/theme-snippets/APPLY-page-jsonld.sh | 43 ++++++++++++++++++----
1 file changed, 35 insertions(+), 8 deletions(-)
diff --git a/docs/aeo-drafts/theme-snippets/APPLY-page-jsonld.sh b/docs/aeo-drafts/theme-snippets/APPLY-page-jsonld.sh
index 6c4e6e0..d4decdb 100755
--- a/docs/aeo-drafts/theme-snippets/APPLY-page-jsonld.sh
+++ b/docs/aeo-drafts/theme-snippets/APPLY-page-jsonld.sh
@@ -28,16 +28,43 @@ node -e '
curl -s -X PUT "$API" -H "X-Shopify-Access-Token: $TOKEN" -H "Content-Type: application/json" \
--data-binary @/tmp/aeo-snippet-put.json | tee /tmp/aeo-snippet-put-resp.json | head -c 300; echo
-echo "== [2/3] PUT sections/page.liquid (adds the render hook) =="
-node -e '
+echo "== [2/3] append render hook to the LIVE sections/page.liquid (drift-safe) =="
+# vp-dw-commerce REVISE (2026-07-26): do NOT PUT the stale .PROPOSED snapshot — it could
+# clobber live drift. Instead FETCH the live file, verify it still matches the .PROPOSED
+# body (abort on drift so a human can re-inspect), then APPEND only the single render line
+# and PUT that. Idempotent: no-op if the render line is already present.
+LIVE_JSON="$(curl -s "$API?asset%5Bkey%5D=sections/page.liquid" -H "X-Shopify-Access-Token: $TOKEN")"
+echo "$LIVE_JSON" | node -e '
const fs=require("fs");
- // strip the leading TK-20 comment block from the .PROPOSED before shipping
- let val=fs.readFileSync(process.argv[1],"utf8");
- val=val.replace(/^{%- comment -%}[\s\S]*?{%- endcomment -%}\n/, "");
- process.stdout.write(JSON.stringify({asset:{key:"sections/page.liquid",value:val}}));
+ let d=""; process.stdin.on("data",c=>d+=c).on("end",()=>{
+ const live = JSON.parse(d).asset.value;
+ const HOOK = "{% render \x27dw-aeo-jsonld\x27 %}";
+ if (live.includes(HOOK)) { console.error(" render hook already present — nothing to do."); process.exit(3); }
+ // expected live == .PROPOSED minus the leading TK-20 comment block and minus the hook line
+ let proposed = fs.readFileSync(process.argv[1],"utf8")
+ .replace(/^{%- comment -%}[\s\S]*?{%- endcomment -%}\n/, "");
+ const expectedBody = proposed.replace(/\n*{% render \x27dw-aeo-jsonld\x27 %}\n*$/, "").trim();
+ if (live.trim() !== expectedBody) {
+ console.error(" !! DRIFT: live sections/page.liquid differs from the captured .PROPOSED body.");
+ console.error(" !! ABORTING step [2]. Diff the LIVE-BACKUP against .PROPOSED, then append the");
+ console.error(" !! single line {% render \x27dw-aeo-jsonld\x27 %} to the live file by hand and PUT.");
+ process.exit(4);
+ }
+ const shipped = live.replace(/\s*$/, "") + "\n\n" + HOOK + "\n";
+ process.stdout.write(JSON.stringify({asset:{key:"sections/page.liquid",value:shipped}}));
+ });
' "$DIR/sections-page.liquid.PROPOSED" > /tmp/aeo-page-put.json
-curl -s -X PUT "$API" -H "X-Shopify-Access-Token: $TOKEN" -H "Content-Type: application/json" \
- --data-binary @/tmp/aeo-page-put.json | tee /tmp/aeo-page-put-resp.json | head -c 300; echo
+_step2=$?
+if [ "$_step2" = "3" ]; then
+ echo " [2/3] skipped (hook already installed)."
+elif [ "$_step2" != "0" ]; then
+ echo " [2/3] ABORTED (drift or fetch error, exit $_step2) — snippet from [1] is live; page.liquid untouched."
+ echo " Resolve drift, then hand-PUT. Everything else is safe to leave as-is."
+ exit "$_step2"
+else
+ curl -s -X PUT "$API" -H "X-Shopify-Access-Token: $TOKEN" -H "Content-Type: application/json" \
+ --data-binary @/tmp/aeo-page-put.json | tee /tmp/aeo-page-put-resp.json | head -c 300; echo
+fi
echo "== [3/3] verify (re-render with Playwright) =="
echo " node ../../scripts/aeo-render-verify.mjs # expect hasJsonLdFaq:true on the page"
← d9016b7 TK-20: AEO JSON-LD injector draft + read-only render-verify
·
back to Consulting Designerwallcoverings Com
·
TK-20: apply vp-dw-commerce REVISE — collection JSON-LD bran 5f94a3d →