feat(workflows): test-run unsaved drafts and browse workflow version history

A test run pins a validated draft, runs with forge and push writes
suppressed and recorded per step, and is excluded from workflow stats.
The History tab lists revisions that changed a workflow, diffs them as
YAML and on the canvas, restores into the editor, and ties runs to the
revision they used.
This commit is contained in:
sam committed 2026-10-13 12:27:40 +11:00
1 parent b391e8a9bf
commit d54f4af11e
37 files changed
+677 -132

No files matched your search

@@ -186,6 +186,7 @@ SELECT workflow, stage,
COUNT(*) FILTER (WHERE (data::jsonb ->> 'error') IS NOT NULL)::int AS errors
FROM events
WHERE kind = 'stage_finish' AND ($1::text IS NULL OR org_id = $1)
AND task_id NOT IN (SELECT id FROM tasks WHERE source = 'test')
GROUP BY workflow, stage
ORDER BY workflow, stage
`
@@ -336,7 +337,7 @@ SELECT workflow,
AVG(iterations)::float8 AS avg_steps,
SUM(tokens_used)::bigint AS total_tokens
FROM tasks
WHERE workflow <> '' AND ($1::text IS NULL OR org_id = $1)
WHERE workflow <> '' AND source <> 'test' AND ($1::text IS NULL OR org_id = $1)
GROUP BY workflow
ORDER BY COUNT(*) DESC
`