Creative ideas + design notes
Commits with substantial prose (≥120 chars) — the rationale behind each move.
5f484b7 · 2026-09-24 · carnegie phase2: retry metafield writes, record failures, guard hardcoded RETAIL
Apply-path hardening on the Acapella PoC: (1) shopify() now retries 429/5xx with
backoff so per-product metafield writes aren't silently dropped on a transient
throttle; (2) failed metafields are recorded on the created record (created.mf_failed
-> run summary) instead of vanishing into a console.warn; (3) added a guard that
aborts if any item's cost != $42, since RETAIL=76 is hardcoded from that cost and a
copy to a different-cost pattern would otherwise ship a wrong price. Also lands the
reviewed-clean TK-10820 change (activation gates on bodyHtmlValid, not raw
description_text) that was uncommitted in this file.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
081afea · 2026-09-12 · TK-11547: weight guard on the carnegie rollback un-archive (heal, never block)
archive-redirect.mjs's rollback path PUTs status:'active' to un-archive products
(com.steve.carnegie-rollout). Despite the filename it is a real activator, and it had no
weight handling — so a restored product could go live at zero weight, collapsing orders into
the lowest weight tier / free-shipping band (Steve's TK-11414 rule).
Found by shopify-activator-register (TK-11498) on its first run; never in the
TK-11414/TK-11471 field of view.
DELIBERATELY DIFFERENT from every other TK-11547 site, which HOLD. This is an UNDO path: it
restores products that were intentionally archived. A gate that can block a rollback is worse
than the defect it prevents — it strands you mid-incident with no way back. So this never
refuses to un-archive:
1. read each variant's current weight
2. fill the TK-11414-approved default on any zero (sample 0.25 lb, sellable 3.0 lb)
3. RE-VERIFY — the write's own 200 is not evidence the weight is set
4. un-archive REGARDLESS, and if any variant is still zero, say so LOUDLY on stderr with the
ids, leaving dw-active-weight-canary (daily) as the backstop
Silence is the only outcome ruled out. The heal goes through the REST variant field because
this script authenticates with the narrow SHOPIFY_ADMIN_TOKEN, which lacks write_inventory —
the GraphQL inventoryItemUpdate path would 403.
test-weight-guard.mjs — 10/10, offline. Unit cases for zero/null/negative/NaN and kg/g/oz
conversion, plus five structural checks: it re-verifies after writing, it un-archives even
when the heal fails, a failed heal is loud rather than silent, the heal uses the REST path the
narrow token can actually call, and the sample/sellable default split is applied.
(One test caught itself: the "no GraphQL path" assertion initially matched the word
inventoryItemUpdate inside this guard's own explanatory comment and failed on correct code.
Now strips comments before asserting — prose is not behaviour.)
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
6116dfb · 2026-09-11 · TK-11434: align all four Carnegie create paths to the fixer's 2-decimal retail
The reprice fixer writes round(cost/0.65/0.85, 2) - verified live in its ledger
($39 cost -> $70.59). The create paths rounded to whole dollars, so the same cost
produced a different price depending on whether a product was CREATED or REPRICED
($71 vs $70.59). Now consistent across:
carnegie-split/rollout.mjs
carnegie-split/rollout2.mjs
carnegie-split/build-siltech-grain-v2-archived.mjs
carnegie-reprice/rebuild-line.mjs
Values reproduce the TK-11434 memo's own table exactly: 997 -> 1804.52,
114 -> 206.33, 623 -> 1127.60.
rebuild-line.mjs keeps retail as a NUMBER rather than a formatted string: line 151
and the progress log at :239 both call .toFixed(2) on it, so returning a string
there would have thrown "retail.toFixed is not a function" at runtime. node --check
passes either way - it checks syntax, not types - so the usage sites were read
before committing.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1293658 · 2026-09-11 · TK-11434: spec-complete Carnegie reprice executor (apply-tk11434.mjs)
Successor to reprice-tk11434.mjs (the original, already Steve-fired live). Reads the
join-verified staging table carnegie_reprice_staging_tk11434 (source of truth, NOT the
buggy reprice.mjs REST pull). Adds: FULL-access token preference, DRY-RUN Σ-delta plan,
pre-flight >2%-drift abort, per-variant live-re-read + compare-and-set, batched
productVariantsBulkUpdate with THROTTLED backoff, --limit daily cap, end-of-apply
re-sweep, and a --rollback mode. SHARES the ledger + undo with reprice-tk11434.mjs so
resume + rollback stay unified and idempotent. DRY-RUN by default; --apply is gated.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CFntkQoFivTSkgwHjLY6ky
618df8b · 2026-08-24 · TK-10820: gate rebuild-line + build-one-proof born-active on non-blank body_html
HOLE 1 (Cody): rebuild-line.mjs (the 5,928-SKU Phase-3 rollout create path) gated
ACTIVE only on (imgs.length && hasMfr) — a scraped body that is a whitespace/entity
shell (e.g. <p> </p>) is truthy at L100 so the fallback composer never fires,
letting a blank-desc product ship ACTIVE. Now imports bodyHtmlValid and gates on
(imgs.length && hasMfr && bodyValid); blank body -> DRAFT + Needs-Description tag,
recorded in the ledger (desc_gate field).
Also patched build-one-proof.mjs (the 7th born-active create path Cody's census asked
me to find): it POSTed status:'active' with raw row.description_text and NO gate. Now
gates on imgs.length && mfrSkuValid && bodyHtmlValid, DRAFT+tag otherwise.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
4de1b96 · 2026-08-23 · feat: Carnegie importer gate — skip ACTIVE if no real mfr_sku (TK-10792 stop-the-bleed)
Add carnegie-mfr-gate.mjs (canonical guard + CLI audit) and wire into all
activation paths: rebuild-line.mjs, phase2-poc-acapella.mjs. Products with
null/empty or DWAG-* mfr_sku are held as DRAFT + tagged Needs-Mfr-SKU.
Durable run-summary written to ledger JSONL. archive-redirect.mjs rollback
path documented (intentionally exempt — restores original Carnegie products
with real vendor codes). CODE ONLY — no Shopify writes.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>