fix(tradein): harden same-building anchor address normalizer for prod formats (#677) #679
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#679
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "fix/tradein-anchor-address-match"
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?
Fixes the same-building anchor (#677) missing real comps on prod — the live golden KPI was 67% vs 95% offline-sim because _normalize_building_key was too brittle on production address formats.
Rewrites _normalize_building_key to be format-invariant: strips city / р-н / мкр / ·-tail, drops street-type words from either side (Олимпийская наб. <-> набережная Олимпийская), tolerant house parse (',', 'д.', '/N', 'кN', glued corpus letter), ё->е + street alias (Ткачёва->Ткачей) on the full multi-word street core. Tier A SQL unchanged (brittleness was 100% in the normalizer).
Validated against the live tradein DB — comps matched before->after: Ткачёва 13 0->27, Б.Ельцина 6 (Iset) 0->44, Олимпийская наб 13 0->5, Сакко 99 ->4, Февральской 21 ->3. Over-match guarded: 13 != 130/131, 99 != 100, corpus letter 16а != 16.
ruff clean; 30 anchor tests pass (12 new: format variants, over-match, numeric-street prefix 8 Марта/1905, corpus, alias, ё->е). No change to #677 weighting/guardrail/FSD; fully behind estimate_same_building_anchor_enabled.
After merge+deploy I will re-run the 53-case live golden E2E; expect premium/business coverage to jump (those buildings now match). Geocode lat/lon=None on prod is separate/out-of-scope (SB tier is address-based).
Refs #651 #652 #677
Hardens _normalize_building_key for prod EKB address formats (#677 follow-up). Core fix correct: house number = LAST digit-token (not first), so numeric street prefixes (8 ????? 204?) parse as street=8 ????? / house=204 / letter=? instead of house=8. Robust handling: admin-marker+value drop (?-?/???/?), city tokens, ?-tail (Avito district), ?./???, type-word either side (???.???????????), /N + ?N corpus collapse, corpus-letter-distinct (16??16), alias after ???. 11 new tests cover all variants comprehensively. Pure string logic ? no pricing math/DB mutation, does not touch #674 expected_sold path; only improves anchor comp recall. 0 conflicts. NOTE (non-blocking): ???????/????? as standalone city tokens could over-strip a street literally so named ? corner case, graceful fallback. APPROVE.