You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#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.
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).
Context
#3427 asked for a way to fire a single
record_changeflow on both create and update. It was resolved (PR #3446) by addingrecord-after-write/record-before-write— the create-OR-update union — rather than a general array oftriggerTypes.That was a deliberate, scoped choice:
writecovers 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.triggerTypestays astring), needs no engine/spec change (the engine already forwards anyrecord-*token to the trigger), and avoids N authoring dialects (contract-first, AGENTS.md Prime Directive Add comprehensive test suite for Zod schema validation #12).triggerType: ['record-after-create', 'record-after-delete']) or other unions (create+delete, update+delete) would add real pipeline complexity — engine parsingstring | string[], an ambiguousbinding.event, per-event condition/ctx.eventsemantics — 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-
writecombination, or when a Tier-1 feature requires it. Until then, the surface stays: the single-op tokens plus thewriteunion.If we do build it, the likely shape is an array on the start node (
triggerType: string | string[]), with the engine expanding it into abinding.events: string[]and the trigger binding one hook per token (the trigger already maps a token → N hook events viatriggerTypeToHookEvents, so the trigger side is mostly there).References
record-after-writeimplementation)packages/triggers/trigger-record-change/src/record-change-trigger.ts(triggerTypeToHookEvents)packages/services/service-automation/src/engine.ts(resolveTriggerBinding)