diff --git a/apps/api/src/integrations/pl24/pl24.types.spec.ts b/apps/api/src/integrations/pl24/pl24.types.spec.ts index 260ad11..36bb3a8 100644 --- a/apps/api/src/integrations/pl24/pl24.types.spec.ts +++ b/apps/api/src/integrations/pl24/pl24.types.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { PL24_WMI_SERVICE_MAP, SERVICE_TO_BRAND } from "./pl24.types"; +import { PL24_SERVICE_CATALOGS, 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), @@ -45,3 +45,53 @@ describe("PL24_WMI_SERVICE_MAP — kapsam dışı WMI'ler", () => { expect(PL24_WMI_SERVICE_MAP.VXK).toBe("psa_opel_parts"); }); }); + +/** + * 2026-09-20 canlı WMI servisi taraması (plv2.md, bulgu types_wmi-06/09). + * Prod'daki 1.406 haritasız araçtan hangilerinin PL24'te gerçekten karşılığı + * olduğu `/pl24-wmi/ext/api/2.0/decode` ile tek tek soruldu; bu test o cevapları + * kilitliyor — özellikle "yok" cevaplarını, çünkü onları haritaya eklemek + * boşuna istek üretir. + */ +describe("WMI haritası — canlı WMI servisi taraması (2026-09-20)", () => { + it("Renault yeniden açıldı (VIN tanımlama askısı kalktı)", () => { + expect(PL24_WMI_SERVICE_MAP.VF1).toBe("renault_parts"); + expect(PL24_WMI_SERVICE_MAP.VF6).toBe("renault_parts"); + expect(PL24_WMI_SERVICE_MAP.VNE).toBe("renault_parts"); + }); + + it("canlı servisin çözdüğü yeni WMI'ler haritada", () => { + expect(PL24_WMI_SERVICE_MAP.NLH).toBe("hyundai_parts"); + expect(PL24_WMI_SERVICE_MAP.TMA).toBe("hyundai_parts"); + expect(PL24_WMI_SERVICE_MAP.NLJ).toBe("hyundai_parts"); + expect(PL24_WMI_SERVICE_MAP.KMF).toBe("hyundai_parts"); + expect(PL24_WMI_SERVICE_MAP.KNE).toBe("kia_parts"); + expect(PL24_WMI_SERVICE_MAP.KNC).toBe("kia_parts"); + expect(PL24_WMI_SERVICE_MAP.MMC).toBe("mmc_parts"); + expect(PL24_WMI_SERVICE_MAP.XMC).toBe("mmc_parts"); + expect(PL24_WMI_SERVICE_MAP.JSA).toBe("suzuki_parts"); + }); + + it("NMB binek Mercedes değil, kamyon kataloğuna gider", () => { + expect(PL24_WMI_SERVICE_MAP.NMB).toBe("mercedestrucks_parts"); + // Binek WMI'leri bozulmadı. + expect(PL24_WMI_SERVICE_MAP.WDD).toBe("mercedes_parts"); + }); + + it("PL24'te olmayan WMI'ler haritaya EKLENMEDİ (HTTP 410)", () => { + // Honda ve Chevrolet'nin PL24'te kataloğu yok; eklemek boşuna istek olurdu. + for (const wmi of ["JHM", "SHH", "SHS", "MAK", "NLA", "KL1", "NM4", "VR7"]) { + expect(PL24_WMI_SERVICE_MAP[wmi]).toBeUndefined(); + } + }); + + it("JMZ (Mazda) eklenmedi — servis Ford kataloğu öneriyor, marka tutarsız", () => { + expect(PL24_WMI_SERVICE_MAP.JMZ).toBeUndefined(); + }); + + it("eşlenen her servisin katalog tanımı var", () => { + for (const [wmi, svc] of Object.entries(PL24_WMI_SERVICE_MAP)) { + expect(PL24_SERVICE_CATALOGS[svc], `${wmi} → ${svc}`).toBeDefined(); + } + }); +}); diff --git a/apps/api/src/integrations/pl24/pl24.types.ts b/apps/api/src/integrations/pl24/pl24.types.ts index eebea4a..46d1f3b 100644 --- a/apps/api/src/integrations/pl24/pl24.types.ts +++ b/apps/api/src/integrations/pl24/pl24.types.ts @@ -540,6 +540,10 @@ export const PL24_WMI_SERVICE_MAP: Record = { // Mercedes-Benz WDB: "mercedes_parts", + // NMB: canlı WMI servisi bunu mercedes_parts'a DEĞİL mercedestrucks_parts'a + // çözüyor (error:false) — 30 prod aracı "Mercedes-Benz" etiketliydi ama binek + // kataloğunda yok. + NMB: "mercedestrucks_parts", WDD: "mercedes_parts", WDC: "mercedes_parts", W1K: "mercedes_parts", @@ -578,15 +582,21 @@ export const PL24_WMI_SERVICE_MAP: Record = { JTJ: "lexus_parts", "2T2": "lexus_parts", - // Renault — DISABLED: PL24 has suspended Renault VIN identification ("Bu marka - // için şasi numarası tanımlamasının belirsiz bir süre için mevcut olmayacağını - // üzülerek bildiririz."). renault_parts authorizes fine but every decode throws - // that message → wasted ~1s call AND it trips the PL24 circuit breaker, which - // then skips PL24 for ALL brands. PCAT + EMEX cover Renault. Re-enable when PL24 - // restores Renault VIN decode. - // VF1: "renault_parts", - // VF6: "renault_parts", - // VNE: "renault_parts", + // Renault — RE-ENABLED 2026-09-20. It was disabled while PL24 had suspended + // Renault VIN identification ("Bu marka için şasi numarası tanımlamasının + // belirsiz bir süre için mevcut olmayacağını üzülerek bildiririz."), which both + // wasted a call per decode and, back then, tripped the global PL24 breaker. + // BOTH reasons are gone, each verified against prod rather than assumed: + // 1. The suspension is over — live directAccess on /p5renault for a real + // customer VIN (VF14SRCL458170337) returns resultStatus + // VEHICLE_IDENTIFIED, "SYMBOL II/LOGAN II", and the WMI service answers + // {service: renault_parts, valid: true, error: false}. + // 2. The breaker no longer counts definitive upstream negatives, only + // transient transport faults (see vehicles.service `isTransient`). + // 450 prod vehicles carry VF1 and had no PL24 catalog at all. + VF1: "renault_parts", + VF6: "renault_parts", + VNE: "renault_parts", // Dacia UU1: "dacia_parts", @@ -606,6 +616,10 @@ export const PL24_WMI_SERVICE_MAP: Record = { WMH: "man_parts", // Mitsubishi + // XMC / MMC: canlı WMI servisi ikisini de mmc_parts'a çözüyor ve P5 doğruluyor + // (error:false) — 26 prod aracı haritasızdı. + MMC: "mmc_parts", // Mitsubishi Japan + XMC: "mmc_parts", // Mitsubishi (diğer pazarlar) JMB: "mmc_parts", JMY: "mmc_parts", MMB: "mmc_parts", @@ -615,6 +629,7 @@ export const PL24_WMI_SERVICE_MAP: Record = { JS2: "suzuki_parts", JS3: "suzuki_parts", TSM: "suzuki_parts", + JSA: "suzuki_parts", // Suzuki (canlı WMI: suzuki_parts, error:false) MA3: "suzuki_parts", MBH: "suzuki_parts", @@ -638,10 +653,19 @@ export const PL24_WMI_SERVICE_MAP: Record = { // Hyundai KMH: "hyundai_parts", // Hyundai Korea Motor House + // Aşağıdakiler 2026-09-20'de canlı WMI servisinden alındı; hepsi hyundai_parts. + // TMA iki marka döndürüyor (hyundai_parts + kia_parts) — Hyundai Assan (Türkiye) + // üretimi olduğu için hyundai seçildi. + NLH: "hyundai_parts", // Hyundai Assan / Türkiye (106 prod aracı) + TMA: "hyundai_parts", // Hyundai Türkiye (49) + NLJ: "hyundai_parts", // Hyundai (8) + KMF: "hyundai_parts", // Hyundai (7) TMK: "hyundai_parts", // Hyundai (Turkey/other markets) // Kia KNA: "kia_parts", // Kia (worldwide production) + KNE: "kia_parts", // Kia (canlı WMI, 31 prod aracı) + KNC: "kia_parts", // Kia (canlı WMI, 8) U5Y: "kia_parts", // Kia Slovakia // Nissan @@ -682,6 +706,13 @@ export const PL24_WMI_SERVICE_MAP: Record = { // kaydedilmişti. Haritada tutmak yalnız boşuna PL24 isteği üretir ve // pcat/emex/vinpin fallback'ini geciktirir. + // PL24'TE HİÇ OLMAYANLAR — canlı WMI servisi HTTP 410 "no brands found for WMI" + // dedi (2026-09-20), tıpkı NM4 ve VR7 gibi. Haritaya eklenmemeleri kasıtlı: + // eklemek yalnız boşuna istek üretir ve pcat/emex/vinpin fallback'ini geciktirir. + // JHM, SHH, SHS, MAK, NLA (Honda) · KL1 (Chevrolet) + // JMZ (Mazda) 410 DEĞİL ama fordp/fordt döndürüyor (Ford-Mazda platform ortaklığı + // dönemi); marka tutarsız olduğu için eklenmedi — bir Mazda 3 Ford kataloğunda yok. + // Volvo YV1: "volvo_parts", // Volvo Cars (Sweden) YV4: "volvo_parts", // Volvo Cars (specific models)