fix(pl24): drop P4 nav-crumb links from decoded categories

VIN-group HTML for Ford/Volvo legacy services exposes the header
breadcrumb links (Portal / Model seçimi / current VIN) via the same
.action pattern the parser relied on, so they were being persisted as
"part categories" — users saw three useless rows instead of real groups.
The PSA flow already documented this trap and bypassed rawData; extend
the same defense to the rest of P4 legacy (parser-side + categories
insert fallback).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-15 22:18:25 +03:00
parent a9611b913e
commit 032217716e
2 changed files with 19 additions and 7 deletions

View File

@@ -148,8 +148,13 @@ export class CategoriesService {
if (decodedCats && decodedCats.length > 0) {
try {
// Strip P4 header/breadcrumb nav crumbs (Portal, "Model seçimi",
// current VIN) — these slipped past the older decoder filter and
// sit in cached rawData; they are never real part categories.
const NAV_CRUMB_RE = /(portal|vehicle|vin-group|logout)\.action/i;
const seenNames = new Set<string>();
const uniqueCats = decodedCats.filter((c) => {
if (c.linkPath && NAV_CRUMB_RE.test(c.linkPath)) return false;
const name = c.nameTr || c.nameEn;
if (seenNames.has(name)) return false;
seenNames.add(name);