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). |
||
|---|---|---|
| .. | ||
| app | ||
| data/sql | ||
| tests | ||
| .dockerignore | ||
| Dockerfile | ||
| pyproject.toml | ||