← back to Ticket System
Record canonical parser regression and preview proof for TK-11443
d3d11f6f79d9836a69372d031e897bb209479dac · 2026-09-10 17:59:00 -0700 · Steve Abrams
Files touched
A verification/tk11443/baseline-red.txtA verification/tk11443/baseline.mjsA verification/tk11443/candidate.patchA verification/tk11443/e2e-proof.jsonA verification/tk11443/prior-dtd-review.mdA verification/tk11443/verification.jsonA verification/tk11443/verify.mjs
Diff
commit d3d11f6f79d9836a69372d031e897bb209479dac
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Thu Sep 10 17:59:00 2026 -0700
Record canonical parser regression and preview proof for TK-11443
---
verification/tk11443/baseline-red.txt | 302 +++++++++++++++++++++++++++++++
verification/tk11443/baseline.mjs | 134 ++++++++++++++
verification/tk11443/candidate.patch | 13 ++
verification/tk11443/e2e-proof.json | 69 +++++++
verification/tk11443/prior-dtd-review.md | 36 ++++
verification/tk11443/verification.json | 245 +++++++++++++++++++++++++
verification/tk11443/verify.mjs | 74 ++++++++
7 files changed, 873 insertions(+)
diff --git a/verification/tk11443/baseline-red.txt b/verification/tk11443/baseline-red.txt
new file mode 100644
index 00000000..21bd9f24
--- /dev/null
+++ b/verification/tk11443/baseline-red.txt
@@ -0,0 +1,302 @@
+node:internal/modules/run_main:107
+ triggerUncaughtException(
+ ^
+
+AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
++ actual - expected
+... Skipped lines
+
+ '#!/usr/bin/env node\n' +
+ '// ============================================================================\n' +
+ '// TK-11410 GATE 2 — APPLY reprice + repoint mfr_sku for the resolved Kravet\n' +
+ '// fabric-SKU wallcoverings. *** DRAFT — Steve runs this; it is NOT auto-fired. ***\n' +
+ '//\n' +
+...
+ "const APPLY=argv.includes('--apply');\n" +
++ "const BATCH=(argv[argv.indexOf('--batch')+1]||'A').toUpperCase();\n" +
+- "const BATCH=(argv.includes('--batch') ? argv[argv.indexOf('--batch')+1]||'A' : 'A').toUpperCase();\n" +
+ "const KAM_SSH=process.env.KAMATERA_SSH||'root@45.61.58.125';\n" +
+ "const KAM_DB=process.env.KAMATERA_DB||'dw_unified';\n" +
+ 'const MIN_PRICE=1.00; // hard floor: NEVER write a price below this (guards the $0-orderable bug class)\n' +
+ 'const PROG=`${S}/tk11410-gate2-apply-progress.txt`;\n' +
+ 'const RESULT=`${S}/tk11410-gate2-apply-result.jsonl`;\n' +
+
+ at file:///Users/macstudio3/Projects/ticket-system/verification/tk11443/verify.mjs:13:8
+ at ModuleJob.run (node:internal/modules/esm/module_job:447:25)
+ at async node:internal/modules/esm/loader:646:26
+ at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:101:5) {
+ generatedMessage: true,
+ code: 'ERR_ASSERTION',
+ actual: '#!/usr/bin/env node\n' +
+ '// ============================================================================\n' +
+ '// TK-11410 GATE 2 — APPLY reprice + repoint mfr_sku for the resolved Kravet\n' +
+ '// fabric-SKU wallcoverings. *** DRAFT — Steve runs this; it is NOT auto-fired. ***\n' +
+ '//\n' +
+ '// Per product it will:\n' +
+ '// (a) write new_mfr (correct paper SKU) to the global.Item metafield AND\n' +
+ '// shopify_products.mfr_sku on Mac2 (local) AND Kamatera (ssh)\n' +
+ '// (b) set the SELLABLE variant price = new_MAP (authoritative 2026 MAP)\n' +
+ '// (c) leave status = DRAFT (never touches status)\n' +
+ '//\n' +
+ '// Safety: idempotent (skips if already at target), verify-per-write (re-reads\n' +
+ '// after each), self-ledgering with a REAL undo (old_mfr + old_price restore),\n' +
+ '// background-safe (paced + 429/502/503 retry).\n' +
+ '//\n' +
+ '// MODES:\n' +
+ '// node tk11410-gate2-apply.mjs -> --preview (default): NO network,\n' +
+ '// prints planned mutations only\n' +
+ '// node tk11410-gate2-apply.mjs --apply -> LIVE: performs the writes (Steve)\n' +
+ '// node tk11410-gate2-apply.mjs --apply --batch B -> run the confirm batch (after\n' +
+ '// colorway/portal confirm)\n' +
+ '// env: SHOPIFY_ADMIN_TOKEN or SHOPIFY_FULL_ACCESS_TOKEN (metafields+price+read)\n' +
+ '// KAMATERA_SSH (default: root@45.61.58.125) KAMATERA_DB (default: dw_unified)\n' +
+ '// ============================================================================\n' +
+ "import { readFileSync, appendFileSync, writeFileSync } from 'node:fs';\n" +
+ "import { execFileSync } from 'node:child_process';\n" +
+ '\n' +
+ "const S='/private/tmp/claude-501/-Users-macstudio3/99b3ab49-c5fe-4009-ac1c-00937236c566/scratchpad';\n" +
+ "const SHOP='designer-laboratory-sandbox.myshopify.com', API='2024-10';\n" +
+ "const LEDGER='/Users/macstudio3/.claude/yolo-queue/executed-reversible/ledger.jsonl';\n" +
+ 'const argv=process.argv.slice(2);\n' +
+ "const APPLY=argv.includes('--apply');\n" +
+ "const BATCH=(argv[argv.indexOf('--batch')+1]||'A').toUpperCase();\n" +
+ "const KAM_SSH=process.env.KAMATERA_SSH||'root@45.61.58.125';\n" +
+ "const KAM_DB=process.env.KAMATERA_DB||'dw_unified';\n" +
+ 'const MIN_PRICE=1.00; // hard floor: NEVER write a price below this (guards the $0-orderable bug class)\n' +
+ 'const PROG=`${S}/tk11410-gate2-apply-progress.txt`;\n' +
+ 'const RESULT=`${S}/tk11410-gate2-apply-result.jsonl`;\n' +
+ '\n' +
+ "const env=readFileSync('/Users/macstudio3/Projects/secrets-manager/.env','utf8');\n" +
+ `const TOKEN=(env.match(/^SHOPIFY_FULL_ACCESS_TOKEN=(.*)$/m)||env.match(/^SHOPIFY_ADMIN_TOKEN=(.*)$/m)||[])[1]?.replace(/["' ]/g,'');\n` +
+ '\n' +
+ "const rows=readFileSync(`${S}/tk11410-apply-batch${BATCH}.jsonl`,'utf8').trim().split('\\n').filter(Boolean).map(JSON.parse);\n" +
+ 'const sleep=ms=>new Promise(r=>setTimeout(r,ms));\n' +
+ "const gid2id=g=>String(g).replace('gid://shopify/Product/','');\n" +
+ `const q2=s=>String(s).replace(/"/g,'\\\\"');\n` +
+ '\n' +
+ 'async function gql(query){\n' +
+ ' for(let a=0;a<5;a++){ try{\n' +
+ " const r=await fetch(`https://${SHOP}/admin/api/${API}/graphql.json`,{method:'POST',\n" +
+ " headers:{'X-Shopify-Access-Token':TOKEN,'Content-Type':'application/json'},body:JSON.stringify({query})});\n" +
+ ' if([429,502,503].includes(r.status)){await sleep(1500*(a+1));continue;}\n' +
+ ' return await r.json();\n' +
+ ' }catch(e){await sleep(1500*(a+1));} }\n' +
+ " return {errors:[{message:'retries exhausted'}]};\n" +
+ '}\n' +
+ '// read current global.Item + sellable variant price\n' +
+ 'async function readCurrent(pgid, variantGid){\n' +
+ ' const j=await gql(`{ product(id:"${pgid}"){ status item:metafield(namespace:"global",key:"Item"){id value} variants(first:15){nodes{id sku price}} } }`);\n' +
+ ' const p=j?.data?.product; if(!p) return null;\n' +
+ ' const vs=p.variants?.nodes||[];\n' +
+ ' const sell=vs.find(v=>v.id===variantGid) || vs.find(v=>v.sku&&!/-sample$/i.test(v.sku));\n' +
+ ' return {status:p.status, item:p.item?.value??null, price:sell?String(sell.price):null, sellId:sell?.id||variantGid};\n' +
+ '}\n' +
+ 'async function setItem(pgid,val){\n' +
+ ' return gql(`mutation{ metafieldsSet(metafields:[{ownerId:"${pgid}",namespace:"global",key:"Item",type:"single_line_text_field",value:"${q2(val)}"}]){ metafields{ id key value } userErrors{ field message } } }`);\n' +
+ '}\n' +
+ 'async function setPrice(pgid,variantGid,price){\n' +
+ ' return gql(`mutation{ productVariantsBulkUpdate(productId:"${pgid}", variants:[{id:"${variantGid}", price:"${Number(price).toFixed(2)}"}]){ productVariants{ id price } userErrors{ field message } } }`);\n' +
+ '}\n' +
+ 'function mirror(sql,{kam=false}={}){\n' +
+ ' if(kam) return execFileSync(\'ssh\',[KAM_SSH,`psql -d ${KAM_DB} -c "${sql.replace(/"/g,\'\\\\"\')}"`],{stdio:\'pipe\'}).toString();\n' +
+ " return execFileSync('psql',['-c',sql],{env:{...process.env,PGHOST:'/tmp',PGDATABASE:'dw_unified'},stdio:'pipe'}).toString();\n" +
+ '}\n' +
+ '\n' +
+ "console.log(`TK-11410 GATE2 apply — batch ${BATCH} — ${rows.length} products — mode=${APPLY?'APPLY (LIVE)':'PREVIEW (no network)'}`);\n" +
+ 'if(!APPLY){\n' +
+ " console.log('--- PREVIEW: first 10 planned mutations (dw_sku, old->new mfr, old->new price) ---');\n" +
+ ' for(const r of rows.slice(0,10)){\n' +
+ " const np = (r.new_map!=null && r.new_map>=MIN_PRICE) ? '$'+Number(r.new_map).toFixed(2) : 'MISSING(verify MAP - price NOT written)';\n" +
+ ' console.log(`${r.dw_sku}: mfr ${r.old_mfr} -> ${r.new_mfr} | price $${r.old_price} -> ${np} | variant ${r.sellable_variant_gid} | status stays DRAFT`);\n' +
+ ' }\n' +
+ ' const noPrice=rows.filter(r=>!(r.new_map!=null&&r.new_map>=MIN_PRICE)).length;\n' +
+ " if(noPrice) console.log(`\\nNOTE: ${noPrice} row(s) in this batch have no valid MAP (< $${MIN_PRICE}); the apply's hard floor SKIPS them (no write) until a MAP is confirmed.`);\n" +
+ ' console.log(`\\nPREVIEW ONLY — no writes performed. Re-run with --apply (as Steve) to execute batch ${BATCH}.`);\n' +
+ ' process.exit(0);\n' +
+ '}\n' +
+ '\n' +
+ '// ---- LIVE APPLY ----\n' +
+ "if(!TOKEN){ console.error('NO TOKEN'); process.exit(2); }\n" +
+ 'writeFileSync(PROG,`GATE2 batch ${BATCH} APPLY start ${new Date().toISOString()} n=${rows.length}\\n`);\n' +
+ "writeFileSync(RESULT,'');\n" +
+ 'let applied=0,skipped=0,failed=0;\n' +
+ 'for(const r of rows){\n' +
+ ' const pgid=r.shopify_id, vgid=r.sellable_variant_gid, newMfr=r.new_mfr, newMap=Number(r.new_map);\n' +
+ ' // HARD GUARD: never write a price below the floor (guards the $0-orderable bug class)\n' +
+ " if(!(newMap>=MIN_PRICE)){ const rec={dw_sku:r.dw_sku,new_mfr:newMfr,new_map:r.new_map,result:'SKIP-invalid-price'}; failed++; appendFileSync(RESULT,JSON.stringify(rec)+'\\n'); appendFileSync(PROG,`${r.dw_sku} SKIP-invalid-price (MAP<${MIN_PRICE}) - not written\\n`); continue; }\n" +
+ ' const cur=await readCurrent(pgid, vgid);\n' +
+ ' let rec={dw_sku:r.dw_sku, new_mfr:newMfr, new_map:newMap};\n' +
+ " if(!cur){ rec.result='FAILED-read'; failed++; appendFileSync(RESULT,JSON.stringify(rec)+'\\n'); continue; }\n" +
+ ' const old_mfr=cur.item, old_price=cur.price, sellId=cur.sellId;\n' +
+ ' rec.old_mfr=old_mfr; rec.old_price=old_price;\n' +
+ ' const priceOk = old_price!=null && Math.abs(Number(old_price)-newMap)<0.005;\n' +
+ " if(cur.item===newMfr && priceOk){ rec.result='skip-idempotent'; skipped++; appendFileSync(RESULT,JSON.stringify(rec)+'\\n'); appendFileSync(PROG,`${r.dw_sku} skip (already at target)\\n`); continue; }\n" +
+ ' // (a) metafield\n' +
+ ' const mfRes=await setItem(pgid,newMfr); const mfErr=mfRes?.data?.metafieldsSet?.userErrors||[];\n' +
+ ' // (b) price\n' +
+ ' const prRes=await setPrice(pgid,sellId,newMap); const prErr=prRes?.data?.productVariantsBulkUpdate?.userErrors||[];\n' +
+ ' await sleep(400);\n' +
+ ' // verify\n' +
+ ' const after=await readCurrent(pgid, sellId);\n' +
+ ' const okMf=after && after.item===newMfr;\n' +
+ ' const okPr=after && after.price!=null && Math.abs(Number(after.price)-newMap)<0.005;\n' +
+ ' if(okMf && okPr && mfErr.length===0 && prErr.length===0){\n' +
+ ' // (a2) mirror both machines\n' +
+ " let mMac='',mKam='';\n" +
+ ' try{ mirror(`UPDATE shopify_products SET mfr_sku=\'${q2(newMfr).replace(/\'/g,"\'\'")}\' WHERE dw_sku=\'${r.dw_sku}\';`); mMac=\'ok\'; }catch(e){ mMac=\'ERR:\'+e.message; }\n' +
+ ' try{ mirror(`UPDATE shopify_products SET mfr_sku=\'${newMfr.replace(/\'/g,"\'\'")}\' WHERE dw_sku=\'${r.dw_sku}\';`,{kam:true}); mKam=\'ok\'; }catch(e){ mKam=\'ERR:\'+e.message; }\n' +
+ " rec.result='applied'; rec.mirror_mac2=mMac; rec.mirror_kam=mKam; applied++;\n" +
+ " appendFileSync(LEDGER, JSON.stringify({agent:'vp-dw-commerce',ticket:'TK-11410',\n" +
+ ' action:`Gate2 reprice+repoint: ${r.dw_sku} mfr ${old_mfr}->${newMfr}, price ${old_price}->${newMap.toFixed(2)} (status stays DRAFT)`,\n' +
+ ' blast_radius:1,\n' +
+ ' undo_cmd:`# restore metafield+price+mirror for ${r.dw_sku}\\ncurl -s -X POST https://${SHOP}/admin/api/${API}/graphql.json -H "X-Shopify-Access-Token: $SHOPIFY_ADMIN_TOKEN" -H \'Content-Type: application/json\' -d \'{"query":"mutation{ metafieldsSet(metafields:[{ownerId:\\\\"${pgid}\\\\",namespace:\\\\"global\\\\",key:\\\\"Item\\\\",type:\\\\"single_line_text_field\\\\",value:\\\\"${old_mfr}\\\\"}]){userErrors{message}} }"}\'; curl -s -X POST https://${SHOP}/admin/api/${API}/graphql.json -H "X-Shopify-Access-Token: $SHOPIFY_ADMIN_TOKEN" -H \'Content-Type: application/json\' -d \'{"query":"mutation{ productVariantsBulkUpdate(productId:\\\\"${pgid}\\\\",variants:[{id:\\\\"${sellId}\\\\",price:\\\\"${old_price}\\\\"}]){userErrors{message}} }"}\'; psql -h /tmp -d dw_unified -c "UPDATE shopify_products SET mfr_sku=\'${old_mfr}\' WHERE dw_sku=\'${r.dw_sku}\';"; ssh ${KAM_SSH} "psql -d ${KAM_DB} -c \\\\"UPDATE shopify_products SET mfr_sku=\'${old_mfr}\' WHERE dw_sku=\'${r.dw_sku}\';\\\\""`,\n' +
+ ' verify:`curl -s https://${SHOP}/admin/api/${API}/products/${gid2id(pgid)}/metafields.json -H "X-Shopify-Access-Token: $SHOPIFY_ADMIN_TOKEN" | grep Item`,\n' +
+ " ts:new Date().toISOString()})+'\\n');\n" +
+ ' } else {\n' +
+ " rec.result='FAILED-verify'; rec.after=after; rec.mfErr=mfErr; rec.prErr=prErr; failed++;\n" +
+ ' }\n' +
+ " appendFileSync(RESULT,JSON.stringify(rec)+'\\n');\n" +
+ ' appendFileSync(PROG,`${r.dw_sku} ${rec.result} [applied=${applied} skip=${skipped} fail=${failed}]\\n`);\n' +
+ ' await sleep(400);\n' +
+ '}\n' +
+ 'appendFileSync(PROG,`GATE2 batch ${BATCH} DONE ${new Date().toISOString()} applied=${applied} skip=${skipped} fail=${failed}\\n`);\n' +
+ 'console.log(`DONE batch ${BATCH}: applied=${applied} skip=${skipped} fail=${failed}`);\n',
+ expected: '#!/usr/bin/env node\n' +
+ '// ============================================================================\n' +
+ '// TK-11410 GATE 2 — APPLY reprice + repoint mfr_sku for the resolved Kravet\n' +
+ '// fabric-SKU wallcoverings. *** DRAFT — Steve runs this; it is NOT auto-fired. ***\n' +
+ '//\n' +
+ '// Per product it will:\n' +
+ '// (a) write new_mfr (correct paper SKU) to the global.Item metafield AND\n' +
+ '// shopify_products.mfr_sku on Mac2 (local) AND Kamatera (ssh)\n' +
+ '// (b) set the SELLABLE variant price = new_MAP (authoritative 2026 MAP)\n' +
+ '// (c) leave status = DRAFT (never touches status)\n' +
+ '//\n' +
+ '// Safety: idempotent (skips if already at target), verify-per-write (re-reads\n' +
+ '// after each), self-ledgering with a REAL undo (old_mfr + old_price restore),\n' +
+ '// background-safe (paced + 429/502/503 retry).\n' +
+ '//\n' +
+ '// MODES:\n' +
+ '// node tk11410-gate2-apply.mjs -> --preview (default): NO network,\n' +
+ '// prints planned mutations only\n' +
+ '// node tk11410-gate2-apply.mjs --apply -> LIVE: performs the writes (Steve)\n' +
+ '// node tk11410-gate2-apply.mjs --apply --batch B -> run the confirm batch (after\n' +
+ '// colorway/portal confirm)\n' +
+ '// env: SHOPIFY_ADMIN_TOKEN or SHOPIFY_FULL_ACCESS_TOKEN (metafields+price+read)\n' +
+ '// KAMATERA_SSH (default: root@45.61.58.125) KAMATERA_DB (default: dw_unified)\n' +
+ '// ============================================================================\n' +
+ "import { readFileSync, appendFileSync, writeFileSync } from 'node:fs';\n" +
+ "import { execFileSync } from 'node:child_process';\n" +
+ '\n' +
+ "const S='/private/tmp/claude-501/-Users-macstudio3/99b3ab49-c5fe-4009-ac1c-00937236c566/scratchpad';\n" +
+ "const SHOP='designer-laboratory-sandbox.myshopify.com', API='2024-10';\n" +
+ "const LEDGER='/Users/macstudio3/.claude/yolo-queue/executed-reversible/ledger.jsonl';\n" +
+ 'const argv=process.argv.slice(2);\n' +
+ "const APPLY=argv.includes('--apply');\n" +
+ "const BATCH=(argv.includes('--batch') ? argv[argv.indexOf('--batch')+1]||'A' : 'A').toUpperCase();\n" +
+ "const KAM_SSH=process.env.KAMATERA_SSH||'root@45.61.58.125';\n" +
+ "const KAM_DB=process.env.KAMATERA_DB||'dw_unified';\n" +
+ 'const MIN_PRICE=1.00; // hard floor: NEVER write a price below this (guards the $0-orderable bug class)\n' +
+ 'const PROG=`${S}/tk11410-gate2-apply-progress.txt`;\n' +
+ 'const RESULT=`${S}/tk11410-gate2-apply-result.jsonl`;\n' +
+ '\n' +
+ "const env=readFileSync('/Users/macstudio3/Projects/secrets-manager/.env','utf8');\n" +
+ `const TOKEN=(env.match(/^SHOPIFY_FULL_ACCESS_TOKEN=(.*)$/m)||env.match(/^SHOPIFY_ADMIN_TOKEN=(.*)$/m)||[])[1]?.replace(/["' ]/g,'');\n` +
+ '\n' +
+ "const rows=readFileSync(`${S}/tk11410-apply-batch${BATCH}.jsonl`,'utf8').trim().split('\\n').filter(Boolean).map(JSON.parse);\n" +
+ 'const sleep=ms=>new Promise(r=>setTimeout(r,ms));\n' +
+ "const gid2id=g=>String(g).replace('gid://shopify/Product/','');\n" +
+ `const q2=s=>String(s).replace(/"/g,'\\\\"');\n` +
+ '\n' +
+ 'async function gql(query){\n' +
+ ' for(let a=0;a<5;a++){ try{\n' +
+ " const r=await fetch(`https://${SHOP}/admin/api/${API}/graphql.json`,{method:'POST',\n" +
+ " headers:{'X-Shopify-Access-Token':TOKEN,'Content-Type':'application/json'},body:JSON.stringify({query})});\n" +
+ ' if([429,502,503].includes(r.status)){await sleep(1500*(a+1));continue;}\n' +
+ ' return await r.json();\n' +
+ ' }catch(e){await sleep(1500*(a+1));} }\n' +
+ " return {errors:[{message:'retries exhausted'}]};\n" +
+ '}\n' +
+ '// read current global.Item + sellable variant price\n' +
+ 'async function readCurrent(pgid, variantGid){\n' +
+ ' const j=await gql(`{ product(id:"${pgid}"){ status item:metafield(namespace:"global",key:"Item"){id value} variants(first:15){nodes{id sku price}} } }`);\n' +
+ ' const p=j?.data?.product; if(!p) return null;\n' +
+ ' const vs=p.variants?.nodes||[];\n' +
+ ' const sell=vs.find(v=>v.id===variantGid) || vs.find(v=>v.sku&&!/-sample$/i.test(v.sku));\n' +
+ ' return {status:p.status, item:p.item?.value??null, price:sell?String(sell.price):null, sellId:sell?.id||variantGid};\n' +
+ '}\n' +
+ 'async function setItem(pgid,val){\n' +
+ ' return gql(`mutation{ metafieldsSet(metafields:[{ownerId:"${pgid}",namespace:"global",key:"Item",type:"single_line_text_field",value:"${q2(val)}"}]){ metafields{ id key value } userErrors{ field message } } }`);\n' +
+ '}\n' +
+ 'async function setPrice(pgid,variantGid,price){\n' +
+ ' return gql(`mutation{ productVariantsBulkUpdate(productId:"${pgid}", variants:[{id:"${variantGid}", price:"${Number(price).toFixed(2)}"}]){ productVariants{ id price } userErrors{ field message } } }`);\n' +
+ '}\n' +
+ 'function mirror(sql,{kam=false}={}){\n' +
+ ' if(kam) return execFileSync(\'ssh\',[KAM_SSH,`psql -d ${KAM_DB} -c "${sql.replace(/"/g,\'\\\\"\')}"`],{stdio:\'pipe\'}).toString();\n' +
+ " return execFileSync('psql',['-c',sql],{env:{...process.env,PGHOST:'/tmp',PGDATABASE:'dw_unified'},stdio:'pipe'}).toString();\n" +
+ '}\n' +
+ '\n' +
+ "console.log(`TK-11410 GATE2 apply — batch ${BATCH} — ${rows.length} products — mode=${APPLY?'APPLY (LIVE)':'PREVIEW (no network)'}`);\n" +
+ 'if(!APPLY){\n' +
+ " console.log('--- PREVIEW: first 10 planned mutations (dw_sku, old->new mfr, old->new price) ---');\n" +
+ ' for(const r of rows.slice(0,10)){\n' +
+ " const np = (r.new_map!=null && r.new_map>=MIN_PRICE) ? '$'+Number(r.new_map).toFixed(2) : 'MISSING(verify MAP - price NOT written)';\n" +
+ ' console.log(`${r.dw_sku}: mfr ${r.old_mfr} -> ${r.new_mfr} | price $${r.old_price} -> ${np} | variant ${r.sellable_variant_gid} | status stays DRAFT`);\n' +
+ ' }\n' +
+ ' const noPrice=rows.filter(r=>!(r.new_map!=null&&r.new_map>=MIN_PRICE)).length;\n' +
+ " if(noPrice) console.log(`\\nNOTE: ${noPrice} row(s) in this batch have no valid MAP (< $${MIN_PRICE}); the apply's hard floor SKIPS them (no write) until a MAP is confirmed.`);\n" +
+ ' console.log(`\\nPREVIEW ONLY — no writes performed. Re-run with --apply (as Steve) to execute batch ${BATCH}.`);\n' +
+ ' process.exit(0);\n' +
+ '}\n' +
+ '\n' +
+ '// ---- LIVE APPLY ----\n' +
+ "if(!TOKEN){ console.error('NO TOKEN'); process.exit(2); }\n" +
+ 'writeFileSync(PROG,`GATE2 batch ${BATCH} APPLY start ${new Date().toISOString()} n=${rows.length}\\n`);\n' +
+ "writeFileSync(RESULT,'');\n" +
+ 'let applied=0,skipped=0,failed=0;\n' +
+ 'for(const r of rows){\n' +
+ ' const pgid=r.shopify_id, vgid=r.sellable_variant_gid, newMfr=r.new_mfr, newMap=Number(r.new_map);\n' +
+ ' // HARD GUARD: never write a price below the floor (guards the $0-orderable bug class)\n' +
+ " if(!(newMap>=MIN_PRICE)){ const rec={dw_sku:r.dw_sku,new_mfr:newMfr,new_map:r.new_map,result:'SKIP-invalid-price'}; failed++; appendFileSync(RESULT,JSON.stringify(rec)+'\\n'); appendFileSync(PROG,`${r.dw_sku} SKIP-invalid-price (MAP<${MIN_PRICE}) - not written\\n`); continue; }\n" +
+ ' const cur=await readCurrent(pgid, vgid);\n' +
+ ' let rec={dw_sku:r.dw_sku, new_mfr:newMfr, new_map:newMap};\n' +
+ " if(!cur){ rec.result='FAILED-read'; failed++; appendFileSync(RESULT,JSON.stringify(rec)+'\\n'); continue; }\n" +
+ ' const old_mfr=cur.item, old_price=cur.price, sellId=cur.sellId;\n' +
+ ' rec.old_mfr=old_mfr; rec.old_price=old_price;\n' +
+ ' const priceOk = old_price!=null && Math.abs(Number(old_price)-newMap)<0.005;\n' +
+ " if(cur.item===newMfr && priceOk){ rec.result='skip-idempotent'; skipped++; appendFileSync(RESULT,JSON.stringify(rec)+'\\n'); appendFileSync(PROG,`${r.dw_sku} skip (already at target)\\n`); continue; }\n" +
+ ' // (a) metafield\n' +
+ ' const mfRes=await setItem(pgid,newMfr); const mfErr=mfRes?.data?.metafieldsSet?.userErrors||[];\n' +
+ ' // (b) price\n' +
+ ' const prRes=await setPrice(pgid,sellId,newMap); const prErr=prRes?.data?.productVariantsBulkUpdate?.userErrors||[];\n' +
+ ' await sleep(400);\n' +
+ ' // verify\n' +
+ ' const after=await readCurrent(pgid, sellId);\n' +
+ ' const okMf=after && after.item===newMfr;\n' +
+ ' const okPr=after && after.price!=null && Math.abs(Number(after.price)-newMap)<0.005;\n' +
+ ' if(okMf && okPr && mfErr.length===0 && prErr.length===0){\n' +
+ ' // (a2) mirror both machines\n' +
+ " let mMac='',mKam='';\n" +
+ ' try{ mirror(`UPDATE shopify_products SET mfr_sku=\'${q2(newMfr).replace(/\'/g,"\'\'")}\' WHERE dw_sku=\'${r.dw_sku}\';`); mMac=\'ok\'; }catch(e){ mMac=\'ERR:\'+e.message; }\n' +
+ ' try{ mirror(`UPDATE shopify_products SET mfr_sku=\'${newMfr.replace(/\'/g,"\'\'")}\' WHERE dw_sku=\'${r.dw_sku}\';`,{kam:true}); mKam=\'ok\'; }catch(e){ mKam=\'ERR:\'+e.message; }\n' +
+ " rec.result='applied'; rec.mirror_mac2=mMac; rec.mirror_kam=mKam; applied++;\n" +
+ " appendFileSync(LEDGER, JSON.stringify({agent:'vp-dw-commerce',ticket:'TK-11410',\n" +
+ ' action:`Gate2 reprice+repoint: ${r.dw_sku} mfr ${old_mfr}->${newMfr}, price ${old_price}->${newMap.toFixed(2)} (status stays DRAFT)`,\n' +
+ ' blast_radius:1,\n' +
+ ' undo_cmd:`# restore metafield+price+mirror for ${r.dw_sku}\\ncurl -s -X POST https://${SHOP}/admin/api/${API}/graphql.json -H "X-Shopify-Access-Token: $SHOPIFY_ADMIN_TOKEN" -H \'Content-Type: application/json\' -d \'{"query":"mutation{ metafieldsSet(metafields:[{ownerId:\\\\"${pgid}\\\\",namespace:\\\\"global\\\\",key:\\\\"Item\\\\",type:\\\\"single_line_text_field\\\\",value:\\\\"${old_mfr}\\\\"}]){userErrors{message}} }"}\'; curl -s -X POST https://${SHOP}/admin/api/${API}/graphql.json -H "X-Shopify-Access-Token: $SHOPIFY_ADMIN_TOKEN" -H \'Content-Type: application/json\' -d \'{"query":"mutation{ productVariantsBulkUpdate(productId:\\\\"${pgid}\\\\",variants:[{id:\\\\"${sellId}\\\\",price:\\\\"${old_price}\\\\"}]){userErrors{message}} }"}\'; psql -h /tmp -d dw_unified -c "UPDATE shopify_products SET mfr_sku=\'${old_mfr}\' WHERE dw_sku=\'${r.dw_sku}\';"; ssh ${KAM_SSH} "psql -d ${KAM_DB} -c \\\\"UPDATE shopify_products SET mfr_sku=\'${old_mfr}\' WHERE dw_sku=\'${r.dw_sku}\';\\\\""`,\n' +
+ ' verify:`curl -s https://${SHOP}/admin/api/${API}/products/${gid2id(pgid)}/metafields.json -H "X-Shopify-Access-Token: $SHOPIFY_ADMIN_TOKEN" | grep Item`,\n' +
+ " ts:new Date().toISOString()})+'\\n');\n" +
+ ' } else {\n' +
+ " rec.result='FAILED-verify'; rec.after=after; rec.mfErr=mfErr; rec.prErr=prErr; failed++;\n" +
+ ' }\n' +
+ " appendFileSync(RESULT,JSON.stringify(rec)+'\\n');\n" +
+ ' appendFileSync(PROG,`${r.dw_sku} ${rec.result} [applied=${applied} skip=${skipped} fail=${failed}]\\n`);\n' +
+ ' await sleep(400);\n' +
+ '}\n' +
+ 'appendFileSync(PROG,`GATE2 batch ${BATCH} DONE ${new Date().toISOString()} applied=${applied} skip=${skipped} fail=${failed}\\n`);\n' +
+ 'console.log(`DONE batch ${BATCH}: applied=${applied} skip=${skipped} fail=${failed}`);\n',
+ operator: 'strictEqual',
+ diff: 'simple'
+}
+
+Node.js v26.4.0
diff --git a/verification/tk11443/baseline.mjs b/verification/tk11443/baseline.mjs
new file mode 100644
index 00000000..d034ad7c
--- /dev/null
+++ b/verification/tk11443/baseline.mjs
@@ -0,0 +1,134 @@
+#!/usr/bin/env node
+// ============================================================================
+// TK-11410 GATE 2 — APPLY reprice + repoint mfr_sku for the resolved Kravet
+// fabric-SKU wallcoverings. *** DRAFT — Steve runs this; it is NOT auto-fired. ***
+//
+// Per product it will:
+// (a) write new_mfr (correct paper SKU) to the global.Item metafield AND
+// shopify_products.mfr_sku on Mac2 (local) AND Kamatera (ssh)
+// (b) set the SELLABLE variant price = new_MAP (authoritative 2026 MAP)
+// (c) leave status = DRAFT (never touches status)
+//
+// Safety: idempotent (skips if already at target), verify-per-write (re-reads
+// after each), self-ledgering with a REAL undo (old_mfr + old_price restore),
+// background-safe (paced + 429/502/503 retry).
+//
+// MODES:
+// node tk11410-gate2-apply.mjs -> --preview (default): NO network,
+// prints planned mutations only
+// node tk11410-gate2-apply.mjs --apply -> LIVE: performs the writes (Steve)
+// node tk11410-gate2-apply.mjs --apply --batch B -> run the confirm batch (after
+// colorway/portal confirm)
+// env: SHOPIFY_ADMIN_TOKEN or SHOPIFY_FULL_ACCESS_TOKEN (metafields+price+read)
+// KAMATERA_SSH (default: root@45.61.58.125) KAMATERA_DB (default: dw_unified)
+// ============================================================================
+import { readFileSync, appendFileSync, writeFileSync } from 'node:fs';
+import { execFileSync } from 'node:child_process';
+
+const S='/private/tmp/claude-501/-Users-macstudio3/99b3ab49-c5fe-4009-ac1c-00937236c566/scratchpad';
+const SHOP='designer-laboratory-sandbox.myshopify.com', API='2024-10';
+const LEDGER='/Users/macstudio3/.claude/yolo-queue/executed-reversible/ledger.jsonl';
+const argv=process.argv.slice(2);
+const APPLY=argv.includes('--apply');
+const BATCH=(argv[argv.indexOf('--batch')+1]||'A').toUpperCase();
+const KAM_SSH=process.env.KAMATERA_SSH||'root@45.61.58.125';
+const KAM_DB=process.env.KAMATERA_DB||'dw_unified';
+const MIN_PRICE=1.00; // hard floor: NEVER write a price below this (guards the $0-orderable bug class)
+const PROG=`${S}/tk11410-gate2-apply-progress.txt`;
+const RESULT=`${S}/tk11410-gate2-apply-result.jsonl`;
+
+const env=readFileSync('/Users/macstudio3/Projects/secrets-manager/.env','utf8');
+const TOKEN=(env.match(/^SHOPIFY_FULL_ACCESS_TOKEN=(.*)$/m)||env.match(/^SHOPIFY_ADMIN_TOKEN=(.*)$/m)||[])[1]?.replace(/["' ]/g,'');
+
+const rows=readFileSync(`${S}/tk11410-apply-batch${BATCH}.jsonl`,'utf8').trim().split('\n').filter(Boolean).map(JSON.parse);
+const sleep=ms=>new Promise(r=>setTimeout(r,ms));
+const gid2id=g=>String(g).replace('gid://shopify/Product/','');
+const q2=s=>String(s).replace(/"/g,'\\"');
+
+async function gql(query){
+ for(let a=0;a<5;a++){ try{
+ const r=await fetch(`https://${SHOP}/admin/api/${API}/graphql.json`,{method:'POST',
+ headers:{'X-Shopify-Access-Token':TOKEN,'Content-Type':'application/json'},body:JSON.stringify({query})});
+ if([429,502,503].includes(r.status)){await sleep(1500*(a+1));continue;}
+ return await r.json();
+ }catch(e){await sleep(1500*(a+1));} }
+ return {errors:[{message:'retries exhausted'}]};
+}
+// read current global.Item + sellable variant price
+async function readCurrent(pgid, variantGid){
+ const j=await gql(`{ product(id:"${pgid}"){ status item:metafield(namespace:"global",key:"Item"){id value} variants(first:15){nodes{id sku price}} } }`);
+ const p=j?.data?.product; if(!p) return null;
+ const vs=p.variants?.nodes||[];
+ const sell=vs.find(v=>v.id===variantGid) || vs.find(v=>v.sku&&!/-sample$/i.test(v.sku));
+ return {status:p.status, item:p.item?.value??null, price:sell?String(sell.price):null, sellId:sell?.id||variantGid};
+}
+async function setItem(pgid,val){
+ return gql(`mutation{ metafieldsSet(metafields:[{ownerId:"${pgid}",namespace:"global",key:"Item",type:"single_line_text_field",value:"${q2(val)}"}]){ metafields{ id key value } userErrors{ field message } } }`);
+}
+async function setPrice(pgid,variantGid,price){
+ return gql(`mutation{ productVariantsBulkUpdate(productId:"${pgid}", variants:[{id:"${variantGid}", price:"${Number(price).toFixed(2)}"}]){ productVariants{ id price } userErrors{ field message } } }`);
+}
+function mirror(sql,{kam=false}={}){
+ if(kam) return execFileSync('ssh',[KAM_SSH,`psql -d ${KAM_DB} -c "${sql.replace(/"/g,'\\"')}"`],{stdio:'pipe'}).toString();
+ return execFileSync('psql',['-c',sql],{env:{...process.env,PGHOST:'/tmp',PGDATABASE:'dw_unified'},stdio:'pipe'}).toString();
+}
+
+console.log(`TK-11410 GATE2 apply — batch ${BATCH} — ${rows.length} products — mode=${APPLY?'APPLY (LIVE)':'PREVIEW (no network)'}`);
+if(!APPLY){
+ console.log('--- PREVIEW: first 10 planned mutations (dw_sku, old->new mfr, old->new price) ---');
+ for(const r of rows.slice(0,10)){
+ const np = (r.new_map!=null && r.new_map>=MIN_PRICE) ? '$'+Number(r.new_map).toFixed(2) : 'MISSING(verify MAP - price NOT written)';
+ console.log(`${r.dw_sku}: mfr ${r.old_mfr} -> ${r.new_mfr} | price $${r.old_price} -> ${np} | variant ${r.sellable_variant_gid} | status stays DRAFT`);
+ }
+ const noPrice=rows.filter(r=>!(r.new_map!=null&&r.new_map>=MIN_PRICE)).length;
+ if(noPrice) console.log(`\nNOTE: ${noPrice} row(s) in this batch have no valid MAP (< $${MIN_PRICE}); the apply's hard floor SKIPS them (no write) until a MAP is confirmed.`);
+ console.log(`\nPREVIEW ONLY — no writes performed. Re-run with --apply (as Steve) to execute batch ${BATCH}.`);
+ process.exit(0);
+}
+
+// ---- LIVE APPLY ----
+if(!TOKEN){ console.error('NO TOKEN'); process.exit(2); }
+writeFileSync(PROG,`GATE2 batch ${BATCH} APPLY start ${new Date().toISOString()} n=${rows.length}\n`);
+writeFileSync(RESULT,'');
+let applied=0,skipped=0,failed=0;
+for(const r of rows){
+ const pgid=r.shopify_id, vgid=r.sellable_variant_gid, newMfr=r.new_mfr, newMap=Number(r.new_map);
+ // HARD GUARD: never write a price below the floor (guards the $0-orderable bug class)
+ if(!(newMap>=MIN_PRICE)){ const rec={dw_sku:r.dw_sku,new_mfr:newMfr,new_map:r.new_map,result:'SKIP-invalid-price'}; failed++; appendFileSync(RESULT,JSON.stringify(rec)+'\n'); appendFileSync(PROG,`${r.dw_sku} SKIP-invalid-price (MAP<${MIN_PRICE}) - not written\n`); continue; }
+ const cur=await readCurrent(pgid, vgid);
+ let rec={dw_sku:r.dw_sku, new_mfr:newMfr, new_map:newMap};
+ if(!cur){ rec.result='FAILED-read'; failed++; appendFileSync(RESULT,JSON.stringify(rec)+'\n'); continue; }
+ const old_mfr=cur.item, old_price=cur.price, sellId=cur.sellId;
+ rec.old_mfr=old_mfr; rec.old_price=old_price;
+ const priceOk = old_price!=null && Math.abs(Number(old_price)-newMap)<0.005;
+ if(cur.item===newMfr && priceOk){ rec.result='skip-idempotent'; skipped++; appendFileSync(RESULT,JSON.stringify(rec)+'\n'); appendFileSync(PROG,`${r.dw_sku} skip (already at target)\n`); continue; }
+ // (a) metafield
+ const mfRes=await setItem(pgid,newMfr); const mfErr=mfRes?.data?.metafieldsSet?.userErrors||[];
+ // (b) price
+ const prRes=await setPrice(pgid,sellId,newMap); const prErr=prRes?.data?.productVariantsBulkUpdate?.userErrors||[];
+ await sleep(400);
+ // verify
+ const after=await readCurrent(pgid, sellId);
+ const okMf=after && after.item===newMfr;
+ const okPr=after && after.price!=null && Math.abs(Number(after.price)-newMap)<0.005;
+ if(okMf && okPr && mfErr.length===0 && prErr.length===0){
+ // (a2) mirror both machines
+ let mMac='',mKam='';
+ try{ mirror(`UPDATE shopify_products SET mfr_sku='${q2(newMfr).replace(/'/g,"''")}' WHERE dw_sku='${r.dw_sku}';`); mMac='ok'; }catch(e){ mMac='ERR:'+e.message; }
+ try{ mirror(`UPDATE shopify_products SET mfr_sku='${newMfr.replace(/'/g,"''")}' WHERE dw_sku='${r.dw_sku}';`,{kam:true}); mKam='ok'; }catch(e){ mKam='ERR:'+e.message; }
+ rec.result='applied'; rec.mirror_mac2=mMac; rec.mirror_kam=mKam; applied++;
+ appendFileSync(LEDGER, JSON.stringify({agent:'vp-dw-commerce',ticket:'TK-11410',
+ action:`Gate2 reprice+repoint: ${r.dw_sku} mfr ${old_mfr}->${newMfr}, price ${old_price}->${newMap.toFixed(2)} (status stays DRAFT)`,
+ blast_radius:1,
+ undo_cmd:`# restore metafield+price+mirror for ${r.dw_sku}\ncurl -s -X POST https://${SHOP}/admin/api/${API}/graphql.json -H "X-Shopify-Access-Token: $SHOPIFY_ADMIN_TOKEN" -H 'Content-Type: application/json' -d '{"query":"mutation{ metafieldsSet(metafields:[{ownerId:\\"${pgid}\\",namespace:\\"global\\",key:\\"Item\\",type:\\"single_line_text_field\\",value:\\"${old_mfr}\\"}]){userErrors{message}} }"}'; curl -s -X POST https://${SHOP}/admin/api/${API}/graphql.json -H "X-Shopify-Access-Token: $SHOPIFY_ADMIN_TOKEN" -H 'Content-Type: application/json' -d '{"query":"mutation{ productVariantsBulkUpdate(productId:\\"${pgid}\\",variants:[{id:\\"${sellId}\\",price:\\"${old_price}\\"}]){userErrors{message}} }"}'; psql -h /tmp -d dw_unified -c "UPDATE shopify_products SET mfr_sku='${old_mfr}' WHERE dw_sku='${r.dw_sku}';"; ssh ${KAM_SSH} "psql -d ${KAM_DB} -c \\"UPDATE shopify_products SET mfr_sku='${old_mfr}' WHERE dw_sku='${r.dw_sku}';\\""`,
+ verify:`curl -s https://${SHOP}/admin/api/${API}/products/${gid2id(pgid)}/metafields.json -H "X-Shopify-Access-Token: $SHOPIFY_ADMIN_TOKEN" | grep Item`,
+ ts:new Date().toISOString()})+'\n');
+ } else {
+ rec.result='FAILED-verify'; rec.after=after; rec.mfErr=mfErr; rec.prErr=prErr; failed++;
+ }
+ appendFileSync(RESULT,JSON.stringify(rec)+'\n');
+ appendFileSync(PROG,`${r.dw_sku} ${rec.result} [applied=${applied} skip=${skipped} fail=${failed}]\n`);
+ await sleep(400);
+}
+appendFileSync(PROG,`GATE2 batch ${BATCH} DONE ${new Date().toISOString()} applied=${applied} skip=${skipped} fail=${failed}\n`);
+console.log(`DONE batch ${BATCH}: applied=${applied} skip=${skipped} fail=${failed}`);
diff --git a/verification/tk11443/candidate.patch b/verification/tk11443/candidate.patch
new file mode 100644
index 00000000..a51d5dfc
--- /dev/null
+++ b/verification/tk11443/candidate.patch
@@ -0,0 +1,13 @@
+diff --git a/tk11410-gate2-apply.mjs b/tk11410-gate2-apply.mjs
+index d034ad7..cb7af99 100644
+--- a/tk11410-gate2-apply.mjs
++++ b/tk11410-gate2-apply.mjs
+@@ -30,7 +30,7 @@ const SHOP='designer-laboratory-sandbox.myshopify.com', API='2024-10';
+ const LEDGER='/Users/macstudio3/.claude/yolo-queue/executed-reversible/ledger.jsonl';
+ const argv=process.argv.slice(2);
+ const APPLY=argv.includes('--apply');
+-const BATCH=(argv[argv.indexOf('--batch')+1]||'A').toUpperCase();
++const BATCH=(argv.includes('--batch') ? argv[argv.indexOf('--batch')+1]||'A' : 'A').toUpperCase();
+ const KAM_SSH=process.env.KAMATERA_SSH||'root@45.61.58.125';
+ const KAM_DB=process.env.KAMATERA_DB||'dw_unified';
+ const MIN_PRICE=1.00; // hard floor: NEVER write a price below this (guards the $0-orderable bug class)
diff --git a/verification/tk11443/e2e-proof.json b/verification/tk11443/e2e-proof.json
new file mode 100644
index 00000000..6c9161c4
--- /dev/null
+++ b/verification/tk11443/e2e-proof.json
@@ -0,0 +1,69 @@
+{
+ "ticket": "TK-11443-tk-11410-apply-script-arg-parser-bug-app",
+ "intent": "Adopt the previously reviewed one-line missing --batch guard into the canonical draft script.",
+ "risk_tier": "R1",
+ "timestamp": "2026-09-11T00:58:33.103166+00:00",
+ "environment": "macOS; Node VM executes entire canonical module with fixture-only filesystem and denied side effects",
+ "build": {
+ "repository": "/Users/macstudio3/.claude/yolo-queue",
+ "commit": "7ee3a89d020ff1fbfc0f01e75e070edfabefe2c3",
+ "source": "/Users/macstudio3/.claude/yolo-queue/pending-approval/tk11410-artifacts/tk11410-gate2-apply.mjs",
+ "sha256": "5d694c32bf91bb0c643880ef25e3453746e8afe0662efbc24ba84b69606e521c"
+ },
+ "baseline": {
+ "commit": "bf52a53",
+ "file": "baseline.mjs",
+ "sha256": "c7bc7ecd93e89072d51a4ee8a8a9e169c2022b2e4f7681fc114f81df000866d3",
+ "regression_test": "FAIL as expected before patch (exit 1); baseline-red.txt"
+ },
+ "commands": [
+ "node --check /Users/macstudio3/.claude/yolo-queue/pending-approval/tk11410-artifacts/tk11410-gate2-apply.mjs",
+ "node --experimental-vm-modules verification/tk11443/verify.mjs",
+ "git -C /Users/macstudio3/.claude/yolo-queue diff --check -- pending-approval/tk11410-artifacts/tk11410-gate2-apply.mjs"
+ ],
+ "checks": [
+ {
+ "name": "Exact one-line source delta; APPLY and remaining source byte-for-byte unchanged",
+ "verdict": "PASS"
+ },
+ {
+ "name": "10 extracted-parser cases, including --apply alone, --preview alone, explicit batches, unknown flags and preserved malformed legacy input",
+ "verdict": "PASS"
+ },
+ {
+ "name": "4 whole-canonical-module preview journeys with batch filename, output, valid MAP and invalid MAP assertions",
+ "verdict": "PASS"
+ },
+ {
+ "name": "Zero real secret reads, filesystem writes, network calls, child processes or live apply",
+ "verdict": "PASS"
+ },
+ {
+ "name": "Syntax and scoped whitespace checks",
+ "verdict": "PASS"
+ },
+ {
+ "name": "Regression harness rejects original unpatched canonical source",
+ "verdict": "PASS"
+ }
+ ],
+ "review": {
+ "file": "prior-dtd-review.md",
+ "decision": "Prior DTD 2/2, Codex FINAL KEEP; exact approved scope unchanged"
+ },
+ "evidence": [
+ "verification.json",
+ "baseline-red.txt",
+ "verify.mjs",
+ "candidate.patch",
+ "prior-dtd-review.md"
+ ],
+ "limitations": [
+ "Preview uses fixture data; live apply is outside this parser-only task and was never executed.",
+ "Malformed --batch --apply behavior is intentionally unchanged, per prior review; this change only fixes omitted --batch.",
+ "An initial repository-wide whitespace check reported pre-existing TK-10926 review-file trailing spaces; the target-scoped check passed."
+ ],
+ "cleanup": "No test side effects; retained fixture baseline and evidence for replay. No live resources changed.",
+ "rollback": "git -C /Users/macstudio3/.claude/yolo-queue revert 7ee3a89d020ff1fbfc0f01e75e070edfabefe2c3",
+ "verdict": "PASS"
+}
diff --git a/verification/tk11443/prior-dtd-review.md b/verification/tk11443/prior-dtd-review.md
new file mode 100644
index 00000000..6f692ae0
--- /dev/null
+++ b/verification/tk11443/prior-dtd-review.md
@@ -0,0 +1,36 @@
+# DTD Verdict — args bounded increment
+
+## Decision: A
+
+Confidence: medium · Vote: 2/2 · Availability: 2/6
+
+| Reference | Runtime/model | Recorded response |
+|---|---|---|
+| Claude | Disabled by zero-cost policy | [claude disabled: DTD_ZERO_COST=1] |
+| Codex | Codex CLI / gpt-6-astra | VERDICT: A |
+| Qwen | local Ollama / qwen3:14b | VERDICT: A |
+| Grok | Unavailable | [grok unavailable] |
+| Kimi | Unavailable | [kimi unavailable] |
+| Muse | Local endpoint unavailable | [muse unavailable] |
+
+## Dissent
+
+No minority valid vote; keep candidate inert and claims limited to fixture proof.
+
+## Post-decision Codex debate
+
+**PROSECUTOR:** Overturn A. The panel risks expanding a narrow parsing fix into an unsupported behavioral change. Qwen adds “rejecting invalid inputs” without evidence establishing valid batch identifiers. Codex also makes candidate preparation depend on TK11424’s handoff, although the stated ownership restriction concerns adoption. These additions could block authorized candidate work or reject previously accepted batches. The verified defect is specific: non-batch flags become batch identifiers. No-argument `A` is already correct.
+
+**DEFENDER:** Those objections limit implementation; they do not defeat A’s central decision. TK11443 explicitly requires default batch `A`, and the parent’s exact-source VM evaluation confirms existing behavior: no arguments produce `A`, while `--preview` and `--apply` incorrectly become `--PREVIEW` and `--APPLY`. A minimal candidate can ignore non-batch flags while preserving the no-argument result and leaving `APPLY=argv.includes("--apply")` untouched. No unsupported identifier restrictions or new action defaults are necessary. Candidate preparation does not authorize owner adoption, and apply parsing can be tested without executing live apply.
+
+**JUDGE:** The prosecutor exposes unjustified additions, but provides no controlling reason to reject the constrained parsing correction. Keep A with those additions excluded.
+
+FINAL: KEEP
+
+The controlling evidence establishes a batch-selection bug, not an action-default bug: `A` is required and already returned with no arguments. The candidate must only correct batch parsing to ignore non-batch flags, preserve the existing APPLY expression and remaining behavior, and remain pending owner adoption. Unsupported batch validation, invented action defaults, and live apply execution fall outside this decision.
+
+## Scope
+
+args
+
+Exact run: /private/tmp/dtd-cyf2204-args.KlgyMn
diff --git a/verification/tk11443/verification.json b/verification/tk11443/verification.json
new file mode 100644
index 00000000..4d2ba2dd
--- /dev/null
+++ b/verification/tk11443/verification.json
@@ -0,0 +1,245 @@
+{
+ "task_id": "TK-11443",
+ "canonicalPath": "/Users/macstudio3/.claude/yolo-queue/pending-approval/tk11410-artifacts/tk11410-gate2-apply.mjs",
+ "canonical_sha256": "5d694c32bf91bb0c643880ef25e3453746e8afe0662efbc24ba84b69606e521c",
+ "source_sha256": "c7bc7ecd93e89072d51a4ee8a8a9e169c2022b2e4f7681fc114f81df000866d3",
+ "exact_one_line_change": "PASS",
+ "parserResults": [
+ {
+ "args": [],
+ "before": {
+ "APPLY": false,
+ "BATCH": "A"
+ },
+ "after": {
+ "APPLY": false,
+ "BATCH": "A"
+ },
+ "verdict": "PASS"
+ },
+ {
+ "args": [
+ "--preview"
+ ],
+ "before": {
+ "APPLY": false,
+ "BATCH": "--PREVIEW"
+ },
+ "after": {
+ "APPLY": false,
+ "BATCH": "A"
+ },
+ "verdict": "PASS"
+ },
+ {
+ "args": [
+ "--apply"
+ ],
+ "before": {
+ "APPLY": true,
+ "BATCH": "--APPLY"
+ },
+ "after": {
+ "APPLY": true,
+ "BATCH": "A"
+ },
+ "verdict": "PASS"
+ },
+ {
+ "args": [
+ "--batch",
+ "B"
+ ],
+ "before": {
+ "APPLY": false,
+ "BATCH": "B"
+ },
+ "after": {
+ "APPLY": false,
+ "BATCH": "B"
+ },
+ "verdict": "PASS"
+ },
+ {
+ "args": [
+ "--apply",
+ "--batch",
+ "b"
+ ],
+ "before": {
+ "APPLY": true,
+ "BATCH": "B"
+ },
+ "after": {
+ "APPLY": true,
+ "BATCH": "B"
+ },
+ "verdict": "PASS"
+ },
+ {
+ "args": [
+ "--preview",
+ "--batch",
+ "b"
+ ],
+ "before": {
+ "APPLY": false,
+ "BATCH": "B"
+ },
+ "after": {
+ "APPLY": false,
+ "BATCH": "B"
+ },
+ "verdict": "PASS"
+ },
+ {
+ "args": [
+ "--batch"
+ ],
+ "before": {
+ "APPLY": false,
+ "BATCH": "A"
+ },
+ "after": {
+ "APPLY": false,
+ "BATCH": "A"
+ },
+ "verdict": "PASS"
+ },
+ {
+ "args": [
+ "--other"
+ ],
+ "before": {
+ "APPLY": false,
+ "BATCH": "--OTHER"
+ },
+ "after": {
+ "APPLY": false,
+ "BATCH": "A"
+ },
+ "verdict": "PASS"
+ },
+ {
+ "args": [
+ "--batch",
+ "C"
+ ],
+ "before": {
+ "APPLY": false,
+ "BATCH": "C"
+ },
+ "after": {
+ "APPLY": false,
+ "BATCH": "C"
+ },
+ "verdict": "PASS"
+ },
+ {
+ "args": [
+ "--batch",
+ "--apply"
+ ],
+ "before": {
+ "APPLY": true,
+ "BATCH": "--APPLY"
+ },
+ "after": {
+ "APPLY": true,
+ "BATCH": "--APPLY"
+ },
+ "verdict": "PASS"
+ }
+ ],
+ "previews": [
+ {
+ "args": [],
+ "batch": "A",
+ "mockedReads": [
+ "/Users/macstudio3/Projects/secrets-manager/.env",
+ "/private/tmp/claude-501/-Users-macstudio3/99b3ab49-c5fe-4009-ac1c-00937236c566/scratchpad/tk11410-apply-batchA.jsonl"
+ ],
+ "output": [
+ "TK-11410 GATE2 apply — batch A — 2 products — mode=PREVIEW (no network)",
+ "--- PREVIEW: first 10 planned mutations (dw_sku, old->new mfr, old->new price) ---",
+ "FIXTURE-VALID: mfr OLD -> NEW | price $10 -> $20.00 | variant fixture-variant | status stays DRAFT",
+ "FIXTURE-FLOOR: mfr OLD -> NEW | price $10 -> MISSING(verify MAP - price NOT written) | variant fixture-variant | status stays DRAFT",
+ "\nNOTE: 1 row(s) in this batch have no valid MAP (< $1); the apply's hard floor SKIPS them (no write) until a MAP is confirmed.",
+ "\nPREVIEW ONLY — no writes performed. Re-run with --apply (as Steve) to execute batch A."
+ ],
+ "denied": [],
+ "exitCode": 0,
+ "verdict": "PASS"
+ },
+ {
+ "args": [
+ "--preview"
+ ],
+ "batch": "A",
+ "mockedReads": [
+ "/Users/macstudio3/Projects/secrets-manager/.env",
+ "/private/tmp/claude-501/-Users-macstudio3/99b3ab49-c5fe-4009-ac1c-00937236c566/scratchpad/tk11410-apply-batchA.jsonl"
+ ],
+ "output": [
+ "TK-11410 GATE2 apply — batch A — 2 products — mode=PREVIEW (no network)",
+ "--- PREVIEW: first 10 planned mutations (dw_sku, old->new mfr, old->new price) ---",
+ "FIXTURE-VALID: mfr OLD -> NEW | price $10 -> $20.00 | variant fixture-variant | status stays DRAFT",
+ "FIXTURE-FLOOR: mfr OLD -> NEW | price $10 -> MISSING(verify MAP - price NOT written) | variant fixture-variant | status stays DRAFT",
+ "\nNOTE: 1 row(s) in this batch have no valid MAP (< $1); the apply's hard floor SKIPS them (no write) until a MAP is confirmed.",
+ "\nPREVIEW ONLY — no writes performed. Re-run with --apply (as Steve) to execute batch A."
+ ],
+ "denied": [],
+ "exitCode": 0,
+ "verdict": "PASS"
+ },
+ {
+ "args": [
+ "--preview",
+ "--batch",
+ "b"
+ ],
+ "batch": "B",
+ "mockedReads": [
+ "/Users/macstudio3/Projects/secrets-manager/.env",
+ "/private/tmp/claude-501/-Users-macstudio3/99b3ab49-c5fe-4009-ac1c-00937236c566/scratchpad/tk11410-apply-batchB.jsonl"
+ ],
+ "output": [
+ "TK-11410 GATE2 apply — batch B — 2 products — mode=PREVIEW (no network)",
+ "--- PREVIEW: first 10 planned mutations (dw_sku, old->new mfr, old->new price) ---",
+ "FIXTURE-VALID: mfr OLD -> NEW | price $10 -> $20.00 | variant fixture-variant | status stays DRAFT",
+ "FIXTURE-FLOOR: mfr OLD -> NEW | price $10 -> MISSING(verify MAP - price NOT written) | variant fixture-variant | status stays DRAFT",
+ "\nNOTE: 1 row(s) in this batch have no valid MAP (< $1); the apply's hard floor SKIPS them (no write) until a MAP is confirmed.",
+ "\nPREVIEW ONLY — no writes performed. Re-run with --apply (as Steve) to execute batch B."
+ ],
+ "denied": [],
+ "exitCode": 0,
+ "verdict": "PASS"
+ },
+ {
+ "args": [
+ "--batch"
+ ],
+ "batch": "A",
+ "mockedReads": [
+ "/Users/macstudio3/Projects/secrets-manager/.env",
+ "/private/tmp/claude-501/-Users-macstudio3/99b3ab49-c5fe-4009-ac1c-00937236c566/scratchpad/tk11410-apply-batchA.jsonl"
+ ],
+ "output": [
+ "TK-11410 GATE2 apply — batch A — 2 products — mode=PREVIEW (no network)",
+ "--- PREVIEW: first 10 planned mutations (dw_sku, old->new mfr, old->new price) ---",
+ "FIXTURE-VALID: mfr OLD -> NEW | price $10 -> $20.00 | variant fixture-variant | status stays DRAFT",
+ "FIXTURE-FLOOR: mfr OLD -> NEW | price $10 -> MISSING(verify MAP - price NOT written) | variant fixture-variant | status stays DRAFT",
+ "\nNOTE: 1 row(s) in this batch have no valid MAP (< $1); the apply's hard floor SKIPS them (no write) until a MAP is confirmed.",
+ "\nPREVIEW ONLY — no writes performed. Re-run with --apply (as Steve) to execute batch A."
+ ],
+ "denied": [],
+ "exitCode": 0,
+ "verdict": "PASS"
+ }
+ ],
+ "realSecretReads": 0,
+ "networkCalls": 0,
+ "childProcesses": 0,
+ "candidateWrites": 0,
+ "liveApplyExecuted": false
+}
diff --git a/verification/tk11443/verify.mjs b/verification/tk11443/verify.mjs
new file mode 100644
index 00000000..59e59fee
--- /dev/null
+++ b/verification/tk11443/verify.mjs
@@ -0,0 +1,74 @@
+import assert from 'node:assert/strict';
+import { readFileSync } from 'node:fs';
+import { createHash } from 'node:crypto';
+import vm from 'node:vm';
+
+const candidatePath = '/Users/macstudio3/.claude/yolo-queue/pending-approval/tk11410-artifacts/tk11410-gate2-apply.mjs';
+const sourcePath = new URL('./baseline.mjs', import.meta.url);
+const source = readFileSync(sourcePath, 'utf8');
+const candidate = readFileSync(candidatePath, 'utf8');
+const oldLine = "const BATCH=(argv[argv.indexOf('--batch')+1]||'A').toUpperCase();";
+const newLine = "const BATCH=(argv.includes('--batch') ? argv[argv.indexOf('--batch')+1]||'A' : 'A').toUpperCase();";
+assert(source.includes(oldLine));
+assert.equal(candidate, source.replace(oldLine, newLine));
+const parser = text => text.match(/^const argv=.*\nconst APPLY=.*\nconst BATCH=.*$/m)[0];
+const parse = (text, args) => vm.runInNewContext(parser(text) + '\n({APPLY,BATCH})', { process: { argv: ['node', 'script', ...args] } }, { timeout: 1000 });
+const matrix = [
+ [[], 'A', false], [['--preview'], 'A', false], [['--apply'], 'A', true],
+ [['--batch', 'B'], 'B', false], [['--apply', '--batch', 'b'], 'B', true],
+ [['--preview', '--batch', 'b'], 'B', false], [['--batch'], 'A', false],
+ [['--other'], 'A', false], [['--batch', 'C'], 'C', false],
+ [['--batch', '--apply'], '--APPLY', true]
+];
+const parserResults = matrix.map(([args, batch, apply]) => {
+ const before = parse(source, args), after = parse(candidate, args);
+ assert.equal(after.BATCH, batch); assert.equal(after.APPLY, apply);
+ return { args, before, after, verdict: 'PASS' };
+});
+assert.equal(parserResults[1].before.BATCH, '--PREVIEW');
+assert.equal(parserResults[2].before.BATCH, '--APPLY');
+
+async function preview(args, batch) {
+ assert(!args.includes('--apply'));
+ const reads = [], output = [], denied = [];
+ const deny = name => (...unused) => { denied.push(name); throw new Error('DENIED ' + name); };
+ const exited = {};
+ const context = vm.createContext({
+ process: { argv: ['node', 'script', ...args], env: Object.freeze({}), exit: code => { assert.equal(code, 0); throw exited; } },
+ console: { log: (...parts) => output.push(parts.join(' ')), error: deny('console.error') },
+ fetch: deny('fetch'), setTimeout: deny('timer')
+ }, { codeGeneration: { strings: false, wasm: false } });
+ const fixture = [
+ { dw_sku: 'FIXTURE-VALID', old_mfr: 'OLD', new_mfr: 'NEW', old_price: 10, new_map: 20, sellable_variant_gid: 'fixture-variant' },
+ { dw_sku: 'FIXTURE-FLOOR', old_mfr: 'OLD', new_mfr: 'NEW', old_price: 10, new_map: 0, sellable_variant_gid: 'fixture-variant' }
+ ].map(JSON.stringify).join('\n');
+ const batchPath = '/private/tmp/claude-501/-Users-macstudio3/99b3ab49-c5fe-4009-ac1c-00937236c566/scratchpad/tk11410-apply-batch' + batch + '.jsonl';
+ const mockedRead = (path, encoding) => {
+ reads.push(path); assert.equal(encoding, 'utf8');
+ if (path === '/Users/macstudio3/Projects/secrets-manager/.env') return '';
+ if (path === batchPath) return fixture;
+ return deny('unexpected read')();
+ };
+ const fs = new vm.SyntheticModule(['readFileSync', 'appendFileSync', 'writeFileSync'], function () {
+ this.setExport('readFileSync', mockedRead); this.setExport('appendFileSync', deny('append')); this.setExport('writeFileSync', deny('write'));
+ }, { context });
+ const child = new vm.SyntheticModule(['execFileSync'], function () { this.setExport('execFileSync', deny('child_process')); }, { context });
+ const module = new vm.SourceTextModule(candidate, { context, importModuleDynamically: deny('dynamic import') });
+ await module.link(name => {
+ if (name === 'node:fs') return fs;
+ if (name === 'node:child_process') return child;
+ return deny('unexpected module')();
+ });
+ let exitObserved = false;
+ try { await module.evaluate({ timeout: 1000 }); } catch (error) { if (error !== exited) throw error; exitObserved = true; }
+ assert(exitObserved); assert.deepEqual(denied, []); assert.equal(reads.length, 2);
+ assert(output[0].includes('batch ' + batch + ' — 2 products — mode=PREVIEW'));
+ assert(output.some(line => line.includes('FIXTURE-VALID') && line.includes('$20.00')));
+ assert(output.some(line => line.includes('FIXTURE-FLOOR') && line.includes('MISSING')));
+ assert(output.some(line => line.includes('1 row(s)')));
+ assert(output.at(-1).includes('PREVIEW ONLY — no writes performed'));
+ return { args, batch, mockedReads: reads, output, denied, exitCode: 0, verdict: 'PASS' };
+}
+const previews = [];
+for (const [args, batch] of [[[], 'A'], [['--preview'], 'A'], [['--preview', '--batch', 'b'], 'B'], [['--batch'], 'A']]) previews.push(await preview(args, batch));
+console.log(JSON.stringify({ task_id: 'TK-11443', canonicalPath: candidatePath, canonical_sha256: createHash('sha256').update(candidate).digest('hex'), source_sha256: createHash('sha256').update(source).digest('hex'), exact_one_line_change: 'PASS', parserResults, previews, realSecretReads: 0, networkCalls: 0, childProcesses: 0, candidateWrites: 0, liveApplyExecuted: false }, null, 2));
← 00df756a governance(TK-11370): make live-by-default Shopify writers d
·
back to Ticket System
·
auto-data-snapshot: 2026-09-10T18:07:04 (2 data files) — ver 877645f8 →