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
feat(trigger-record-change): record-after-write fires one flow on create OR update (#3427) (#3446)
A record_change flow's start node bound to exactly one lifecycle event via
`triggerType`, so a rule meant to run on both insert and update forced authors
to duplicate the whole flow into two near-identical definitions that drift.
Add `record-after-write` / `record-before-write` — the create-OR-update union
(delete excluded: a write persists field data, a delete removes the row). One
start node binds both lifecycle hooks (afterInsert + afterUpdate) under the same
flow; exactly one fires per mutation (a write is an insert xor an update), so it
is not a double run. To branch on which event fired, test `previous` (empty on
create, populated on update).
- New `triggerTypeToHookEvents` (plural) is the canonical mapper, expanding
`write` to both events; `triggerTypeToHookEvent` (singular) is kept for
back-compat and returns null for the multi-event write tokens.
- The engine already forwards any `record-*` token to this trigger, so no
engine/lint/spec change is needed — the trigger owns the vocabulary.
- Unit + end-to-end tests (a single write flow fires on both create and update,
self-write does not loop); docs under Automation > Flows and the README.
Claude-Session: https://claude.ai/code/session_018939yJ413zG3irLzcTtqaa
Co-authored-by: Claude <noreply@anthropic.com>
0 commit comments