← back to Dw Sku Integrity
TK-10900 normalize catalog unit suffixes before recovery
79fb8ef998886f84c3811751224315f9a680da77 · 2026-08-31 11:53:31 -0700 · codex-10896
Files touched
M apply-plans-content-match/Arte International/apply.sqlM apply-plans-content-match/Arte International/restore-map.jsonM apply-plans-content-match/Arte International/undo.sqlM apply-plans-content-match/SUMMARY-Arte International.jsonM content-match-gen.mjsM test/match-helpers.test.mjs
Diff
commit 79fb8ef998886f84c3811751224315f9a680da77
Author: codex-10896 <steve@designerwallcoverings.com>
Date: Mon Aug 31 11:53:31 2026 -0700
TK-10900 normalize catalog unit suffixes before recovery
---
apply-plans-content-match/Arte International/apply.sql | 2 +-
apply-plans-content-match/Arte International/restore-map.json | 2 +-
apply-plans-content-match/Arte International/undo.sql | 2 +-
apply-plans-content-match/SUMMARY-Arte International.json | 2 +-
content-match-gen.mjs | 10 ++++++++--
test/match-helpers.test.mjs | 1 +
6 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/apply-plans-content-match/Arte International/apply.sql b/apply-plans-content-match/Arte International/apply.sql
index 248619c..f5debb3 100644
--- a/apply-plans-content-match/Arte International/apply.sql
+++ b/apply-plans-content-match/Arte International/apply.sql
@@ -1,3 +1,3 @@
-- GATED -- canonical Kamatera dw_unified write. Do NOT run automatically.
-- Content-match recovery (concat-key -> arte_catalog dw_sku, existing code, no mint). TK-10900.
-UPDATE shopify_products SET dw_sku='DWKE-41415-Sample' WHERE shopify_id='gid://shopify/Product/7813807210547' AND (dw_sku IS NULL OR btrim(dw_sku)='');
+UPDATE shopify_products SET dw_sku='DWKE-41415' WHERE shopify_id='gid://shopify/Product/7813807210547' AND (dw_sku IS NULL OR btrim(dw_sku)='');
diff --git a/apply-plans-content-match/Arte International/restore-map.json b/apply-plans-content-match/Arte International/restore-map.json
index a97383c..df4c8a2 100644
--- a/apply-plans-content-match/Arte International/restore-map.json
+++ b/apply-plans-content-match/Arte International/restore-map.json
@@ -4,6 +4,6 @@
"title": "Bouquet Emerald Wallcovering | Arte International",
"column": "dw_sku",
"old": null,
- "new": "DWKE-41415-Sample"
+ "new": "DWKE-41415"
}
]
diff --git a/apply-plans-content-match/Arte International/undo.sql b/apply-plans-content-match/Arte International/undo.sql
index 40dcca5..d89dc06 100644
--- a/apply-plans-content-match/Arte International/undo.sql
+++ b/apply-plans-content-match/Arte International/undo.sql
@@ -1,3 +1,3 @@
-- GATED -- canonical Kamatera dw_unified write. Do NOT run automatically.
-- Content-match recovery (concat-key -> arte_catalog dw_sku, existing code, no mint). TK-10900.
-UPDATE shopify_products SET dw_sku=NULL WHERE shopify_id='gid://shopify/Product/7813807210547' AND dw_sku='DWKE-41415-Sample';
+UPDATE shopify_products SET dw_sku=NULL WHERE shopify_id='gid://shopify/Product/7813807210547' AND dw_sku='DWKE-41415';
diff --git a/apply-plans-content-match/SUMMARY-Arte International.json b/apply-plans-content-match/SUMMARY-Arte International.json
index 8dcac09..9b6c5c4 100644
--- a/apply-plans-content-match/SUMMARY-Arte International.json
+++ b/apply-plans-content-match/SUMMARY-Arte International.json
@@ -6,7 +6,7 @@
"status": "supported",
"key_mode": "concat",
"color_column": "color_name",
- "code_source": "dw_sku",
+ "code_source": "dw_sku(base-stripped)",
"bucket_guard": true,
"catalog_usable": 1979,
"catalog_excluded_mint": 12,
diff --git a/content-match-gen.mjs b/content-match-gen.mjs
index 6028400..5ead3c5 100644
--- a/content-match-gen.mjs
+++ b/content-match-gen.mjs
@@ -81,7 +81,13 @@ let catUsable = 0, catExcluded = 0;
for (const [a, b, ptype, dw, mfr] of catRows) {
const raw = useMfr ? mfr : dw;
if (!raw || !raw.trim()) continue;
- const code = useMfr ? baseCode(mfr) : dw.trim();
+ // Catalog dw_sku can itself carry a sell-unit suffix (for example
+ // DWKE-41415-Sample). Canonical dw_sku is the shared base identity for the
+ // sellable and sample rows, so normalize both code sources. The previous
+ // verbatim dw_sku path produced a restore-map candidate that disagreed with
+ // the canonical DB normalization trigger and made post-apply verification
+ // fail even though the stored value was correct.
+ const code = baseCode(raw);
if (!CODE_SHAPE.test(code) || GREENFIELD_MINT.test(code) || minted.has(code.toUpperCase())) { catExcluded++; continue; }
const key = keyMode === 'concat' ? scrubTitle(norm(a) + ' ' + norm(b)) : scrubTitle(a);
if (!key) continue;
@@ -154,7 +160,7 @@ writeFileSync(join(dir, 'review-queue.json'), JSON.stringify(review, null, 2) +
const summary = {
ticket: 'TK-10900', program: 'A-content-match', vendor: VENDOR, catalog, status: 'supported', key_mode: keyMode,
- color_column: colColumn, code_source: useMfr ? 'mfr_sku(base-stripped)' : 'dw_sku', bucket_guard: hasProductType,
+ color_column: colColumn, code_source: useMfr ? 'mfr_sku(base-stripped)' : 'dw_sku(base-stripped)', bucket_guard: hasProductType,
catalog_usable: catUsable, catalog_excluded_mint: catExcluded, ...stat, review_queue: review.length, statements: entries.length,
match_pct: stat.shopify_blank ? (100 * stat.matched / stat.shopify_blank).toFixed(1) + '%' : '0%',
note: 'NOTHING executed. apply.sql is a GATED draft; review-queue.json is NOT written.',
diff --git a/test/match-helpers.test.mjs b/test/match-helpers.test.mjs
index 16a2916..9b75ae7 100644
--- a/test/match-helpers.test.mjs
+++ b/test/match-helpers.test.mjs
@@ -30,6 +30,7 @@ test('baseCode: strips trailing -<alpha> type suffixes to the real code', () =>
assert.equal(baseCode('6603S36-upholstery'), '6603S36');
assert.equal(baseCode('101545417-dividers'), '101545417');
assert.equal(baseCode('6557W94-wallcoverings'), '6557W94');
+ assert.equal(baseCode('DWKE-41415-Sample'), 'DWKE-41415');
});
test('baseCode: PRESERVES a numeric-hyphenated real code (no truncation)', () => {
← 0b977b0 auto-data-snapshot: 2026-08-31T10:06:07 (4 data files) — dat
·
back to Dw Sku Integrity
·
TK-10900 enforce 500-row recovery chunks e144e7a →