wiki/b-reference/platform/workflowAutomation.md

77 lines
4.3 KiB
Markdown

<!-- status: canonical -->
<!-- lastReviewed: 2026-06-08 -->
# 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`. `TABLE_NAMESPACE` = `system.workflowAutomation`.
- **DB-Scoping:** `AutoWorkflow.mandateId` + `runAsPrincipal` (Owner). `targetFeatureInstanceId` + per-Node `FeatureInstanceRef` bleiben als Daten-Scope.
- **RBAC-Boot-Migration:** `_migrateRbacNamespace()` in `onBootstrap()` migriert bei jedem Start idempotent AccessRule-Einträge von `feature.graphicalEditor` auf `system.workflowAutomation`.
## Code-Pfade
| Schicht | Pfad |
|---------|------|
| Komponente (Entry) | `platform-core/modules/workflowAutomation/mainWorkflowAutomation.py` |
| Editor | `platform-core/modules/workflowAutomation/editor/` |
| Engine | `platform-core/modules/workflowAutomation/engine/` |
| Scheduler | `platform-core/modules/workflowAutomation/scheduler/` |
| Routen (mandatsweit) | `platform-core/modules/routes/routeWorkflowAutomation.py` |
| Interface (DB-Ops) | `platform-core/modules/interfaces/interfaceWorkflowAutomation.py` |
| Shared Helpers | `platform-core/modules/shared/workflowAutomationHelpers.py` |
| Models (kanonisch, L1) | `platform-core/modules/datamodels/datamodelWorkflowAutomation.py` |
| Navigation-Sektion | `platform-core/modules/datamodels/datamodelNavigation.py` (Block `workflowAutomation`) |
| Frontend Hub | `ui-nyla/src/pages/workflowAutomation/WorkflowAutomationHubPage.tsx` |
| Frontend Tabs | `ui-nyla/src/pages/workflowAutomation/tabs/{WorkflowsTab,RunsTab,RunDetailTab,EditorTab,TemplatesTab}.tsx` |
| Frontend API Client | `ui-nyla/src/api/workflowAutomationApi.ts` |
## API
**Basis-Pfad:** `/api/workflow-automation/`
| Methode | Pfad | Beschreibung |
|---------|------|--------------|
| GET | `/workflows` | Workflows mandatsweit (RBAC-gefiltert) |
| GET | `/workflows/{id}` | Einzelner Workflow |
| POST | `/workflows/{id}/execute` | Workflow ausführen |
| DELETE | `/workflows/{id}` | Workflow + Cascade löschen |
| GET | `/versions/{workflowId}` | Versionen eines Workflows |
| POST | `/versions/{id}/publish` | Version publizieren |
| GET | `/runs` | Läufe mandatsweit |
| GET | `/runs/{id}` | Einzelner Run |
| GET | `/runs/{id}/detail` | Run-Detail mit Steps |
| GET | `/runs/{id}/stream` | SSE Run-Stream |
| POST | `/runs/{id}/stop` | Run stoppen |
| DELETE | `/runs/{id}` | Run + Steps löschen |
| GET | `/tasks` | Human-Tasks mandatsweit |
| POST | `/tasks/{id}/complete` | Task abschliessen |
| POST | `/tasks/{id}/cancel` | Task abbrechen |
| GET | `/steps/{runId}` | Step-Logs eines Runs |
| GET | `/metrics` | Workflow-Metriken |
| GET | `/node-types` | Node-Typ-Katalog |
| GET | `/templates` | Workflow-Vorlagen |
| GET | `/connections` | Verfügbare Connections |
## 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`
## 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`