fix(vin): Q5 WMI brand map + Q6 PL24 nissan/van routing (RCA, verified)
Some checks failed
QA Gate (P0/P1) / Test affected app (pull_request) Has been cancelled

Second batch from undecoded-vin-rca.md. Every entry verified (authoritative
WMI registry + prod sibling + VDS fingerprint + live PL24 probe) before adding
— a wrong brand label or a dead PL24 route both have real downside.

Q5 — WMI_BRAND_MAP (packages/shared, UX/telemetry only; does NOT change which
catalog decodes). Adds 9: W1V=Mercedes-Benz, VXF=Fiat, YAR=Toyota, NL1=Hyundai,
KPA=SsangYong, PL1=Proton, LSV=Volkswagen, LVV=Chery, ZCF=Iveco. Resolves the
RCA conflicts: VXF=Fiat (not Opel), YAR=Toyota ProAce (not Opel); NL1=Hyundai
(not TOGG — MY char predates TOGG). Deliberately NOT added: WF1/WAA/W0W (1-char
corruptions of WF0/WAU/WVW — mapping them would mislabel typo classes), VE1
(unresolved, deferred).

Q6 — PL24_WMI_SERVICE_MAP (real decode routing). Both target services are
proven live, so these only append WMIs to working routes (no dead-route →
isDecodeable()=true → 25s-budget/circuit-breaker hazard):
- SJN/VSK/MNT → nissan_parts (Sunderland/Spain/Thailand) — regression restore,
  dropped in the 757905f refactor; nissan_parts proven (JN1 decodes in prod).
- W1V → mercedesvans_parts (Sprinter/Vito) — retires the RCA "never tried" flag:
  mercedesvans_parts decodes WDF44770513186937 live today via the same P5 path.

Tests: shared getBrandFromWmi (adds + corruption-skips return null), pl24 route
map. Full api suite green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-03 23:55:22 +03:00
parent a361c12312
commit 83b2693af2
4 changed files with 79 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
import { describe, expect, it } from "vitest";
import { PL24_WMI_SERVICE_MAP, SERVICE_TO_BRAND } from "./pl24.types";
// Q6 routing additions (undecoded-vin-rca.md). Both target services are already
// live in prod (nissan_parts: JN1 success; mercedesvans_parts: WDF decodes today),
// so these add WMIs to working routes — no dead-route / circuit-breaker risk.
describe("PL24_WMI_SERVICE_MAP — Q6 routing additions", () => {
it("routes restored Nissan WMIs to nissan_parts (757905f regression)", () => {
expect(PL24_WMI_SERVICE_MAP.SJN).toBe("nissan_parts"); // Nissan UK (Sunderland)
expect(PL24_WMI_SERVICE_MAP.VSK).toBe("nissan_parts"); // Nissan Spain
expect(PL24_WMI_SERVICE_MAP.MNT).toBe("nissan_parts"); // Nissan Thailand
});
it("routes W1V to the (live-proven) mercedesvans_parts service", () => {
expect(PL24_WMI_SERVICE_MAP.W1V).toBe("mercedesvans_parts");
});
it("the target services resolve to the correct brand", () => {
expect(SERVICE_TO_BRAND[PL24_WMI_SERVICE_MAP.SJN]).toBe("Nissan");
expect(SERVICE_TO_BRAND[PL24_WMI_SERVICE_MAP.W1V]).toBe("Mercedes-Benz");
});
it("new routes reuse existing services (no orphan service names)", () => {
for (const wmi of ["SJN", "VSK", "MNT", "W1V"]) {
const svc = PL24_WMI_SERVICE_MAP[wmi];
expect(SERVICE_TO_BRAND[svc]).toBeDefined();
}
});
});

View File

@@ -452,6 +452,7 @@ export const PL24_WMI_SERVICE_MAP: Record<string, string> = {
WDF: "mercedesvans_parts",
WD3: "mercedesvans_parts",
WD4: "mercedesvans_parts",
W1V: "mercedesvans_parts", // Mercedes-Benz Vans (Sprinter/Vito) — same P5 path proven live via WDF sibling
// smart
WME: "smart_parts",
@@ -551,6 +552,9 @@ export const PL24_WMI_SERVICE_MAP: Record<string, string> = {
JN6: "nissan_parts", // Nissan Japan (pickup/van)
JN8: "nissan_parts", // Nissan Japan (SUV)
VNK: "nissan_parts", // Nissan UK/Europe
SJN: "nissan_parts", // Nissan UK (Sunderland) — re-added; dropped in 757905f refactor
VSK: "nissan_parts", // Nissan Spain (Barcelona)
MNT: "nissan_parts", // Nissan Thailand
// Infiniti
JNK: "infiniti_parts", // Infiniti (Japan/Korea)