gendesign/tradein-mvp/backend/app
lekss361 4a2a804296 fix(tradein-estimator): restore CAST in IS NOT NULL predicates (revert audit #9)
PR #509 removed CAST(:target_year AS integer) and CAST(:target_house_type AS text)
from the IS NOT NULL predicates in _fetch_analogs, citing audit finding #9 (perf).
This broke production: psycopg3 prepared statement could not determine $4 type
when target_house_type=None, raising AmbiguousParameter at plan time. The CAST
in the THEN branch is not enough — PG planner needs the type to evaluate
IS NOT NULL itself.

The inline comment at lines 814-816 explicitly documented this requirement;
PR #509 misread the audit finding. Per-row CAST cost on ≤300 rows is negligible
vs production breakage. Restoring CAST forms; THEN-branch CASTs untouched
(they were never removed).

Verified prod stack trace 2026-05-24 ~12:25 (target_year=1978, target_house_type=None).
2026-05-24 15:28:36 +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): restore CAST in IS NOT NULL predicates (revert audit #9) 2026-05-24 15:28:36 +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