Skip to content

CK Matching β€” Current State

This is the entry point for the CK matching work. Read this first; the numbered docs (01–13) are the detailed investigation trail.

Measured baseline (real matcher, history ground truth)

Section titled β€œMeasured baseline (real matcher, history ground truth)”

66 CK orders / 328 lines, WhereFour ERP, 2026:

MetricValue
Recall60.4%
Wrong-match rate26.1%
Root causeCandidate recall (not ranking) β€” 58% of wrong binds never had the right product in the candidate set

The catalog splits cleanly in two: ~56% of lines carry a UPC (matching is strong); ~43% (Walmart DCs, Harris Teeter, Stop & Shop) carry no UPC and match poorly (~38% recall / ~50% wrong). All improvement work targets the no-UPC half.

ChangeFlagEffect (measured A/B)
broadenUnion β€” wider candidate recallmatching_pack_variant_v1Recall ↑ 56.5% β†’ 71.1%
pricePackSelect β€” unit-price pack disambiguationmatching_price_pack_select_v1Wrong-match ↓ 38.7% β†’ 26.3%
Ship-to resolvermatching_shipto_resolver_v1Customer ID accuracy 64.3% β†’ 93.5% (built, gated OFF)
Xref-first pipeline(P-A through P-F PRs)Infra shipped; CSR flywheel wiring in progress

All flags are Flagsmith-gated and connection-scoped. No flag touches auto-submit without explicit sign-off.

Doc 13 defines the current direction. Four facts drive it:

  1. Within a customer, the pack is deterministic β€” 97.8% of (customer, product-family) groups map to exactly one SKU.
  2. Volume is repeat business β€” 96.3% of lines are in repeat (customer, description) groups.
  3. Identity-grade binds are safe β€” xref/UPC/exact-id: 2.6% wrong. Fuzzy: 32% wrong (and confidence is a useless flat 0.92).
  4. Ship-to identifies the customer β€” 93.5% top-1 with the resolver.

Conclusion: Learn a customer-scoped description→SKU cross-reference from confirmed order history. Auto-submit only identity-grade binds. Route everything else to human review, whose confirmation writes the next xref.

extracted PO line
↓ ship-to resolver β†’ customer_id
↓
P1 xref (history-learned, customer-scoped)
P2 UPC exact / exact-id
──── identity-grade line: AUTO-SUBMIT ────
P3 fuzzy + pricePackSelect ← review-assist only, never auto-submits
↓
HUMAN REVIEW β†’ confirms product β†’ writes xref β†’ next identical order auto-submits

This hits ≀2% wrong-match by construction (only identity-grade binds go through), and grows coverage through the flywheel.

ArtifactPath
Eval harnessapps/webapp/scripts/run-ck-match-eval.ts
Candidate experimentsapps/webapp/scripts/run-ck-candidate-experiments.ts
Scorerpackages/eval/src/scorers/ck-match-scorer.ts
Ship-to resolverpackages/pdf-shared/pdf_shared/matching/shipto_resolver.py
Typesense asset (UPC derivation)apps/dagster/erp_pipeline/assets/typesense.py
Eval reportspackages/eval/reports/ck-*.json
DocWhat it established
01 β€” Measuring match qualityHarness design, history ground truth, metrics
02 β€” Baseline & root cause60.4%/26.1% baseline; candidate recall is the root cause
04 β€” Fidelity roadmapRanked levers; broadenUnion first
09 β€” Ship-to resolutionResolver design; 93.5% top-1 measured
10 β€” Pack variant matcherRecall/ranking split; broadenUnion spec
11 β€” Price-pack selectorpricePackSelect spec; A/B numbers
13 β€” Xref-first matchingCurrent direction; supersedes doc 12
Decisions logWhy each major choice was made