Merge pull request 'fix(vin): Q5 WMI brand map + Q6 PL24 nissan/van routing (RCA, verified)' (#95) from fix/vin-wmi-routing into main
This commit was merged in pull request #95.
This commit is contained in:
29
apps/api/src/integrations/pl24/pl24.types.spec.ts
Normal file
29
apps/api/src/integrations/pl24/pl24.types.spec.ts
Normal 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();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -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)
|
||||
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
validateVinCheckDigit,
|
||||
extractWmi,
|
||||
extractModelYear,
|
||||
getBrandFromWmi,
|
||||
formatTRY,
|
||||
kurusToLira,
|
||||
liraToKurus,
|
||||
@@ -782,3 +783,33 @@ describe("ERROR_CODES", () => {
|
||||
expect(ERROR_CODES.CORGI_ERROR).toBe("INT_003");
|
||||
});
|
||||
});
|
||||
|
||||
describe("getBrandFromWmi — RCA Q5 additions", () => {
|
||||
// Verified WMI->brand additions (undecoded-vin-rca.md Q5). UX/telemetry only.
|
||||
const ADDED: Array<[string, string]> = [
|
||||
["W1V", "Mercedes-Benz"],
|
||||
["VXF", "Fiat"], // resolved Fiat (not Opel)
|
||||
["YAR", "Toyota"], // resolved Toyota ProAce (not Opel)
|
||||
["NL1", "Hyundai"],
|
||||
["KPA", "SsangYong"],
|
||||
["PL1", "Proton"],
|
||||
["LSV", "Volkswagen"],
|
||||
["LVV", "Chery"],
|
||||
["ZCF", "Iveco"],
|
||||
];
|
||||
it.each(ADDED)("maps %s -> %s", (wmi, brand) => {
|
||||
expect(getBrandFromWmi(wmi)).toBe(brand);
|
||||
});
|
||||
|
||||
it("is case-insensitive", () => {
|
||||
expect(getBrandFromWmi("w1v")).toBe("Mercedes-Benz");
|
||||
});
|
||||
|
||||
it("does NOT map likely VIN corruptions (would mislabel typo classes)", () => {
|
||||
// WF1->WF0(Ford), WAA->WAU(Audi), W0W->WVW(VW) were deliberately skipped.
|
||||
expect(getBrandFromWmi("WF1")).toBeNull();
|
||||
expect(getBrandFromWmi("WAA")).toBeNull();
|
||||
expect(getBrandFromWmi("W0W")).toBeNull();
|
||||
expect(getBrandFromWmi("VE1")).toBeNull(); // deferred — unresolved
|
||||
});
|
||||
});
|
||||
|
||||
@@ -182,6 +182,21 @@ export const WMI_BRAND_MAP: Record<string, string> = {
|
||||
ZAR: "Alfa Romeo", // Alfa Romeo (145/146)
|
||||
ZLA: "Lancia", // Lancia (Kappa) — CarBrandLogo'da logo yok
|
||||
WMA: "MAN", // MAN — ticari araç/kamyon
|
||||
|
||||
// ── RCA undecoded-VIN audit eklemeleri (2026-06-03) ──
|
||||
// Çoğu UX/telemetri amaçlı: sert "marka desteklenmiyor" yerine "X olarak
|
||||
// tanındı" mesajı (decode routing'i DEĞİŞTİRMEZ). WMI'lar authoritative
|
||||
// registry + prod sibling + VDS parmak izi ile doğrulandı (undecoded-vin-rca.md Q5).
|
||||
// Bilerek EKLENMEDİ (bozulma): WF1→WF0(Ford), WAA→WAU(Audi), W0W→WVW(VW) — typo sınıfı.
|
||||
W1V: "Mercedes-Benz", // Mercedes-Benz Vans — Sprinter/Vito (+ PL24 mercedesvans routing)
|
||||
VXF: "Fiat", // Stellantis France — Fiat LCV (Scudo/Ducato sınıfı)
|
||||
YAR: "Toyota", // Toyota ProAce ailesi (Stellantis Vigo, Toyota markalı)
|
||||
NL1: "Hyundai", // Hyundai Assan (HAOS) — Türkiye ticari
|
||||
KPA: "SsangYong", // SsangYong / KG Mobility — Kore (katalog yok; logo fallback)
|
||||
PL1: "Proton", // Proton — Malezya (katalog yok)
|
||||
LSV: "Volkswagen", // SAIC Volkswagen — Çin
|
||||
LVV: "Chery", // Chery — Çin (CarBrandLogo'da logo yok)
|
||||
ZCF: "Iveco", // Iveco — İtalya (Daily; ticari)
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user