mirror of
https://github.com/bitbaum/evig.git
synced 2026-12-04 14:57:58 +01:00
- make AI runtime config deterministic from DB (dedupe-safe ordering)\n- respect provider enabled flags in fallback runtime\n- improve protocol NO_PROVIDER UX copy with clear admin hint\n- extend admin hirn providers PATCH for apiKey persistence + enable toggle + guarded default switch\n- add DB migration 036 to dedupe/uniqueness-hardening for system providers\n- update hirn init insert conflict handling
6.7 KiB
6.7 KiB
Betrieb Hardening Checklist (Tasks / Protokolle / Entscheidungen)
Last updated: 2026-02-17
Objective
Bring /admin/tasks, /admin/protocols, /admin/decisions to production-grade quality with measurable gates aligned to CLAUDE.md.
Quality Gates
1) Core Functionality
- Tasks: create/list/edit/request/attention/complete end-to-end
- Protocols: create/list/detail/process/finalize end-to-end
- Decisions: create/list/detail/discussion/voting/transition end-to-end
- Admin route protection verified (
/admin/*redirects to login when unauthenticated)
2) Resilience & UX
- No infinite loading state on decisions list API failure
- Decisions list shows actionable error state with retry
- Unified loading/empty/error/success patterns across all 3 areas
3) Notifications
- Task request creates in-app notifications
- Task attention flag creates in-app notifications
- Verify notifications surface correctly in UI (read/unread lifecycle)
4) CLAUDE.md Engineering Compliance
- No
console.login Betrieb API/UI paths - Uses
loggerin touched API routes - Uses
TABLE_NAMESin touched API routes - Uses parameterized SQL in touched API routes
- Full-project typecheck pass (pending long-run command completion)
5) Automated Validation
- Targeted ESLint pass on changed files
- Added regression tests for critical fixes (decisions error/retry + task notification helper)
- Expand automated tests to full tasks/protocols/decisions end-to-end critical paths
- Run E2E smoke (admin login + 3 Betrieb paths)
Implemented in this hardening pass
-
Decisions list hardening (
src/app/admin/decisions/DecisionListClient.tsx)- Added robust async loading flow (
try/catch/finally) - Added explicit error state + retry button
- Prevents stuck loading spinner on API/network failures
- Added robust async loading flow (
-
Task notifications implemented
- Added shared helper:
createInAppNotifications()insrc/lib/api/task-helpers.ts - Wired into:
src/app/api/tasks/[id]/request/route.tssrc/app/api/tasks/[id]/attention/route.ts
- Notifications created in
notificationstable with type=system, related totask
- Added shared helper:
-
Static quality checks
- Targeted ESLint pass completed on changed files.
-
Regression tests added
src/app/admin/decisions/__tests__/DecisionListClient.test.tsx- verifies error state and retry recovery path
src/lib/api/__tests__/task-helpers.test.ts- verifies notification insert call + recipient deduplication
Remaining work to call this “perfect”
- Run full typecheck to completion in CI-capable environment.
- Execute full manual/E2E verification of the three Betrieb workflows.
- Add regression tests for:
- decision list error/retry behavior
- task request + attention notification creation
- Validate notification UX visibility and interaction in admin/client surfaces.
Overnight Update – 2026-02-17 (George)
Umgesetzt heute Nacht
-
Root-Cause Fix für „Kein KI-Provider erreichbar“ (end-to-end, Protokoll-Pfad)
src/lib/ai/providers.ts- Lädt System-Provider jetzt deterministisch via
DISTINCT ON (provider) ... ORDER BY is_default DESC, updated_at DESC. - Respektiert
is_enabledstrikt (deaktivierte Provider werden nicht mehr still via.envreaktiviert). - Sauberes Verhalten bei deaktiviertem Ollama/Groq/OpenRouter (frühe, klare Fehlgründe statt zufälliger Netzwerk-Fallbacks).
- Lädt System-Provider jetzt deterministisch via
src/lib/ai/protocol-processing.ts- Benutzerfehlertext verbessert: klarer Hinweis auf Admin > Hirn und API-Schlüssel-Prüfung.
-
Admin Provider Settings/API-Key Persistence repariert
src/app/api/admin/hirn/providers/route.ts- PATCH unterstützt jetzt robust:
apiKeyspeichern ohne sofortigen Default-WechselisEnabledtoggelnisDefaultnur wenn Provider aktiviert + erreichbar
- Damit ist der Deadlock weg, wo ungültige/veraltete Keys nicht sauber gespeichert/korrigiert werden konnten.
- PATCH unterstützt jetzt robust:
src/lib/hirn/providers/index.ts- Neue Funktion
setProviderEnabled(...)ergänzt.
- Neue Funktion
src/components/admin/HirnProviderSelector.tsx- UI ergänzt: „Key speichern“ direkt pro Cloud-Provider.
- API-Key kann jetzt in der Admin-UI persistent gesetzt werden (nicht nur externen Link öffnen).
-
DB-Härtung gegen doppelte System-Provider (wahrscheinlicher Prod-Blocker)
- Neue Migration:
scripts/db/migrations/036_hirn_provider_settings_uniqueness.sql- Bereinigt doppelte
scope='system'Provider-Zeilen (neueste gewinnt) - Erzwingt Eindeutigkeit via partiellen Unique Indexes
- Bereinigt doppelte
src/app/api/admin/hirn/init/route.ts- Auf
ON CONFLICT DO NOTHINGumgestellt, kompatibel mit partiellen Unique Indexes.
- Auf
- Neue Migration:
-
Guided Step UX list/detail konsistent gemacht
src/lib/protocols/workflow.tsgetProtocolWorkflowStep(...)akzeptiert jetzt Kontext (Status + unlinked tasks)- Review-Protokolle mit offenen Action Items mappen auf Schritt „Aufgaben erstellen“
src/lib/services/protocols.ts- List-Query erweitert um:
unlinked_action_item_counthas_structured_notes
- List-Query erweitert um:
src/lib/schemas/protocols.tsProtocolListItemum neue Felder erweitert
src/app/admin/protocols/page.tsx- Step-Filter + Workflow-Badge nutzen jetzt den echten Workflow-Kontext statt nur Status
src/lib/protocols/__tests__/workflow.test.ts- Regression-Test für Mapping auf
tasksergänzt
- Regression-Test für Mapping auf
Verifikation (Tests/Lint)
- ✅
npx eslintauf allen angepassten Dateien: pass - ✅
npm test -- src/lib/protocols/__tests__/workflow.test.ts src/lib/ai/__tests__/protocol-processing.test.ts: pass - ✅
npm test -- src/app/admin/protocols/\[id\]/__tests__/ProtocolDetailClient.test.tsx --passWithNoTests: pass - ⚠️
npm run typecheck: gestartet, aber im verfügbaren Zeitfenster nicht abgeschlossen (langlaufend)
Browser Smoke
- ⚠️ Blockiert durch Infrastruktur:
http://localhost:3001/admin/protocolswar nicht erreichbar (ERR_CONNECTION_REFUSED) - Mitigation: Für nächste Runde zuerst App-Stack hochfahren (
npm run doder definierter CI Preview URL), dann Smoke auf:- Admin Login
/admin/protocolsList + Schritt-Filter/admin/protocols/[id]Stepper/Guidance- Protokoll-Verarbeitung inkl. Provider-Fehlerfall
Noch offen / verbleibende Prod-Risiken
- Migration 036 muss auf Prod ausgeführt werden, sonst können doppelte System-Provider weiterhin zu nicht-deterministischem Runtime-Verhalten führen.
- Typecheck voll durchlaufen lassen in stabiler CI/Build-Umgebung.
- Live-Smoke nach Deploy (inkl. echter API-Key Rotation in Admin > Hirn und anschliessende Protokoll-Verarbeitung).