# Handoff prompt — ArchiTools cutover, resume after 2026-05-19 session

## Where we left off

Faze A→F of plan 003 (`docs/plans/003-architools-cutover-execution-2026-05-17.md`) are committed and deployed. Pilot user `m.tarau@beletage.ro` is on the V2 / api.gis.ac path. Two outstanding bugs and the Faza G/H work remain. Full state in memory `[[architools-cutover-state-2026-05-19]]`. The Authentik token-endpoint root-cause is in memory `[[authentik-token-endpoint-shared]]`.

## Suggested prompt for the next session

```
Sesiune nouă în ~/Code/ArchiTools după un session lung pe 2026-05-19. Continuăm
cutover-ul ArchiTools → api.gis.ac (Plan 003).

Citește în ordine de prioritate:
1. docs/plans/prompt-handoff-2026-05-19.md (acest fișier)
2. ~/.claude/projects/-home-orchestrator-Code-ArchiTools/memory/MEMORY.md
3. docs/plans/audit-2026-05-19.md (audit complet după Faze A-E)
4. docs/plans/004-faza-h-runbook.md (Faza H runbook — NU executa, doar înțelege)
5. docs/plans/003-architools-cutover-execution-2026-05-17.md (planul original)

Confirmă că înțelegi state-ul curent + cele 2 bug-uri outstanding, apoi cere-mi
direcție. NU re-rula Faze A-F — sunt deployate. Pilot user m.tarau e activ pe V2.

Bug-uri prioritare de fixat:
- B1: /geoportal V2 panel nu randează enrichment-ul din DB după click parcelă.
  Datele EXISTĂ în gis_core.GisFeature.enrichment (verificat: parcela
  f9bf2ca4-d35c-4636-bd82-9caf09454166, 10 chei). api.gis.ac /parcela
  întoarce datele cu scope=full. Dar panel-ul arată "Apasă „Citește din
  ANCPI" pentru a încărca". Caut bug pe client între setDetail(data) și
  enrichmentEntries render. Începe cu logs `[gis-parcela]` (deja există)
  + DevTools Network response shape.
- B2: "Comandă CF" în V2 panel deschide /parcel-sync?tab=epay&cad=… dar
  pagina destinație nu citește query params. Sau wire-up parametrii în
  parcel-sync page, sau schimbă strategia de deep-link.

Apoi: Faza G (24h grace + monitor), Faza H prereqs (eterra.live cutover,
identify writer la GisFeature, schema drift CfExtract).
```

Adaugă tu la prompt orice ai vrea schimbat sau extins.

## Quick facts cheatsheet for the new session

- **Live commit**: check `/api/version` for `commitShort` — should be `162c8ed` or later
- **Pilot user**: `m.tarau@beletage.ro` (in Infisical `/architools` `GIS_AC_PILOT_USERS`)
- **Flag global**: `USE_GIS_AC=0` (only pilot list active)
- **Authentik token endpoint**: `https://auth.beletage.ro/application/o/token/` (shared, NOT per-provider)
- **ePay pool**: 2 accounts on `gis_meta.eterra_accounts`, 500/h quota each — needs manual reset when exhausted: `UPDATE gis_meta.eterra_accounts SET usage_current_hour = 0 WHERE status = 'active';`
- **Trigram index on `gis_core."GisFeature"."cadastralRef"`**: `gisfeature_cadref_trgm_idx` exists (built 2026-05-18, search latency 30s → 150ms)
- **Connection limit** on gis-api Prisma: 10 (after the trigram-index fix, lower causes pool timeouts)
- **Pilot decision on CF**: Marius wants per-user ePay session + credit visibility — V2 panel deep-links to legacy `/parcel-sync` instead of using `/api/cf/*`

## Files modified this session (for context only — DO NOT redo)

```
src/core/auth/auth-options.ts            — refresh flow + cooldown + token endpoint fix
src/core/feature-flags/use-gis-ac.ts     — flag helper
src/core/version/version-watcher.tsx     — toast component
src/lib/gis-api-client.ts                — thin client lib
src/app/api/version/route.ts             — version endpoint
src/app/api/gis/{search,parcela/[id],parcel/tech}/route.ts  — V2 proxy routes
src/app/api/cf/{order,orders,[id],[id]/pdf,catalog}/route.ts — Faza F routes (currently unused by V2 panel)
src/modules/geoportal/components/geoportal-module.tsx       — branch on session.useGisAc
src/modules/geoportal/v2/*                                  — V2 components
src/modules/parcel-sync/components/cf-api-base.ts           — UI helper
src/modules/parcel-sync/components/epay-{tab,order-button}.tsx — flag-branched
src/middleware.ts                        — /api/version exclusion
Dockerfile, docker-compose.yml, docker-entrypoint.sh — Infisical runtime + GIT_COMMIT/BUILD_TIME
```

## How to verify the next session is healthy

```bash
curl -s https://tools.beletage.ro/api/version | jq .
# expect commitShort = latest pushed commit
```

```bash
ssh satra "docker logs architools --tail 10 2>&1"
# expect: [infisical] fetched 39+ secrets, Next.js Ready in <500ms
```

```bash
# Pool state
ssh shop "docker exec postgres-gis psql -U gis_superuser -d gis -c \"SELECT username, usage_current_hour, quota_per_hour FROM gis_meta.eterra_accounts WHERE status='active';\""
```
