# WorkflowAutomation (System-Komponente) ## Überblick **WorkflowAutomation** ist die mandanten- und feature-übergreifende Orchestrierungs-Infrastruktur der Plattform. Sie wurde aus dem ehemaligen Feature `graphicalEditor` extrahiert, da dieses keine Domänen-/Kundendaten hält, sondern ausschliesslich Orchestrierungs-Metadaten (`AutoWorkflow`, `AutoRun`, `AutoTask`) verwaltet und beim App-Start den globalen Scheduler bootet. **Warum System-Komponente:** `graphicalEditor` war ein Hybrid — formal Feature mit `FeatureInstance`-RBAC, architektonisch aber System-Infrastruktur (eigene DB `poweron_graphicaleditor`, globaler Scheduler, cross-instance Workflows). Die Solution-Schicht (CustomerCases) verankert Ownership an Mandant + Principal; das Feature-Modell kollidiert damit. ## Architektur - **System-Lifespan Boot:** Scheduler- und Email-Poller-Start in `app.py` (nicht mehr Feature-`onStart`). - **Mandatsweite API:** `/api/workflow-automation/{workflows,versions,runs,tasks,steps}` — kein `{instanceId}` als RBAC-Anker. - **RBAC-Modell:** Mandats-Mitgliedschaft (read), Mandats-Admin (write/execute/delete), `isPlatformAdmin`-Bypass. Keine Feature-Instanz-Rollen; `instantiable=False`. - **DB-Scoping:** `AutoWorkflow.mandateId` + `runAsPrincipal` (Owner). `targetFeatureInstanceId` + per-Node `FeatureInstanceRef` bleiben als Daten-Scope. ## Code-Pfade | Schicht | Pfad | |---------|------| | Routen (mandatsweit) | `platform-core/modules/routes/routeWorkflowAutomation.py` | | Models (kanonisch, L1) | `platform-core/modules/datamodels/datamodelWorkflowAutomation.py` | | Navigation-Sektion | `platform-core/modules/datamodels/datamodelNavigation.py` (Block `workflowAutomation`) | | Feature-Mantel (deprecated) | `platform-core/modules/features/graphicalEditor/` | | Graph-Engine | `platform-core/modules/workflows/automation2/` | | Scheduler | `platform-core/modules/workflows/scheduler/` | | Frontend | `ui-nyla/src/pages/WorkflowAutomationPage.tsx` | ## API **Basis-Pfad:** `/api/workflow-automation/` | Methode | Pfad | Beschreibung | |---------|------|--------------| | GET | `/workflows` | Workflows mandatsweit (RBAC-gefiltert) | | GET | `/workflows/{id}` | Einzelner Workflow | | GET | `/versions/{workflowId}` | Versionen eines Workflows | | GET | `/runs` | Läufe mandatsweit | | GET | `/runs/{id}` | Einzelner Run | | GET | `/tasks` | Human-Tasks mandatsweit | | POST | `/tasks/{id}/complete` | Task abschliessen | | GET | `/steps/{runId}` | Step-Logs eines Runs | | DELETE | `/workflows/{id}` | Workflow + Cascade löschen | | DELETE | `/runs/{id}` | Run + Steps löschen | ## Navigation Statischer Block `workflowAutomation` (order 25) mit UI-Objekten: - `page.system.workflowAutomation.workflows` - `page.system.workflowAutomation.editor` - `page.system.workflowAutomation.templates` - `page.system.workflowAutomation.runs` - `page.system.workflowAutomation.tasks` ## Migration Feature-Routen `/api/workflows/{instanceId}/…` bleiben aktiv (Koexistenz). Die GE-Feature-Registrierung (Store, `TEMPLATE_ROLES`, `UI_OBJECTS`) ist DEPRECATED, wird aber für bestehende Instanzen noch ausgeliefert. Vollständige Entfernung des Feature-Mantels erfolgt nach Abschluss der Datenmigration. ## Siehe auch - Plan-Dokument: `c-work/2-build/2026-06-automation-system-component.md` - RBAC: `b-reference/platform/rbac.md` - Navigation: `b-reference/platform/navigation.md`