Some checks failed
QA Gate (P0/P1) / Test affected app (pull_request) Has been cancelled
Faz 3 backfill'i açmadan önce hacmi ölçtüm ve raporun işaret ettiğinden
çok daha büyük bir israf çıktı.
**Mitsubishi'nin parça listesi grup sanılıyordu.**
`/p5mitsubishi/extern/details/vinDetails` yanıtı `partno`/`qty` taşıyan
bir PARÇA listesi (canlı doğrulama: 16 kayıt), ama her kaydın kendi
linki `partInfoTable` ve ne wid ne yol sınıflandırıcıda karşılık
buluyordu. Sonuç (prod ölçümü): 2.193 parça listesi grup düğümüne
döndü, içlerindeki 19.576 tekil parça ("SCREW,LOCK CYLINDER",
"BOLT,STEERING COLUMN WASHER") kategori olarak kaydedildi. Bu 19.576
sahte düğümün TOPLAM 2 tanesinde parça var ve hepsi her prefetch
turunda yeniden çekiliyor. İkisi de %100 Mitsubishi.
- `detailsTable` artık yaprak, `isPl24PartDetailNode()` ile
`partInfoTable` hiç kuyruklanmıyor.
- `isLeafLinkPath` artık `linkWid`'i de geçiriyor. Okuma yolu bu
güvenilir sinyali hep kullanıyordu ama kuyruklama yolu düşürüyordu —
sınıflandırıcı `detailsTable`'ı öğrense bile burada yine grup
sayılacaktı.
- Migration 0036: 19.576 sahte kategori siliniyor. Okuma yolu bir
düğümün ÖNCE çocuklarına baktığı için bu silme düzeltmenin parçası,
ayrı temizlik değil. Kuru çalıştırma: 19.576 kategori, 9 araç, 2
parça, Mitsubishi dışı 0.
**Backfill anahtarı.** `PL24_BACKFILL_ENABLED` eklendi, varsayılan
KAPALI. Eski `PL24_TR_DISABLED` adı "tr hesabı öldü" diyordu ama işi
"toplu yükü tek sağ kalan hesaptan uzak tut"tu. Eski değişken hâlâ
kapatabiliyor — yarım deploy musluğu sessizce açamasın. Kullanıcı
tetikli fast-lane bu anahtardan etkilenmiyor.
9 yeni test. api 647 test geçiyor.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
187 lines
6.5 KiB
TypeScript
187 lines
6.5 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
||
import {
|
||
isPl24GroupNode,
|
||
isPl24LeafNode,
|
||
isPl24PartDetailNode,
|
||
isStalePl24Architecture,
|
||
} from "./pl24-tree";
|
||
|
||
// Canlı P5 yanıtlarından (2026-09-16 keşfi, plv2-artefakt/) alınan gerçek
|
||
// wid + path çiftleri. Bu dosya "0 parça" sınıfı hatanın regresyon kilidi.
|
||
|
||
describe("isPl24LeafNode — canlı P5 şekilleri", () => {
|
||
it("VW (p5vwag): maingroups/subgroups grup, bom/vin yaprak", () => {
|
||
expect(
|
||
isPl24GroupNode({
|
||
linkWid: "mainGroupsTable",
|
||
linkPath: "/p5vwag/extern/groups/vin_maingroups?vin=X",
|
||
}),
|
||
).toBe(true);
|
||
expect(
|
||
isPl24GroupNode({
|
||
linkWid: "subGroupsIllusTable",
|
||
linkPath: "/p5vwag/extern/groups/vin_subgroups_illus?maingroup=4",
|
||
}),
|
||
).toBe(true);
|
||
expect(
|
||
isPl24LeafNode({
|
||
linkWid: "bomlist",
|
||
linkPath: "/p5vwag/extern/bom/vin?illustration=407-000",
|
||
}),
|
||
).toBe(true);
|
||
});
|
||
|
||
it("PSA (p5psa): scope + mainGroups + illusTable grup, bomDetails yaprak", () => {
|
||
expect(
|
||
isPl24GroupNode({
|
||
linkWid: "scopeTable",
|
||
linkPath: "/p5psa/extern/group/vin/scope?modelCode=1PD2",
|
||
}),
|
||
).toBe(true);
|
||
expect(
|
||
isPl24GroupNode({
|
||
linkWid: "mainGroupTable",
|
||
linkPath: "/p5psa/extern/group/vin/mainGroups?scope=_FCT0001",
|
||
}),
|
||
).toBe(true);
|
||
// Eski `includes("group")` kuralının kaçırdığı seviye — sessiz boş panelin kaynağı.
|
||
expect(
|
||
isPl24GroupNode({
|
||
linkWid: "illusTable",
|
||
linkPath: "/p5psa/extern/group/vin/illus?mainGroup=_FCT0001_FCT0512",
|
||
}),
|
||
).toBe(true);
|
||
// camelCase bomDetails — eski `includes("/bomdetails")` kaçırıyordu.
|
||
expect(
|
||
isPl24LeafNode({
|
||
linkWid: "bomlist",
|
||
linkPath: "/p5psa/extern/details/vin/bomDetails?illustration=D2F001A48A",
|
||
}),
|
||
).toBe(true);
|
||
});
|
||
|
||
it("Volvo (p5volvo): illustrationsTable grup, bom yaprak", () => {
|
||
expect(
|
||
isPl24GroupNode({
|
||
linkWid: "illustrationsTable",
|
||
linkPath: "/p5volvo/extern/groups/vin/illustration?group=0b00c8af80205942",
|
||
}),
|
||
).toBe(true);
|
||
expect(isPl24LeafNode({ linkWid: "bomlist", linkPath: "/p5volvo/extern/bom/vin?..." })).toBe(
|
||
true,
|
||
);
|
||
expect(
|
||
isPl24LeafNode({
|
||
linkWid: "partinfo",
|
||
linkPath: "/p5volvo/extern/partinfo/vin?partno=36050493",
|
||
}),
|
||
).toBe(true);
|
||
});
|
||
|
||
it("Subaru (p5subaru): subgroups/illustrations grup, bom/vin?figNum yaprak", () => {
|
||
expect(
|
||
isPl24GroupNode({
|
||
linkWid: "illustrationsTable",
|
||
linkPath: "/p5subaru/extern/groups/vin/illustrations?subGroup=001",
|
||
}),
|
||
).toBe(true);
|
||
expect(
|
||
isPl24LeafNode({ linkWid: "bomlist", linkPath: "/p5subaru/extern/bom/vin?figNum=01" }),
|
||
).toBe(true);
|
||
});
|
||
|
||
it("wid yoksa yol kalıbına düşer (eski DB satırları)", () => {
|
||
expect(isPl24LeafNode({ linkPath: "/p5vwag/extern/bom/vin?illustration=1" })).toBe(true);
|
||
expect(
|
||
isPl24LeafNode({ linkPath: "/psa/peugeot_parts/vin-image-board.action?illCode=1" }),
|
||
).toBe(true);
|
||
expect(
|
||
isPl24GroupNode({
|
||
linkPath: "/psa/peugeot_parts/json-vin-main-groups.action?scope=_FCT0001",
|
||
}),
|
||
).toBe(true);
|
||
});
|
||
|
||
it("hasSubgroups=true yol tahminini ezer", () => {
|
||
expect(isPl24LeafNode({ linkPath: "/p5x/extern/unknown", hasSubgroups: true })).toBe(false);
|
||
});
|
||
|
||
it("servicepart öğe listesi yapraktır", () => {
|
||
expect(
|
||
isPl24LeafNode({
|
||
linkWid: "servicePartsItemsTable",
|
||
linkPath: "/p5vwag/extern/servicepart/vin_items?x=1",
|
||
}),
|
||
).toBe(true);
|
||
});
|
||
});
|
||
|
||
describe("isStalePl24Architecture — P4→P5 göç tespiti", () => {
|
||
it("eski PSA/Volvo yolu + artık P5 olan servis → bayat", () => {
|
||
expect(
|
||
isStalePl24Architecture({ catalogPath: "/psa/peugeot_parts", currentApiPath: "/p5psa" }),
|
||
).toBe(true);
|
||
expect(isStalePl24Architecture({ catalogPath: "/volvo", currentApiPath: "/p5volvo" })).toBe(
|
||
true,
|
||
);
|
||
});
|
||
|
||
it("zaten P5 kaydı bayat değil", () => {
|
||
expect(isStalePl24Architecture({ catalogPath: "/p5psa", currentApiPath: "/p5psa" })).toBe(
|
||
false,
|
||
);
|
||
});
|
||
|
||
it("hâlâ P4 olan markalar (Ford/Opel/Hyundai) dokunulmaz", () => {
|
||
expect(isStalePl24Architecture({ catalogPath: "/ford", currentApiPath: "/ford" })).toBe(false);
|
||
expect(isStalePl24Architecture({ catalogPath: "/opel", currentApiPath: "/opel" })).toBe(false);
|
||
});
|
||
|
||
it("eksik bilgi → bayat sayma (güvenli taraf)", () => {
|
||
expect(isStalePl24Architecture({ catalogPath: null, currentApiPath: "/p5psa" })).toBe(false);
|
||
expect(isStalePl24Architecture({ catalogPath: "/psa/x", currentApiPath: null })).toBe(false);
|
||
});
|
||
});
|
||
|
||
/**
|
||
* Mitsubishi: parça listesi grup sanılıyordu (plv2.md, bulgu consumers-13).
|
||
*
|
||
* `/p5mitsubishi/extern/details/vinDetails` yanıtı `partno`/`qty` taşıyan bir
|
||
* PARÇA listesi (canlı doğrulama 2026-09-20: 16 kayıt), ama her kaydın linki
|
||
* `partInfoTable`. Ne wid ne yol sınıflandırıcıda karşılık bulmuyordu → 2.193
|
||
* parça listesi gruba, içlerindeki 19.576 tekil parça kategoriye dönüşmüştü;
|
||
* hepsinde toplam 2 parça vardı ve her prefetch turunda yeniden çekiliyorlardı.
|
||
*/
|
||
describe("Mitsubishi detailsTable / partInfoTable", () => {
|
||
const detailsPath =
|
||
"/p5mitsubishi/extern/details/vinDetails?bomDetails=133_110D00125Y&mainGroup=33";
|
||
const partInfoPath = "/p5mitsubishi/extern/details/vinpartinfo?bomDetails=142_7103K22Y5T";
|
||
|
||
it("detailsTable bir parça listesi — yaprak", () => {
|
||
expect(isPl24LeafNode({ linkWid: "detailsTable", linkPath: detailsPath })).toBe(true);
|
||
expect(isPl24GroupNode({ linkWid: "detailsTable", linkPath: detailsPath })).toBe(false);
|
||
});
|
||
|
||
it("partInfoTable tekil parça detayı — ne grup ne liste", () => {
|
||
expect(isPl24PartDetailNode({ linkWid: "partInfoTable", linkPath: partInfoPath })).toBe(true);
|
||
expect(isPl24GroupNode({ linkWid: "partInfoTable", linkPath: partInfoPath })).toBe(false);
|
||
});
|
||
|
||
it("wid yoksa yol kalıbı parça-detayını yine yakalar", () => {
|
||
expect(isPl24PartDetailNode({ linkPath: partInfoPath })).toBe(true);
|
||
});
|
||
|
||
it("gerçek parça uçlarını parça-detayı sanmaz", () => {
|
||
// Volvo'nun partinfo yaprağı ve VW'nin bom listesi etkilenmemeli.
|
||
expect(
|
||
isPl24PartDetailNode({
|
||
linkWid: "partinfo",
|
||
linkPath: "/p5volvo/extern/partinfo/vin?partno=1",
|
||
}),
|
||
).toBe(false);
|
||
expect(
|
||
isPl24PartDetailNode({ linkWid: "bomlist", linkPath: "/p5vwag/extern/bom/vin?x=1" }),
|
||
).toBe(false);
|
||
});
|
||
});
|