← back to Dw Kravet Hires
TK-12090: parameterize low-res width threshold (--max-width, default 400) to fix Batch B false-green skip risk
8ab5855c1fefaef9a25f9f5ae243ef01ea93309c · 2026-09-23 17:47:51 -0700 · Steve Abrams
Batch B (Jeffrey Stevens ~665 products) targets <500px low-res, but the hardcoded 400px threshold at L171 was skipping ALL of them as 'already moved'. Added --max-width parameter (defaults to 400 for Batch A Kravet compatibility) so each batch can specify its own threshold: Batch A=400, Batch B=500, Batch C=640, Batch D=650 (per memo targets). Also fixed the skip message to show the actual limit being applied, not the hardcoded 400.
Files touched
M scripts/apply-hires.mjs
Diff
commit 8ab5855c1fefaef9a25f9f5ae243ef01ea93309c
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Wed Sep 23 17:47:51 2026 -0700
TK-12090: parameterize low-res width threshold (--max-width, default 400) to fix Batch B false-green skip risk
Batch B (Jeffrey Stevens ~665 products) targets <500px low-res, but the hardcoded 400px threshold at L171 was skipping ALL of them as 'already moved'. Added --max-width parameter (defaults to 400 for Batch A Kravet compatibility) so each batch can specify its own threshold: Batch A=400, Batch B=500, Batch C=640, Batch D=650 (per memo targets). Also fixed the skip message to show the actual limit being applied, not the hardcoded 400.
---
scripts/apply-hires.mjs | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/scripts/apply-hires.mjs b/scripts/apply-hires.mjs
index 6bc29b2..17d2673 100644
--- a/scripts/apply-hires.mjs
+++ b/scripts/apply-hires.mjs
@@ -59,6 +59,7 @@ const ONLY_SWAPPABLE = has('--only-swappable');
const BATCH = parseInt(val('--batch', '200'), 10);
const GAP = parseInt(val('--gap', '90'), 10); // seconds between batches (live only)
const LIMIT = parseInt(val('--limit', '0'), 10); // optional hard cap on rows this run (0 = all)
+const MAX_WIDTH = parseInt(val('--max-width', '400'), 10); // low-res threshold per batch: Kravet=400, Jeffrey Stevens=500 (etc.)
const MAX_HIRES = 5000; // originals >~5000px (>25MP) fail Shopify processing → self-heal skip
const HERE = path.dirname(new URL(import.meta.url).pathname);
@@ -167,10 +168,10 @@ async function applyLive(rows) {
if (!lf || !lf.first) { skipped++; console.log(` ⤫ SKIP (no image media) ${r.mfr_sku}`); continue; }
const curUrl = (lf.first.image.url || '').split('?')[0];
const curWidth = Math.max(lf.first.image.width || 0, lf.first.image.height || 0);
- // race-safe: if the live featured image already moved off the recorded 400px media, skip.
- if (curUrl !== anchorUrl || curWidth > 400) {
+ // race-safe: if the live featured image already moved off the recorded low-res media (threshold per batch), skip.
+ if (curUrl !== anchorUrl || curWidth > MAX_WIDTH) {
skipped++;
- console.log(` ⤫ SKIP (featured already moved: live=${curWidth}px ${curUrl === anchorUrl ? 'same-url' : 'diff-url'}) ${r.mfr_sku}`);
+ console.log(` ⤫ SKIP (featured already moved: live=${curWidth}px limit=${MAX_WIDTH} ${curUrl === anchorUrl ? 'same-url' : 'diff-url'}) ${r.mfr_sku}`);
continue;
}
const oldMediaId = lf.first.id;
← 9caaaac TK-11658 cycle-4 ground truth (2026-09-17/18): Phase-1 remai
·
back to Dw Kravet Hires
·
auto-data-snapshot: 2026-09-23T17:59:00 (4 data files) — dat 970e304 →