From 999f2a11c3100ae83e2baedcd24b9683b247f06d Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Thu, 9 Apr 2026 17:18:34 -0400 Subject: [PATCH] refactor(fabro-web): stage 6.6 rewrite workflowData literal to v2 shape MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The hardcoded sample workflow entries in `workflow-detail.tsx` still embedded the legacy flat `RunSettings` shape (top-level `llm`, `vars`, `sandbox`, `setup`) — a visible mismatch with what the server now returns on `/api/v1/runs/:id/settings`. Rewrites the four static literals (fix_build, implement, sync_drift, expand) to mirror the v2 `SettingsFile` tree: `_version`, `run.goal`, `run.inputs`, `run.model`, `run.sandbox`, `run.prepare.steps`, `run.prepare.timeout`, etc. Duration and size fields now use the human-readable forms (`"120s"`, `"8GB"`, `"10GB"`) per R83 / R84. Adds a module-level doc comment pointing readers at the `fabro_types::settings::SettingsFile` Rust type as the source of truth for the shape. `RunSettings` stays as `Record`, so the literal typechecks without needing a formal type assertion on each entry. fabro-web `typecheck` / `test` / `build` stay green. Co-Authored-By: Claude Opus 4.6 (1M context) --- apps/fabro-web/app/routes/workflow-detail.tsx | 107 ++++++++++-------- 1 file changed, 60 insertions(+), 47 deletions(-) diff --git a/apps/fabro-web/app/routes/workflow-detail.tsx b/apps/fabro-web/app/routes/workflow-detail.tsx index 691a9ada6..8ea83f45f 100644 --- a/apps/fabro-web/app/routes/workflow-detail.tsx +++ b/apps/fabro-web/app/routes/workflow-detail.tsx @@ -12,8 +12,11 @@ export interface WorkflowEntry { graph: string; } -// Keep this exported for backward compatibility with other routes that import it. -// It will be populated by the loader, but the static version is kept as fallback. +// Static sample data used by the `workflow-definition` index route for the +// hardcoded showcase workflows. Shape mirrors the v2 `SettingsFile` JSON +// returned by `/api/v1/runs/:id/settings` (see the Rust +// `fabro_types::settings::SettingsFile` type). Fields are opaque to the +// `RunSettings` TypeScript type, which is a bare `Record`. export const workflowData: Record = { fix_build: { name: "Fix Build", @@ -21,17 +24,18 @@ export const workflowData: Record = { filename: "fix_build.fabro", description: "Automatically diagnoses and fixes CI build failures by analyzing error logs, identifying root causes, and applying targeted code changes.", settings: { - version: 1, - goal: "Diagnose and fix CI build failures", - graph: "fix_build.fabro", - llm: { model: "claude-sonnet" }, - vars: { repo_url: "https://github.com/org/service", branch: "main" }, - sandbox: { - provider: "daytona", - daytona: { - auto_stop_interval: 60, - labels: { project: "fix-build" }, - snapshot: { name: "fix-build-dev", cpu: 4, memory: 8, disk: 10 }, + _version: 1, + run: { + goal: "Diagnose and fix CI build failures", + inputs: { repo_url: "https://github.com/org/service", branch: "main" }, + model: { name: "claude-sonnet" }, + sandbox: { + provider: "daytona", + daytona: { + auto_stop_interval: 60, + labels: { project: "fix-build" }, + snapshot: { name: "fix-build-dev", cpu: 4, memory: "8GB", disk: "10GB" }, + }, }, }, }, @@ -62,18 +66,25 @@ export const workflowData: Record = { filename: "implement.fabro", description: "Generates production-ready code from a technical blueprint, including tests, documentation, and a pull request ready for review.", settings: { - version: 1, - goal: "Implement feature from technical blueprint", - graph: "implement.fabro", - llm: { model: "claude-sonnet" }, - vars: { spec_path: "specs/feature.md", test_framework: "vitest" }, - setup: { commands: ["bun install", "bun run typecheck"], timeout_ms: 120000 }, - sandbox: { - provider: "daytona", - daytona: { - auto_stop_interval: 120, - labels: { project: "implement", team: "engineering" }, - snapshot: { name: "implement-dev", cpu: 4, memory: 8, disk: 20 }, + _version: 1, + run: { + goal: "Implement feature from technical blueprint", + inputs: { spec_path: "specs/feature.md", test_framework: "vitest" }, + model: { name: "claude-sonnet" }, + prepare: { + steps: [ + { command: ["bun", "install"] }, + { command: ["bun", "run", "typecheck"] }, + ], + timeout: "120s", + }, + sandbox: { + provider: "daytona", + daytona: { + auto_stop_interval: 120, + labels: { project: "implement", team: "engineering" }, + snapshot: { name: "implement-dev", cpu: 4, memory: "8GB", disk: "20GB" }, + }, }, }, }, @@ -118,17 +129,18 @@ export const workflowData: Record = { filename: "sync_drift.fabro", description: "Detects configuration and code drift between environments, then generates reconciliation patches to bring everything back in sync.", settings: { - version: 1, - goal: "Detect and reconcile configuration drift across environments", - graph: "sync_drift.fabro", - llm: { model: "claude-sonnet" }, - vars: { source_env: "production", target_env: "staging", drift_threshold: "warn" }, - sandbox: { - provider: "daytona", - daytona: { - auto_stop_interval: 120, - labels: { project: "sync-drift", team: "platform" }, - snapshot: { name: "sync-drift-dev", cpu: 2, memory: 4, disk: 10 }, + _version: 1, + run: { + goal: "Detect and reconcile configuration drift across environments", + inputs: { source_env: "production", target_env: "staging", drift_threshold: "warn" }, + model: { name: "claude-sonnet" }, + sandbox: { + provider: "daytona", + daytona: { + auto_stop_interval: 120, + labels: { project: "sync-drift", team: "platform" }, + snapshot: { name: "sync-drift-dev", cpu: 2, memory: "4GB", disk: "10GB" }, + }, }, }, }, @@ -163,17 +175,18 @@ export const workflowData: Record = { filename: "expand.fabro", description: "Evolves the product by analyzing usage patterns and specifications to propose and implement incremental improvements.", settings: { - version: 1, - goal: "Propose and implement incremental product improvements", - graph: "expand.fabro", - llm: { model: "claude-sonnet" }, - vars: { analytics_window: "30d", min_confidence: "0.8" }, - sandbox: { - provider: "daytona", - daytona: { - auto_stop_interval: 180, - labels: { project: "expand", team: "product" }, - snapshot: { name: "expand-dev", cpu: 2, memory: 4, disk: 10 }, + _version: 1, + run: { + goal: "Propose and implement incremental product improvements", + inputs: { analytics_window: "30d", min_confidence: "0.8" }, + model: { name: "claude-sonnet" }, + sandbox: { + provider: "daytona", + daytona: { + auto_stop_interval: 180, + labels: { project: "expand", team: "product" }, + snapshot: { name: "expand-dev", cpu: 2, memory: "4GB", disk: "10GB" }, + }, }, }, },