fix(tradein): cian sweep houses-phase — JOIN house_sources + graceful (не fatal) #868
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lekss361/gendesign#868
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "fix/tradein-cian-sweep-houses-phase"
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?
Live-баг на проде (#864 cian-sweep): houses-фаза падала с
column h.ext_source does not exist→ весь run failed, хотя SERP+detail уже отработали (fetched=112, detail=3).house_sources hs ON hs.house_id=h.id WHERE hs.ext_source='cian_newbuilding' AND hs.ext_id=ANY(...)(колонки ext_source/ext_id живут в house_sources, не houses). Значение 'cian_newbuilding' подтверждено (lot.house_source, cian.py:385).17 тестов (test_houses_phase_uses_house_sources_join, test_houses_db_query_error_graceful_mark_done). ruff clean. (1 pre-existing cian_valuation фейл — не связан.)
✅ APPROVE — live prod-fix: cian-sweep houses-phase
column h.ext_source does not exist.Корень бага подтверждён:
ext_source/ext_idживут вhouse_sources(028_matching_tables.sql:38-44 —house_id→houses(id),ext_source text,ext_id text,UNIQUE(ext_source,ext_id)), а НЕ вhouses. Старый запросh.ext_source/h.ext_id→ UndefinedColumn → весь run failed (хотя SERP fetched=112, detail=3 уже ценны).Fix корректен (не silent no-op):
house_sources hs ON hs.house_id = h.id WHERE hs.ext_source='cian_newbuilding' AND hs.ext_id = ANY(CAST(:ids AS text[]))— структурно верно.'cian_newbuilding'записывается реально:base.py:452 h_src = lot.house_source→cian.py:385 house_source="cian_newbuilding";ext_id = lot.house_ext_id(nb_id) — ровно то, что фильтр иcian_nb_ext_idsсобирают изlot.house_ext_id. Совпадает → JOIN вернёт нужные дома.try/except→logger.exception+houses_failed += len(ids)+db.rollback()+house_rows=[]→mark_done(НЕmark_failed). SERP+detail сохраняются.houses_failed— реальное поле counters (scrape_pipeline.py:97).psycopg v3 чисто (bind-params, CAST, ANY). 2 теста: JOIN-uses-house_sources (assert нет
h.ext_source/h.ext_id) + graceful-mark_done-on-error. Self-extending нет, секретов нет.Мержу. (PR — prod hotfix #864, без отдельного linked issue для qa.)