gendesign/tradein-mvp/backend/app/services/matching
bot-backend 4e95cf622c fix(matching): Tier 2b alias sync + collapse double SAVEPOINT (#849)
#774-2 Parts 2/3/4 (Part 1 UNIQUE/dedup deferred — cadnum data not flowing).

Part 2 — fingerprint<->alias sync: two scrapers with same address but coords
beyond the 4-decimal fingerprint rounding produced distinct fp -> duplicate
houses. Add Tier 2b lookup by normalized_address after Tier 2a (fingerprint)
misses, register the new fp via _insert_alias; alias upsert DO NOTHING ->
DO UPDATE SET fingerprint to keep alias synced.

Part 3 — collapse double-nested SAVEPOINT: removed redundant inner
db.begin_nested() around match_or_create_house inside _link_listing_to_house.
Outer per-row SAVEPOINT in save_listings already isolates a failing lot from
siblings and from the listings INSERT (per backend.md). BEHAVIOR NOTE: a
house-match failure now aborts the whole hook for that lot (incl. listing_source
link) atomically instead of partially committing it.

Part 4 — confidence/method wiring deferred to #774-3 (matcher not on ingestion
path; listing_sources columns exist, written as source_link=1.0).

Refs #849
2026-05-31 10:58:34 +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(matching): Tier 2b alias sync + collapse double SAVEPOINT (#849) 2026-05-31 10:58:34 +03:00
listings.py fix(matching): Tier 2b alias sync + collapse double SAVEPOINT (#849) 2026-05-31 10:58:34 +03:00
normalize.py feat(tradein): cross-source matching service (3-tier: cadastr / fingerprint / geo / composite) (#470) 2026-05-23 14:12:16 +00:00