gendesign/tradein-mvp/backend/app
bot-backend deeff7ed1f fix(tradein/estimator): Tier S radius-fallback house-number boundary + distance_m
Audit finding 1 (medium): the Tier S same-building radius-fallback matched
`address ILIKE short_addr + '%'` with no boundary after the house number, so
"ул. Ленина, 5%" collided with "..., 50/51/500/5а" (a different building).
MAX_ANALOGS_PER_ADDRESS=5 + `len(tier_s) >= 3` meant one stray building could
poison the same-building median. Fix reuses the already-vetted anchor Tier A
machinery (_normalize_building_key + new shared _house_boundary_regex helper)
instead of a bare string prefix, and replaces the hardcoded `0.0 AS distance_m`
with a real ST_Distance so anomalously-far "same building" matches are visible
in the data.

_extract_short_addr is left in place (unused by _fetch_analogs now, own tests
still pass) with a note explaining the supersession, rather than deleted, to
keep this PR scoped to the boundary bug.

Audit finding 2 (low): conflict_resolution.py's resolve_house_field/
resolve_listing_field priority system is confirmed dead in the production
merge path (matching/houses.py + listings.py use a simpler COALESCE
newest-wins pattern instead) per vault Decision_774_Matching_Architecture
(2026-05-31, code-archaeology + live-DB verified). Documented this in the
module docstring instead of deleting — removal + its ~30 dedicated tests is
already scoped as an independent "Path 2 / Sub-3" cleanup in that decision,
kept separate from this unrelated Tier-S bugfix. Not wired into the price-calc
path per audit instructions.

Tests: new tests/test_estimator_tier_s_house_boundary.py (boundary regex +
SQL-rendering checks); test_same_building_match.py updated to assert the new
boundary-regex SQL shape instead of the old bare ILIKE. Full suite: 2632
passed, 8 skipped, 1 deselected (same deselect as ci-tradein.yml).
2026-07-26 23:42:36 +03:00
..
api feat(tradein/admin): audit + analytics read API over user_events (#2520) 2026-07-13 20:26:58 +00:00
core feat(tradein/tgbot): Telegram support-мост @MERAsupport_bot 2026-07-16 16:58:53 +03:00
observability feat(tradein/tgbot): Telegram support-мост @MERAsupport_bot 2026-07-16 16:58:53 +03:00
schemas feat(tradein/admin): audit + analytics read API over user_events (#2520) 2026-07-13 20:26:58 +00:00
services fix(tradein/estimator): Tier S radius-fallback house-number boundary + distance_m 2026-07-26 23:42:36 +03:00
tasks feat(tradein): монитор свежести СберИндекса (audit п.1) 2026-07-12 23:27:35 +03:00
__init__.py feat: add tradein-mvp subproject (Trade-In Estimator под /trade-in) 2026-05-21 00:25:39 +03:00
main.py feat(tradein/admin): audit + analytics read API over user_events (#2520) 2026-07-13 20:26:58 +00:00
scheduler_main.py refactor(tradein/scheduler): удалить legacy scheduler_loop + scraper-scheduling, kit единственный путь (#2397 Part C) 2026-07-04 13:00:30 +03:00
tgbot_main.py feat(tradein/tgbot): Telegram support-мост @MERAsupport_bot 2026-07-16 16:58:53 +03:00