feat(flows): trigger execution + run history#68
Merged
Conversation
Make flows runnable from the app and surface their execution log — the last
read-only piece of the Flows feature.
Client/UI:
- useFlowRuns / useFlowRun / useTriggerFlow hooks wrap the automation API
(GET /automation/{name}/runs, GET .../runs/{id}, POST .../trigger). The
trigger endpoint wraps the handler result, so a 200 can still carry
{ success: false, error } — useTriggerFlow detects that and reports a real
failure instead of a false success (same envelope trap as object actions).
- Flow detail gains a "Run" header button: confirm (cross-platform dialog) →
trigger → success/error toast → run history auto-refetches.
- Flow detail shows a "Run History" section (status badge, trigger, time,
duration); tapping a run opens a new run-detail screen with the per-node
step log. Route restructured: flows/[name].tsx → flows/[name]/index.tsx plus
flows/[name]/runs/[runId].tsx.
- i18n: workflow.{runFlow,runConfirm,runStarted,runFailed,runHistory,noRuns,
steps,runLabel} in en/zh/ar.
Server (apps/server):
- Add @objectstack/service-automation (+ trigger plugins) and register
AutomationServicePlugin so the local dev server actually exposes the
automation routes (previously "automation: unavailable"). The plugin seeds
built-in node executors itself (ADR-0018).
Verified in-browser against the local 7.5.0 server: Run opens the confirm
dialog, POST .../trigger fires, the inner "Flow not found" (template flows ship
as drafts) is surfaced as an error toast, and Run History renders + refetches.
Adds useFlowRuns tests (incl. the inner-envelope case); typecheck + server
validate clean; full suite green apart from pre-existing snapshots.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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
Makes flows runnable from the app and surfaces their execution log — the last read-only piece of the Flows feature (completes: list ✅, diagram ✅, run ✅, history ✅).
Client / UI
useFlowRuns/useFlowRun/useTriggerFlowwrap the automation API (GET /automation/{name}/runs,GET .../runs/{id},POST .../trigger). The trigger endpoint wraps the handler result, so a 200 can still carry{ success: false, error }—useTriggerFlowdetects that and reports a real failure instead of a false success (the same envelope trap as object actions).flows/[name].tsx→flows/[name]/index.tsx+flows/[name]/runs/[runId].tsx.workflow.{runFlow,runConfirm,runStarted,runFailed,runHistory,noRuns,steps,runLabel}in en/zh/ar.Server (
apps/server)@objectstack/service-automation(+ trigger plugins) and registerAutomationServicePlugin, so the local dev server actually exposes the automation routes (previously reportedautomation: unavailable). The plugin seeds built-in node executors itself (ADR-0018).Verification
POST /automation/lead_conversion/triggerfires (200), the inner{success:false,error:"Flow 'lead_conversion' not found"}(template flows ship asdraft, so the engine won't run them) is surfaced as an error toast, and Run History renders + auto-refetches.useFlowRunstests incl. the inner-envelope failure case;tsc(mobile + server) +objectstack validateclean; full suite 1135 pass (20 pre-existing snapshot failures, unrelated).Note
A successful run + populated history/step-log couldn't be shown locally because the bundled template flows are
status: draft(you don't run drafts). The run-detail screen is built against the documentedExecutionLogEntryshape and renders defensively; it'll populate against any active flow.🤖 Generated with Claude Code