fix(catalog): case-insensitive PL24 group-wid drill check
Some checks failed
QA Gate (P0/P1) / Test affected app (pull_request) Has been cancelled

PL24 sub-group nav nodes were classified by linkWid.includes("Group")
(case-sensitive). That matched capitalised wids (subGroupsTable) but
missed lowercase ones — groupReferenceTable, groupTable, groupsTable
(~1157 leaf nodes in prod) — so those skipped the group-drill branch in
getCategoryWithPartsInner and the reference-resolution descent, falling
to the parts path (a wasted upstream fetch; the generic drill-on-empty
fallback then re-drilled them). Lowercasing the check routes these nav
nodes straight to children/loadError like their capitalised siblings.

Empty-catalog audit (2026-06-03) showed PL24 drives 61% of user-seen
'0 parça' views; pcat fake-leaves are effectively solved (1 case).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-03 15:40:39 +03:00
parent c7fad362a5
commit c5f8288d71

View File

@@ -879,7 +879,15 @@ export class CategoriesService {
// parent. If the drill comes back empty, the catalog snapshot is broken
// server-side: surface that as a load error instead of a misleading
// "no parts" leaf (these group nodes are never legitimately empty).
if (category.source === "pl24" && category.linkWid?.includes("Group") && category.vehicleId) {
// Case-insensitive: link_wid group tables come capitalised (subGroupsTable)
// AND lowercase (groupReferenceTable, groupTable, groupsTable). The old
// case-sensitive includes("Group") missed the lowercase ones (~1157 nodes),
// so they skipped this group-drill branch and fell to the parts path.
if (
category.source === "pl24" &&
category.linkWid?.toLowerCase().includes("group") &&
category.vehicleId
) {
const groupChildren = await this.getChildren(categoryId);
const base = {
id: category.id,
@@ -1594,7 +1602,8 @@ export class CategoriesService {
.from(categories)
.where(eq(categories.parentId, root.id));
for (const sub of subs) {
const isGroup = sub.hasSubgroups === true || sub.linkWid?.includes("Group");
const isGroup =
sub.hasSubgroups === true || (sub.linkWid?.toLowerCase().includes("group") ?? false);
if (!isGroup) continue;
const subHit = await drillAndCheck(sub.id);
if (subHit) return { code, categoryId: subHit };