fix(cadastre): CAST :geom AS text — psycopg ambig param (#168) #178
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
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lekss361/gendesign#178
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "fix/cadastre-geom-ambiguous-param"
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?
Pilot v4 (job 4) failed psycopg AmbiguousParameter on
$20(lineCASE WHEN :geom IS NOT NULL). PG can't infer type when bare param used only сIS NOT NULL(type-polymorphic). Fix: wrap inCAST(:geom AS text)per CLAUDE.md pattern (no:x::typetrap). 6 upsert helpers.Review
CI зелёный (backend 1m9s + frontend 1m41s) + cross-check (agent):
✅ Coverage полная
Все 6 upsert helpers обработаны, zero bare
:geomвbulk_harvest.py:upsert_parcel(L361,363)upsert_building(L474,476)upsert_construction(L596,597)upsert_onc(L692,693)upsert_enk(L753,754)upsert_zouit(L831,834)Wider grep по
backend/app/api/v1/*иbackend/app/services/*: другихST_GeomFromGeoJSONнет — все call sites покрыты.✅ Cast корректен + None handling intact
ST_GeomFromGeoJSONacceptstext→CAST(:geom AS text)правильно."geom": geom_jsonгдеgeom_json = json.dumps(feature.geometry) if feature.geometry else None— всегдаstr | None.CAST(NULL AS text) IS NOT NULL→ false → NULL branch →COALESCE(EXCLUDED.geom, target.geom)сохраняет prior geom. None handling работает.✅ Precedent
CLAUDE.md паттерн
CAST(:x AS type)уже использован в #152 (:weights::jsonb) и #160 (:window_interval::interval). Существующий тестtest_upsert_parcel_uses_cast_not_double_colon:268уже проверяет общий принцип (CAST(:raw_props AS jsonb)есть,::jsonb/::dateотсутствуют). Минор — стоило бы добавить one-linerassert "CAST(:geom AS text)" in sql, но не блокер: AmbiguousParameter — runtime PG error, юнит-тестом на mock'е не ловится; integration/live verification = pilot v5.✅ Drift отсутствует
Pure SQL string change. Param dict shape, return signatures, RETURNING clause — без изменений. Никаких TS/pydantic схем не трогаем.
approve merge