Skip to content

Workflows are Harbor's: the records, the engine, the builder and the pages (0.24.0) - #28

Merged
adamfortuna merged 1 commit into
mainfrom
workflows
Nov 14, 2026
Merged

adamfortuna merged 1 commit into
mainfrom
workflows

Conversation

@adamfortuna

@adamfortuna adamfortuna commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Workflows move into Harbor (0.23.0): the records, the definition, the engine, the builder and every page, with what a workflow is built from held in one registered list.

What is here

  • Records: Harbor::Workflow, WorkflowVersion, WorkflowRun, WorkflowStepRun, WorkflowWait, on the tables of those names. The migration creates what is missing and leaves a host's existing tables alone.
  • Definition, conditions, context: Harbor::Workflows::Definition (parse, validate, walk), Condition, Context.
  • Engine: Harbor::Workflows::Engine replays a definition against recorded step runs; AdvanceJob is the only thing that moves a run; Control cancels, answers an approval and runs again; Starter (Harbor::Workflows.start!) starts a run from host code.
  • Registry (Harbor::Workflows): register_step, register_trigger, register_data, register_setting, register_validator, register_claim, plus update_* and remove_*. Validation, the engine, the builder's palette and forms and the reference page all read it.
  • Harbor's own step types: agent and verifier (run as agent sessions through AgentStepJob), the note action, filter, choice, loop, approval, call; the manual trigger.
  • Pages: /factory/workflows (list, a workflow's page, builder, reference) and /factory/workflow_runs (recent runs, a run's page). The builder is harbor--workflow-builder, drawn from the catalog and knowing no host's step by name; its styles are workflows.css.
  • For a host: twelve config values (workflow_class … workflow_run_cancel) and eight partials in app/views/harbor/workflows/. README "Workflows" documents all of it; CHANGELOG has the upgrade notes.

Not here

  • A step that waits for an event, and steps that make and remove a workspace. Neither has a host-free form yet: a wait needs something to deliver events, and agent sessions make their own worktree. Harbor::WorkflowWait and Harbor::Workflows.sweep_waits! are here for a host's waiting step.
  • Matching a webhook delivery to workflows. A host decides which workflows a delivery starts and calls start!.

Checked

  • bin/test: 687 runs, 5857 assertions, 0 failures. bundle exec rubocop: no offenses.
  • Tests cover the registry and catalog, the definition, conditions and templates, the engine through Harbor's own step types and steps registered by the tests, the session-run agent step on the stand-in Orca, and the pages, including a site with no host code creating a workflow on the page, starting it and seeing its run finish.
  • The builder's JavaScript changed only where it named a host's step or trigger (it now reads those from the catalog). It was syntax-checked but not exercised in a browser in this branch.

Rebasing

Based on 0.21.0. Against current main (0.22.0) the conflicts are the expected shared files: CHANGELOG.md, README.md, Gemfile.lock, lib/harbor/version.rb, lib/harbor.rb, lib/harbor/nav.rb, app/models/harbor/run.rb and test/dummy/db/schema.rb (regenerate with rake app:db:migrate). The dummy app on main has a host route named workflows; with this branch that entry is the engine's own, so the dummy needs another host page for the menu tests.

…pages, built from registered step types

Harbor::Workflow, WorkflowVersion, WorkflowRun, WorkflowStepRun and
WorkflowWait are records on the tables of those names (a migration creates
them where they are missing). Harbor::Workflows holds the definition and its
validation, conditions, the run context and its templates, the engine that
replays a definition against recorded step runs, the control actions, and
AdvanceJob, the only thing that moves a run forward. Harbor::WorkflowsController
and Harbor::WorkflowRunsController serve /factory/workflows (the list, a
workflow's page, the builder, the reference) and /factory/workflow_runs (recent
runs and a run's page); the builder is the harbor--workflow-builder Stimulus
controller with its styles in workflows.css. The menu's Workflows entry is the
engine's own route.

What a workflow is built from is one registered list (Harbor::Workflows):
register_step gives a step type its form, its outputs, its checks and the
object that runs it; register_trigger, register_data, register_setting,
register_validator and register_claim do the same for triggers, the data a
step reads, a workflow's settings, rules that span steps and the flows a live
workflow takes over. Validation, the engine, the builder's palette and forms
and the reference page all read it. Harbor registers what needs no host: an
agent and a verifier that run as agent sessions (AgentStep, AgentStepJob), a
note, filter, choice, loop, approval and call, and the manual trigger. A host
registers its own beside them and may replace, change or remove Harbor's.

Harbor::Workflows.start! starts a workflow from host code, with what the run
is about and one active run per workflow per subject. A Run that is a workflow
step hands its result back when it finishes (Harbor::Run), whoever ran it.

What is a host's arrives as config (workflow_class, workflow_run_class,
user_class, workflow_params, workflow_starter, workflow_subject,
workflow_manual_start, workflow_event_data, workflow_run_url,
workflow_run_finished, workflow_step_retry, workflow_run_cancel) and as
partials in its app/views/harbor/workflows/. 0.23.0.
@adamfortuna
adamfortuna merged commit 08d0419 into main Nov 14, 2026
2 checks passed
@adamfortuna
adamfortuna deleted the workflows branch November 14, 2026 23:51
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.

1 participant