chore(catalog-source): split per-source kill switches; default pcat off

Verified 2026-06-01 against dev's 103 unique pcat carIds: the current pcat
dump's deep-scrape (7.978 cars with real parts data via schema_parts or
part_groups+part_group_items) targets a US/JDM-market subset — Toyota 2112,
Nissan 1508, Audi 1311, Chevy 1050, Hyundai 745. **None** of sase's TR-market
vehicles intersect that rich subset:

  - 18/103 sase carIds are in dump.cars at all (registry only)
  - 0/103 yield parts via Bridge A (schema_images → schema_parts)
  - 0/103 yield parts via Bridge B (part_groups → part_group_items)

Even the cars that match by exact carId (Fiat Doblo 368 schemas, Renault
Megane, Bravo 456 schemas) have only diagram metadata — no parts annotation.
The dump scraper finished tier-1 (catalog/model/car listing) and tier-2
(schema diagrams) for these, but stopped before tier-3 (parts annotation).

Under the strict "always correct OEM" constraint there is no safe pcat lookup
today. Disable it. The container stays up for future use cases (OEM cross-
reference search, alt-part matching) and so we can flip the env back without
a code change if a richer dump arrives.

EMEX stays on (its catalog-allowlist is the next step).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-01 17:50:07 +03:00
parent 506f11d636
commit 3a3a7d3ebf
5 changed files with 42 additions and 6 deletions

View File

@@ -73,6 +73,10 @@ export default () => ({
enabled: process.env.CATALOG_SOURCE_DB_ENABLED === "true",
pcatUrl: process.env.PCAT_SOURCE_DB_URL,
emexUrl: process.env.EMEX_SOURCE_DB_URL,
// Per-source kill switches. PCAT defaults off — the current dump's deep-scrape
// doesn't cover sase's TR-market vehicles; see service comment for details.
emexEnabled: (process.env.EMEX_SOURCE_DB_ENABLED ?? "true") === "true",
pcatEnabled: process.env.PCAT_SOURCE_DB_ENABLED === "true",
},
otel: {
enabled: process.env.OTEL_ENABLED === "true",

View File

@@ -30,11 +30,14 @@ export class EmexSourceDbService implements OnModuleInit, OnModuleDestroy {
constructor(private readonly config: ConfigService) {}
onModuleInit() {
const enabled = this.config.get<boolean>("catalogSource.enabled");
const masterEnabled = this.config.get<boolean>("catalogSource.enabled");
const emexEnabled = this.config.get<boolean>("catalogSource.emexEnabled");
const url = this.config.get<string>("catalogSource.emexUrl");
if (!enabled || !url) {
if (!masterEnabled || !emexEnabled || !url) {
this.logger.log(
`[emex-src] disabled (enabled=${enabled}, urlSet=${Boolean(url)}); upstream-only`,
`[emex-src] disabled (master=${masterEnabled}, emex=${emexEnabled}, urlSet=${Boolean(
url,
)}); upstream-only`,
);
return;
}

View File

@@ -24,11 +24,19 @@ export class PcatSourceDbService implements OnModuleInit, OnModuleDestroy {
constructor(private readonly config: ConfigService) {}
onModuleInit() {
const enabled = this.config.get<boolean>("catalogSource.enabled");
const masterEnabled = this.config.get<boolean>("catalogSource.enabled");
const pcatEnabled = this.config.get<boolean>("catalogSource.pcatEnabled");
const url = this.config.get<string>("catalogSource.pcatUrl");
if (!enabled || !url) {
// Default off: verified 2026-06-01 that the current pcat dump's deep-scrape
// (7.978 cars with real parts) targets US/JDM-market models (Toyota 2112,
// Nissan 1508, Audi 1311, Chevy 1050, Hyundai 745) and covers 0 of sase's
// 103 dev TR-market pcat carIds via either bridge (schema_parts or
// part_groups+part_group_items). Container stays up for future use cases.
if (!masterEnabled || !pcatEnabled || !url) {
this.logger.log(
`[pcat-src] disabled (enabled=${enabled}, urlSet=${Boolean(url)}); upstream-only`,
`[pcat-src] disabled (master=${masterEnabled}, pcat=${pcatEnabled}, urlSet=${Boolean(
url,
)}); upstream-only`,
);
return;
}