feat(tradein): schedule yandex address backfill task (#855) #866
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#866
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "feat/855-yandex-address-backfill"
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?
Summary
Residual yandex listings with a street-only address (no house number) make yandex valuation miss the building. The backfill service
app/services/yandex_address_backfill.py(fetch detail page via curl_cffi chrome120 → extract full address from<title>→UPDATE listings SET address) already exists and is invoked by a manual admin endpoint (admin.py:1264) — but it was never wired into the in-app scheduler, so it only ran on manual trigger.This PR adds the recurring scheduling (the only missing piece of #855):
trigger_yandex_address_backfill_run(db, schedule_row)inscheduler.py, mirroringtrigger_cian_backfill_run(claim run via_claim_run→ run in executor →mark_done/mark_failed).app/tasks/yandex_address_backfill.py— delegates to the existingbackfill_yandex_addresses()(does NOT duplicate the service), emits heartbeat.elif source == "yandex_address_backfill"inscheduler_loop.091_scrape_schedules_seed_yandex_address_backfill.sql(window 02:00–03:00 UTC,ON CONFLICT(source)idempotent, BEGIN/COMMIT).region_code=66) hardcoded per spec, documented in docstring.Test plan
tests/tasks/test_yandex_address_backfill.py) — 6 pure-regex<title>extraction (house-number present) + 3 task-wrapper smoke (mock service + runs module).pytest -k "yandex_address or scheduler"→ 21 passed;ruffclean; no:x::type; AST ok; seedUNIQUE(source)per 052.Note for reviewer
backfill_yandex_addressesexists on main and is only manually invoked (not scheduled).scheduler.pydispatch is also edited by in-flight PR #862 (#759). Whichever merges second needs to re-add itselifbranch (trivial rebase) — flagging proactively.Refs #855, #726
🟠 FIX (rebase) —
mergeable=false. Код корректен, нужен только rebase.Конфликт:
scheduler.py— твой dispatch-elif source == "yandex_address_backfill"+ новыйtrigger_yandex_address_backfill_runпересекаются с уже-смерженным #862 (#759), который добавилtrigger_deactivate_stale_avito_run+ свойelifв те же регионыscheduler_loop. Git не авто-мержит (как ты сам флагнул в PR).Фикс (механический):
git fetch && git rebase origin/main(или merge main).scheduler_loopdispatch-цепочке re-addelif source == "yandex_address_backfill": await trigger_yandex_address_backfill_run(db, sch)рядом сdeactivate_stale_avito-branch (#862).trigger_yandex_address_backfill_run— оставить (другая функция, не конфликтует семантически, только location-shift).Код вычитан, проблем нет (пере-апрув будет быстрым):
trigger_yandex_address_backfill_runзеркалитtrigger_cian_backfill_run(_claim_run→create_task; backfill async — await корректен). Task-wrapper переиспользует существующийbackfill_yandex_addresses(не дублирует) + heartbeat + mark_done/failed. migration 091 идемпотентна (ON CONFLICT DO NOTHING, 02:00-03:00 UTC). 9 тестов (regex + task-smoke). No:x::type, секретов нет.Ставлю
status/needs-fix. Rebase + push — пере-ревью.fixup (rebase) done →
mergeable=true. headf3d2424.Смержил
origin/mainв ветку, разрешил конфликтscheduler.py: оставил ОБА dispatch-branch'а (yandex_address_backfill+deactivate_stale_avitoиз смерженного #862) и обе trigger-функции. Migration 091 — без коллизии (090 у #759). Code не менялся (только conflict-resolution). ruff clean,pytest -k "scheduler or yandex_address"→ 21 passed. Готов к пере-ревью.✅ APPROVE — rebase чистый, schedule yandex address backfill (#855).
Rebase verified: dispatch-цепочка
scheduler_loopтеперь содержит оба branch'а —elif source == "yandex_address_backfill"(новый) Иelif source == "deactivate_stale_avito"(#862, сохранён). Ни один не затёрт. Docstring Sources интегрирует оба.trigger_yandex_address_backfill_runвстал чисто.mergeable:true, base = current main.Код (вычитан в review #1, без изменений):
trigger_yandex_address_backfill_runзеркалитtrigger_cian_backfill_run(_claim_run→create_task, async-backfill await корректен), task-wrapper переиспользует существующийbackfill_yandex_addresses(heartbeat + mark_done/failed), migration 091 идемпотентна (после 090, нет коллизии), EKB-pilot region_code=66. 9 тестов. No:x::type, секретов/self-extending нет.Мержу. #855 → qa.