---
id: WF-PFM-INT-022
title: Publish an automation rule and raise it when its event happens
trigger: The initiating automation administrator starts this flow.
product_area: platform
module: integrations
revision: 1
status: draft
design_intent: confirmed
implementation_evidence: partially-observed
origin: docs/proposals/application-processes-and-workflow-actions/14-decisions.md D-10 (Andrew 2026-10-17)
inference: []
source_sha:
  services-platform: ad3f6a6582843008ed0f5a17b131878d15829af1
  macroservice-libraries: 54536a441935c6e09fdb7f96f0bec71c52ba4e03
implements:
  - CAP-PFM-INT-020
moves:
  - STATE-PFM-INT-015
crosses: []
idempotency: Publishing consumes the draft; the shared host engine keys raised work to its event occurrence.
concurrency: >-
  Publication locks the rule and draft; hosts observe committed publications according to their transaction’s
  read timing.
hops:
  - 'n': 1
    actor_or_service: Automation administrator
    action: Request publication of the editable rule version.
    anchor: >-
      services-platform:modules/workflow-actions/services/automation/publish-automation-rule.ts:publishAutomationRule
    seam: sync
    on_failure: Return the publication problems.
    left_inconsistent: The editable draft remains.
    observer: The administrator
    provenance: observed
    source: >-
      services-platform:modules/workflow-actions/services/automation/publish-automation-rule.ts:publishAutomationRule
  - 'n': 2
    actor_or_service: Workflow-actions service
    action: >-
      Lock the rule and draft and validate its registered event, allowed facts, nonempty actions and publisher
      permissions.
    anchor: >-
      services-platform:modules/workflow-actions/services/automation/publish-automation-rule.ts:publishAutomationRule
    seam: sync
    on_failure: Refuse the publication without freezing content.
    left_inconsistent: Current publication and draft retain their prior values.
    observer: The administrator
    provenance: observed
    source: >-
      services-platform:modules/workflow-actions/services/automation/publish-automation-rule.ts:publishAutomationRule
  - 'n': 3
    actor_or_service: Workflow-actions service
    action: >-
      Freeze content with fingerprint and publication attribution, make it current and enable a previously
      draft rule.
    anchor: >-
      services-platform:modules/workflow-actions/services/automation/publish-automation-rule.ts:publishAutomationRule
    seam: sync
    on_failure: Rollback failed publication writes.
    left_inconsistent: No half-published version commits.
    observer: Rule versions
    provenance: observed
    source: >-
      services-platform:modules/workflow-actions/services/automation/publish-automation-rule.ts:publishAutomationRule
  - 'n': 4
    actor_or_service: Event owner
    action: >-
      When the owning event occurs, read no more than two hundred enabled rules and their current published
      versions inside the host transaction.
    anchor: 'services-platform:modules/workflow-actions/services/persistence/automation-rules.ts:enabledRulesForEvent'
    seam: event
    on_failure: The host transaction fails and follows the host’s event-recovery behavior.
    left_inconsistent: No new work is guaranteed until the host successfully commits.
    observer: The owner
    provenance: observed
    source: 'services-platform:modules/workflow-actions/services/persistence/automation-rules.ts:enabledRulesForEvent'
  - 'n': 5
    actor_or_service: Event owner
    action: >-
      Evaluate conditions using event facts and raise matching actions through the shared library in the host
      schema, retaining rule-version attribution.
    anchor: 'macroservice-libraries:packages/workflow-actions/src/automation.ts:raiseForEvent'
    seam: sync
    on_failure: Failure aborts that host transaction.
    left_inconsistent: The examined library proves raising semantics; deployed host adoption is unverified.
    observer: Runs list
    provenance: observed
    source: 'macroservice-libraries:packages/workflow-actions/src/automation.ts:raiseForEvent'
  - 'n': 6
    actor_or_service: Automation administrator
    action: List combined host runs and timers with the selected filters.
    anchor: 'services-platform:modules/workflow-actions/services/persistence/cross-workflow-views.ts'
    seam: sync
    on_failure: Return list errors; missing host arms are omitted during view rebuilding.
    left_inconsistent: A combined view can exclude a host whose contract was incomplete at rebuild time.
    observer: The administrator
    provenance: observed
    source: 'services-platform:modules/workflow-actions/services/persistence/cross-workflow-views.ts'
evidence:
  - >-
    services-platform at ad3f6a65: modules/workflow-actions/services/automation/publish-automation-rule.ts;
    services/persistence/automation-rules.ts, cross-workflow-views.ts;
    docs/workflow-actions/automation-rules.md, cross-service-views.md
  - 'macroservice-libraries at 54536a44: packages/workflow-actions (automation raiseForEvent)'
  - >-
    services-platform:modules/workflow-actions/tests/integration/services/automation/publish-automation-rule.integration.spec.js#refuses
    a publisher without the permission an action’s type requires
  - >-
    services-platform:modules/workflow-actions/tests/integration/services/automation/publish-automation-rule.integration.spec.js#refuses
    a publisher without the permission an action’s type requires
  - >-
    services-platform:modules/workflow-actions/tests/integration/db/workflow-actions-tables.integration.spec.js#refuses
    a change to a published version’s actions
  - >-
    macroservice-libraries:packages/workflow-actions/src/tests/integration/automation.integration.spec.ts#raises
    each matching rule’s actions as platform.automation_rule, rule and version, at event, once per event
  - >-
    services-platform:modules/workflow-actions/tests/integration/services/persistence/cross-workflow-views.queries.integration.spec.js#skips
    a host with no view, and one whose view lacks a column, naming each
controls: [TC-AVL-001, TC-AVL-004, TC-AVL-005, TC-AZ-001, TC-AZ-002, TC-AZ-003, TC-AZ-004, TC-CHG-001, TC-CHG-002, TC-CHG-003, TC-CHG-004, TC-CHG-005, TC-CHG-006, TC-DAT-001, TC-DAT-002, TC-DAT-003, TC-DAT-004, TC-IAM-001, TC-IAM-002, TC-IAM-004, TC-IAM-005, TC-IAM-006, TC-LOG-002, TC-LOG-003, TC-LOG-004, TC-LOG-005, TC-MON-001, TC-PI-001, TC-PI-002, TC-PI-003, TC-PI-004, TC-PI-005, TC-PRV-001, TC-PRV-002, TC-TEN-001, TC-TEN-002, TC-TEN-003, TC-TEN-004, TC-VEN-001, TC-VEN-002, TC-VEN-003]
---

# Publish an automation rule and raise it when its event happens

## What It Does

Automation publication freezes a valid event condition and action list with the publisher’s authority. The event-owning host later reads applicable publications and raises work in its own transaction. Shared lists expose host results without transferring their ownership to Platform.

## The Flow

```mermaid
sequenceDiagram
  participant P0 as Automation administrator
  participant P1 as Workflow-actions service
  participant P2 as Event owner
  P0->>P0: 1. Request publication of the editable rule version.
  P1->>P1: 2. Lock the rule and draft and validate its registered event
  P1->>P1: 3. Freeze content with fingerprint and publication attribution
  P2->>P2: 4. When the owning event occurs
  P2->>P2: 5. Evaluate conditions using event facts and raise matching actions through the shared library in the host schema
  P0->>P0: 6. List combined host runs and timers with the selected filters.
```

## When Something Fails

Return the publication problems. The editable draft remains. Refuse the publication without freezing content. Current publication and draft retain their prior values. Rollback failed publication writes. No half-published version commits. The host transaction fails and follows the host’s event-recovery behavior. No new work is guaranteed until the host successfully commits. Failure aborts that host transaction. The examined library proves raising semantics; deployed host adoption is unverified. Return list errors; missing host arms are omitted during view rebuilding. A combined view can exclude a host whose contract was incomplete at rebuild time.

## Open Design Questions

A real event-producing application and connected authoring and run-review screens still need proof. Disabling a rule does not cancel work already raised.
