test(tradein): reusable legacy/scraper_kit parity harness (#2304) #2313
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#2313
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "feat/tradein-parity-test-harness"
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?
Closes #2304 (Stage 0 эпика #2277 — scraper_kit migration).
Что сделано
tests/support/parity.py— переиспользуемая parity-test утилита:assert_parity()/compare_outputs(), нормализует dataclass/pydantic перед сравнением (решает проблему "legacy_result == kit_resultвсегдаFalse, т.к. это разные классы"), поддерживаетignore_fieldsи глобальный numerictolerance, при расхождении кидаетParityMismatchErrorс полным field-path и обоими значениями.tests/support/test_parity.py— 7 unit-тестов харнесса (идентичные/разные входы, tolerance, ignore_fields, bool/int type-mismatch — см. hardening ниже).tests/support/README.md— как следующим PR'ам (#2305-#2310) подключить харнесс.tests/scrapers/test_avito_detail_kit_parity.py— smoke-доказательство на реальном коде: legacyavito_detail.parse_detail_htmlvs kitproviders/avito/detail.pyна фиксированной HTML-фикстуре + тест, что харнесс реально ЛОВИТ расхождение (мутацияprice_rub→ParityMismatchErrorс упоминанием поля).Hardening после code-review (2-й коммит)
Ревьюер (verdict: ⚠️ MINOR, safe to merge) нашёл: exact-equality путь не отличал
True/1(bool — подкласс int в Python,True == 1). Для будущей высокорисковой миграцииestimator.py(#2308) такая тихая маскировка типа была бы опасна. Пофикшено + добавлен тест. Per-field tolerance (dict вместо float) оставлен как заметка на будущее для #2308 — не нужен сейчас (defaulttolerance=0.0, opt-in).Проверено
pytest tests/support tests/scrapers/test_avito_detail_kit_parity.py— 10 passed (после rebase на актуальный main)app/services/scrapers/*(legacy), не трогаетscraper_kitprovider-логику, не мигрирует ни один из 12 importers (это #2305-#2310)Дальше
Блокирует #2305, #2306, #2307, #2310 — все используют этот харнесс для parity-гейта.