Skip to content

flow record trigger: consider multi-event triggerType (array / unions beyond create-or-update) #3457

Description

@os-zhuang

Context

#3427 asked for a way to fire a single record_change flow on both create and update. It was resolved (PR #3446) by adding record-after-write / record-before-write — the create-OR-update union — rather than a general array of triggerTypes.

That was a deliberate, scoped choice:

  • write covers the canonical "created or updated" case (mirrors Salesforce's record-trigger option and Rails' after_save), which is the only combination record_change flow start node binds to a single lifecycle event — no create-OR-update in one flow #3427 and industry precedent actually ask for.
  • A single canonical token keeps the start-node contract simple (triggerType stays a string), needs no engine/spec change (the engine already forwards any record-* token to the trigger), and avoids N authoring dialects (contract-first, AGENTS.md Prime Directive Add comprehensive test suite for Zod schema validation #12).
  • An arbitrary array (triggerType: ['record-after-create', 'record-after-delete']) or other unions (create+delete, update+delete) would add real pipeline complexity — engine parsing string | string[], an ambiguous binding.event, per-event condition/ctx.event semantics — for combinations no concrete scenario needs yet (YAGNI).

The deferred question

Do we ever need record-trigger unions other than create-OR-update — e.g. create+delete, update+delete, or a fully general array?

Promotion criteria (AGENTS.md-style)

Revisit and implement a general multi-event form when two independent real projects need a non-write combination, or when a Tier-1 feature requires it. Until then, the surface stays: the single-op tokens plus the write union.

If we do build it, the likely shape is an array on the start node (triggerType: string | string[]), with the engine expanding it into a binding.events: string[] and the trigger binding one hook per token (the trigger already maps a token → N hook events via triggerTypeToHookEvents, so the trigger side is mostly there).

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions