feat(tradein): cian newbuilding enrichment backfill task + live-data fix (#972) #1148
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#1148
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "feat/newbuilding-enrich-backfill-972"
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?
Что
#972 (950-E1): backfill-таска для 3 ПУСТЫХ newbuilding-enrichment таблиц (
houses_price_dynamics/house_reliability_checks/house_reviews). Прогоняет существующийfetch_newbuilding+save_newbuilding_enrichmentпо cian-домам (ext_source='cian_newbuilding'+cian_zhk_url). Подсистема tradein-mvp (внутри репо). Non-colliding с ИРД/КРТ-треком.2 живых бага найдено+починено (gating)
save_newbuilding_enrichmentпадал на ЖИВЫХ cian-данных —transportAccessibilityRateдрейфанулint → nested dict→cannot adapt type 'dict'вCAST(:tar). Починка_extract_transport_rate(dict/float/bad →int|None, bool до int). Это чинит live-enrichment-краш, не только backfill — поэтому функции «прогонялись локально» раньше, но падали бы сейчас.id DESCtiebreaker, «regardless of force» закрывает partial-resume дыру).Идемпотентность / устойчивость
dim_key, reviewsON CONFLICT (source,ext_review_id), reliability dedup). SAVEPOINT-per-house (одна captcha/ошибка — log+continue, батч не падает).get_scraper_delay('cian')+jitter.limit=для bounded-прогонов. Использует СВОЮ tradein-сессию.Verify
code-reviewer: ✅ APPROVE — оба gate (cian-fix no-regression сверено с 20 тестами +==7; SAVEPOINT+идемпотентность сверены с РЕАЛЬНЫМИ constraints). 8 новых тестов + isolated-DB proof-run (pd 0→6, reliability 0→1, идемпотентность доказана 3× re-run). Полный tradein-suite 359 pass (1 pre-existing-unrelated fail), ruff чисто. cian достижим из dev (1 fetch → 200, без captcha).Остаётся (не в этом PR)
fetch_newbuilding= follow-up.Refs #972.
950-E1: app/tasks/newbuilding_enrich_backfill.py selects houses linked to ext_source='cian_newbuilding' with a fetchable cian_zhk_url and runs the existing fetch_newbuilding + save_newbuilding_enrichment over each, populating houses_price_dynamics + house_reliability_checks (+ house_reviews when present). - Idempotent + resumable: skips already-enriched houses; force= re-run dup-safe (price_dynamics UPSERT via dim_key, reliability dedup guard with id-DESC tiebreaker, reviews ON CONFLICT (source,ext_review_id)). - Anti-bot aware: get_scraper_delay('cian') + jitter, SAVEPOINT-per-house (one captcha/failure logs + continues, never aborts the batch). - limit= for bounded proof runs; sizing counters (total/fetchable/pending). Fix cian_newbuilding._extract_transport_rate: cian transportAccessibilityRate drifted to a nested dict and broke save_newbuilding_enrichment's CAST bind on LIVE data (cannot adapt type 'dict') — coerce dict/float/bad -> int|None (bool excluded before int). Fixes the live enrichment crash, not just backfill. house_reviews stays ~0 for now: cian reviews are in a separate XHR, not the ЖК initialState — extending fetch_newbuilding for them is a documented follow-up. Tested: 8 new unit tests; isolated-DB proof-run landed 6 price_dynamics + 1 reliability row, idempotency proven across re-runs. Refs #972.