test(tradein): estimator pure-helper unit tests + fix None crash in _filter_outliers (#580) #640
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#640
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "test/580-estimator-pure-units"
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
Closes #580 (estimator IQR/confidence/fallback coverage).
1. Latent crash fix in
_filter_outliers(Tukey IQR filter, estimate path).lot.get("price_per_m2", 0)returns its 0 default only when the key is ABSENT; for a present-but-None value (listings.price_per_m2 is nullable) it returns None ->low <= None <= highraises TypeError, crashing the estimate. Now None-safe: unpriced lots kept, priced lots still filtered. Behavior byte-identical for all real prices (incl. 0) — verified by code-reviewer re-running old vs new. Latent (prod has 0 NULL price_per_m2 now, but column nullable -> future-reachable).2. 23 pure unit tests (test_estimator_pure_units.py) for _percentile, _filter_outliers (incl. None regression that fails on old code), _compute_confidence (thresholds, concentration downgrade, fallback notes, listings=None).
code-reviewer: approve, no blockers.
Test plan
Closes #580
_filter_outliers used lot.get("price_per_m2", 0), whose default only applies when the key is absent; a present-but-None value (listings.price_per_m2 is nullable) leaked into `low <= None <= high` → TypeError, crashing the estimate. Make the bounds check None-safe: keep unpriced lots, still drop genuine priced outliers. Behavior byte-identical for all real prices (incl. 0). Add tests/test_estimator_pure_units.py (23 tests) covering _percentile, _filter_outliers (incl. the None regression) and _compute_confidence (thresholds, concentration downgrade, fallback notes). Closes #580