Commit Graph

126 Commits

Author SHA1 Message Date
Agent Zero 07d4587499 Plan anpassen: 4.5/4.6 entfernt, neue generelle 4.5 Modul-Konfiguration pro Workspace 2026-08-03 13:55:14 +02:00
Agent Zero 3eb11b1745 Phase 1: Migrationsaudit + Forward-Migrationen 0093-0096
Audit (docs/migration_history_audit.md):
- files.size_bytes: INTEGER (Alembic) vs BIGINT (Produktion/Plugin)
- GIN-Indizes: Fehlendes USING GIN in Alembic 0002
- guest_users: ix_guest_users_email_tenant fehlt UNIQUE in Alembic 0059
- plugins.name: Doppelter Unique-Index in Produktion

Forward-Migrationen:
- 0093: files.size_bytes INTEGER → BIGINT
- 0094: GIN-Indizes reparieren + plugins.name doppelten Index entfernen
- 0095: guest_users email+tenant_id UNIQUE INDEX (mit Dubletten-Check)
- 0096: Workspace tenant_integrity (tenant-bound FKs)

Tests: 41/41 bestanden (17 Workspace + 24 Command)
Alembic Head: 0096
2026-08-03 13:29:16 +02:00
Agent Zero a760a759eb Phase 0+3: Stand sichern, alte Doku einfrieren, doppelte Command-Struktur entfernen
Phase 0:
- Git Tag: pre-recovery-current (3cbf921)
- Branch: recovery/minimal-finish
- docs/RECOVERY_SCOPE.md als verbindliche Quelle
- Alte Dokumente als UEBERHOLT markiert

Phase 3:
- app/core/commands.py entfernt (ungenutzte Doppelstruktur)
- app/commands/create_contact.py entfernt (ungenutzte Doppelstruktur)
- 24/24 Command-Tests bestanden — produktive Commands unbeeinflusst
2026-08-03 13:25:48 +02:00
Agent Zero a7b3424eee docs: Vollständige Installationsanleitung (INSTALL.md)
- Komplette Schritt-für-Schritt-Installation von Grund auf
- Alle DB-Rollen und Bootstrap-Reihenfolge dokumentiert
- Alle ENV-Variablen für API, Worker, DB dokumentiert
- Vollständige docker-compose.yml Referenz
- Coolify-Setup-Anleitung
- prestart.sh Startup-Ablauf
- seed_admin.py Admin-Erstellung
- Verifikationsschritte (Health, Login, Alembic, RLS, DDL)
- SMTP-Konfiguration
- Backup und Restore mit Grant-Hinweis
- Häufige Probleme und Lösungen
- Architektur-Übersicht und Datei-Struktur
2026-08-01 20:37:53 +02:00
Agent Zero be20a8545e docs: Abschlussbericht Phase 0+1 und vollständiger Sanierungsplan
- Kompletter Statusbericht mit allen 5 Gates
- Datenbankrollen-Architektur dokumentiert
- RLS-Architektur dokumentiert
- Verifizierte Sicherheitsnachweise
- Durchgeführte Code-Änderungen und Migrationen
- Offene Risiken
- Vollständiger Sanierungsplan Phase 2-10
- Gesamtschätzung: 120-210h verbleibend
- Empfohlene Reihenfolge
2026-08-01 07:28:11 +02:00
Agent Zero 733fa1c807 docs: Gate 3 acceptance — restore test verified
Gate 3 (Restore-Test) bestanden:
- Backup aus Forgejo-Release heruntergeladen, MD5 verifiziert
- pg_restore in separate Test-DB (crm_restore_test)
- alembic upgrade head: 0086 → 0090
- Datenintegrität: 9 Contacts, 2 Tenants, 1 User, 479 Sessions
- RLS: 0 rows ohne Kontext, 8 rows Tenant B, 2 rows Tenant A
- Cross-Tenant INSERT blockiert, DDL blockiert
- 108 RLS-Tabellen, 112 Policies, 0 Legacy Policies
2026-08-01 00:27:12 +02:00
Agent Zero 9b4ee3b8ca docs: Gate 5 acceptance — worker event handlers verified
Gate 5 (Worker und Eventhandler) bestanden:
- Worker healthy, verarbeitet Outbox-Jobs und enqueued Jobs
- 18 Worker-Funktionen registriert
- Plugin-Eventhandler nur für aktive Plugins
- Per-Tenant Outbox-Processing mit RLS-Kontext
- Worker verwendet crm_worker (get_worker_session_factory)
- Keine Plugin-Router im Worker
2026-07-31 23:15:32 +02:00
Agent Zero 89fe7a4750 docs: Gate 2 acceptance — fresh DB install verified
Gate 2 (Neuinstallation auf leerer Datenbank) bestanden:
- Alembic-Head 0090, 124 Tabellen, 47 RLS-Tabellen
- 0 legacy app.tenant_id policies
- Alle 4 DB-Rollen korrekt (NOSUPERUSER, crm_migration BYPASSRLS)
- RLS fail-closed: 0 rows ohne Kontext
- Cross-Tenant INSERT blockiert
- crm_api DDL blockiert
- seed_admin.py funktioniert
- Login erfolgreich (200 OK)
- Keine manuellen Schemaänderungen
2026-07-31 22:33:07 +02:00
Agent Zero 3f3ef28264 gate: final acceptance report — Gate 1 + Gate 4 passed, Gate 2/3/5 open 2026-07-31 12:07:04 +02:00
Agent Zero 044336a56d gate: final acceptance report for Phase 0 + Phase 1 with all gate items 2026-07-31 09:45:45 +02:00
Agent Zero 94318aaa4d phase1: acceptance report for Phase 0 + Phase 1 2026-07-31 02:29:32 +02:00
Agent Zero cdbbc1b6f0 phase0: frozen error list with 21 findings (10 P0, 7 P1 open, 4 P1 fixed) 2026-07-31 01:58:43 +02:00
Agent Zero 7fbbe420bd fix: comprehensive system audit fixes (55+ issues)
Check Cross-Plugin Imports / check (push) Has been cancelled
CRITICAL:
- Fix SQL injection in prestart.sh (parameterized query)
- Fix secret key validation (always validate, not just production)
- Fix workspace model partial index bug (func.text -> text)
- Fix HealthResponse schema (add checks field)
- Fix Tenant import in permissions.py (NameError on every auth request)
- Fix README tech stack (React instead of Alpine.js)
- Delete broken test_cross_tenant_security_v2.py
- Add fail-closed RLS migration 0084 (48 tenant tables)

HIGH:
- Add GeneralRateLimitMiddleware for all API routes
- Add file type blocklist for DMS and attachment uploads
- Fix guest auth: Pydantic schema, tenant_slug required, CSRF bypass
- Fix CSRF bypass path matching (in -> endswith)
- Add worker healthcheck in docker-compose.yml
- Add ARQ max_tries=3 for job retries
- Fix 28 bare pass in mail services (-> logger.debug)
- Fix print() -> logger in main.py and ai_assistant
- Fix duplicate email handling (catch IntegrityError -> 409)
- Add session revocation (invalidate_all_user_sessions)
- Add resource limits to all containers
- Fix CORS default (localhost -> production domain)
- Fix SameSite=Lax -> Strict
- Fix Redis password visibility in healthcheck
- Fix npm vulnerabilities (19 -> 9)
- Fix Sidebar OOM (wildcard lucide import -> curated ICON_MAP)

MEDIUM:
- Localize ErrorBoundary to German
- Wire Mail.tsx save/delete filter to API
- Document system_notif plugin (no routes needed)
- Fix datetime.utcnow() -> datetime.now(UTC)
- Pin litellm version (>=1.0,<2.0)
- Move CSRF token from sessionStorage to in-memory
- Fix restore_backup error handling and transaction
- Fix Dms.tsx useEffect cleanup
- Add skip-to-content link for accessibility
- Add selectinload imports to 3 services
- Add .env.example missing variables
- Fix AppShell/TopBar/Sidebar test mocks

NEW TESTS:
- test_guest_auth.py (6 tests)
- test_user_service.py (8 tests)
- test_backup_service.py (5 tests)

NEW SCHEMAS:
- saved_filter, saved_view, user_preference, workspace, entity_policy

Tests: 22/22 PASSED
2026-07-31 00:58:05 +02:00
Agent Zero 3e9cfbef8a phase11: /health/live + /health/ready endpoints + monitoring docs + Prometheus metrics docs 2026-07-29 23:22:29 +02:00
Agent Zero 8da803156e phase1: RLS simplified to tenant isolation only + canAccess fallback removed + useUserPermissions hook + security kernel docs 2026-07-29 16:36:51 +02:00
Agent Zero 24690fb674 sprint20-23: tests + documentation + guest access + infrastructure + migrations 0059 2026-07-29 02:53:37 +02:00
Agent Zero 5378372aba security: remove hardcoded credentials from scripts and docs 2026-07-28 00:35:09 +02:00
Agent Zero 66b6c32ed8 Phase 5.14: API documentation - OpenAPI tags, response models, examples, docs 2026-07-23 22:44:54 +02:00
Agent Zero f137acb805 feat(5.1): add API audit document covering all 158 UI functions across 24 categories
- Create docs/api-audit.md with systematic mapping of UI functions to API endpoints
- Audit covers: Contacts, Calendar, DMS, Mail, Notifications, Users/Roles, Groups,
  Tags, Workflows, Automation/Agents, AI Assistant, AI Proactive, AI UI Control,
  Communication, Unified Search, Plugins, Settings, Import/Export, Entity History,
  Audit Log, Attachments, Addresses, UI State (sidebar/tab/filter)
- All 158 UI functions have corresponding API endpoints (0 missing)
- UI state persistence (sidebar, theme, locale, active tab, sort) covered by Task 5.2
- Frontend API module coverage table maps all 25 frontend modules to backend routes
- RBAC coverage documented for all endpoints
- Add 9 tests verifying audit document structure and endpoint reachability
2026-07-23 20:41:45 +02:00
Agent Zero fc96a2f86c Phase 3: Plugin-UI-System (WordPress-Style)
Backend:
- PluginManifest um 5 neue UI-Felder erweitert: menu_items, page_routes,
  detail_tabs, settings_pages, dashboard_widgets (FrontendMenuItem,
  FrontendPageRoute, FrontendDetailTab, FrontendSettingsPage,
  FrontendDashboardWidget)
- GET /api/v1/plugins/active-manifests Endpoint liefert UI-Manifeste
  aller aktiven Plugins
- Registry.get_active_manifests() + PluginService.get_active_manifests()
- 12 Built-in Plugins mit UI-Manifest-Daten gefuellt (menu_items,
  page_routes, detail_tabs, settings_pages)
- Plugin-Install-System: POST /upload (ZIP), POST /install-url (URL)
  mit Validierung (Manifest, dangerous imports, SQL migrations)

Frontend:
- pluginStore.ts (Zustand) mit PluginUiManifest Typen + Selektoren
- useActivePluginManifests() React Query Hook
- PluginRegistry.tsx — fetcht Manifeste beim App-Start
- PluginLoader.tsx — dynamisches React.lazy() mit ErrorBoundary
- PluginRouteRenderer.tsx — Catch-all fuer Plugin-Routes
- routes/index.tsx — Catch-all Routes fuer Plugin-Pages + Settings
- Sidebar.tsx — dynamische Plugin Menu-Items mit Grouping + Icons
- Settings.tsx — dynamische Plugin Settings-Pages
- ContactDetail.tsx — dynamische Plugin Detail-Tabs mit Permissions
- AppShell.tsx — PluginRegistry Provider eingebunden
- SettingsPlugins.tsx — Install-UI (ZIP Upload + URL Install)
- plugins.ts — useUploadPlugin() + useInstallPluginFromUrl() Hooks

Docs & Templates:
- docs/plugin-development-guide.md — komplette Entwickler-Doku
- templates/plugin-template/ — Boilerplate mit allen Manifest-Feldern

Tests:
- 34 Vitest-Tests (PluginRegistry, PluginLoader, PluginRouteRenderer,
  pluginStore) — alle bestanden
- TSC: keine neuen Errors (nur pre-existing Dms.tsx)
2026-07-23 19:01:18 +02:00
Agent Zero a8331fbc2b Phase 2: Code-Splitting + Virtual Scrolling (Tasks 2.1-2.7) 2026-07-23 12:00:34 +02:00
Agent Zero ec81940178 Phase 0 Complete: Tasks 0.7-0.20
- 0.7: UI-Design-Richtlinien (docs/ui-design-guidelines.md, 535 lines)
- 0.8: Theme-Customization Backend (4 theme fields, migration 0023)
- 0.9: Theme-Customization Frontend (SettingsTheme.tsx, themeStore.ts, live preview)
- 0.10: RBAC-Audit (4 plugins secured, 53 routes with require_permission)
- 0.11: LiteLLM-Cleanup (llm_client.py migrated from httpx to litellm)
- 0.12: KI-Agent-Framework docs (plugin-development-guide.md, agent_capabilities field)
- 0.13: Heartbeat configurable (ProactiveSettings, migration 0024, frontend UI)
- 0.14: Unified Search Field-Level RBAC (resolve_permissions + filter_fields_by_permission)
- 0.15: Undo/History-System (EntityHistory model, service, routes, migration 0025, HistoryViewer)
- 0.16: Storage Backend (LocalStorage + S3Storage, DMS/attachments/mail updated)
- 0.17: Import/Export unified Contact fields (firstname, surname, email_1, phone_1)
- 0.18: .gitignore & Config-Cleanup (webui→frontend, python-jose removed, .env untracked)
- 0.19: Mail-Salt Security-Fix (per-account random salt, migration 0026)
- 0.20: AGPL replaced (PyMuPDF→pypdf, OnlyOffice→Collabora, LICENSE + THIRD_PARTY_LICENSES.md)
2026-07-23 08:42:26 +02:00
Agent Zero cc3ac9a43d feat: Unified Messaging System — kommunikation plugin, AI/Proactive/System participants, MessageSidebar, Rich Content Renderer
Phase 1: Backend plugin kommunikation (13 files, 10 tables, REST API, WebSocket, RBAC, DMS Bridge, Participant Registry, Mini-App Registry, Search Provider)
Phase 2: AI plugins as participants (ai_assistant + ai_proactive dock as participants, heartbeat job)
Phase 3: system_notif plugin (system events → chat messages, pinned System room)
Phase 4: Frontend MessageSidebar (replaces AISidebar, same design, comm API client, WebSocket hook, commStore)
Phase 5: Rich Content Block Renderer (11 components: Markdown, HTML, Image, Audio, Video, File, ActionCard, ContactCard, MiniApp, BlockRenderer)
BasePlugin: added services property + _container in on_activate
2026-07-22 01:22:15 +02:00
leocrm-bot 1694b14c55 docs: Core Plugin & Dependency concept — is_core flag, topological sort, report_generator, ERP roadmap 2026-07-07 07:16:11 +02:00
leocrm-bot 69e91fd5d0 T10: Monitoring, Performance, Documentation & Environment Config — 38 tests, ruff clean, docs OK
- Extended health endpoint: DB+Redis+Storage+Worker checks with degraded status
- Prometheus metrics endpoint: admin-only, text/plain format
- Metrics: http_requests_total, db_pool_connections, arq_jobs_total
- Structured JSON logging (structlog): timestamp, level, method, path, status, duration_ms, tenant_id
- Performance: page_size max 100 enforced (422), streaming CSV export (StreamingResponse)
- Scripts: seed_perf_data.py, check_indexes.py
- Docs: admin-guide.md (Deploy, Backup, Restore, Env-Vars, Troubleshooting), api-overview.md
- README updated: prod setup, API section, env profiles, admin-guide link
- .env.example: added SECRET_KEY, STORAGE_PATH, SMTP_* vars
- 38 new tests, full regression 564/564 pass (0 failures)
- Ruff: all checks passed
2026-07-01 23:15:35 +02:00
leocrm-bot d8f46abe0b chore: clean main for new system architecture
- Old code archived on archive/legacy-v0 and feat/T1-auth
- Main contains only requirements and analysis docs
- UI Prototype: https://webspace.media-on.de/leocrm-prototype-x7k2p9/
- Ready for Phase 2: Architecture design
2026-06-29 08:02:14 +02:00