fix(automation,objectql): conditional & record-change flows silently skipping#1429
Merged
Merged
Conversation
…skipping
Every flow with a start-node / edge condition silently skipped — record-change
triggers fired but the flow body never ran, and `previous.*` / `budget > N`
gates all evaluated false. Two independent bugs:
service-automation — CEL engine unreachable in ESM
The condition evaluator loaded the formula engine via a CommonJS
`require('@objectstack/formula')`. In the package's ESM build
("type":"module") that compiles to tsup's throwing `__require` stub, so every
CEL evaluation threw and the swallowing catch returned false. Replaced with a
static top-level import — binds correctly in both ESM and CJS builds.
objectql — prior record not exposed to update hooks
HookContext documents a `previous` snapshot for update/delete, but
engine.update never populated it (the row fetched for validation stayed a
local var). Record-change conditions like
`status == "done" && previous.status != "done"` had no `previous` to read.
The engine now attaches the pre-update record to hookContext.previous for
single-id updates when a validation rule needs it or an afterUpdate hook is
registered.
Verified end-to-end in the showcase: reassign → notify→inbox, mark-done →
REST/Slack connector_action + email, budget>100k → approval (paused at
manager_review). New unit tests cover both paths.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
xuyushun441-sys
added a commit
that referenced
this pull request
Jun 1, 2026
Activates the showcase's automation chains now that the platform supports them (capability tokens from #1426; conditional/record-change flows fixed in #1429): - requires: ['ui','automation','approvals','messaging','triggers','job'] so the notify node delivers and record-change/schedule flows auto-fire. - Register the `rest` + `slack` connectors for the connector_action node. `rest` points at the running server (SHOWCASE_SELF_URL) so its call + response are observable with no external dependency. - Two worked flows: ScheduledDigestFlow (interval schedule → notify → inbox) and TaskCompletedRestPingFlow (record-change → rest connector GET /health). - Fix BudgetApprovalFlow's decision node: branch on edge `condition` (`budget > 500000` / `<= 500000`) per the flow spec, instead of the unevaluated node-level config + true/false labels — so budgets ≤ $500k correctly skip the executive approval step. - Ambient `process` decl so `pnpm typecheck` stays green without @types/node. Verified end-to-end in the browser: schedule digest, reassign→notify→inbox (email→user-id resolved), mark-done→REST/Slack/email, budget→approval with correct decision routing and approve→resume. Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
xuyushun441-sys
pushed a commit
that referenced
this pull request
Jun 1, 2026
feat(app-shell): repoint Console bell to sys_inbox_message + receipts (ADR-0030) (#1429) objectui@80f97961772850e4792dcfcfe69676a84e518ede
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.
Problem
Every flow with a start-node / edge condition silently skipped. Record-change triggers fired (
engine.executeran), but the flow body never executed —previous.*gates,budget > 100000, andstatus == "done" && previous.status != "done"all evaluated tofalseand the flow returned{skipped, condition_not_met}. Only condition-less flows (e.g. the interval schedule) worked.Discovered while testing the showcase automation suite end-to-end in a browser.
Two independent root causes
1. service-automation — CEL engine unreachable in ESM (the universal blocker)
AutomationEngine.evaluateConditionloaded the formula engine lazily:The package ships ESM (
"type": "module"), where tsup compiles thatrequireinto a__requirestub that throwsDynamic require of "..." is not supported. The surroundingcatch { return false }swallowed it, so every CEL evaluation returned false — platform-wide, for all condition sites (start gates, decision nodes, edge predicates). Fixed with a static top-levelimport, which binds in both ESM and CJS builds.2. objectql — prior record not exposed to update hooks
HookContextdocuments aprevioussnapshot "for update/delete", butengine.updatenever populated it — the row it fetched for validation (needsPriorRecord) stayed a local variable. So even once CEL worked, record-change conditions referencingprevious.*had nothing to read. The engine now attaches the pre-update record tohookContext.previousfor single-id updates whenever a validation rule needs it or anafterUpdatehook is registered.Verification
End-to-end in the showcase (record-change triggers + capability tokens from #1426):
assigned_notifycompleted →task.assignedinbox row, keyed to the resolvedadminuser id (email→userId from feat(messaging,cli): messaging + triggers capability tokens; notify-by-email resolves to user id #1426).rest_ping(RESTconnector_actionGET /api/v1/health),completed(email), andslack(connector_action) all completed.budget_approvallaunched and paused atmanager_review.Tests
@objectstack/objectql: 451 passed — new test assertsafterUpdatehooks receivectx.previous, and that no prior-record fetch happens absent hooks/rules.@objectstack/service-automation: 105 passed — new test asserts the CEL path evaluates record-change conditions (previous.*+ bare fields).🤖 Generated with Claude Code