feat(tradein): estimator — Cian Valuation as on-demand evaluation source (Stage 9) #476
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#476
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "feat/tradein-estimator-cian-clean"
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
Stage 9 / Wave 7 of CianScraper v1. Integrate
cian_valuation.estimate_via_cian_valuation()(Stage 7, PR #465) as on-demand evaluation source вestimator.py.Files
app/services/estimator.py— +42 lines (import + Cian block mirroring existing avito_imv / yandex_valuation patterns)tests/test_estimator_cian_integration.py(NEW) — 7 unit tests, 244 linesPattern reference
Mirrors
yandex_valuationintegration from PR #473 (commitb26e0ff):estimate_via_cian_valuation(db, ...)после aggregation'cian_valuation'кsources_usedif result hassale_price_rubGraceful degradation
estimate_via_cian_valuationreturns None → log warning, estimator continues без CianCache
24h TTL via
external_valuationscache_key (Stage 7 implementation). Cache hit → no Cian HTTP call.Tests
7/7 pass. Coverage:
sources_usedestimate_via_cian_valuationreturns None (no cookies)Deviations from spec
external_benchmarksdict не реализован —AggregatedEstimateschema не has такого field. Codebase pattern (avito_imv, yandex_valuation) populates толькоsources_used. Ifexternal_benchmarksneeded — separate schema change PR.feat/tradein-estimator-cian-clean(suffix-clean) — added by worker, see commitfcded1a.Push verify
fcded1a6522040742ebc45cac4101c307cfdef9efcded1a6522040742ebc45cac4101c307cfdef9eRuff
New code clean. 5 pre-existing errors в estimator.py не touched.
Refs
decisions/CianScraper_v1_Implementation_Plan.mdStage 9decisions/Schema_Cian_SERP_Inventory.mdsec 27 (final flow)estimate_via_cian_valuationAPI)Next
Stage 10 — QA smoke matrix after deploy.
Test plan
sources_usedincludescian_valuation(если cookies uploaded)Merged via deep-code-reviewer — verdict APPROVE.
Verification summary
Pattern fidelity to PR #473 (yandex_valuation): high. Identical structure — import block, post-aggregation placement (before deals fetch), two-place
sources_usedappend (pre + final), try/except graceful wrapper, logger conventions.Signature alignment with PR #465 (cian_valuation module): verified. All kwargs match
estimate_via_cian_valuation(db, *, address, total_area, rooms_count, floor, total_floors, repair_type, deal_type, use_cache)signature. No drift.UNIQUE constraint re-confirmed:
external_valuations.UNIQUE(source, cache_key)indata/sql/026_external_valuations.sql:34applies forsource='cian_valuation'._save_to_cacheuses ON CONFLICT DO UPDATE per Stage 7.Graceful degradation tested: 4 modes — no cookies / session expired / network error / result without sale_price. All covered by 7 unit tests.
Architectural deviation noted (not blocking): Inline
try/except + await estimate_via_cian_valuation()instead of_get_or_fetch_cian_valuation_cached()wrapper. Acceptable because the module already has internal cache lookup (use_cache=Truedefault), making a separate wrapper redundant.Non-blocking follow-ups
repair_type="cosmetic"anddeal_type="sale"hardcoded — consider deriving frompayload.repair_statein future PRasyncio.gatherparallelization PRPost-merge verification steps (for user)
deploy-tradein.ymlshould trigger on main/admin/scrape/cian/upload-cookies(Stage 4 PR #457) if not alreadyPOST /estimatewith ЕКБ address →sources_usedshould containcian_valuation(if auth OK)Wave 7 (Stage 10 QA smoke matrix) now unblocked.