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:
| Metric | Value |
|---|---|
| Recall | 60.4% |
| Wrong-match rate | 26.1% |
| Root cause | Candidate 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.
Whatβs live today
Section titled βWhatβs live todayβ| Change | Flag | Effect (measured A/B) |
|---|---|---|
broadenUnion β wider candidate recall | matching_pack_variant_v1 | Recall β 56.5% β 71.1% |
pricePackSelect β unit-price pack disambiguation | matching_price_pack_select_v1 | Wrong-match β 38.7% β 26.3% |
| Ship-to resolver | matching_shipto_resolver_v1 | Customer 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.
Where itβs going: xref-first
Section titled βWhere itβs going: xref-firstβDoc 13 defines the current direction. Four facts drive it:
- Within a customer, the pack is deterministic β 97.8% of (customer, product-family) groups map to exactly one SKU.
- Volume is repeat business β 96.3% of lines are in repeat (customer, description) groups.
- Identity-grade binds are safe β xref/UPC/exact-id: 2.6% wrong. Fuzzy: 32% wrong (and confidence is a useless flat 0.92).
- 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-submitsThis hits β€2% wrong-match by construction (only identity-grade binds go through), and grows coverage through the flywheel.
Key artifacts
Section titled βKey artifactsβ| Artifact | Path |
|---|---|
| Eval harness | apps/webapp/scripts/run-ck-match-eval.ts |
| Candidate experiments | apps/webapp/scripts/run-ck-candidate-experiments.ts |
| Scorer | packages/eval/src/scorers/ck-match-scorer.ts |
| Ship-to resolver | packages/pdf-shared/pdf_shared/matching/shipto_resolver.py |
| Typesense asset (UPC derivation) | apps/dagster/erp_pipeline/assets/typesense.py |
| Eval reports | packages/eval/reports/ck-*.json |
Investigation docs (chronological)
Section titled βInvestigation docs (chronological)β| Doc | What it established |
|---|---|
| 01 β Measuring match quality | Harness design, history ground truth, metrics |
| 02 β Baseline & root cause | 60.4%/26.1% baseline; candidate recall is the root cause |
| 04 β Fidelity roadmap | Ranked levers; broadenUnion first |
| 09 β Ship-to resolution | Resolver design; 93.5% top-1 measured |
| 10 β Pack variant matcher | Recall/ranking split; broadenUnion spec |
| 11 β Price-pack selector | pricePackSelect spec; A/B numbers |
| 13 β Xref-first matching | Current direction; supersedes doc 12 |
| Decisions log | Why each major choice was made |