← back to Japan Enrich
carnegie: add GATED activation script for 41 eligible drafts (TK-11016, not run)
e48de5a70f34198d452f3d998934502e90bc4dc6 · 2026-08-31 09:54:43 -0700 · Steve Abrams
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Files touched
A carnegie-split/activate-eligible-drafts.cjs
Diff
commit e48de5a70f34198d452f3d998934502e90bc4dc6
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Mon Aug 31 09:54:43 2026 -0700
carnegie: add GATED activation script for 41 eligible drafts (TK-11016, not run)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---
carnegie-split/activate-eligible-drafts.cjs | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/carnegie-split/activate-eligible-drafts.cjs b/carnegie-split/activate-eligible-drafts.cjs
new file mode 100644
index 0000000..56802f1
--- /dev/null
+++ b/carnegie-split/activate-eligible-drafts.cjs
@@ -0,0 +1,29 @@
+// GATED — CUSTOMER-FACING PUBLISH. Do NOT run without Steve's explicit go.
+// Flips the 41 now-eligible Carnegie drafts (width+image present, TK-11016) to ACTIVE.
+// Reversible: writes a restore map (id->prior status 'draft') BEFORE flipping.
+// Reads the same width-backfill-plan.json set that was width-backfilled.
+//
+// Usage: node activate-eligible-drafts.cjs (dry-run: lists what would flip)
+// node activate-eligible-drafts.cjs --apply (flips to ACTIVE — GATED)
+const fs=require("fs"),os=require("os"),path=require("path"),https=require("https");
+const APPLY=process.argv.includes("--apply");
+const env=fs.readFileSync(path.join(os.homedir(),"Projects/secrets-manager/.env"),"utf8");
+const g=k=>{const m=env.match(new RegExp("^"+k+"=(.*)$","m"));return m?m[1].trim().replace(/^["']|["']$/g,""):null};
+const shop="designer-laboratory-sandbox.myshopify.com",tok=g("SHOPIFY_ADMIN_TOKEN")||g("SHOPIFY_ADMIN_API_TOKEN");
+const sleep=ms=>new Promise(r=>setTimeout(r,ms));
+function req(method,p,body){return new Promise((res)=>{const b=body?JSON.stringify(body):null;const o={host:shop,path:p,method,headers:{"X-Shopify-Access-Token":tok,"Content-Type":"application/json"},timeout:30000};if(b)o.headers["Content-Length"]=Buffer.byteLength(b);const r=https.request(o,x=>{let d="";x.on("data",c=>d+=c);x.on("end",()=>res({status:x.statusCode,body:d}))});r.on("error",e=>res({status:0,body:String(e)}));if(b)r.write(b);r.end()})}
+(async()=>{
+ const plan=JSON.parse(fs.readFileSync("width-backfill-plan.json","utf8"));
+ const ids=plan.toWrite.map(d=>d.id);
+ console.log(`eligible drafts to activate: ${ids.length}`);
+ if(!APPLY){console.log("DRY-RUN — pass --apply (GATED). Nothing flipped.");return;}
+ const ts=new Date().toISOString().replace(/[:.]/g,"-");
+ fs.writeFileSync(`activation-restore-${ts}.json`,JSON.stringify({ticket:"TK-11016",undo:"PUT status:draft for each id",ids},null,2));
+ let ok=0,fail=0;
+ for(const id of ids){
+ const r=await req("PUT",`/admin/api/2024-10/products/${id}.json`,{product:{id,status:"active"}});
+ if(r.status===200){ok++;process.stdout.write(".");}else{fail++;process.stdout.write("x");}
+ await sleep(400);
+ }
+ console.log(`\nactivated ${ok}, ${fail} failed. Restore: activation-restore-${ts}.json`);
+})();
← a3d377e carnegie: add width-backfill revert tool (TK-11016 undo)
·
back to Japan Enrich
·
TK-11016: activate 41 Carnegie drafts + tag 12 furniture SKU 0beac0c →