refactor(tradein/scrapers): удалить legacy scrape_pipeline.py + тест-хирургия (#2397 Part E1) #2405
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#2405
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "chore/tradein-partE1-delete-scrape-pipeline"
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
Umbrella #2397 Part E1 (эпик #2277 decommission legacy orchestration). Удаляет legacy
app/services/scrape_pipeline.py(3734 строки) — SERP-оркестрацию, ставшую 0-importer dead code после Part C (#2402, удалениеscheduler_loop). Kit-оркестрация (scraper_kit.orchestration.pipeline) — parity-покрытый replacement, прод уже 100% на kit.0 runtime-импортёров подтверждено независимым adversarial-аудитом (7 модулей-кандидатов, per-module refute): каждая non-test ссылка на
scrape_pipeline— комментарий/докстринг или тест. Единственный live-импортёр (Part C убрал последний изmain.py) отсутствует.Это первый из двух E-слайсов (split по blast-radius, handoff «>800 строк → 2 PR»):
scrape_pipeline.py+ хирургия ~18 тестов, импортировавших его.cian,cian_detail,yandex_realty,domclick,domclick_exceptions,avito_houses) + их provider/parity-тесты.Изменения
app/services/scrape_pipeline.py.test_scrape_pipeline.py,test_scrape_pipeline_proxy_pool.py,test_anchor_watchdog.py,test_ban_rotation_1790.py,test_provider_rotation_1848.py,test_scraper_resilience_1949_1950.py,test_sweep_drain.py.test_scraper_kit_pipeline_parity.py,test_scraper_kit_pipeline_parity2.py(kit-driving остаётся основным orchestration-regression-сьютом),test_sweep_imv_phase.py(6 IMV-phase тестов → kitrun_avito_city_sweepc DI; попутно найден и починен реальный signature-gap: kit добавляетmatcher=kwarg вsave_house_catalog_enrichment).scraper_kit.orchestration.pipeline):test_city_sweep.py,test_cian_city_sweep.py,test_yandex_city_sweep.py,test_domclick_sweep.py,test_avito_newbuilding_sweep.py,test_pipeline_browser_routing.py,test_scraper_proxy.py,tests/scrapers/test_avito_anti_bot.py.admin.py,avito_detail_backfill.py,house_imv_backfill.py,yandex_price_history.py,scrapers/avito_detail.py, kitorchestration/__init__.py+pipeline.py+providers/avito/detail.py. Не тронуты:data/sql/*.sql(immutable history),contracts.py(провенанс-footnote).Diff: +417 −9221 (27 файлов).
Test plan
tradein-mvp/backend, venv py3.12, tradein pg :5432): 3088 passed, 6 skipped, 1 failed — единственный fail = известный pre-existing flaketest_search_cache_hit(#2208), unrelated. Падение общего числа тестов ожидаемо (удалены legacy orchestration/parity-тесты), как в #2394.import app.main; import app.scheduler_main→ OK.grep -rn scrape_pipeline app/ scripts/ packages/→ только past-tense упоминания («удалён в Part E1»), 0 импортёров.ruff checkclean на всех тронутых файлах. ⚠️ Прогон ruff был на0.15.20(venv), не на CI-пине0.7.4— CI подтвердит parity (0.15.20 строже, clean на нём ⇒ ожидаемо clean на 0.7.4).Base merge-base =
ab250a13; свежий main-коммит #2404 (2e345acb) не пересекается по файлам — merge чистый.Refs #2397, #2277
app.services.scrape_pipeline (3734 строк) имел 0 runtime-импортёров — Part C убрал последнего вызывающего (admin.py, scheduler_main.py уже на scraper_kit.orchestration.pipeline). Удаление: - backend/app/services/scrape_pipeline.py — удалён целиком Тесты (18 файлов, импортировавших scrape_pipeline): DELETE (чистая legacy-оркестрация, kit-эквивалент покрыт в test_scraper_kit_pipeline_parity{,2}.py): - test_scrape_pipeline.py, test_scrape_pipeline_proxy_pool.py (proxy-pool DB-lease вытеснен RealProxyProvider DI-адаптером, покрытым test_scraper_adapters_contracts.py) - test_anchor_watchdog.py, test_ban_rotation_1790.py, test_provider_rotation_1848.py - test_scraper_resilience_1949_1950.py, test_sweep_drain.py CONVERT (parity-сравнение убрано, kit-only regression оставлен/усилен): - test_scraper_kit_pipeline_parity.py, test_scraper_kit_pipeline_parity2.py — _drive_old убран, _drive_new стал единственной веткой; ассёрты на конкретные значения counters сохранены (это теперь основное regression-покрытие kit orchestration) - test_sweep_imv_phase.py — 6 IMV-phase тестов (enrich_imv true/false/no-touched/ crash/failed-counter/cancel) переведены на run_avito_city_sweep (kit) с DI (config/matcher/enrichment); enrichment.process_houses_imv_batch — инжектируемый Protocol-метод вместо прямого импорта app.services.house_imv_backfill PARTIAL-EDIT (легаси sweep-behavior вырезан, admin/kit-DI/несвязанные тесты оставлены): - test_city_sweep.py — только retarget 4 импортов на scraper_kit.orchestration.pipeline - test_cian_city_sweep.py, test_yandex_city_sweep.py — sweep-behavior секции удалены, admin endpoint тесты (уже kit-DI) + anchor-timeout/watchdog формулы (retarget import) оставлены - test_domclick_sweep.py — sweep-wiring тесты удалены, Counters + _map_item оставлены - test_avito_newbuilding_sweep.py — sweep-wiring тест #5 удалён, retarget NewbuildingSweepCounters - test_pipeline_browser_routing.py — 3 run_avito_pipeline теста удалены, browser-routing на уровне fetch_detail/fetch_house_catalog/AvitoScraper не тронут - test_scraper_proxy.py, tests/scrapers/test_avito_anti_bot.py — _avito_proxies() переведён на kit (DI-параметр вместо settings-patch); pipeline-level тесты удалены Stale-комментарии (scrape_pipeline.py как текущая реальность) поправлены в admin.py, avito_detail_backfill.py, house_imv_backfill.py, yandex_price_history.py, scrapers/avito_detail.py + kit-пакете (orchestration/__init__.py, orchestration /pipeline.py, providers/avito/detail.py — strangler завершён, легаси удалён). grep -rn scrape_pipeline app/ scripts/ packages/ — только past-tense упоминания ("удалён в Part E1", "перед его удалением") + один historical footnote (contracts.py:138, provenance-заметка "собраны grep'ом по ... .py"). Backend suite: 3088 passed, 6 skipped (известный flake test_search_cache_hit #2208 — не регрессия). ruff check чист на всех изменённых файлах.