[object Object]

← back to Dw Signup Fulfillment

TK-11185: add Gate 2 theme PUT + rollback scripts (cwd-independent, self-verify main theme)

5e609e88a9a36482998f36b8f95b6f8da677f5d1 · 2026-09-03 11:32:20 -0700 · Steve Abrams

Runnable .mjs equivalents of the memo's Gate 2 pastes for the approved live theme write:
- scripts/gate2-theme-put.mjs: confirms 145121607731 is the live/main theme (aborts on
  mismatch), reads the staged patched snippet, PUTs snippets/dw-signin-modal.liquid, prints HTTP.
- scripts/gate2-theme-rollback.mjs: re-PUTs the 20260903T181955 pre-change backup, prints HTTP.
Token read inside Node from secrets-manager/.env (no shell quoting), store designer-laboratory-sandbox, API 2024-10.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X3co77k7JzTkAJRdemt6Ru

Files touched

Diff

commit 5e609e88a9a36482998f36b8f95b6f8da677f5d1
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Thu Sep 3 11:32:20 2026 -0700

    TK-11185: add Gate 2 theme PUT + rollback scripts (cwd-independent, self-verify main theme)
    
    Runnable .mjs equivalents of the memo's Gate 2 pastes for the approved live theme write:
    - scripts/gate2-theme-put.mjs: confirms 145121607731 is the live/main theme (aborts on
      mismatch), reads the staged patched snippet, PUTs snippets/dw-signin-modal.liquid, prints HTTP.
    - scripts/gate2-theme-rollback.mjs: re-PUTs the 20260903T181955 pre-change backup, prints HTTP.
    Token read inside Node from secrets-manager/.env (no shell quoting), store designer-laboratory-sandbox, API 2024-10.
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_01X3co77k7JzTkAJRdemt6Ru
---
 scripts/gate2-theme-put.mjs      | 26 ++++++++++++++++++++++++++
 scripts/gate2-theme-rollback.mjs | 15 +++++++++++++++
 2 files changed, 41 insertions(+)

diff --git a/scripts/gate2-theme-put.mjs b/scripts/gate2-theme-put.mjs
new file mode 100644
index 0000000..78c0eed
--- /dev/null
+++ b/scripts/gate2-theme-put.mjs
@@ -0,0 +1,26 @@
+// TK-11185 GATE 2 — live theme PUT of the patched trade-apply success handler.
+// Confirms 145121607731 is the live/main theme before writing (aborts on mismatch).
+// cwd-independent (absolute paths); token read inside Node (no shell quoting).
+import fs from "fs";
+import os from "os";
+const ROOT = os.homedir() + "/Projects/dw-signup-fulfillment";
+const env = fs.readFileSync(os.homedir() + "/Projects/secrets-manager/.env", "utf8");
+const TT = (env.match(/^SHOPIFY_THEME_TOKEN=(.*)$/m) || [])[1].replace(/^"|"$/g, "").trim();
+const DOMAIN = "designer-laboratory-sandbox.myshopify.com", VER = "2024-10", THEME = "145121607731";
+const H = { "X-Shopify-Access-Token": TT };
+
+const tj = await (await fetch(`https://${DOMAIN}/admin/api/${VER}/themes.json`, { headers: H })).json();
+const main = (tj.themes || []).find(t => t.role === "main");
+console.log("live/main theme:", main && main.id, main && main.name);
+if (!main || String(main.id) !== THEME) {
+  console.error("ABORT: main theme is", main && main.id, "expected", THEME, "— do not PUT.");
+  process.exit(1);
+}
+const value = fs.readFileSync(ROOT + "/theme-proposals/loggedin-trade-entry/dw-signin-modal.PATCHED-tk11185.liquid", "utf8");
+const r = await fetch(`https://${DOMAIN}/admin/api/${VER}/themes/${THEME}/assets.json`, {
+  method: "PUT",
+  headers: { ...H, "Content-Type": "application/json" },
+  body: JSON.stringify({ asset: { key: "snippets/dw-signin-modal.liquid", value } }),
+});
+const j = await r.json();
+console.log("HTTP", r.status, j.asset ? ("PUT OK " + j.asset.key + " @ " + j.asset.updated_at) : JSON.stringify(j));
diff --git a/scripts/gate2-theme-rollback.mjs b/scripts/gate2-theme-rollback.mjs
new file mode 100644
index 0000000..a35570c
--- /dev/null
+++ b/scripts/gate2-theme-rollback.mjs
@@ -0,0 +1,15 @@
+// TK-11185 GATE 2 ROLLBACK — re-PUT the pre-change live snapshot of dw-signin-modal.liquid.
+import fs from "fs";
+import os from "os";
+const ROOT = os.homedir() + "/Projects/dw-signup-fulfillment";
+const env = fs.readFileSync(os.homedir() + "/Projects/secrets-manager/.env", "utf8");
+const TT = (env.match(/^SHOPIFY_THEME_TOKEN=(.*)$/m) || [])[1].replace(/^"|"$/g, "").trim();
+const DOMAIN = "designer-laboratory-sandbox.myshopify.com", VER = "2024-10", THEME = "145121607731";
+const value = fs.readFileSync(ROOT + "/theme-backups/live-snapshots/snippets__dw-signin-modal.liquid.20260903T181955.bak", "utf8");
+const r = await fetch(`https://${DOMAIN}/admin/api/${VER}/themes/${THEME}/assets.json`, {
+  method: "PUT",
+  headers: { "X-Shopify-Access-Token": TT, "Content-Type": "application/json" },
+  body: JSON.stringify({ asset: { key: "snippets/dw-signin-modal.liquid", value } }),
+});
+const j = await r.json();
+console.log("HTTP", r.status, j.asset ? ("ROLLBACK OK " + j.asset.updated_at) : JSON.stringify(j));

← 6e51634 TK-11185: back up live dw-signin-modal snippet + stage patch  ·  back to Dw Signup Fulfillment  ·  TK-11190: recovery tooling for pre-fix stuck trade applicati 164ab38 →