refactor(tradein/estimator): extract deterministic pricing into pure _price_from_inputs (#1966 foundation) #1976
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#1976
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "refactor/tradein-estimator-price-spine"
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
Foundation refactor for #1966 (accuracy-loop → CI gate). Extracts the deterministic pricing orchestration out of the async
estimate_qualityinto a new pure, synchronous_price_from_inputs()— single source of truth — so the pricing spine becomes unit-testable and reusable by an offline backtest harness.estimate_quality; their results are injected into the pure function: pre-fetched objects (dkp_raw,imv_anchor,anchor_comps,imv_eval, presence flags for yandex/cian) + 3 thin callables (ratio_resolver,quarter_index_lookup,quarter_indexes_lookup) for lookups whose arguments are computed mid-block.PricingResultdataclass (19 fields) carries everythingestimate_qualityconsumes downstream (DB INSERT, analogs/anchor selection, freshness,AggregatedEstimate).Test plan
tradein-mvp, env-only — unrelated.)tests/test_estimator_price_spine.py(401 lines, hermetic/no-DB) covers: radius-only, anchor Tier A, Tier C corridor gate, ghost-anchor, quarter-index (apply + Guard-2 skip), corridor clamp, expected_sold presence/absence, coarse-geo downgrade.code-reviewer: ✅ APPROVE — zero output divergence across 7 risk vectors (ratio timing, IMV pre-fetch, cian/yandex presence, quarter guards, mutation order, PricingResult completeness, psycopg/ruff).Unblocks PR2 (backtest harness on
_price_from_inputs+ range-coverage + confidence-calibration + frozen baseline) and PR3 (CI regression gate).Part of #1966 (PR 1/3). Refs #1966.