← back to Designerwallcoverings
TK-11186 Step E: fix theme-deploy verify (PUT checksum + GET backoff) — the read-after-write race false-failed a PUT that actually landed
15d8c9cb574010e057acfd1eb704d139bf44314d · 2026-09-03 12:27:18 -0700 · Steve Abrams
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Files touched
M scripts/tk11186-showroom-hide/theme-deploy/push-theme-assets.mjs
Diff
commit 15d8c9cb574010e057acfd1eb704d139bf44314d
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Thu Sep 3 12:27:18 2026 -0700
TK-11186 Step E: fix theme-deploy verify (PUT checksum + GET backoff) — the read-after-write race false-failed a PUT that actually landed
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---
.../theme-deploy/push-theme-assets.mjs | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/scripts/tk11186-showroom-hide/theme-deploy/push-theme-assets.mjs b/scripts/tk11186-showroom-hide/theme-deploy/push-theme-assets.mjs
index 2f65c93..430ed32 100644
--- a/scripts/tk11186-showroom-hide/theme-deploy/push-theme-assets.mjs
+++ b/scripts/tk11186-showroom-hide/theme-deploy/push-theme-assets.mjs
@@ -76,9 +76,18 @@ for (const f of FILES) {
if (!APPLY && !ROLLBACK) continue;
if (liveSum === localSum) { console.log(' skip (identical)'); continue; }
const res = await putAsset(f.key, local);
- const after = await getAsset(f.key);
- const ok = md5(after.value) === localSum;
- console.log(` PUT done — verify ${ok ? 'OK' : 'MISMATCH!'} (new live md5 ${md5(after.value)})`);
+ // Verify — prefer the PUT response's OWN checksum (returned by Shopify on the write itself, so it
+ // can't race). Fall back to a re-GET with backoff, since an immediate read-after-write GET can hit a
+ // stale replica and false-negative even though the PUT landed (Shopify asset eventual consistency).
+ let afterSum = res && res.checksum ? res.checksum : '';
+ let ok = afterSum === localSum;
+ for (let attempt = 1; !ok && attempt <= 6; attempt++) {
+ await new Promise(r => setTimeout(r, 2500));
+ const after = await getAsset(f.key);
+ afterSum = md5(after.value);
+ ok = afterSum === localSum;
+ }
+ console.log(` PUT done — verify ${ok ? 'OK' : 'MISMATCH!'} (live md5 ${afterSum})`);
ledger({ agent: process.env.TK_AGENT || 'vp-dw-commerce', ticket: 'TK-11186',
action: `STEP E theme asset ${ROLLBACK ? 'ROLLBACK' : 'deploy'} ${f.key} on theme ${THEME_ID} (md5 ${liveSum} -> ${localSum})`,
blast_radius: 1,
← 5555d3e TK-11186 Step D+E prep: showroom-vendor guard in New Arrival
·
back to Designerwallcoverings
·
auto-data-snapshot: 2026-09-03T12:32:21 (10 data files) — sc f84dd8b →