← back to Designerwallcoverings
TK-00060: contrarian FIX-FIRST fixes on maharam budget (round-2 SHIP IT)
28920acf05827f6b73b3b8bc0216aa380730be93 · 2026-07-27 16:15:20 -0700 · Steve Abrams
Cody's round-1 panel returned FIX FIRST on the DTD-A maharam-budget commit (0034812);
its self-reported 'contrarian SHIP IT' in that commit message was never on the ticket
record and, when actually run, found 3 real defects. Fixed all three (round-2 re-gate: SHIP IT 5/5):
1. status().remaining.osborne overstated headroom: it used bare globalLeft while
take()/remaining('osborne') subtract maharamReservation. On a pinched-global day the
dashboard reported osborne=20 while execution granted 0 — it lied exactly when a cron
fails and you need it honest. Now subtracts maharamReserved → status ≡ execution for all
states (proven: DW_VARIANT_BUDGET=720 forces globalLeft=28<100; old=20 vs take=0, new=0=0).
2. create-drafts.mjs leaked budget on failure (no refund) — diverged from sanderson/stroheim.
A 429 storm could burn the 100/day budget creating 0 products, then stall. Added
refund-on-exhausted-grant, refund-on-create-failed, and refund-in-catch to match the sibling
idiom (verified no double-refund: else/catch mutually exclusive, variants.length===1).
3. maharam-daily-drip.sh line 26 stale 'backlog' comment (the fix's whole point was moving
OFF backlog) → 'maharam'.
Also (contrarian note): documented the honest trade-off — the ~100-variant/day floor trims
'upload' by up to ~100 variants/day for the ~14-day onboard window (throttled, never zeroed).
Verified: node --check + bash -n pass; status/execution symmetry proven under forced pinch;
dry-run no-regression (headroom 100, 1429 to create, task-spec titles). Zero live writes.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Files touched
M scripts/maharam-onboard/create-drafts.mjsM scripts/maharam-onboard/maharam-daily-drip.shM scripts/variant-budget/budget.cjs
Diff
commit 28920acf05827f6b73b3b8bc0216aa380730be93
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Mon Jul 27 16:15:20 2026 -0700
TK-00060: contrarian FIX-FIRST fixes on maharam budget (round-2 SHIP IT)
Cody's round-1 panel returned FIX FIRST on the DTD-A maharam-budget commit (0034812);
its self-reported 'contrarian SHIP IT' in that commit message was never on the ticket
record and, when actually run, found 3 real defects. Fixed all three (round-2 re-gate: SHIP IT 5/5):
1. status().remaining.osborne overstated headroom: it used bare globalLeft while
take()/remaining('osborne') subtract maharamReservation. On a pinched-global day the
dashboard reported osborne=20 while execution granted 0 — it lied exactly when a cron
fails and you need it honest. Now subtracts maharamReserved → status ≡ execution for all
states (proven: DW_VARIANT_BUDGET=720 forces globalLeft=28<100; old=20 vs take=0, new=0=0).
2. create-drafts.mjs leaked budget on failure (no refund) — diverged from sanderson/stroheim.
A 429 storm could burn the 100/day budget creating 0 products, then stall. Added
refund-on-exhausted-grant, refund-on-create-failed, and refund-in-catch to match the sibling
idiom (verified no double-refund: else/catch mutually exclusive, variants.length===1).
3. maharam-daily-drip.sh line 26 stale 'backlog' comment (the fix's whole point was moving
OFF backlog) → 'maharam'.
Also (contrarian note): documented the honest trade-off — the ~100-variant/day floor trims
'upload' by up to ~100 variants/day for the ~14-day onboard window (throttled, never zeroed).
Verified: node --check + bash -n pass; status/execution symmetry proven under forced pinch;
dry-run no-regression (headroom 100, 1429 to create, task-spec titles). Zero live writes.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---
scripts/maharam-onboard/create-drafts.mjs | 5 +++--
scripts/maharam-onboard/maharam-daily-drip.sh | 2 +-
scripts/variant-budget/budget.cjs | 5 ++++-
3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/scripts/maharam-onboard/create-drafts.mjs b/scripts/maharam-onboard/create-drafts.mjs
index 667cfe0..7a14ba6 100644
--- a/scripts/maharam-onboard/create-drafts.mjs
+++ b/scripts/maharam-onboard/create-drafts.mjs
@@ -86,7 +86,7 @@ async function main() {
let ok = 0, fail = 0, mfFail = 0, imgFail = 0;
for (const o of todo) {
const grant = budget.take(BUDGET_CAT, o.product.variants.length);
- if (grant < o.product.variants.length) { console.error(`\n⛔ '${BUDGET_CAT}' budget exhausted today (granted ${grant}). Stop — resume tomorrow (idempotent).`); break; }
+ if (grant < o.product.variants.length) { if (grant) budget.refund(BUDGET_CAT, grant); console.error(`\n⛔ '${BUDGET_CAT}' budget exhausted today (granted ${grant}). Stop — resume tomorrow (idempotent).`); break; }
try {
const res = await rest('/products.json', { method: 'POST', body: { product: o.product } });
const body = await res.json().catch(() => ({}));
@@ -108,11 +108,12 @@ async function main() {
fs.writeSync(fd, JSON.stringify({ mfr_sku: o.mfr_sku, sku: o.sku, product_id: String(pid), imgs: imgOk, status: 'draft', created_at: new Date().toISOString() }) + '\n');
ok++; if (ok % 20 === 0) console.log(` ...created ${ok} (fail ${fail}, mfFail ${mfFail}, imgFail ${imgFail})`);
} else {
+ budget.refund(BUDGET_CAT, o.product.variants.length); // creation failed → return the grant (match sanderson/stroheim)
const errStr = JSON.stringify(body).toLowerCase();
if (/exceed|limit|too many|maximum/.test(errStr) && /variant|product|day/.test(errStr)) { console.error(`\n⛔ Shopify cap on ${o.sku}. Stop — resume tomorrow.`); break; }
fail++; console.error(` FAIL ${o.sku}: HTTP ${res.status} ${JSON.stringify(body).slice(0,200)}`);
}
- } catch (e) { fail++; console.error(` ERR ${o.sku}: ${String(e).slice(0,160)}`); await sleep(700); }
+ } catch (e) { budget.refund(BUDGET_CAT, o.product.variants.length); fail++; console.error(` ERR ${o.sku}: ${String(e).slice(0,160)}`); await sleep(700); }
}
fs.closeSync(fd);
console.log(`\nDONE. created=${ok} failed=${fail} mfFail=${mfFail} imgFail=${imgFail} of ${todo.length}`);
diff --git a/scripts/maharam-onboard/maharam-daily-drip.sh b/scripts/maharam-onboard/maharam-daily-drip.sh
index 90dcba2..010e9d9 100755
--- a/scripts/maharam-onboard/maharam-daily-drip.sh
+++ b/scripts/maharam-onboard/maharam-daily-drip.sh
@@ -23,7 +23,7 @@ cd "$DIR" || { echo "FATAL: no $DIR"; exit 1; }
# refresh payloads from staging (cheap, idempotent — reflects any staging edits)
node build-payloads.mjs || { echo "build-payloads failed"; exit 1; }
-# 1) create drafts (budget-metered via 'backlog'; PG-first write-back inside).
+# 1) create drafts (budget-metered via the finite 'maharam' category; PG-first write-back inside).
# Budget-exhausted is a clean exit 0 (normal stop); a real failure exits non-zero → stop before go-live.
node create-drafts.mjs --apply --limit="$DAILY_CAP" || { echo "create-drafts failed (rc=$?)"; exit 1; }
# 2) activate today's (and any leftover) drafts → auto-join the smart collection
diff --git a/scripts/variant-budget/budget.cjs b/scripts/variant-budget/budget.cjs
index 0de1ca9..834b201 100644
--- a/scripts/variant-budget/budget.cjs
+++ b/scripts/variant-budget/budget.cjs
@@ -99,6 +99,9 @@ const OSB_OUT = path.join(REPO_ROOT, 'scripts', 'osborne-onboard', 'out');
// reservation (below) that auto-zeroes when created.jsonl reaches the payload total, so the daily
// ~100/day trickle can neither be starved by the 5-field 'backlog' drain (the bug it hit) NOR breach
// the Shopify ~1,000/day cap (clamped to remainingGlobal like every category). 1,429 → ~14 days.
+// TRADE-OFF (contrarian, TK-00060): the ~100-variant floor is subtracted from the global pool, so
+// 'upload' draws up to ~100 fewer variants/day for the ~14-day onboard window (upload is throttled,
+// never zeroed — it still keeps its own cap minus the residual). Self-ends when the reservation zeroes.
// REVERSIBLE — the reservation self-zeroes on completion; force off via DW_MAHARAM_CAP=0.
const MAHARAM_CAP = parseInt(process.env.DW_MAHARAM_CAP || '100', 10); // 100 variants = 100 sample-only products/day
const MAHARAM_FLOOR = parseInt(process.env.DW_MAHARAM_FLOOR || String(MAHARAM_CAP), 10);
@@ -316,7 +319,7 @@ function status() {
upload: Math.min(Math.max(0, ph.caps.upload - j.spent.upload), othersGlobal),
backlog: reclaimActive() ? othersGlobal
: Math.min(Math.max(0, ph.caps.backlog - j.spent.backlog), othersGlobal),
- osborne: Math.min(Math.max(0, ph.caps.osborne - j.spent.osborne), globalLeft),
+ osborne: Math.min(Math.max(0, ph.caps.osborne - j.spent.osborne), Math.max(0, globalLeft - maharamReserved)),
maharam: Math.min(Math.max(0, ph.caps.maharam - j.spent.maharam), Math.max(0, globalLeft - osborneReserved)),
global: globalLeft },
};
← 0034812 TK-00060: give Maharam onboard its own finite 'maharam' vari
·
back to Designerwallcoverings
·
Stout daily-drip wrapper + plist (draft, mirrors Maharam TK- fed35c9 →