fix(tradein): coarse-geo downgrade no longer shielded by Tier C anchor (#693) #720
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lekss361/gendesign#720
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "fix/693-tier-c-coarse"
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
QA re-smoke after #718 (fixup 2/3): the canonical report case — garbage (
фывапролд 999,ёъхзщшг, …) → ЕКБ city-centroid → identicalmedium/ median 6 912 813 / n=35 — was still not downgraded, though region/other-city coarse cases now work.Root cause
The QA explanation text "…из ближайшего окружения (≤500 м)" is the Tier C signature. When a coarse geocode lands on the dense ЕКБ centroid,
_fetch_anchor_compsTier C (micro-radius ≤500 m) collects ≥5 comps →anchor_tier="C". The #693 gate guard wasanchor_tier is None, so Tier C blocked the downgrade. The two digit-free garbage strings prove_geocode_is_coarsealready returnedTruefor the centroid — they were blocked solely by the anchor guard, not by the text heuristic.Tier C is not "same building" (#691) — it's random flats within 500 m of a meaningless centroid, i.e. exactly the false confidence this issue targets. Only Tier A (real comps of the house) deserves protection.
Fix
anchor_tier is None→anchor_tier != "A": protect only Tier A; coarse-geo + Tier C now downgrades tolow+ «оценка ориентировочная».logger.infoofgeo.full_address / confidence / lat,lon / provider / anchor_tierat the gate (QA explicitly requested this for prod).No false-downgrades: a precise address + Tier C →
_geocode_is_coarse=False→ not downgraded (new test asserts this).Test plan
pytest tests/test_same_building_anchor.py→ 50 passed (+2: coarse+Tier C → low+flag; precise+Tier C → not downgraded).test_estimate_coarse_geo_with_anchor_no_dadata_not_downgradedgreen).ruff check+ruff-formatclean.Post-merge QA (use
user1,pilottestquota exhausted): re-runфывапролд 999/йцукенгшщ 777/ёъхзщшг/плорпарп ыватим→ expectconfidence="low"+ flag. The new prod log line will also surfacegeo.full_addressfor the centroid if any case still slips (hypothesis: Yandex snapping garbage to a numbered building).Refs #693
✅ APPROVE — guard loosening
anchor_tier is None→!= "A"is correct and safe.Key verification (the over-reach concern):
_fetch_anchor_compsonly ever returnstier ∈ {"A", "C", None}. Tier B is never assigned — explicitly skipped (estimator.py:1035, "Tier B «тот же ЖК» — skip: complex_id/cian_zhk_url ненадёжны"). So!= "A"resolves to exactly{None, "C"}in practice. No phantom Tier B gets downgraded; Tier A (#691 same-building) stays protected.(None)._geocode_is_coarse=False→ neither block fires (covered by newtest_estimate_precise_geo_tier_c_not_downgraded).logger = logging.getLogger(__name__)at line 69;geoguaranteed non-None at gate (early_empty_estimatereturn);geo.lat/lonnon-optionalfloat→%.5fsafe; all logged fields exist.dadata_coarse/geo_coarse), reused in bothifs — no re-call, log block is side-effect-free, no double-emit of user-facing text.Minor (non-blocking, not queued): the diagnostic
logger.infofires even when Tier A suppresses the downgrade, logginganchor_tier=Awithout an explicitaction=skippedmarker — could enrich later, but the tier is already in the line. Merging.