gendesign/tradein-mvp/backend/app
lekss361 dd774032d8 fix(tradein-estimator): extend cohort filter to Tier S + Tier H, fix late_soviet overlap
PR #519 added cohort hard-filter but only to Tier W's inline SQL. Tier S
(address ILIKE) and Tier H (year ±15) share _COMMON_WHERE which was not
extended — for target_year=1978 (brezhnev), Tier H allowed year_built ∈
[1963, 1993] and a 1965 khrushchev or 1992 late_soviet match could win
before cohort filter ever evaluated.

Fixes (reviewer feedback on PR #519, item #1):
* Append cohort clause to _COMMON_WHERE so Tier S and Tier H inherit it.
* Add cohort_year_min/max binds to base_params (auto-propagates to both).
* Tier W's inline copy stays — not converted to _COMMON_WHERE (relevance_score
  CASE expressions require inline form). Comment near _COMMON_WHERE documents
  the dual code path requirement.

Also (reviewer item #5):
* Fix late_soviet range 1985-1999 → 1990-1999. Previous overlap with brezhnev
  1970-1989 + first-match semantics made late_soviet effectively cover only
  1990-1999 anyway — rename clarifies actual coverage.

Add parametrized pytest test_target_cohort_range covering None, out-of-range,
boundary cases, and the audit's target (1978 → brezhnev).
2026-05-24 16:09:28 +03:00
..
api fix(tradein-photos): sanitize uploaded images via Pillow re-encode (#511) 2026-05-24 11:32:04 +00:00
core feat(tradein): postgres_fdw live read of gendesign.cad_buildings (replaces snapshot) (#493) 2026-05-24 08:57:30 +00:00
schemas feat(tradein): in-app scheduler — UI-managed schedule (replaces SSH crontab) (#482) 2026-05-23 14:54:25 +00:00
services fix(tradein-estimator): extend cohort filter to Tier S + Tier H, fix late_soviet overlap 2026-05-24 16:09:28 +03:00
tasks fix(tradein): geocode backfill + remove Avito exclusion from estimator (#490) 2026-05-23 20:03:48 +00: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): postgres_fdw live read of gendesign.cad_buildings (replaces snapshot) (#493) 2026-05-24 08:57:30 +00:00