Skip to main content
Feature ID: FW-16
Status: ✅ Complete (All Phases)
Spec Reference: FW-16-event-based-workflow-triggers.md
Last Updated: 2026-03-17

Overview

FW-16 provides a domain event system for workflow triggers: an event registry (fw_workflow_events), an organization-scoped event log (fw_domain_events), and platform-layer event publication (publishEvent()). Cores publish events via the Platform Integration Layer; the FW automation engine consumes events and starts workflows. Date-relative triggers and event filtering are supported.

Integration Points (from Spec)


Platform Layer Contract

  • Event publication: publishEvent({ event_name, payload, organization_id, site_id? }) in src/platform/events/publishEvent.ts
  • Event types: src/platform/events/types.ts; event names aligned with fw_workflow_events.event_name
  • Documentation: src/platform/events/README.md for cores integrating with FW-16

Event Contracts

  • Event payloads must conform to the JSON Schema in fw_workflow_events.payload_schema for the given event_name.
  • New events are registered via seed migrations (insert into fw_workflow_events). See EVENT_CONTRACTS.md for planned and existing event names.
  • Idempotency and retry semantics are documented in EVENT_CONTRACTS.md; FW-16 logs events in fw_domain_events and marks them processed via fw_process_domain_event().

Security and Tenant Isolation

  • Event registry (fw_workflow_events) is global and read-only for authenticated users.
  • Event log (fw_domain_events) is scoped by organization_id; RLS uses has_org_access(auth.uid(), organization_id) (or platform equivalent). Insert allowed for authenticated users in org.
  • Event publication requires organization context; payloads must not contain PHI beyond what is necessary for workflow context.

Phase 2: Event Schema Registry Expansion

Spec: FW-16-PHASE-2-EVENT-SCHEMA-EXPANSION.md
Status: 📋 Specification (Not Started)
Phase 2 adds event governance on top of the FW-16 event system without redefining durable execution (FW-46) or changing the core publish/trigger flow.

Phase 2 Integration Additions

Updated Platform Layer Contract