gendesign/tradein-mvp/backend/app/services/matching
lekss361 9a6890de6a fix(tradein-matching): pg_advisory_xact_lock to prevent duplicate house INSERTs
Two scrapers calling match_or_create_house() concurrently for the same address
could both miss Tier 0-3 and each INSERT a new canonical house — splitting
listings across duplicate house rows and breaking aggregations.

Serialize via pg_advisory_xact_lock(42, hashtext(fingerprint)). Lock is
transaction-scoped (released on caller's COMMIT/ROLLBACK). After unblock, the
losing scraper's Tier 2 fingerprint lookup hits the winner's alias and returns
the same house_id.

Closes finding #1 from 2026-05-24 trade-in audit.
2026-05-24 13:15:50 +03:00
..
__init__.py feat(tradein): cross-source matching service (3-tier: cadastr / fingerprint / geo / composite) (#470) 2026-05-23 14:12:16 +00:00
conflict_resolution.py feat(tradein): conflict_resolution — register Yandex sources in priority dicts (#471) 2026-05-23 14:03:35 +00:00
houses.py fix(tradein-matching): pg_advisory_xact_lock to prevent duplicate house INSERTs 2026-05-24 13:15:50 +03:00
listings.py feat(tradein): cross-source matching service (3-tier: cadastr / fingerprint / geo / composite) (#470) 2026-05-23 14:12:16 +00:00
normalize.py feat(tradein): cross-source matching service (3-tier: cadastr / fingerprint / geo / composite) (#470) 2026-05-23 14:12:16 +00:00