← back to Tk10630 Sku Suffix Canary

vendor-exception-rules.json

51 lines

{
  "_meta": {
    "purpose": "Per-vendor exception rules learned by session 'sku-medic' (TK-10638) while hand-auditing the DW mfr-number / wrong-VID corruption. Handoff artifact per DTD verdict A (2026-08-17, 9/9) + contrarian FIX-FIRST condition: encode these BEFORE the systematic pipeline runs on non-Hollywood vendor scope. Wire as a PRE-FLIGHT input to the classify stage; add a per-vendor DRY-RUN diff gate before any live-write on a newly-added vendor.",
    "author": "sku-medic",
    "date": "2026-08-17",
    "verdict": "DTD Option A, conditioned on this handoff",
    "hard_rule": "The 'mfr_sku == the DW number' signal is ONLY a defect for vendors whose REAL manufacturer scheme is ALPHABETIC. For vendors whose real scheme is NUMERIC, mfr=number is CORRECT (the DW SKU was built FROM the real number) — do NOT flag or archive those."
  },

  "numeric_legit_vendors": {
    "_rule": "Real manufacturer codes are numeric (or numeric+suffix). mfr_sku == DW-number-tail is EXPECTED and CORRECT here. NEVER flag as echoed-fake, NEVER archive on that basis.",
    "vendors": [
      { "vendor": "China Seas", "catalog_table": "china_seas_catalog", "real_scheme": "numeric + '...WP' (e.g. 750321, 935322, 2020-10WP)", "evidence": "1808/2018 catalog mfr_sku are numeric; affected DWCW-750221/mfr=750221 has real pattern counterparts in catalog" },
      { "vendor": "Versace", "catalog_table": "versace_catalog", "real_scheme": "numeric (e.g. 349015, 791335, 4057343271)", "evidence": "160/228 catalog mfr_sku numeric; VER-47240/mfr=47240 plausibly real" }
    ]
  },

  "alpha_scheme_vendors": {
    "_rule": "Real manufacturer scheme is ALPHABETIC/alphanumeric. A bare-number mfr_sku is FAKE (the DW internal number echoed). These ARE genuine defects — but see disposition rules below (orphan -> archive-eligible; real-curated-product -> protect, do NOT archive).",
    "vendors": [
      { "vendor": "Anna French", "catalog_table": "anna_french_catalog", "real_scheme": "AT##### (wallcovering) / AF##### (fabric)", "status": "ORPHANS — legacy DWAT-40xxx / mfr 73xxx NOT in current catalog (65xxx range). 0 join. ARCHIVED 26 by sku-medic 2026-08-17." },
      { "vendor": "Nina Campbell", "catalog_table": "nina_campbell_catalog", "real_scheme": "NCW####-## (e.g. NCW4100-08)", "status": "ORPHANS — legacy DWC-1001xxx + 99/99 GENERIC placeholder titles, NOT in current catalog (DWNC-630xxx). 0 join. ARCHIVED 98 by sku-medic 2026-08-17." },
      { "vendor": "Jeffrey Stevens", "catalog_table": "jeffrey_stevens_catalog", "real_scheme": "GGA-##### (also DWJS in catalog mfr, messy)", "status": "REAL PRODUCTS w/ metadata gap — real pattern names (Kingston Watercolor Jacobean, Bali Grasscloth Stripe), DWJS-90xxx/TRF-56xxx/mfr=bare-number, 0 catalog join. DO NOT ARCHIVE. 20 affected." },
      { "vendor": "Laura Ashley Wallpaper", "catalog_table": "laura_ashley_catalog (EMPTY)", "real_scheme": "unknown (catalog empty)", "status": "REAL PRODUCTS w/ metadata gap — real names (Little Vines Hedgerow, Barley Dusky Seaspray), DWGB-800xxx/mfr=bare-number. No staging to recover from. DO NOT ARCHIVE. 61 affected." },
      { "vendor": "Phyllis Morris", "catalog_table": "(none)", "real_scheme": "unknown (no catalog)", "status": "REAL PRODUCTS w/ metadata gap — real detailed names (Trousdale Rock & Roll Damask, Chanteuse Big Butterflies), PMW-75xxx/mfr=bare-number. DO NOT ARCHIVE. 20 affected." }
    ]
  },

  "disposition_rules": {
    "_order": "Apply top-down. These distinguish 'archive-eligible junk orphan' from 'protect real product' among the alpha-scheme defects.",
    "rules": [
      { "if": "vendor scheme is NUMERIC (numeric_legit_vendors)", "then": "NOT A DEFECT. Leave untouched." },
      { "if": "title is a GENERIC placeholder (matches '<Vendor> Wallcovering', '<Vendor> Fabric', '<Vendor> Fabric - <color> Wallcovering', or has no real pattern name)", "then": "JUNK ORPHAN -> archive-eligible (this is how Anna French + Nina Campbell were correctly archived)." },
      { "if": "title is a REAL specific pattern name AND product does NOT join its current catalog", "then": "REAL PRODUCT with a metadata gap -> DO NOT ARCHIVE. Queue for external mfr-code sourcing (vendor portal / image match). Archiving removes legitimate customer-facing inventory." },
      { "if": "product DOES join its current _catalog with a real alpha mfr code", "then": "RECOVERABLE -> recapture the real code (do not archive)." }
    ]
  },

  "operational_cautions": {
    "stale_mirror": "The dw_unified.shopify_products MIRROR lags the live store (it still listed Anna French/Nina Campbell as ACTIVE after they were archived live). ALWAYS classify + verify against the LIVE store (GraphQL), not the mirror.",
    "vendor_field_code_leak": "1 active product has vendor='DWHD' ('Mission Beach Polaris') — a fabricated code leaked into the VENDOR field. Part of the brand-as-vendor bug family.",
    "dry_run_gate_required": "Per the DTD contrarian: before the pipeline live-writes on any NEW (non-Hollywood) vendor, run a per-vendor DRY-RUN diff and eyeball it. The pipeline's FABRICATED regex is NOT vendor-aware; a vendor whose real codes match /^DW[A-Z]{1,4}-\\d/ would be wrongly purged."
  },

  "already_actioned_by_sku_medic": {
    "hollywood_wallcoverings_HWC_line": "223 archived (Steve-directed, separate from mfr-number issue) — reversibility log ~/hwc-archive-reversibility-20260817-115351.jsonl",
    "anna_french_orphans": "26 archived — ~/af-orphan-archive-reversibility-20260817-130530.jsonl",
    "nina_campbell_orphans": "98 archived — ~/nc-orphan-archive-reversibility-20260817-131705.jsonl"
  }
}