From 49dcdadc444461964f6a6055d6b27a1eb9add82a Mon Sep 17 00:00:00 2001 From: Claude VM Date: Wed, 20 May 2026 19:18:08 +0300 Subject: [PATCH] fix(geoportal-v2): cladiri-aware deep-enrich button + clearer error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Marius hit "Parcela nu există în baza centrală gis_core." on building 304629-C3 (siruta=54975) — feature exists in gis_core (verified, id 70fd7485-fa39-4c38-9074-cfad154ed288) but orchestrator's parcel-deep-enrich hardcodes layerId='TERENURI_ACTIVE' in its pre-flight lookup: // gis-sync-orchestrator src/lib/parcel-deep-enrich/fetch.ts L232–240 SELECT id, attributes, enrichment, "enrichedAt" FROM gis_core."GisFeature" WHERE "layerId" = 'TERENURI_ACTIVE' AND siruta = $1 AND "cadastralRef" = $2 LIMIT 1 → throws ParcelNotFoundError for any CLADIRI cadref. Architots mapped that to a misleading "doesn't exist" message even though by-ref correctly retrieved the building row up-front. Architots-side fix (the proper fix is on orchestrator): 1. Error message for `parcel_not_found` now branches on feature.layerId. For CLADIRI_ACTIVE the user sees: "Deep-enrich nu suportă încă construcțiile — datele clădirii vin via parcela părinte (gis-api orchestrator side)." No more "parcela nu există" confusion when the parcel obviously does. 2. "Actualizează" / "Încarcă din ANCPI" button in the Date eTerra header is now disabled when isCladiri. Tooltip explains why. The button is the one that triggers refreshFromAncpi → /parcel/enrich → the very orchestrator path that doesn't handle buildings. Result: building panels show whatever's in gis_core (CLADIRE_TYPE, CLADIRE_DESTINATIE, etc. if previously enriched via eterra.live's own flow) and don't pretend they can be re-fetched. Next step (orchestrator session): teach loadFeature() to accept an optional layerId param OR auto-detect from cadref-suffix pattern (/-C\\d+$/) so /parcel/enrich works for both layers. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/modules/geoportal/v2/feature-info-panel.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/modules/geoportal/v2/feature-info-panel.tsx b/src/modules/geoportal/v2/feature-info-panel.tsx index fed69b9..75b68ab 100644 --- a/src/modules/geoportal/v2/feature-info-panel.tsx +++ b/src/modules/geoportal/v2/feature-info-panel.tsx @@ -873,11 +873,13 @@ export function FeatureInfoPanel({ feature, onClose, onSelectFeature, basic = fa : error === "no_immovable_match" ? "Parcela nu există în baza eTerra (cadref + SIRUTA nu se potrivesc)." : error === "parcel_not_found" - ? "Parcela nu există în baza centrală gis_core." + ? isCladiri + ? "Deep-enrich nu suportă încă construcțiile — datele clădirii vin via parcela părinte (gis-api orchestrator side)." + : "Parcela nu există în baza centrală gis_core." : error === "eterra_fetch_failed" ? "eTerra ANCPI nu răspunde momentan. Reîncearcă în 1-2 minute." : error === "search_limit_exceeded" - ? "Numărul cadastral e foarte comun (sute de parcele). gis-api are limit 50 la căutare — aceasta nu apare. Trebuie un endpoint /parcela/by-ref dedicat." + ? "Numărul cadastral e foarte comun (sute de parcele). gis-api are limit 50 la căutare — aceasta nu apare." : `Eroare: ${error}`} @@ -936,7 +938,8 @@ export function FeatureInfoPanel({ feature, onClose, onSelectFeature, basic = fa