feat(lint,showcase,automation): record-after-write follow-ups — validation lint, showcase flow, create-leg previous fix (#3427)#3467
Merged
Conversation
…ord-after-write showcase flow (#3427) Follow-ups to the record-after-write feature (#3446). Lint (item 3): new `flow-trigger-unknown-event` rule in validateFlowTriggerReadiness flags a start node whose `triggerType` is record-lifecycle-shaped (`record-before|after-<op>`) but names an op the record-change trigger cannot map — a typo like `record-after-updated`. The engine still routes any `record-` token to the record trigger, which then binds to NO hook and never fires (only a runtime warn), so this surfaces the never-fire defect at authoring/`os validate` time. Warning severity, consistent with the file's existing rules. Bare `record-<noun>` shapes (e.g. `record-change`) are out of scope for this rule. Showcase (item 2): add `UrgentTaskAlertFlow`, a single `record-after-write` flow that fires when a task is created Urgent OR escalated to Urgent — using the `previous == null` create/update discrimination the write trigger enables. Plus a durable integration test booting a real kernel that verifies the create leg (`previous == null` → fires on afterInsert), the non-urgent create (no fire), and the escalation leg (fires on afterUpdate). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018939yJ413zG3irLzcTtqaa
…ix showcase notify recipient (#3427) Dogfooding the record-after-write showcase flow in a live app surfaced two bugs: 1. The engine bound `previous` into the flow condition scope only when truthy, so on a record insert `previous` was an unknown CEL variable — the documented `previous == null` create-discrimination threw "Unknown variable: previous" and failed the whole start condition, dropping the run. `previous` is now always bound (null when there is no prior row), making the create/update discrimination the record-after-write docs + Studio designer advertise actually work. Verified end-to-end (integration test + a live showcase boot: the flow fires on create-urgent and on escalation, and correctly skips a non-urgent create). 2. The showcase `UrgentTaskAlertFlow` notify node had no recipient, so every run failed "at least one recipient is required". Now notifies the assignee, falling back to the triggering user (`{$User.Id}`) so an unassigned urgent task still pings someone. Live-verified: a `task.urgent` notification is delivered. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018939yJ413zG3irLzcTtqaa
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 3 package(s): 7 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018939yJ413zG3irLzcTtqaa
os-zhuang
marked this pull request as ready for review
July 24, 2026 16:07
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-ups to the
record-after-writefeature (#3427, merged in #3446). Three things, one of them a real bug the dogfood caught:1. Authoring-time lint for never-firing record triggers (
@objectstack/lint)New
flow-trigger-unknown-eventrule invalidateFlowTriggerReadiness: a start node whosetriggerTypeis record-lifecycle-shaped (record-before|after-<op>) but names an op the record-change trigger can't map — a typo likerecord-after-updated— binds to the trigger yet maps to no hook and never fires (only a runtime warn). The rule surfaces that atos validatetime. Warning severity, consistent with the file's existing rules. (Barerecord-<noun>shapes likerecord-changeare out of this rule's scope.)2. Showcase example (
examples/app-showcase)UrgentTaskAlertFlow— onerecord-after-writeflow that fires when a task is created Urgent or escalated to Urgent, using theprevious == nullcreate/update discrimination. Demonstrates the feature as a real, dogfood-verified example.3. Fix:
previousunbound on the create leg (@objectstack/service-automation) 🐛Dogfooding #2 in a live app surfaced a real bug: the engine bound
previousinto the flow condition scope only when truthy, so on a record insertpreviouswas an unknown CEL variable. Theprevious == nulldiscrimination that #3446 documented (flows docs + the Studio designer) actually threwcondition failed to evaluate as CEL: Unknown variable: previousand dropped the run.previousis now always bound —nullwhen there is no prior row — soprevious == nullis the create leg andprevious.<field>the update leg, as advertised. Update-triggered flows are unchanged.Verification (dogfood)
Booted the showcase app on a fresh backend and drove it over REST:
record-after-writeflow binds to afterInsert + afterUpdate; among the 20 active bound flows.previous == null→ true), zeroUnknown variableerrors, atask.urgentnotification is delivered.The dogfood also caught a second, showcase-local bug (the notify node had no recipient → every run failed "at least one recipient is required"); fixed by notifying the assignee with
{$User.Id}as a guaranteed fallback (live-verified a notification is delivered).Automated:
service-automation(347) +trigger-record-change(42, incl. a new create/update discrimination integration test) +lint(271) suites all green.Changesets
@objectstack/service-automation: patch (thepreviousbinding fix).Related
record-after-writefeature), flow record trigger: consider multi-eventtriggerType(array / unions beyond create-or-update) #3457 (the deferred multi-event/arraytriggerTypedecision).Generated by Claude Code