PART 1 — cian-новостройки теряли номер дома: geo.address[] для ЖК часто без
части {type:"house"}, адрес выходил house-less («…улица Евгения Савкова» без
«29») и раздробленные корпуса схлопывались в catch-all → same-building anchor
рвался. Теперь для новостроек без house восстанавливаем номер по приоритету:
(a) building.houseNumber / building.address, (b) building_cadastral_number как
anchor-ключ, (c) хвостовой дом-токен из newbuilding.name — без catch-all
фабрикации. building_cadastral_number предпочтён как house anchor
(house_source=cian_building_cad) → Tier 0 cadastr_exact схлопывает корпуса;
nb_id остаётся fallback'ом.
PART 2 — дубль-листинги: миграция 133 дедупит listings по (source, source_id)
(keeper = house_id_fk → активность → свежесть → id), безопасно перепривязывает
детей (price_history/snapshots/listing_sources/external_valuations/merged_into)
collision-safe и вешает частичный UNIQUE (source, source_id) WHERE source_id IS
NOT NULL. Идемпотентно, недеструктивно для keeper. save_listings оставлен на
ON CONFLICT (dedup_hash) — арбитр согласован с новым constraint, source_id=NULL
(yandex/url-only) не ломается.
Refs #1773
Adds listings.card_hash (SHA-256 of volatile SERP-card fields) computed and
stored on every scrape. Skips the redundant per-day listings_snapshots write
when a listing's card is unchanged. listings.last_seen_at/is_active still
bumped on every sighting (delisting TTL). Lays groundwork for detail-refresh
gating (C2).
p3 naming-consistency (cadastral cols 0% filled). Migration 094_cadastral_unify.sql
(idempotent DO-block IF EXISTS): drop+recreate listings_search_mv (MV) +
v_data_quality (view), RENAME deals/house_metadata kadastr_num->cadastral_number,
DROP listings.kadastr_num + listings_kadastr_idx. Code SQL-string renames in
search_query/estimator/base (Lot dataclass field NOT renamed). 240 tests pass.
WARN: destructive DDL auto-applies to prod on deploy -> MERGE-GATE post-demo.
Reviewer: verify recreated MV/view DDL vs LIVE pg_get_viewdef before apply
(reconstructed from migration history 050/046, not live capture).
Refs #732
Закрывает последнюю часть #769 (A1/A2/B/C/D в #798/#804). Finding #17:
bare-city адреса геокодились в city-центроид и сохранялись как точные lat/lon →
mislocated листинги участвовали в radius ST_DWithin-аналогах.
- 089: ALTER TABLE listings ADD COLUMN IF NOT EXISTS geo_precision text (idempot).
- ScrapedLot.geo_precision + проброс в save_listings.
- geocode_missing.py: geo_precision='city' через существующий _geocode_is_coarse.
- estimator _fetch_analogs Tier H+W: + AND (geo_precision IS DISTINCT FROM 'city').
NULL проходит (консервативно, сдвига до backfill нет). Pricing не тронут.
7 тестов; 270 passed, ruff clean.