docs + fix: eTerra health check keywords from real maintenance page
- Added real eTerra maintenance keywords observed 2026-03-08: 'serviciu indisponibil', 'activități de mentenanță sunt în desfășurare' - Extract actual maintenance message from HTML response for UI display - Updated CLAUDE.md: ParcelSync module #15, Visual Copilot #16, eTerra/PostGIS integrations, TS strict gotchas, eTerra API rules - Updated ROADMAP.md: Phase 7B (ParcelSync) with 5 completed tasks - Updated SESSION-LOG.md: full session entry with bugs/learnings
This commit is contained in:
@@ -4,6 +4,87 @@
|
||||
|
||||
---
|
||||
|
||||
## Session — 2026-03-08 (GitHub Copilot - Claude Opus 4.6)
|
||||
|
||||
### Context
|
||||
|
||||
ParcelSync module development continuation — owner search, UAT dashboard, eTerra health check/maintenance detection. Documentation update.
|
||||
|
||||
### Completed
|
||||
|
||||
- **ParcelSync — Owner Name Search:**
|
||||
- New `searchImmovableByOwnerName()` method in `eterra-client.ts` — tries personName/titularName/ownerName filter keys
|
||||
- New `/api/eterra/search-owner` API route — DB search first (enrichment ILIKE with `unaccent()`), eTerra API fallback
|
||||
- UI: mode toggle (Nr. Cadastral / Proprietar) in Search tab, owner results with source badges (BD/eTerra)
|
||||
- Relaxed search tab guard: only requires UAT selection (not eTerra connection)
|
||||
- Commit: `6558c69`
|
||||
|
||||
- **ParcelSync — Per-UAT Analytics Dashboard:**
|
||||
- New `/api/eterra/uat-dashboard` API route with SQL aggregates (area stats, intravilan/extravilan, land use, top owners, fun facts, median area via PERCENTILE_CONT)
|
||||
- New `uat-dashboard.tsx` component — CSS-only visualizations: 6 KPI cards, donut ring (conic-gradient), horizontal bar charts (width-based), top 10 owners list, fun facts
|
||||
- Dashboard button (BarChart3 icon) on each UAT card in DB tab, expands panel below
|
||||
- Zero chart library dependencies
|
||||
- Commit: `6557cd5`
|
||||
|
||||
- **ParcelSync — eTerra Health Check + Maintenance Detection:**
|
||||
- New `eterra-health.ts` service: pings eTerra every 3min, 10s timeout, detects maintenance by keywords in HTML response (includes real keywords from 2026-03-08 outage: "serviciu indisponibil", "activități de mentenanță sunt în desfășurare")
|
||||
- Extracts actual maintenance message from page for display in UI
|
||||
- New `/api/eterra/health` endpoint (GET cached, POST force-check)
|
||||
- Session route blocks login when eTerra is in maintenance (returns 503 + `{maintenance: true}`)
|
||||
- `GET /api/eterra/session` enriched with `eterraAvailable`, `eterraMaintenance`, `eterraHealthMessage`
|
||||
- ConnectionPill shows amber "Mentenanță" state with AlertTriangle icon instead of red "Eroare"
|
||||
- Auto-connect skips during maintenance, retries when back online (30s poll detects recovery)
|
||||
- Commit: `b7a236c`
|
||||
|
||||
- **eTerra Timeout Fix:**
|
||||
- `DEFAULT_TIMEOUT_MS` 40000→120000 (eTerra 1000-feature geometry pages need 60-90s)
|
||||
- Added `timeoutMs` option to `syncLayer()`, passed through to `EterraClient.create()`
|
||||
- Commit: `8bb4a47`
|
||||
|
||||
- **Documentation Update:**
|
||||
- CLAUDE.md: Added ParcelSync module (#15) + Visual Copilot (#16), eTerra integration, PostGIS, new TS strict mode gotchas, eTerra/external API rules
|
||||
- ROADMAP.md: Added Phase 7B with 5 completed tasks, updated module status table
|
||||
- SESSION-LOG.md: This session entry
|
||||
|
||||
### Bugs Found & Fixed
|
||||
|
||||
| Bug | Root Cause | Fix |
|
||||
|-----|-----------|-----|
|
||||
| `timeout of 40000ms exceeded` on TERENURI_ACTIVE | Default 40s too short for 1000-feature geometry pages | Increased to 120s |
|
||||
| `suprafata` type `{}` not assignable to `string\|number` | `?? ""` on enrichment field typed `{}` produces `{}` | `typeof x === 'number'` explicit check |
|
||||
| `Object is possibly 'undefined'` on `topOwners[0]` | TS strict: `arr[0]` is `T\|undefined` even after `length > 0` | Assign to const, `if (const)` guard |
|
||||
| eTerra maintenance shows as "Eroare conectare" | No health check, login attempt fails with generic error | Health check + maintenance detection + amber UI state |
|
||||
|
||||
### Learnings
|
||||
|
||||
- **eTerra goes down for maintenance regularly** — need pre-check before any login attempt
|
||||
- **eTerra login page shows**: "Serviciu indisponibil" + "activități de mentenanță sunt în desfășurare" during outages
|
||||
- **CSS-only charts work great**: conic-gradient donut rings, width-based horizontal bars — zero library overhead
|
||||
- **TS strict `arr[0]`**: ALWAYS assign to const even after length check — the TS compiler doesn't narrow
|
||||
- **Prisma `$queryRaw`**: always cast explicitly and guard access — it returns `unknown[]`
|
||||
|
||||
### Files Changed
|
||||
|
||||
- **New:** `src/modules/parcel-sync/services/eterra-health.ts`
|
||||
- **New:** `src/modules/parcel-sync/components/uat-dashboard.tsx`
|
||||
- **New:** `src/app/api/eterra/health/route.ts`
|
||||
- **New:** `src/app/api/eterra/uat-dashboard/route.ts`
|
||||
- **New:** `src/app/api/eterra/search-owner/route.ts`
|
||||
- **Modified:** `src/modules/parcel-sync/services/eterra-client.ts` (timeout 120s, `searchImmovableByOwnerName()`)
|
||||
- **Modified:** `src/modules/parcel-sync/services/sync-service.ts` (timeoutMs option)
|
||||
- **Modified:** `src/modules/parcel-sync/services/session-store.ts` (health fields in SessionStatus)
|
||||
- **Modified:** `src/modules/parcel-sync/components/parcel-sync-module.tsx` (owner search, dashboard, maintenance UI)
|
||||
- **Modified:** `src/app/api/eterra/session/route.ts` (health check integration, login blocking)
|
||||
- **Modified:** `CLAUDE.md`, `ROADMAP.md`, `SESSION-LOG.md`
|
||||
|
||||
### Build
|
||||
|
||||
- `npx next build` — zero errors
|
||||
- Commits: `8bb4a47` → `6558c69` → `6557cd5` → `b7a236c`
|
||||
- Pushed to main → Portainer auto-deploy
|
||||
|
||||
---
|
||||
|
||||
## Session — 2026-02-28c (GitHub Copilot - Claude Opus 4.6)
|
||||
|
||||
### Context
|
||||
|
||||
Reference in New Issue
Block a user