Skip to content

feat(flows): trigger execution + run history#68

Merged
xuyushun441-sys merged 1 commit into
mainfrom
feat/flow-runs
Jun 1, 2026
Merged

feat(flows): trigger execution + run history#68
xuyushun441-sys merged 1 commit into
mainfrom
feat/flow-runs

Conversation

@xuyushun441-sys
Copy link
Copy Markdown
Contributor

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 / useTriggerFlow 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 (the 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.
  • 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].tsxflows/[name]/index.tsx + 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 reported automation: unavailable). The plugin seeds built-in node executors itself (ADR-0018).

Verification

  • ✅ In-browser against the local 7.5.0 server: Run opens the confirm dialog, POST /automation/lead_conversion/trigger fires (200), the inner {success:false,error:"Flow 'lead_conversion' not found"} (template flows ship as draft, so the engine won't run them) is surfaced as an error toast, and Run History renders + auto-refetches.
  • ✅ New useFlowRuns tests incl. the inner-envelope failure case; tsc (mobile + server) + objectstack validate clean; 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 documented ExecutionLogEntry shape and renders defensively; it'll populate against any active flow.

🤖 Generated with Claude Code

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>
@xuyushun441-sys xuyushun441-sys merged commit 6ccd6fe into main Jun 1, 2026
1 of 4 checks passed
@xuyushun441-sys xuyushun441-sys deleted the feat/flow-runs branch June 1, 2026 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants