VIN-based fallback (VIN lookup)
VIN lookup resolves a Redbook vehicle key from a dealer-supplied VIN when neither the dealer's feed nor an AGVI lookup already supplied one. It runs inside the same enrichData() hook described in Enrichment — but unlike the AGVI lookup, it applies to every provider's every file, not just Autograb's. It's the third and last resolution attempt before a record is given up on.
What it's for: a meaningful share of dealer feeds arrive with no usable Redbook key and no agvi value at all — only a VIN. Without this fallback those records have no redbook_vehicle_key, and get filtered out of stock_int entirely later on (see Redbook key resolution hierarchy). VIN lookup gives them a second chance by calling Autograb's VIN endpoint directly.
How it works: every record is classified into exactly one outcome, checked in this order:
When the VIN lookup is triggered
A record enters the VIN lookup path only when all three are true:
- It does not already have a usable Redbook key.
- It does not have an
agvivalue. - It has a VIN that passes validation.
If any of the three fails, the record is resolved another way (STOCK_FEED or AGVI_MAPPING) or passed through unchanged — the VIN lookup is never reached.
Per-record classification
-
Has a usable Redbook key already → tagged
STOCK_FEED. No API call, VIN lookup not triggered."Usable" means: a non-empty string after trimming whitespace and stripping leading
(/[and trailing)/]characters."AUVTOYO2025AEAC"and"(ABC123)"both count;"",null," ","()"do not. -
Has an
agvivalue → goes to the AGVI branch above instead of VIN lookup. TaggedAGVI_MAPPINGon success. VIN lookup not triggered. -
Has a VIN that passes validation → this is the condition that triggers the VIN lookup. A VIN must:
- Be exactly 17 characters, from
[A-HJ-NPR-Z0-9](letters I, O, Q are invalid VIN characters and excluded). - Not be a known synthetic/placeholder WMI (e.g. prefix
"6ZZ"). - Have no run of 5 or more identical characters in a row.
- Be exactly 17 characters, from
-
None of the above (no usable key, no
agvi, no valid VIN) → passed through unchanged, no tag. VIN lookup not triggered.
Cooldown (retry suppression)
Before Stage 1 is ever called, the VIN is checked against a cooldown ledger (a DynamoDB table, keyed by VIN). If the VIN is currently in cooldown, the record is left unresolved with no Autograb call at all — not even Stage 1.
A VIN enters cooldown whenever a lookup doesn't resolve a key, for 30 days (a clean or ambiguous no-match, or a reduced-confidence/Stage-2-clean-miss discard) or 24 hours (a genuine upstream HTTP/network failure from Autograb). A VIN that resolves successfully has any existing cooldown entry cleared immediately. A Stage-2 failure caused by a missing AUTOGRAB_API_KEY configuration value writes no cooldown — that's a deployment bug, not a vehicle- or vendor-specific failure, and shouldn't suppress a VIN's next real attempt.
This exists because stock feeds re-submit the same unsold inventory on every ingestion cycle: without it, a VIN that failed once got re-queried against the paid Autograb API on every subsequent file for as long as that vehicle stayed listed.
Resolution outcome once triggered
Triggering the lookup does not guarantee a resolved key:
- Stage 1 (
resolveAgviFromVin) must returnconfidence: "standard"exactly."reduced"or a missing confidence field → discarded, no Stage 2 call, record left unchanged, no error, VIN cooled down (no-match). - If Stage 1 returns an
agvibut no inline key, Stage 2 (lookupVehicleKeyByAgvi, the same function the AGVI branch above uses) is called. If that also finds nothing, the record stays unresolved and the VIN is cooled down (no-match); if it fails with a genuine upstream error, the VIN is cooled down for the shorter transient-error window instead. - On success, tagged
VIN_LOOKUP, and any existing cooldown entry for that VIN is cleared.
Scope and limits
Applies to every provider's every file, every dealer — no per-dealer allowlist, no per-file cap.
Structural limits (infrastructure, not business logic):
- Lambda timeout: 900 seconds, hard cutoff (
stockInboundProcess). - Up to 5 files processed concurrently (
maximumConcurrency: 5). - The Autograb HTTP call has no per-request timeout — a stalled call can hold up to Node's default socket timeout, and every first-time VIN candidate in a file is still dispatched concurrently in one batch with no internal throttling. The cooldown above narrows retry volume (the same VIN being re-queried file after file) but does nothing about burst volume within a single file's first pass — that remains a known, accepted risk, not a bug still being worked on.