feat: migrate workflows from database to file-based architecture#910
Conversation
Flatten workflow JSON schema (remove workflowConfig/stepsConfig nesting), add file I/O utilities, slug-based trigger lookups, file workflow data source, and update frontend automation pages to support file-backed workflow configuration.
…tools Migrate workflow update/approval system from database record references (workflowId, stepRecordId, workflowVersionNumber) to file-based identifiers (workflowSlug, stepSlug, workflowVersion). Tools now read/write workflow JSON files via file_actions instead of querying DB tables directly. - Update save_workflow_definition_tool to read workflow files instead of DB - Update update_workflow_step_tool to resolve steps from file config - Update internal_mutations to accept slug-based args - Update internal_actions to patch steps by slug in file config - Update approval card UI to display slug-based metadata - Add step order field and sort keys alphabetically in example workflow - Add compute_step_order helper with tests - Update all related tests for file-based architecture
Complete the file-based workflow migration by deleting the database-backed CRUD modules (wf_definitions, wf_step_defs, workflows/definitions, workflows/steps, workflows/triggers mutations/queries) and updating the frontend, engine, scheduler, and triggers to use file-based slugs.
Replace publish/unpublish actions in automation navigation with a history dropdown that lists snapshots, opens a JSON diff dialog, and allows restoring previous versions. Dispatch workflow-updated events from approval cards so the detail page refetches after changes.
Replace client-side template fetching from GitHub with a server-side installWorkflow action that sets an `installed` flag on workflow configs. Templates are now listed from the filesystem and filtered by install status, removing the need for hardcoded template constants, the fetch-workflow-template utility, and the Vite dev server middleware.
- Fix missing slugToUrlParam() in 3 navigation locations that broke routing for folder-based workflow slugs containing slashes - Fix event subscription duplicate check to include organizationId, preventing cross-tenant collisions - Replace deprecated getAvailableWorkflows query (reading empty legacy table) with file-based action so agent tool selector shows workflows - Fix readJsonFile() masking all errors as 'not_found' — now properly distinguishes EACCES/EPERM as 'inaccessible' - Add workflow slug validation to trigger create mutations - Remove unused orgSlug parameter from trigger create mutation args - Rename createdWorkflowId to createdWorkflowSlug for consistency - Fix outdated JSDoc referencing workflowId instead of workflowSlug
Workflow templates were missing in Docker because the file-based migration only wired up local dev (scripts/dev.ts). This mirrors the existing agents pattern: copy builtin templates into the image, seed them to the data volume on startup (skipping user-modified or installed workflows), and sync WORKFLOWS_DIR to Convex env vars.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (188)
📝 WalkthroughWalkthroughThis PR migrates workflows from a DB-backed model to file-backed workflows and slugs. It adds safe file I/O, history, serialization/validation (workflow JSON schema), file actions (read/list/save/install/duplicate/rename/restore) and internal actions for execution. It removes many Convex DB queries/mutations and step/definition helpers, updates engine/start paths to use file-based flows and new startWorkflowFromFile, and updates frontend hooks/components to use workflow slugs and file-based hooks. Environment, Docker, seed logic, examples, types, and approval metadata were updated; legacy DB tables/exports are annotated deprecated or removed. Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Possibly related PRs
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
|
Remove unnecessary type assertions, fix unused variables/imports/params, add error causes to re-thrown errors, and migrate stress tests from removed startWorkflow mutation to startWorkflowFromFile action.
Summary
wf_definitions,wf_step_defs,workflows/definitions/,workflows/steps/, and legacy trigger mutations/queries deleted (~2,900 lines removed)workflowSlug/stepSlugidentifiersinstalledflag, replacing client-side GitHub fetching and hardcoded template constantsTest plan
compute_step_order,create_bound_workflow_tool,execute_approved_workflow_run,execute_approved_workflow_update, etc.)Summary by CodeRabbit
New Features
Improvements
Chores