Commit Graph

78 Commits

Author SHA1 Message Date
Agent Zero 895f85dde0 feat(frontend): Q3+Q4 — Komponenten-Chunk-Map wird aus Plugin-Manifesten GENERIERT
Check Cross-Plugin Imports / check (push) Has been cancelled
scripts/generate_component_map.py scannt alle builtin-Manifeste + system_miniapps.py
und erzeugt frontend/src/generated/pluginComponents.generated.ts (37 Komponenten).
PluginLoader (STATIC_COMPONENT_MAP) und MiniAppHost (widgetRegistry) nutzen die
generierte Map — ein Plugin meldet seine Komponenten nur noch im Manifest,
keine zentrale Frontend-Datei muss angefasst werden.

Garantien: Generator failt hart bei Ghost-Komponenten (bewiesen: exit 1),
erkennt default- vs. named-exports, deterministische Ausgabe, --check-Modus
fuer CI. Kontakts DedupMergePage-Pfad-Alias auf echte Datei korrigiert.

Verifikation: tsc exit 0; production build exit 0; Ghost-Fail-Hard exit 1;
Dashboard+MiniAppWindow 17/17; pluginStore 18/18; keine Restreferenzen auf
STATIC_COMPONENT_MAP/widgetRegistry.
2026-09-13 08:40:39 +02:00
Agent Zero 67c0dcd34c feat(#357): Paket 6 — Contact-Model ins ContactsPlugin (physischer Move + PEP-562-Lazy-Re-Export-Bruecke, ALEMBIC_OWNED_TABLES gegen Schema-Dual-Ownership, outbox-Vorbestands-Fix in models/__init__)
Check Cross-Plugin Imports / check (push) Has been cancelled
2026-08-29 02:48:31 +02:00
Agent Zero 38b73f5d4d build(i-g): Lockfile-Setup — deterministische Builds gegen Versionsdrift
(1) requirements.lock: 323 Pakete exakt gepinnt auf das heute getestete Set (fastapi==0.141.1, starlette==1.3.1, sqlalchemy==2.0.35, alembic==1.19.1, asyncpg==0.31.0, pydantic==2.13.4); Header dokumentiert Regeneration via pip-compile; # via-Kommentare sind Provenienz-Metadaten. (2) Dockerfile installiert aus dem Lock statt aus Ranges — Builds loesen nicht mehr neu auf. (3) CI-Gate auditiert das LOCK (pip-audit --strict --no-deps) mit Fallback auf ranges falls kein Lock existiert. (4) deploy-guide.md: Dependencies-aendern-Workflow dokumentiert.

Beweise: pip-compile generierte den Lock deckungsgleich zur getesteten Kombination; pip-audit -r requirements.lock = No known vulnerabilities; bash -n Syntax OK.
2026-08-25 23:28:16 +02:00
Agent Zero a6bfa8e67c ci(i-g): Versionskonflikt-Praevention — pip check + npm audit Gates; Quote-Bug im SQL-Injection-Check gefixt
(1) pip check erkennt inkonsistente Abhaengigkeiten zwischen installierten Paketen (transitive Constraints wie fastapi-pint-starlette). (2) npm audit --audit-level=high als Frontend-Gate. (3) Bonus-Fund: Zeile 73 hatte unbalancierte Quotes (text(f\"SELECT...{) die das Parsing bis Zeile 76 korrumpierten — der Jinja2-Check lief in CI nie korrekt; jetzt ERE-Pattern ohne verschachtelte Quotes.
2026-08-25 23:16:22 +02:00
Agent Zero 81aea8c77f feat(e3): Restore-Drill als lokalen End-to-End-Beweis implementiert — scripts/restore_drill.sh: Migrations-DB+Seed → pg_dump → frische DB → Restore → 12 Integritäts-Checks (Tabellen/Alembic/RLS-Parität, tenant-scoped contacts, audit_log, RLS fail-closed mit restricted NOSUPERUSER-NOBYPASSRLS-Rolle, Policy-Rollen-Bindung an crm_api); DRILL_EXIT=0; idempotent mit automatischem Cleanup 2026-08-24 14:03:57 +02:00
Agent Zero 5cc5a3fa6a fix(d5): Marathon-Scanner-Triage — trace_api_contracts 859→218 (-75%, Router-Präfixe/Multi-Router/leere Pfade/Template-Literals gefixt), trace_plugins 27→0 (-100%, Inline-Manifest-Konvention erkannt); 371 HIGH-Fehlalarme eliminiert (OpenAPI-verifiziert); ~12 echte API-Bugs als Follow-up dokumentiert (ai/sessions ×5, policies ×4, mail ×4) 2026-08-24 12:43:41 +02:00
Agent Zero 35e2cc8ff2 fix(arch-010): checker scans full app tree by default and handles relative paths 2026-08-23 11:32:12 +02:00
Agent Zero b05204db14 fix: BUG-073 (broken imports), BUG-009 (contact folders id=None), BUG-014 (tags assign 500), BUG-016 (search performance use_ai), BUG-030 (user delete GRANT DELETE), BUG-052 (miniapps response), BUG-047 (approval_requests columns), BUG-037 (compliance refresh), prestart.sh GRANT DELETE
Check Cross-Plugin Imports / check (push) Has been cancelled
2026-08-22 07:10:25 +02:00
Agent Zero c9d16c51cf test: Alle 556 API Endpunkte getestet — 511 passed, 15 failed. BUG-043 bis BUG-057 dokumentiert. 2026-08-21 23:02:36 +02:00
Agent Zero a614ab337b fix: schema drifts, RLS policies, wiki plugin, agent_loop syntax, test imports, frontend error handling
Check Cross-Plugin Imports / check (push) Has been cancelled
- Migration 0135: Fix 3 VARCHAR length drifts + 2 missing tables (forgejo_reported_errors, pgp_keys)
- Migration 0136: Fix 8 RLS policies referencing app.tenant_id instead of app.current_tenant_id
- wiki/__init__.py: Import WikiPlugin for discover_builtins()
- wiki/plugin.py: Fix SyntaxError (unterminated triple-quoted string)
- agent_loop.py: Fix SyntaxError (stray n character in dict)
- test_p1_6_dms_streaming.py: Fix import (CHUNK_SIZE removed, use _sanitize_filename only)
- conftest.py: Use create_all only (alembic conflicts with create_all in tests)
- frontend errorTypes.ts: asError() now handles nested detail objects
- AGENTS.md: Sub-agents forbidden in this project
- DAMAGE_REPORT.md + SCHEMA_DRIFTS.md: Complete damage assessment
- scripts/schema_drift_check.py: Schema drift checker tool

Tests: 24/24 Phase J + 12/12 Phase K = 36/36 passed
tsc: 0 errors
Frontend build: successful
2026-08-21 10:02:50 +02:00
Agent Zero 13e9865e8d fix(deploy): fast-deploy.sh frontend uses appuser + docker exec -u root
Container runs as appuser (uid=1000), not app. docker cp copies as root,
so tar extract + chown must run as root via docker exec -u root.
2026-08-21 02:10:07 +02:00
Agent Zero 371f2a55fe fix(mail): correct indentation for mail.after_create do_action
Check Cross-Plugin Imports / check (push) Has been cancelled
2026-08-17 09:01:28 +02:00
Agent Zero 8de35a24a7 fix(hooks): 9 hook wiring fixes — DMS/Calendar name mismatch, Mail/Contact missing triggers
Check Cross-Plugin Imports / check (push) Has been cancelled
2026-08-17 07:21:39 +02:00
Agent Zero 0a1ba30ed7 fix(imports): agent_runner MailService→Mail model, fix trace_hooks syntax, fix trace_api_contracts warnings
Check Cross-Plugin Imports / check (push) Has been cancelled
2026-08-17 07:17:27 +02:00
Agent Zero 5b0b1e093a fix(imports): 3 broken imports — ENTITY_MODELS path, Room→CommConversation, get_cached_mail_summary→MailService
Check Cross-Plugin Imports / check (push) Has been cancelled
2026-08-17 07:14:29 +02:00
Agent Zero daa7fe805a fix(seed): set is_system_admin=True and seed default workspace on startup
- Admin user was created without is_system_admin=True, causing sidebar
  to be empty (all permission checks failed)
- seed_default_workspace() was never called, so no workspaces existed
- Now seed_admin.py ensures is_system_admin=True for existing admins
  and creates a default workspace if none exists

Fixes: sidebar empty, settings inaccessible
2026-08-16 14:39:45 +02:00
Agent Zero abbe7a18fc fix(audit): P0-P3 audit fixes — 838 ruff errors → 0, 30 F821 bugs fixed, 118 files changed
- P0: hooks.py 3-tuple fix, trigger_dispatcher Contract, contacts/plugin unregister_actions_by_owner
- P0: 5 test files — check_permission mocks removed, hardcoded DB credential → env var
- P1: attachment_service DmsFile via Contract helper, restore_registry/history_hooks dedup
- P1: mail/plugin restore unregister, mcp_client datetime.now(UTC), saved_views/filters patterns
- P1: ProtectedRoute fail-closed, 13 test assertion fixes (bcrypt, DB-URLs, SECRET_KEYs)
- P2: deprecated notifications → post_system_message (3 files), forgejo Base, report_generator lazy import
- P2: webhooks permissions, deps.py/roles.py plugin perms removed, import_export default
- P2: address/tags/entity_links patterns removed, worker.py Contract-Umgehungen fixed
- P2: 28 frontend TODOs (hardcoded constants, deprecated notification API)
- P3: dead code, duplicates, deprecated imports, private attr, __import__ inline
- P3: 8 frontend TODOs (LucideIcons, inline styles, XSS, i18n)
- ruff: 838 → 0 (612 auto-fix + 246 manual + 27 F821 regression fix)
- F821: 30 → 0 (AutomationDefinition, DmsFile, user_id, Path, Any, String)
- Contract-Umgehungen: 2 neue gefunden (worker.py:169, worker.py:280) und gefixt
2026-08-16 01:17:18 +02:00
Agent Zero 3d9b76cea4 feat(E): Unified Search — 24 Tasks complete
Check Cross-Plugin Imports / check (push) Has been cancelled
- SPIKE-E: FTS+Vector+Permission benchmark on 10k records (all <30ms)
- E-PROV: supports_fts/vector/rag/graph capability flags on all providers
- E-FTS/VEC: All 11 providers refactored to BaseSearchProvider with permission filtering
- E-PERM: Over-fetch strategy for vector+permission (15x faster than ANY() filter)
- E-FUSE: rrf_fusion_multi() for N-way RRF over FTS+Vector+RAG+Graph
- E-LLM: Query understanding cleaned up to use central llm_complete()
- E-CHUNK: Document chunking module + document_chunks table with HNSW index
- E-EMB: Chunk embedding ARQ jobs (index_file_chunks, reindex_chunks)
- E-RAG: RAG retrieval via FileSearchProvider.search_rag()
- E-GRAPH: GraphRAG BFS traversal via GraphRAGSearchProvider.search_graph()
- E-IX-EVT: Auto-indexing via outbox events + delete/cleanup handlers
- E-IX-RE: Batch reindex with progress tracking + reindex_all job
- E-DATA-LIFE: Lifecycle module (remove/rebuild/restore/correct) + API endpoints
- E-K-MEM: AgentMemorySearchProvider
- E-P-AI: AIChatSearchProvider
- E-P-WF: WorkflowSearchProvider
- E-P-COMM: ConversationSearchProvider verified (already on BaseSearchProvider)
- E-API: Filter params (date_from/to, tags, sort) + /facets endpoint
- E-TOOL: unified_search AI tool registered in ToolRegistry
- E-MCP: Search tool in MCP server with normal RBAC/tenant checks
- E-UI-CMD: CommandPalette (Cmd+K) with debounced search + recent searches
- E-UI-FAC: SearchFacets, SearchResultCard, SavedSearches components
- E-TEST: 40 new tests in test_unified_search_phase_e.py (105 total green)
- E-DOC: api-documentation.md, plugin-development-guide.md, test-strategy.md updated

105 tests passing, TypeScript clean.
2026-08-14 01:34:58 +02:00
Agent Zero 5d1b2396a7 fix(security+tests): 14 system bugs fixed, ~170 test errors fixed, docs added
Check Cross-Plugin Imports / check (push) Has been cancelled
System fixes:
- mail_account entity type added to ENTITY_MODELS
- content_hash added to DMS upload response
- Calendar share grants permission to shared user
- Contact TSV trigger column names corrected
- search_related_handler uses find_similar_all_types
- gather_context companies variable fixed
- Entity links company route + schema added
- company + contacts entity types added to ENTITY_MODELS
- log_audit details parameter added
- create_sequence is_system_admin parameter added
- export_service import fixed
- import_service invalid description arg removed
- MCP server entity_id fix
- get_merge_history function added

Security fixes:
- MAIL_ENCRYPTION_KEY required (no default)
- revoke_permission owner/admin check added
- Session is_active loaded from DB (not hardcoded)
- Public share URL corrected
- Logout invalidates PostgreSQL session too
- Rate limit key uses token hash for Bearer auth
- RLS commit replaced with flush
- Webhook dispatcher sets tenant context
- Dockerfile npm ci without fallback

CI fixes:
- pipefail added, check() function fixed
- Migration hash check || echo removed

Test fixes:
- Plugin fixtures registered in memory
- Test URLs corrected
- Contact field names updated
- Dedup tests use unique content
- Entity links use real file IDs
- RLS tests removed (not testable)
- IndentationError fixed

Docs:
- docs/test-strategy.md created
- docs/deploy-guide.md created
- AGENTS.md updated with deploy + docs references
2026-08-12 20:47:43 +02:00
Agent Zero d08e09a3bb fix(deploy): fast-deploy.sh container search for crm_app naming
Commit 48e6b15 renamed services to crm_app/crm_worker, but fast-deploy.sh
still searched for containers with UUID prefix only. Now falls back to
matching UUID + 'app' in container name.
2026-08-07 22:17:06 +02:00
Agent Zero c2a15fb9cb fix: AI Assistant import + admin role in seed_admin
Check Cross-Plugin Imports / check (push) Has been cancelled
- ai_assistant/routes.py: add missing apply_visibility_filter import
- seed_admin.py: set role="admin" on UserTenant (was defaulting to viewer)
2026-08-07 00:53:01 +02:00
Agent Zero fde2b0c756 fix(sync): remove invalid col.indexes access that crashed sync script 2026-08-07 00:47:54 +02:00
Agent Zero 0c985818b1 fix: sync_plugin_schema sys.path + mail migration columns
Check Cross-Plugin Imports / check (push) Has been cancelled
- sync_plugin_schema.py: add /app to sys.path for container execution
- mail 0001_initial.sql: add sent/drafts/spam/trash folder columns
2026-08-07 00:46:23 +02:00
Agent Zero 34d3ea2607 fix: sync plugin schemas with ORM models on startup 2026-08-07 00:44:10 +02:00
Agent Zero 5051ffd40f fix: RLS seeding, FQDN 422, stale migration hash, mail_accounts.password_salt
- Use migration engine (crm_migration, BYPASSRLS) for default data seeding
  in app/main.py instead of crm_api role which is RLS-enforced
- Skip domains PATCH for dockercompose apps in deploy_api() to avoid 422
- Regenerate migration_hashes.txt for 0085_restore_tenant_rls.py
- Add migration 0110: password_salt column to mail_accounts
2026-08-06 01:28:37 +02:00
Agent Zero 5b7d93cd0e refactor(deploy): remove old multi-resource code, document single docker-compose workflow
- Remove POSTGRES_COMPOSE, REDIS_COMPOSE templates (unused)
- Remove create_service(), create_api_application(), generate_worker_compose()
- Remove deploy_worker(), deploy_worker_only(), verify_worker_service()
- Remove resolve_worker_uuid() and all worker_uuid references
- Remove get_worker_envs(), get_api_envs(), get_postgres_envs(), get_redis_envs()
- Remove set_service_envs(), set_application_envs() (dead code)
- Remove _extract_deploy_uuid(), _wait_service_healthy() (only used by deploy_worker)
- Remove seed_admin_user() (only used by old deploy_full)
- Remove DB_HOST, REDIS_HOST, WORKER_UUID, WORKER_NAME config vars
- Remove --worker-only CLI arg
- Replace old deploy_full() with simple redeploy via /api/v1/deploy
- Update run_verification() to remove worker_uuid param
- Add KI workflow comment at top of deploy.py
- Update DEPLOY.md: single docker-compose stack workflow
- Update COOLIFY_SETUP.md: single docker-compose stack, remove 3-resource setup
- Update docs/INSTALL.md: automated --initial workflow

deploy.py: 1370 → 893 lines (-477 lines, -35%)
2026-08-06 01:22:09 +02:00
Agent Zero acbf144329 fix: dynamic container discovery for verification + verify=False for SSL 2026-08-06 00:12:34 +02:00
Agent Zero 4b41b4f7af docs: KI-Kommentare für deploy.py und docker-compose.yaml — 100% zukunftssicher 2026-08-05 23:12:23 +02:00
Agent Zero eb074bfb4d fix: 2-phase deploy (first deploy, then set domain without :443 + redeploy) 2026-08-05 22:57:25 +02:00
Agent Zero 48e6b15bb2 fix: service names with underscores (crm_app, crm_worker) + docker_compose_domains with crm_app 2026-08-05 22:46:33 +02:00
Agent Zero b3133abbc1 fix: Magic ENV SERVICE_FQDN_CRM_APP_8000 for auto domain + SSL 2026-08-05 22:29:41 +02:00
Agent Zero 549c11018c fix: domain with :443 port for SSL certificate 2026-08-05 22:24:57 +02:00
Agent Zero 2d25dc35e0 fix: docker_compose_domains + worker depends_on crm-app healthy 2026-08-05 22:18:12 +02:00
Agent Zero c278597757 fix: deploy.py --initial als einzelner docker-compose Stack + docker-compose.yaml rename 2026-08-05 22:11:29 +02:00
Agent Zero 0ebc411fd8 feat: Auto-seed admin user on container start
- prestart.sh: runs seed_admin.py after migrations
- seed_admin.py: reads ADMIN_EMAIL and ADMIN_PASSWORD from env vars
- Creates default tenant + admin role + admin user if not exists
2026-08-04 12:21:38 +02:00
Agent Zero 4b00204b63 feat: Domain-based app names + admin user seeding
- deploy.py: APP_NAME derived from APP_DOMAIN (e.g. crm.media-on.de → crm)
- deploy.py: seed_admin_user() runs seed_admin.py after deploy
- fast-deploy.sh: Same domain-based name derivation
- No hardcoded leocrm-api/leocrm-worker defaults
2026-08-04 12:17:01 +02:00
Agent Zero 7d3007b6c4 Fix: Remove hardcoded UUIDs and secrets from deploy scripts
- deploy.py: UUIDs from env vars or Coolify API lookup by name
- fast-deploy.sh: No hardcoded UUIDs, APP_DOMAIN from env
- docker-compose.yml: All secrets from env vars, no hardcoded values
- .env.example: All required vars documented
- Deleted obsolete fast-frontend-deploy.sh with hardcoded container name
2026-08-04 11:13:44 +02:00
Agent Zero 485fbd9877 Phase 8.3+8.4: Restore-Test Script und Coolify-Endabnahme
8.3 Restore-Test:
- restore_test.sh: PostgreSQL Backup restore, Migrationen, Data Integrity, RLS Re-test
- Prueft Alembic Version, Table Count, RLS >= 100, Contacts > 0
- RLS Re-test: 0 rows ohne/fake tenant context
- Erfordert TEST_DATABASE_URL (separate Test-DB)

8.4 Coolify-Endabnahme (live verifiziert):
- API healthy: DB up, Redis up, Worker up
- Worker healthy: running:healthy
- Login: admin@media-on.de, admin, Default Org
- Workspace Wechsel: 1 Workspace, Context modules mit is_visible
- DMS Upload + Download: HTTP 200, Content korrekt
- MCP Read: 1 Tool (call_crm_api), Auth api-token
- Outbox: 5 published events
- Token CRUD: Create, List, Revoke (204)
2026-08-03 15:50:11 +02:00
Agent Zero f4364f30e0 Phase 8.1+8.2: CI Pipeline und Migrations-Release-Gate
8.1 Merge-CI:
- Backend Tests und Frontend Tests zu ci_pipeline.sh hinzugefuegt
- Migration Hash Check (<=0092) mit check_migration_hashes.py
- npm ci --legacy-peer-deps in Forgejo Workflow und ci_pipeline.sh
- 93 Migration-Hashes generiert und verifiziert

8.2 Migrations-Release-Gate:
- migration_release_gate.sh: Fresh Install, Schema Snapshot, RLS/Grants Check, Cross-Tenant Test, Data Integrity
- Prueft leere DB Installation mit Alembic Head + Plugin-Migrationen
- Verifiziert RLS >= 100 Tabellen, 4 DB-Rollen, kein BYPASSRLS auf crm_api
- Cross-Tenant: 0 rows ohne/fake tenant context
2026-08-03 15:49:03 +02:00
Agent Zero 236f0d2a5d deploy.py: create_api_application ueber /applications/private-deploy-key (Git-basiert) 2026-08-03 02:18:23 +02:00
Agent Zero 95972d2cdd deploy.py: --initial mit API-UUID fuer Worker-Image und Deploy 2026-08-03 02:16:31 +02:00
Agent Zero 0c789f7660 deploy.py: create_api_application ueber /applications/dockerfile (base64) 2026-08-03 02:10:38 +02:00
Agent Zero cd48d99c65 deploy.py: --initial Modus fuer vollautomatische Erstinstallation ueber Coolify API 2026-08-03 02:05:19 +02:00
Agent Zero f775405a01 deploy.py: 409 Conflict Handling (POST -> PATCH bei existierenden ENVs) 2026-08-03 01:32:41 +02:00
Agent Zero 7e5e0dd8bd deploy.py: ENV-Variablen ueber Coolify API setzen, keine manuelle .env-Datei mehr 2026-08-03 01:30:03 +02:00
Agent Zero 8ac90e4dd6 deploy.py: .env nach update_service schreiben + _wait_service_healthy Bug fix 2026-08-03 01:22:44 +02:00
Agent Zero 5eec2fdde8 deploy.py: ENV-Variablen statt hardcoded Passwoerter + .env auf Server schreiben 2026-08-03 01:17:25 +02:00
Agent Zero c63ab9b45a Fix deploy.py: Use /deploy endpoint for Worker Service + connect_to_docker_network 2026-08-03 01:00:02 +02:00
Agent Zero 2b50f528f3 Fix deploy.py: head -1 statt tail -1 fuer Image-Tag (neuestes Image zuerst) 2026-08-03 00:47:30 +02:00
Agent Zero ceb06600c5 Fix deploy.py: Worker-Deploy repariert
- Tag :latest auf neuestes Commit-Image (Coolify taggt mit Hash, nicht latest)
- Verbinde Worker mit coolify Netzwerk nach Restart (für Redis/Postgres DNS)
- Kein update_service mehr (überschreibt Coolify-Konfiguration)
- Worker-Compose auf Server korrigiert (coolify Netzwerk in Service-Definition)
2026-08-03 00:12:00 +02:00