fix(cadastre): cad_parcels.geom Polygon → MultiPolygon (migration 93) #185
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#185
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "fix/cadastre-parcels-geom-multipolygon"
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?
Summary
Pilot v10 hung again on parcel `66:41:0105017:4` (Многоконтурный участок) — `Geometry type (MultiPolygon) does not match column type (Polygon)`. cad_parcels.geom was strict POLYGON, but NSPD returns MultiPolygon for legit multi-contour parcels.
Changes
Test plan
Review
CI зелёный (backend 1m2s + frontend 1m35s) + cross-check (agent):
✅ Migration 93 — корректна
geometry_columns.type— правильный PostGIS metadata view. Возвращает 'POLYGON' (uppercase) — матчит DO block check. На re-run ALTER skipped → RAISE NOTICE.(cad_num, geom, raw_props, fetched_at)идентичен mig92:672-679.cad_parcels_geom_gist, mig93 DROP+CREATE использует то же имя — нет orphaned index.data/sql/*.sql | sortalphabetical → 93 после 92, tracking через_schema_migrations(PR #151).✅ Other consumers safe
cad_buildings/constructions/oncs/enk—GEOMETRY(Geometry, 4326)generic, ST_Multi не нужен (writers unchanged).cad_zouit.geom—GEOMETRY(MultiPolygon, 4326),upsert_zouit:937уже использует ST_Multi.upsert_quarter_geom_from_feature:1028уже использует ST_Multi (PR #181).parcels.py:518-523_polygon_suitabilityexplicitly принимает оба Polygon/MultiPolygon, picks largest part.cadastre_fetch.pyиспользуетcad_parcels_geomVIEW для existence checks (type-agnostic).ST_Intersects/ST_DWithin/ST_Distance— type-agnostic.✅ ST_Multi wrap корректен
ST_Multi на already-MultiPolygon = no-op (returns same). На Polygon coerce'ит в MultiPolygon. NULL проваливается через CASE WHEN — никогда не доходит до ST_Multi.
✅ Test coverage
test_upsert_parcel_sql_uses_st_multi_for_multipolygon_schema— substring assert"ST_Multi(" in sql. SQL template single-statement, ST_Multi appears once → acceptable safety net.✅ Rollback path documented
DROP VIEW; ALTER COLUMN TYPE Polygon USING ST_GeometryN(geom,1); recreate view/index. 1199 multi-contour rows потеряли бы parts при rollback, но текущих violations Polygon нет.Минор (не блокер)
current_type IS NULLчерез ELSE branch → safe falls through.approve merge