fix(pl24): recover Volvo categories — stop vin-group.action?group1= shadowing

Volvo (VIN-indexed legacy catalog) ships its real top groups as
vin-group.action?group1=… in the vin-group HTML. PL24's
json-vin-main-group.action endpoint now 404s, so decode falls back to the
HTML scrape — but parseP4NavigationCategories AND the seed-time NAV_CRUMB
filter both blanket-exclude vin-group.action, dropping every real Volvo
group → 0 categories. Exclude vin-group.action as a crumb only when it
lacks group1=. Confirmed upstream: 7 real groups (Frenler, Elektrik
sistemi, …) present in the HTML for YV1AS7050A1118639.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-02 01:51:19 +03:00
parent 7da12607ef
commit 0f647b3931
2 changed files with 12 additions and 2 deletions

View File

@@ -155,10 +155,14 @@ export class CategoriesService {
// 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.
// NOTE: vin-group.action?group1=… are NOT crumbs — they are Volvo's
// real top groups (VIN-indexed catalog). Only treat vin-group.action
// as a crumb when it lacks group1=, else every Volvo category is lost.
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;
if (c.linkPath && NAV_CRUMB_RE.test(c.linkPath) && !c.linkPath.includes("group1="))
return false;
const name = c.nameTr || c.nameEn;
if (seenNames.has(name)) return false;
seenNames.add(name);

View File

@@ -4012,7 +4012,13 @@ export class PL24FordLegacyService {
if (
href.includes("portal.action") ||
href.includes("vehicle.action") ||
href.includes("vin-group.action") ||
// vin-group.action is the VIN breadcrumb crumb — EXCEPT when it carries
// group1=. Volvo (and other VIN-indexed legacy catalogs) ship their real
// top groups as vin-group.action?group1=… in the HTML. PL24's
// json-vin-main-group.action now 404s, so decode falls back to this
// scrape; the blanket vin-group.action exclude then drops every real
// Volvo group → 0 categories. Keep the group1= links.
(href.includes("vin-group.action") && !href.includes("group1=")) ||
href.includes("logout.action") ||
href.includes("login")
) {