← back to Dw Sku Integrity
TK-10900: machine allowlist gate — mfr_sku self-copy only for verified-real vendors (Carnegie, Stout)
a258923393426f88159438a3fce2acd738ef50cd · 2026-09-02 12:03:37 -0700 · Steve
Per DTD verdict A (2026-09-02). classify.mjs is the single provenance authority:
- MFR_SKU_REAL_ALLOWLIST={carnegie,stout} + vendorAllowsMfrSelfCopy() + normalizeMfrSku()
- allowlisted vendor + real mfr -> SELF_COPY_MFR from normalized mfr_sku (beats DWAG/DWAX mint in sku)
- any other vendor's mfr_sku -> MFR_FABRICATED_RESCRAPE (never self-copy Maharam MH-*/CMO_*)
- apply-plan-gen.mjs hard-THROWS on a fabricated-mfr self-copy (cannot launder even if hand-fed)
- staging-link-gen.mjs refuses non-allowlisted vendors (exit 2)
- +18 tests, all 81 pass
Files touched
M apply-plan-gen.mjsM classify.mjsM staging-link-gen.mjsM test/apply-plan-gen.test.mjsM test/classify.test.mjs
Diff
commit a258923393426f88159438a3fce2acd738ef50cd
Author: Steve <steve@designerwallcoverings.com>
Date: Wed Sep 2 12:03:37 2026 -0700
TK-10900: machine allowlist gate — mfr_sku self-copy only for verified-real vendors (Carnegie, Stout)
Per DTD verdict A (2026-09-02). classify.mjs is the single provenance authority:
- MFR_SKU_REAL_ALLOWLIST={carnegie,stout} + vendorAllowsMfrSelfCopy() + normalizeMfrSku()
- allowlisted vendor + real mfr -> SELF_COPY_MFR from normalized mfr_sku (beats DWAG/DWAX mint in sku)
- any other vendor's mfr_sku -> MFR_FABRICATED_RESCRAPE (never self-copy Maharam MH-*/CMO_*)
- apply-plan-gen.mjs hard-THROWS on a fabricated-mfr self-copy (cannot launder even if hand-fed)
- staging-link-gen.mjs refuses non-allowlisted vendors (exit 2)
- +18 tests, all 81 pass
---
apply-plan-gen.mjs | 23 +++++++++-
classify.mjs | 91 +++++++++++++++++++++++++++++++++++--
staging-link-gen.mjs | 13 ++++++
test/apply-plan-gen.test.mjs | 24 ++++++++++
test/classify.test.mjs | 104 ++++++++++++++++++++++++++++++++++++++++---
5 files changed, 244 insertions(+), 11 deletions(-)
diff --git a/apply-plan-gen.mjs b/apply-plan-gen.mjs
index a523e4a..006d6b2 100644
--- a/apply-plan-gen.mjs
+++ b/apply-plan-gen.mjs
@@ -15,6 +15,14 @@ import { readFileSync, writeFileSync, mkdirSync, rmSync, existsSync } from 'node
import { join, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
import { execFileSync } from 'node:child_process';
+import { vendorAllowsMfrSelfCopy } from './classify.mjs';
+
+// mfr_sku-sourced recovery classes. These recover dw_sku from mfr_sku and are
+// permitted ONLY for verified-real-mfr vendors (Carnegie, Stout). This sku-keyed
+// generator does NOT emit SQL for them (they have their own generator), but it
+// HARD-ERRORS if a fabricated-mfr self-copy is ever hand-fed in — see the
+// allowlist assertion in selectSelfCopyRows. DTD verdict A, 2026-09-02, TK-10900.
+export const MFR_SELF_COPY_CLASSES = new Set(['SELF_COPY_MFR', 'SELF_COPY_MFR_COLLISION']);
const HERE = dirname(fileURLToPath(import.meta.url));
@@ -47,8 +55,11 @@ export const SELF_COPY_CLASSES = new Set([
export const FORBIDDEN_CLASSES = new Set([
'MINT_RESIDUE_RESCRAPE',
'RESCRAPE',
+ 'MFR_FABRICATED_RESCRAPE',
'SELF_COPY_COLLISION',
'SELF_COPY_DW_COLLISION',
+ 'SELF_COPY_MFR', // mfr recovery has its own generator (mfr-selfcopy-gen)
+ 'SELF_COPY_MFR_COLLISION',
'STAGING_LINK',
'PROVENANCE_REVIEW',
]);
@@ -97,7 +108,17 @@ export function selectSelfCopyRows(planRows) {
const kept = [];
const rejectedShape = [];
for (const row of planRows) {
- if (FORBIDDEN_CLASSES.has(row.class)) continue; // rescrape / collision / staging / residue -> never
+ // HARD MACHINE GATE (DTD verdict A, TK-10900): an mfr_sku-sourced self-copy
+ // for a vendor NOT on the verified-real allowlist is a fabricated-code
+ // laundering attempt. Refuse to proceed at all — even a hand-fed plan
+ // physically cannot slip a fabricated mfr_sku into a canonical write.
+ if (MFR_SELF_COPY_CLASSES.has(row.class) && !vendorAllowsMfrSelfCopy(row.vendor)) {
+ throw new Error(
+ `mfr self-copy blocked: vendor '${row.vendor}' is NOT on MFR_SKU_REAL_ALLOWLIST ` +
+ `(class ${row.class}, candidate ${row.candidate}). Route to re-scrape; never self-copy a fabricated mfr_sku.`,
+ );
+ }
+ if (FORBIDDEN_CLASSES.has(row.class)) continue; // rescrape / collision / staging / residue / mfr -> never
if (!SELF_COPY_CLASSES.has(row.class)) continue; // any other class -> no SQL
const cand = row.candidate == null ? '' : String(row.candidate).trim();
if (cand === '') continue; // require an existing code
diff --git a/classify.mjs b/classify.mjs
index 66e044e..d259556 100644
--- a/classify.mjs
+++ b/classify.mjs
@@ -67,6 +67,62 @@ export const MIXED_USE_MINT_PREFIXES = new Set([
'DWCC', // Novasuede
]);
+// ---- mfr_sku PROVENANCE ALLOWLIST (DTD verdict A, 2026-09-02, TK-10900) -----
+//
+// The mfr_sku column is a REAL manufacturer code for only a verified set of
+// vendors. For everyone else it is FABRICATED at import time (Maharam "MH-*",
+// CMO Paris "CMO_*"), so recovering dw_sku from mfr_sku there would LAUNDER a
+// fabricated code into the canonical identity field — the exact mistake this
+// gate makes physically impossible.
+//
+// RULE: mfr_sku -> dw_sku recovery ("mfr self-copy") is permitted ONLY for a
+// vendor on this allowlist. Any other vendor's mfr_sku self-copy is hard-routed
+// to re-scrape (never written). Evidence: ~/Projects/dw-sku-integrity/evidence/.
+// The allowlist is deliberately SMALL and grows only by Steve-ruled evidence.
+export const MFR_SKU_REAL_ALLOWLIST = new Set(['carnegie', 'stout']);
+
+// Normalize a vendor label to the allowlist key (lowercased, trimmed, and the
+// vendor's leading token so "Stout Textiles" -> "stout"). Must stay in lockstep
+// with how the allowlist keys are spelled.
+export function vendorKey(vendor) {
+ const v = String(vendor || '').trim().toLowerCase();
+ if (!v) return '';
+ if (MFR_SKU_REAL_ALLOWLIST.has(v)) return v; // exact match wins
+ const first = v.split(/[\s/|,-]+/)[0]; // "stout textiles" -> "stout"
+ return MFR_SKU_REAL_ALLOWLIST.has(first) ? first : v;
+}
+
+// The single provenance predicate the whole pipeline consults. Everything that
+// could write an mfr_sku-derived dw_sku MUST gate on this (classify + every plan
+// generator), so the fabricated-mfr class can never reach a canonical write.
+export function vendorAllowsMfrSelfCopy(vendor) {
+ return MFR_SKU_REAL_ALLOWLIST.has(vendorKey(vendor));
+}
+
+// Contract-fabric vendors (Carnegie et al.) append a product-type token to the
+// real code, e.g. "47081-windows", "100795352-panels-museums". Strip ONLY a
+// KNOWN product-type token (repeatedly) so the base colorway code is recovered
+// while a genuine colorway word (e.g. "1234-natural") is preserved. Unknown
+// tokens are left intact on purpose — a wrong strip could collapse two colorways
+// into one identity; the generator's collapse-guard is the second line of defense.
+export const MFR_PRODUCT_TYPE_TOKENS = new Set([
+ 'windows', 'window', 'panels', 'panel', 'museums', 'museum', 'upholstery',
+ 'wallcovering', 'wallcoverings', 'wall', 'drapery', 'dividers', 'divider',
+ 'privacy', 'imo', 'vinyl', 'textile', 'textiles', 'ceiling', 'ceilings',
+ 'wovens', 'woven', 'seating', 'cubicle', 'cubicles',
+]);
+export function normalizeMfrSku(mfr) {
+ if (mfr == null) return mfr;
+ let s = String(mfr).trim();
+ let prev;
+ do {
+ prev = s;
+ const m = /^(.*?)-([A-Za-z]{2,})$/.exec(s);
+ if (m && MFR_PRODUCT_TYPE_TOKENS.has(m[2].toLowerCase())) s = m[1];
+ } while (s !== prev && s.length > 0);
+ return s;
+}
+
function greenfieldPrefixOf(code, prefixSet) {
const m = /^(DW[A-Z0-9]{1,6})-/i.exec(code || '');
if (!m) return null;
@@ -80,6 +136,9 @@ const DW_CODE_RE = /^DW[A-Z0-9]{1,6}-/i;
const CORK_RE = /^cork-/i;
// A literal "null" placeholder sku (import defect, e.g. "null-Sample").
const NULL_RE = /^null([\s-]|$)/i;
+// A code-shaped mfr candidate (no whitespace/parens/title junk, ≤40 chars).
+// Mirrors apply-plan-gen.mjs CODE_SHAPE so a bad mfr never becomes a dw_sku.
+const MFR_CAND_SHAPE = /^[A-Za-z0-9][A-Za-z0-9._/-]{0,39}$/;
/**
* Strip trailing unit/variant suffix tokens from a sku, repeatedly, so that
@@ -118,9 +177,26 @@ export function classifyRow(row, activeCodeSet, opts = {}) {
const mfr = String(row.mfr_sku || '').trim();
const has = (c) => !!(activeCodeSet && c && activeCodeSet.has(c));
+ // HIGHEST-TRUST PATH — verified-real-mfr vendor (DTD verdict A, TK-10900):
+ // recover dw_sku directly from the NORMALIZED mfr_sku. This BEATS the `sku`
+ // path because these vendors' `sku` column carries reverted greenfield-mint
+ // residue (DWAG/DWAX...) that must never be self-copied. Gated by the machine
+ // allowlist — an off-allowlist vendor can NEVER reach this branch.
+ if (mfr && vendorAllowsMfrSelfCopy(row.vendor)) {
+ const cand = normalizeMfrSku(mfr);
+ if (cand && MFR_CAND_SHAPE.test(cand)) {
+ const collides = has(cand);
+ return { class: collides ? 'SELF_COPY_MFR_COLLISION' : 'SELF_COPY_MFR', candidate: cand, collides, note: `mfr_sku recovery (verified-real vendor '${vendorKey(row.vendor)}')` };
+ }
+ // Allowlisted vendor but the mfr_sku is not code-shaped -> re-scrape.
+ return { class: 'RESCRAPE', candidate: null, collides: false, note: 'verified-real vendor but mfr_sku is not code-shaped' };
+ }
+
// Literal "null" placeholder sku = scraper import defect (JOB 4).
if (sku && NULL_RE.test(sku)) {
- if (mfr) return { class: 'STAGING_LINK', candidate: null, collides: false, note: 'null-literal sku, mfr present' };
+ // A non-allowlisted vendor's mfr_sku is potentially fabricated -> re-scrape,
+ // NEVER staging-link/self-copy (the fabricated-mfr laundering guard).
+ if (mfr) return { class: 'MFR_FABRICATED_RESCRAPE', candidate: null, collides: false, note: `null-literal sku; mfr_sku not verified-real for vendor '${String(row.vendor || '').trim()}'` };
return { class: 'IMPORT_DEFECT', candidate: null, collides: false };
}
@@ -149,8 +225,10 @@ export function classifyRow(row, activeCodeSet, opts = {}) {
return { class: collides ? 'SELF_COPY_COLLISION' : 'SELF_COPY_SOURCE', candidate: cand, collides };
}
- // No usable sku.
- if (mfr) return { class: 'STAGING_LINK', candidate: null, collides: false };
+ // No usable sku. Reaching here with an mfr means the vendor is NOT on the
+ // verified-real allowlist (allowlisted vendors were handled at the top), so
+ // the mfr_sku is potentially fabricated -> re-scrape, never self-copy.
+ if (mfr) return { class: 'MFR_FABRICATED_RESCRAPE', candidate: null, collides: false, note: `mfr_sku not verified-real for vendor '${String(row.vendor || '').trim()}' — re-scrape, never self-copy` };
return { class: 'RESCRAPE', candidate: null, collides: false };
}
@@ -159,12 +237,17 @@ export const RECOVERY_GROUP = {
SELF_COPY_DW: 'recoverable_now_self_copy',
SELF_COPY_CORK: 'recoverable_now_self_copy',
SELF_COPY_SOURCE: 'recoverable_now_self_copy',
- STAGING_LINK: 'recoverable_now_staging_link',
+ // mfr_sku recovery — verified-real-mfr vendors ONLY (Carnegie, Stout).
+ SELF_COPY_MFR: 'recoverable_now_mfr',
+ SELF_COPY_MFR_COLLISION: 'dedup_gated_TK10649',
+ STAGING_LINK: 'recoverable_now_staging_link', // legacy — no longer produced by classify
SELF_COPY_DW_COLLISION: 'dedup_gated_TK10649',
SELF_COPY_COLLISION: 'dedup_gated_TK10649',
RESCRAPE: 'rescrape_program_TK10900',
IMPORT_DEFECT: 'rescrape_program_TK10900',
MINT_RESIDUE_RESCRAPE: 'rescrape_program_TK10900',
+ // Fabricated mfr_sku on a non-allowlisted vendor — must re-scrape, never self-copy.
+ MFR_FABRICATED_RESCRAPE: 'rescrape_program_TK10900',
PROVENANCE_REVIEW: 'provenance_review_TK10896',
NOT_BLANK: 'out_of_scope',
OUT_OF_SCOPE_STATUS: 'out_of_scope',
diff --git a/staging-link-gen.mjs b/staging-link-gen.mjs
index 5ff9b99..823f327 100644
--- a/staging-link-gen.mjs
+++ b/staging-link-gen.mjs
@@ -18,11 +18,24 @@ import { readFileSync, writeFileSync, mkdirSync, existsSync, rmSync } from 'node
import { join, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
import { baseCode } from './match-helpers.mjs';
+import { vendorAllowsMfrSelfCopy, MFR_SKU_REAL_ALLOWLIST } from './classify.mjs';
const HERE = dirname(fileURLToPath(import.meta.url));
const US = '\x1f', RS = '\x1e';
const arg = (n, d = null) => { const i = process.argv.indexOf(n); return i >= 0 ? process.argv[i + 1] : d; };
const VENDOR = arg('--vendor', 'carnegie');
+
+// HARD MACHINE GATE (DTD verdict A, TK-10900): this generator recovers dw_sku by
+// keying on mfr_sku, so it may run ONLY for a verified-real-mfr vendor. Refuse
+// outright for anyone else — a fabricated mfr_sku (Maharam MH-*, CMO_*) must be
+// re-scraped, never linked into a canonical dw_sku.
+if (!vendorAllowsMfrSelfCopy(VENDOR)) {
+ console.error(
+ `[staging-link-gen] REFUSING vendor '${VENDOR}': not on MFR_SKU_REAL_ALLOWLIST ` +
+ `(${[...MFR_SKU_REAL_ALLOWLIST].join(', ')}). mfr_sku is potentially fabricated — re-scrape instead.`,
+ );
+ process.exit(2);
+}
const CATALOG = arg('--catalog', `${VENDOR}_catalog`);
const KAM = (arg('--kam', 'ssh root@45.61.58.125 psql dw_unified')).split(/\s+/);
const LEDGER = arg('--ledger', '/tmp/_ledcodes.txt');
diff --git a/test/apply-plan-gen.test.mjs b/test/apply-plan-gen.test.mjs
index 26a1e4a..b58976d 100644
--- a/test/apply-plan-gen.test.mjs
+++ b/test/apply-plan-gen.test.mjs
@@ -5,6 +5,8 @@ import { tmpdir } from 'node:os';
import { join } from 'node:path';
import {
SELF_COPY_CLASSES,
+ FORBIDDEN_CLASSES,
+ MFR_SELF_COPY_CLASSES,
sqlEscape,
selectSelfCopyRows,
buildPlans,
@@ -146,3 +148,25 @@ test('writePlans emits per-vendor artifacts + SUMMARY with correct totals', () =
assert.match(applySql, /Do NOT run automatically/);
assert.match(applySql, /Recovers existing code \(no mint\)/);
});
+
+// ---- mfr_sku allowlist HARD GATE (DTD verdict A, TK-10900) ------------------
+
+test('GATE: a fabricated-mfr self-copy for a non-allowlisted vendor THROWS (cannot launder)', () => {
+ const bad = [{ vendor: 'Maharam', sku: '', class: 'SELF_COPY_MFR', candidate: 'MH-300110-055' }];
+ assert.throws(() => selectSelfCopyRows(bad), /NOT on MFR_SKU_REAL_ALLOWLIST/);
+ const badCol = [{ vendor: 'CMO Paris', sku: '', class: 'SELF_COPY_MFR_COLLISION', candidate: 'CMO_1' }];
+ assert.throws(() => selectSelfCopyRows(badCol), /NOT on MFR_SKU_REAL_ALLOWLIST/);
+});
+
+test('GATE: an allowlisted-vendor mfr self-copy does NOT throw, but this sku-keyed generator still emits no SQL for it', () => {
+ const ok = [{ vendor: 'Carnegie', sku: '', class: 'SELF_COPY_MFR', candidate: '47081' }];
+ const kept = selectSelfCopyRows(ok); // no throw
+ assert.equal(kept.length, 0); // mfr recovery has its own generator
+});
+
+test('GATE: mfr classes are forbidden here and MFR_SELF_COPY_CLASSES is exact', () => {
+ assert.deepEqual([...MFR_SELF_COPY_CLASSES].sort(), ['SELF_COPY_MFR', 'SELF_COPY_MFR_COLLISION']);
+ assert.ok(FORBIDDEN_CLASSES.has('SELF_COPY_MFR'));
+ assert.ok(FORBIDDEN_CLASSES.has('SELF_COPY_MFR_COLLISION'));
+ assert.ok(FORBIDDEN_CLASSES.has('MFR_FABRICATED_RESCRAPE'));
+});
diff --git a/test/classify.test.mjs b/test/classify.test.mjs
index f264b13..edb7309 100644
--- a/test/classify.test.mjs
+++ b/test/classify.test.mjs
@@ -2,7 +2,10 @@
// Run: node --test
import { test } from 'node:test';
import assert from 'node:assert/strict';
-import { stripUnitSuffix, classifyRow, UNIT_SUFFIXES, RECOVERY_GROUP, MIXED_USE_MINT_PREFIXES } from '../classify.mjs';
+import {
+ stripUnitSuffix, classifyRow, UNIT_SUFFIXES, RECOVERY_GROUP, MIXED_USE_MINT_PREFIXES,
+ MFR_SKU_REAL_ALLOWLIST, vendorAllowsMfrSelfCopy, vendorKey, normalizeMfrSku,
+} from '../classify.mjs';
const ACTIVE = new Set(['DWKE-41415', 'DWCC-116000', 'DWCC-116200']); // simulated live codes
@@ -72,9 +75,17 @@ test('classify: non-DW source code -> SELF_COPY_SOURCE', () => {
assert.equal(r.candidate, 'AS784911-0');
});
-test('classify: no sku but mfr present -> STAGING_LINK', () => {
+test('classify: no sku + mfr, NON-allowlisted vendor -> MFR_FABRICATED_RESCRAPE (never self-copy)', () => {
+ const r = classifyRow({ status: 'active', dw_sku: '', sku: '', mfr_sku: 'ABC-123', vendor: 'Maharam' }, ACTIVE);
+ assert.equal(r.class, 'MFR_FABRICATED_RESCRAPE');
+ assert.equal(r.candidate, null);
+ assert.equal(RECOVERY_GROUP[r.class], 'rescrape_program_TK10900');
+});
+
+test('classify: no sku + mfr, UNKNOWN/blank vendor -> MFR_FABRICATED_RESCRAPE (fail closed)', () => {
const r = classifyRow({ status: 'active', dw_sku: '', sku: '', mfr_sku: 'ABC-123' }, ACTIVE);
- assert.equal(r.class, 'STAGING_LINK');
+ assert.equal(r.class, 'MFR_FABRICATED_RESCRAPE');
+ assert.equal(r.candidate, null);
});
test('classify: no sku, no mfr -> RESCRAPE', () => {
@@ -88,9 +99,10 @@ test('classify: literal null-Sample -> IMPORT_DEFECT', () => {
assert.equal(r.class, 'IMPORT_DEFECT');
});
-test('classify: literal null sku with mfr -> STAGING_LINK', () => {
- const r = classifyRow({ status: 'active', dw_sku: '', sku: 'null', mfr_sku: 'X9' }, ACTIVE);
- assert.equal(r.class, 'STAGING_LINK');
+test('classify: literal null sku with mfr, NON-allowlisted vendor -> MFR_FABRICATED_RESCRAPE', () => {
+ const r = classifyRow({ status: 'active', dw_sku: '', sku: 'null', mfr_sku: 'X9', vendor: 'CMO Paris' }, ACTIVE);
+ assert.equal(r.class, 'MFR_FABRICATED_RESCRAPE');
+ assert.equal(r.candidate, null);
});
test('classify: already-populated dw_sku -> NOT_BLANK (never touched)', () => {
@@ -181,3 +193,83 @@ test('UNIT_SUFFIXES includes the observed vocabulary', () => {
assert.ok(UNIT_SUFFIXES.includes(w), `${w} missing from UNIT_SUFFIXES`);
}
});
+
+// ---- mfr_sku PROVENANCE ALLOWLIST GATE (DTD verdict A, TK-10900) ------------
+
+test('ALLOWLIST: contains exactly the verified-real-mfr vendors (Carnegie, Stout)', () => {
+ assert.deepEqual([...MFR_SKU_REAL_ALLOWLIST].sort(), ['carnegie', 'stout']);
+});
+
+test('vendorKey normalizes "Stout Textiles" -> "stout" and is case/space tolerant', () => {
+ assert.equal(vendorKey('Carnegie'), 'carnegie');
+ assert.equal(vendorKey(' STOUT Textiles '), 'stout');
+ assert.equal(vendorKey('Maharam'), 'maharam');
+ assert.equal(vendorKey(''), '');
+ assert.equal(vendorKey(null), '');
+});
+
+test('vendorAllowsMfrSelfCopy: true ONLY for allowlisted vendors', () => {
+ assert.equal(vendorAllowsMfrSelfCopy('Carnegie'), true);
+ assert.equal(vendorAllowsMfrSelfCopy('Stout Textiles'), true);
+ for (const v of ['Maharam', 'CMO Paris', 'Knoll', 'Thibaut', '', null, undefined]) {
+ assert.equal(vendorAllowsMfrSelfCopy(v), false, `${v} must NOT be allowed`);
+ }
+});
+
+test('normalizeMfrSku strips the -windows-class product-type suffix (Carnegie)', () => {
+ assert.equal(normalizeMfrSku('47081-windows'), '47081');
+ assert.equal(normalizeMfrSku('100795352-panels'), '100795352');
+ assert.equal(normalizeMfrSku('100795352-panels-museums'), '100795352');
+ assert.equal(normalizeMfrSku('47081-Windows'), '47081'); // case-insensitive token
+});
+
+test('normalizeMfrSku PRESERVES a genuine colorway word (not a product-type token)', () => {
+ assert.equal(normalizeMfrSku('1234-natural'), '1234-natural');
+ assert.equal(normalizeMfrSku('91026-10'), '91026-10'); // numeric colorway kept
+ assert.equal(normalizeMfrSku('TIGE'), 'TIGE');
+});
+
+test('classify: Carnegie mfr recovery -> SELF_COPY_MFR from NORMALIZED mfr, ignoring DWAG mint in sku', () => {
+ const r = classifyRow({ status: 'active', dw_sku: '', sku: 'DWAG-376566-Sample', mfr_sku: '47081-windows', vendor: 'Carnegie' }, new Set());
+ assert.equal(r.class, 'SELF_COPY_MFR');
+ assert.equal(r.candidate, '47081'); // the REAL code, NOT the DWAG mint
+ assert.equal(r.collides, false);
+ assert.equal(RECOVERY_GROUP[r.class], 'recoverable_now_mfr');
+});
+
+test('classify: Stout mfr recovery -> SELF_COPY_MFR (allowlisted, "Stout Textiles" label)', () => {
+ const r = classifyRow({ status: 'active', dw_sku: '', sku: '', mfr_sku: '92150-01', vendor: 'Stout Textiles' }, new Set());
+ assert.equal(r.class, 'SELF_COPY_MFR');
+ assert.equal(r.candidate, '92150-01');
+});
+
+test('classify: Carnegie mfr recovery flags COLLISION when normalized code already live', () => {
+ const r = classifyRow({ status: 'active', dw_sku: '', sku: '', mfr_sku: '47081-windows', vendor: 'Carnegie' }, new Set(['47081']));
+ assert.equal(r.class, 'SELF_COPY_MFR_COLLISION');
+ assert.equal(r.candidate, '47081');
+ assert.equal(r.collides, true);
+ assert.equal(RECOVERY_GROUP[r.class], 'dedup_gated_TK10649');
+});
+
+test('GATE: Maharam mfr_sku (fabricated MH-*) NEVER self-copies -> MFR_FABRICATED_RESCRAPE', () => {
+ const r = classifyRow({ status: 'active', dw_sku: '', sku: '', mfr_sku: 'MH-300110-055', vendor: 'Maharam' }, new Set());
+ assert.equal(r.class, 'MFR_FABRICATED_RESCRAPE');
+ assert.equal(r.candidate, null);
+ assert.equal(RECOVERY_GROUP[r.class], 'rescrape_program_TK10900');
+});
+
+test('GATE: CMO Paris mfr_sku (fabricated CMO_*) NEVER self-copies -> MFR_FABRICATED_RESCRAPE', () => {
+ const r = classifyRow({ status: 'active', dw_sku: '', sku: '', mfr_sku: 'CMO_1234', vendor: 'CMO Paris' }, new Set());
+ assert.equal(r.class, 'MFR_FABRICATED_RESCRAPE');
+ assert.equal(r.candidate, null);
+});
+
+test('INVARIANT: no non-allowlisted vendor with an mfr_sku ever yields an mfr candidate', () => {
+ const vendors = ['Maharam', 'CMO Paris', 'Knoll', 'Thibaut', 'Romo', 'Wolf Gordon', 'Designtex', '', null];
+ for (const vendor of vendors) {
+ const r = classifyRow({ status: 'active', dw_sku: '', sku: '', mfr_sku: 'ANY-123', vendor }, new Set());
+ assert.notEqual(r.class, 'SELF_COPY_MFR', `${vendor} must not reach SELF_COPY_MFR`);
+ assert.notEqual(r.class, 'SELF_COPY_MFR_COLLISION', `${vendor} must not reach mfr collision`);
+ assert.equal(r.candidate, null, `${vendor} must yield no candidate from mfr`);
+ }
+});
← 7136fe1 TK-10900 verify final Maharam recovery chunk
·
back to Dw Sku Integrity
·
TK-10900: Carnegie mfr recovery generator + gated plans (bla 43b8506 →