gendesign/tradein-mvp/backend/app/services
lekss361 36df5d92d2 fix(tradein/avito): #487 BLOCK — mark_banned + defensive rollback (Option B)
deep-code-reviewer P0: mark_rate_limited() writes status='rate_limited' but
SQL CHECK constraint (015 + 051) only allows banned/done/failed/etc.
First blocking event would CheckViolation -> cascade through mark_failed ->
runs stuck in 'running' -> zombie cleanup. Frontend never shows badge.

Option B fix (no migration): rename mark_rate_limited -> mark_banned, use
existing 'banned' status (migration 015 doc'd as 'Avito вернул 403/captcha' -
exactly this scenario).

Plus:
- mark_failed + mark_banned now defensive db.rollback() at start (cascade-safe)
- All mark_* now RETURNING id + log warning when no rows updated (M3)
- Callers updated: scrape_pipeline.run_avito_city_sweep + test names

Refs PR #487 review (deep-code-reviewer, 2026-05-23).
2026-05-23 23:01:49 +03:00
..
exporters fix(tradein): security hotfix — C-3 config default + C-4 empty estimate persist + C-6 PDF URL allowlist (#435) 2026-05-23 09:38:23 +00:00
matching feat(tradein): cross-source matching service (3-tier: cadastr / fingerprint / geo / composite) (#470) 2026-05-23 14:12:16 +00:00
scrapers fix(tradein/avito): anti-bot hardening — sleep + abort + shared session 2026-05-23 23:00:23 +03:00
__init__.py feat: add tradein-mvp subproject (Trade-In Estimator под /trade-in) 2026-05-21 00:25:39 +03:00
brand.py feat: add tradein-mvp subproject (Trade-In Estimator под /trade-in) 2026-05-21 00:25:39 +03:00
cache.py feat(tradein): Phase 3.2 — /api/v1/search endpoint + Redis cache (#479) 2026-05-23 14:44:22 +00:00
cian_session.py fix(tradein): CIAN_REQUIRED_COOKIES — add real auth cookies (DMIR_AUTH + Cian session) (#480) 2026-05-23 14:52:24 +00:00
estimator.py feat(tradein): estimator — Cian Valuation as on-demand 7th source (Stage 9) (#476) 2026-05-23 14:29:52 +00:00
geocoder.py fix(tradein): map-picker подставляет уличный адрес, а не название POI 2026-05-22 13:32:39 +05:00
house_metadata.py feat(tradein): кадастр зданий как источник house_metadata (#393) 2026-05-22 10:54:42 +05:00
scheduler.py feat(tradein): in-app scheduler — UI-managed schedule (replaces SSH crontab) (#482) 2026-05-23 14:54:25 +00:00
scrape_pipeline.py fix(tradein/avito): #487 BLOCK — mark_banned + defensive rollback (Option B) 2026-05-23 23:01:49 +03:00
scrape_runs.py fix(tradein/avito): #487 BLOCK — mark_banned + defensive rollback (Option B) 2026-05-23 23:01:49 +03:00
scraper_settings.py feat(tradein): global scraper delay setting (applies across all scrapers) (#485) 2026-05-23 15:43:28 +00:00
search_query.py feat(tradein): Phase 3.2 — /api/v1/search endpoint + Redis cache (#479) 2026-05-23 14:44:22 +00:00