Files
HiveGrid-Wireframes/hivegrid-cloud/.planning/ticket-docs/R-P12a.md
T

5.2 KiB

R-P12a · P12 Automation-Engine + Trigger/Action-Registry + Guards

Typ Dev (Code)
Owner Raffael
Phase P12 — Automation-Engine (USP-Säule 1)
Cycle/Fenster W4 — USP, Härtung & Launch · 2026-07-06 → 2026-07-07 · Gate W4
Status geplant

🟢 Kein Pivot-Sonderfall (P12 ist USP, nicht Teil der projekt-zentrischen Kern-Kette) — aber Trigger/Actions arbeiten auf dem Projekt-Kern. 🟡 v1-Grenze: KWP-Push-Action ist nur ein erweiterbarer Registry-Eintrag (zieht mit v2 nach) — kein KWP-Konfig-UI in v1.

Abhängigkeiten & Parallelität

  • Blocked by: R-P11b (Dashboard fertig — Automation baut auf vollem Modul-Set auf)
  • Blocks: R-P12b (Flow-Editor verbraucht Engine + Registry) , R-P13 (KI-Actions docken an) → R-P13 entfällt (AD-26: KI→MCP)
  • Sequenz (Raffaels Kern-Kette): sequenziell (R-P11b → R-P12a → R-P12b) → R-P13 — R-P12b ist Ketten-Ende (AD-26).
  • Läuft parallel zu: Akeshans Module W4. Schema-Trennung nach AD-21.

Was wir bauen

Den Engine-Unterbau der ersten USP-Säule: eine vollständige Trigger-Library (CRM, Lead, Sales, Projekte, Email, Forms, Booking, Kalender, Zeit, Webhooks) und eine erweiterbare Action-Library (CRM, Notification, HTTP, Task, If/Else, Delay, Loop; KWP-Push + KI-Actions docken nach), plus die Schutz-Mechanismen (Loop-Guard, Rate-Limit, Idempotenz, Metering, Resume). Flows sind als JSON-Graph persistiert. Der visuelle Editor folgt in P12b.

Benötigte Screens (Backend bedient — Design liefert D-FLOW + D-P12)

Screen [Route] Kern-Inhalt
Automation-Liste [/automations] Name, Trigger, Status (aktiv/pausiert/Entwurf), Läufe (30d), letzte Ausführung, „nur meine"-Filter
Execution-Liste [/automations/:id/executions] Letzte N Läufe, Filter (Status/Datum/Trigger-Typ), Klick → Detail
Execution-Detail [/automations/:id/executions/:exec_id] summary_text, Trigger-Payload user-lesbar, Step-by-Step-Verlauf mit Klartext je Schritt (Status/Input/Output/Dauer), Dry-Run-Marker, 24h-Rückgängig-Button mit Restzeit, Manuell-Retry, Resume-ab-Schritt
Loop-/Rate-Schutz-Warnmodal Schleifen-Erkennung mit Abhängigkeits-Graph-Visualisierung + „Beheben"; Anomalie-Pause-Hinweis Klartext (z.B. „2.000-mal in 5 Min, typisch 5-10/Tag — pausiert")

(Trigger-/Action-Library = Daten im Knoten-Katalog, kein eigener Screen. Flow-Editor selbst → R-P12b.)

Definition of Done

  • Vollständige Trigger-Library über alle Module (CRM, Lead, Sales, Projekte, Email, Forms, Booking, Kalender, Zeit, Webhook) im Knoten-Katalog gruppiert
  • Erweiterbare Action-Library (CRM, Notification, HTTP, Task, If/Else, Delay, Loop) + Registry — KWP-Push + KI-Actions docken später an (kein v1-Konfig-UI)
  • Schutz: Loop-Guard (Abhängigkeits-Graph-Warnung), Rate-Limit + Anomalie-Pause, Idempotenz-Key, Trigger-Volumen-Metering pro Tenant, Resume-ab-Schritt mit Auto-Retry
  • Klartext-Diagnostik in allen Execution-Logs (Step-Status, Dauer, Input/Output)
  • Datenmodell persistiert: AutomationRule/AutomationRuleStep/AutomationExecution/AutomationStepExecution (+ Credential/Template)
  • Plattform- + Tenant-Templates mit Katalog und „aus Rule erstellen" (Backend)
  • Konnektor tenantHasModule('automation') (Engine/Routes/Actions gated)

Technische Bausteine

  • Entities (eigene prisma/schema/automation.prisma): AutomationRule (name, flow_data JSON, enabled, created_via), AutomationRuleStep (step_kind trigger|condition|action|flow_control, node_type, config, parent_step_ids[] — Graph-Knoten), AutomationExecution (trigger_payload, status, dry_run, idempotency_key, reverse_window_expires_at), AutomationStepExecution (input/output, summary_text), AutomationCredential ([verschlüsselt]), AutomationTemplate (flow_data, category, is_published — SHK-Vorlagen). Andere Modul-.prismas nur über Trigger/Action-Adapter (AD-21).
  • RLS auf Rule/Execution/Template (AD-1); [Soft-Delete] auf Rule; AutomationCredential AES-verschlüsselt.
  • Trigger-Bus: Modul-Events (z.B. lead.qualified, deal.won) → Trigger-Matching → Execution; Idempotenz-Key verhindert Doppel-Läufe.
  • Loop-Guard/Rate-Limit/Metering server-seitig; Anomalie-Pause bei Spike (Klartext-Notification).
  • Konnektor tenantHasModule('automation') gated.
  • is_demo_data-Flag auf SHK-Templates/Demo-Rules.

Quellen (granular)

  • ENTITY-MODEL.md → Domäne 7: Automation & KI (AutomationRule/RuleStep/Execution/StepExecution/Credential/Template)
  • REQUIREMENTS.md → REQ-automation-datenmodell, REQ-automation-trigger-library, REQ-automation-action-library, REQ-automation-schutz (Phase 12)
  • ROADMAP.md → Phase 12 · PHASE-SOURCES.md → P12
  • designer-briefs/P12-automation-engine.md (Flow-Editor BESPOKE — schwerste UI; v1-Grenze KWP-Push)
  • _bmad-output/specs/M17-automation-engine.md

Dev-Nachzug (nach Davids D-FLOW/D-P12-Delta)

  • Spec/ENTITY-MODEL an Davids UI-Entscheidungen angepasst
  • REQUIREMENTS/PHASE-SOURCES nachgezogen
  • Plane-Ticket R-P12a aktualisiert