fix(tradein): backfill house_id_fk via source-identity path (#1781) #1936
No reviewers
Labels
No labels
admin
analytics
auth
automation
bug
business
chore
ci
compliance
data
data-moat
docs
duplicate
dx
enhancement
Fable 5 ревью
feedback/max
generative
GG-форсайт
needs-discussion
needs-human
observability
pause-bots
performance
priority/p0
priority/p1
priority/p2
priority/p3
scope/backend
scope/db
scope/devops
scope/frontend
scope/qa
scrapers
security
site-finder
stage/1
stage/2
status/blocked
status/done
status/needs-analysis
status/needs-fix
status/qa
status/ready
status/review
status/wip
tech-debt
tradein
ux
week ревью 1
wontfix
вторичка
ИРД
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lekss361/gendesign#1936
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "fix/1781-house-fk-source-identity"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Что
Идемпотентный бэкфилл
listings.house_id_fkпо per-listing-identity пути (house_sourcesпоext_source=source, ext_id=source_id) — то, что миграция 130 НЕ покрыла.Почему (продолжение #1781 / migration 130)
Realtime FK-mirror (
base.py:704-750) резолвит дом для каждого listing: если скрейпер вытащил house-catalog id — матчит по(house_source, house_ext_id); иначе падает на identity самого listing:Tier-1 матчера (
matching/houses.py:96-113, confidence 1.0) =SELECT house_id FROM house_sources WHERE ext_source=:s AND ext_id=:e.Прод-замер (2026-06-27, read-only): осталось 1884 active NULL-FK, из них 0 с
house_source/house_ext_id→ re-run 130 = no-op. 744 из них резолвятся по(source, source_id). С учётом inactive — путь(source, source_id)резолвит 4608 NULL-FK всего.Что делает 136
Повторяет ровно этот Tier-1 lookup офлайн:
Восстанавливает каноническую группировку «тот же дом» (estimator Tier-S,
JOIN houses ON house_id_fk=id).Безопасность
WHERE house_id_fk IS NULL→ повторный прогон strict no-op.ext_source(cian_newbuilding,yandex_realty_nb);UNIQUE(ext_source,ext_id)→ ≤1 house_id на(source,source_id).Остаётся (НЕ в этом PR — зона Лёхи)
~1140 active NULL-FK без canonical source-id матча → нужен re-scrape/re-match (расширение охвата
cian_city_sweep+ обновление cian-cookies, #1781). И freshness замороженной cian-первички (корень #1781) — тоже scraper-зона.Refs #1781