Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt

Use this file to discover all available pages before exploring further.

Feature ID: PF-82 Status: ✅ Implemented Spec: PF-82-business-process-registry.md Last Updated: 2026-03-16

Overview

PF-82 (Business Process Registry) provides a centralized, auto-discovered catalog of business processes that aggregate automation rules (fw_automation_rules) and workflow definitions (fw_workflow_definitions) per organization. It calculates composite health scores, surfaces execution metrics, and publishes health-change events consumed by notifications and the system health dashboard.

Integration Points (from Spec)

DependencyPatternPurpose
FW-03 (Automation Engine)Data (SECURITY DEFINER)Source of fw_automation_rules and fw_automation_logs for discovery and health metrics
FW-06 (Workflow Builder)Data (SECURITY DEFINER)Source of fw_workflow_definitions and fw_workflow_instances for discovery and health metrics
PF-29 (Task System)Platform Layer / Impact GraphImpact graph traces task creation actions from automation rules
PF-10 (Notifications)Platform Layer / EventHealth status change notifications (degraded/critical/recovery)
PF-36 (System Health Dashboard)Platform Layer / EventProcess health summary widget; subscribes to process_health_changed event
PF-83 (SLA Management)Data (SECURITY DEFINER)pf_sla_instances queried for SLA compliance component of health score; defaults to 100% when PF-83 is not yet implemented
PF-04 (Audit Logging)Platform LayerDiscovery and health refresh operations logged via PF-04

Cross-Core Data Access

PF-82 reads from FW core tables (fw_automation_rules, fw_automation_logs, fw_workflow_definitions, fw_workflow_instances) via PF-owned SECURITY DEFINER functions (pf_discover_business_processes, pf_refresh_process_health). These functions run with SET search_path = public to prevent search-path injection.
Architecture note: Direct cross-core table reads are normally prohibited by constitution §1. PF-82 mitigates this by routing all FW data access through SECURITY DEFINER database functions owned by the PF core, which is consistent with the pattern used by other platform-level health and observability features (e.g., PF-36, PF-52). No PF React code imports FW modules directly.

Event Contracts

process_health_changed

FieldTypeDescription
processIdstring (UUID)The process that changed health status
organizationIdstring (UUID)Tenant scoping
processNamestringHuman-readable process name
previousStatus'healthy' | 'degraded' | 'critical' | 'unknown'Prior health status
newStatus'healthy' | 'degraded' | 'critical' | 'unknown'New health status
healthScorenumberComposite score (0–100)
topContributingFactorstringComponent with the largest negative impact
changedAtstring (ISO 8601)Timestamp of status change
Publisher: pf_refresh_process_health() (pg_cron every 5 min + Database Webhook on fw_automation_logs INSERT) Subscribers: PF-10 (Notifications), PF-36 (System Health Dashboard) Delivery: pg_notify('process_health_refresh', ...) → Database Webhook → Edge Function → PF-10

process_discovered

FieldTypeDescription
processIdstring (UUID)Newly created or updated process
organizationIdstring (UUID)Tenant scoping
processNamestringDiscovered process name
owningCorestringInferred owning core
processTypestringInferred process type
linkedRuleCountnumberNumber of linked automation rules
linkedWorkflowCountnumberNumber of linked workflow definitions
discoveredAtstring (ISO 8601)Discovery timestamp
Publisher: pf_discover_business_processes() (pg_cron daily + on-demand Edge Function) Subscribers: PF-04 (Audit Logging)

Consumers of PF-82

ConsumerPatternPurpose
PF-36 (System Health Dashboard)Event / DataProcess health summary widget — top degraded/critical processes
PF-83 (SLA Management)DataSLA instances are correlated to processes via correlation_id = process_id

Edge Functions

FunctionTriggerPurpose
pf-discover-processesOn-demand (UI or API)Manual process discovery for a single organization
pf-refresh-health (proposed)Database Webhook on fw_automation_logs INSERTTriggers pf_refresh_process_health() for the linked process

Tenant Isolation

All pf_business_processes and pf_process_execution_snapshots rows are scoped to organization_id. RLS policies enforce tenant isolation using existing platform helpers pf_has_org_access() and pf_is_platform_admin() (both SECURITY DEFINER).

Permission Keys (PF-30)

KeyRoles
pf.business_processes.viewplatform_admin, org_admin, manager
pf.business_processes.manageplatform_admin, org_admin
pf.business_processes.discoverplatform_admin, org_admin
pf.business_processes.settingsplatform_admin, org_admin