← back to Dw Theme Live Signin Split
upload_tk11020: require --apply + only ledger a VERIFIED live-theme write
26c1c830a7a2dbda155160861bd2f24e0e5067a9 · 2026-09-24 11:31:29 -0700 · Steve Abrams
Two guards on a script that PUTs to the live production theme: (1) default to a
no-op dry-run (shows changed/identical) and require --apply, so a bare run can't
silently overwrite the theme; (2) gate the reversible-ledger append on the
post-write verify and sys.exit(1) on failure, so it can no longer record a
"verified" ledger row when the content check actually failed (false-green class).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Files touched
Diff
commit 26c1c830a7a2dbda155160861bd2f24e0e5067a9
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Thu Sep 24 11:31:29 2026 -0700
upload_tk11020: require --apply + only ledger a VERIFIED live-theme write
Two guards on a script that PUTs to the live production theme: (1) default to a
no-op dry-run (shows changed/identical) and require --apply, so a bare run can't
silently overwrite the theme; (2) gate the reversible-ledger append on the
post-write verify and sys.exit(1) on failure, so it can no longer record a
"verified" ledger row when the content check actually failed (false-green class).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---
upload_tk11020.py | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/upload_tk11020.py b/upload_tk11020.py
new file mode 100644
index 0000000..05d252c
--- /dev/null
+++ b/upload_tk11020.py
@@ -0,0 +1,44 @@
+import os,sys,json,urllib.request,time
+tok=os.popen("grep -E '^SHOPIFY_THEME_TOKEN=' ~/Projects/secrets-manager/.env | cut -d= -f2-").read().strip()
+DOMAIN="designer-laboratory-sandbox.myshopify.com"; THEME="145121607731"
+KEY="snippets/dw-samples-banner.liquid"
+val=open(KEY).read()
+LEDGER=os.path.expanduser("~/.claude/yolo-queue/executed-reversible/ledger.jsonl")
+
+def put(value):
+ body=json.dumps({"asset":{"key":KEY,"value":value}}).encode()
+ req=urllib.request.Request(f"https://{DOMAIN}/admin/api/2024-10/themes/{THEME}/assets.json",
+ data=body, method="PUT",
+ headers={"X-Shopify-Access-Token":tok,"Content-Type":"application/json"})
+ return urllib.request.urlopen(req,timeout=45)
+
+def get_asset():
+ req=urllib.request.Request(f"https://{DOMAIN}/admin/api/2024-10/themes/{THEME}/assets.json?asset[key]={KEY}",
+ headers={"X-Shopify-Access-Token":tok})
+ return json.loads(urllib.request.urlopen(req,timeout=45).read())["asset"]["value"]
+
+# GUARD: this PUTs to the LIVE production theme. Default to a no-op dry-run so a
+# bare `python3 upload_tk11020.py` (stale terminal / copied pattern) can't
+# overwrite the live theme; require --apply to actually write.
+if "--apply" not in sys.argv:
+ cur=get_asset()
+ print(f"DRY-RUN (no write). {KEY}: {'CHANGED' if cur!=val else 'identical'} "
+ f"(live {len(cur)}B -> local {len(val)}B). Re-run with --apply to write.")
+ sys.exit(0)
+
+r=put(val)
+print("upload status:", r.status)
+got=get_asset()
+ok = "/pages/trade-only-benefits\">Trade Sign In" in got
+print("verify trade-signin-link-live-in-theme:", ok)
+# Only record the reversible-ledger row on a VERIFIED write — never claim success
+# for an unmeasured/failed check (false-green class).
+if not ok:
+ print("VERIFY FAILED — live write NOT confirmed, not ledgering"); sys.exit(1)
+with open(LEDGER,"a") as f:
+ f.write(json.dumps({"ts":time.strftime("%Y-%m-%dT%H:%M:%S%z"),"agent":"claude-run-10456",
+ "ticket":"TK-11020","action":f"upload {KEY} to live theme {THEME} (add Trade Sign In link, Steve-approved)",
+ "blast_radius":1,
+ "undo_cmd":f"PUT theme {THEME} asset {KEY} = snippets/dw-samples-banner.liquid.baseline",
+ "verify":"GET asset contains trade-only-benefits Trade Sign In link"})+"\n")
+print("ledgered.")
← 757b499 TK-11020: retarget to real live target (snippets/dw-samples-
·
back to Dw Theme Live Signin Split
·
(newest)