refactor(fabro-web): stage 6.6 rewrite workflowData literal to v2 shape

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<string, unknown>`, 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) <noreply@anthropic.com>
This commit is contained in:
Bryan Helmkamp 2026-04-09 17:18:34 -04:00
parent f5b9f82a27
commit 65a9fd137b
No known key found for this signature in database

View file

@ -12,8 +12,11 @@ export interface WorkflowEntry {
graph: string; graph: string;
} }
// Keep this exported for backward compatibility with other routes that import it. // Static sample data used by the `workflow-definition` index route for the
// It will be populated by the loader, but the static version is kept as fallback. // 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<string, unknown>`.
export const workflowData: Record<string, WorkflowEntry> = { export const workflowData: Record<string, WorkflowEntry> = {
fix_build: { fix_build: {
name: "Fix Build", name: "Fix Build",
@ -21,17 +24,18 @@ export const workflowData: Record<string, WorkflowEntry> = {
filename: "fix_build.fabro", filename: "fix_build.fabro",
description: "Automatically diagnoses and fixes CI build failures by analyzing error logs, identifying root causes, and applying targeted code changes.", description: "Automatically diagnoses and fixes CI build failures by analyzing error logs, identifying root causes, and applying targeted code changes.",
settings: { settings: {
version: 1, _version: 1,
goal: "Diagnose and fix CI build failures", run: {
graph: "fix_build.fabro", goal: "Diagnose and fix CI build failures",
llm: { model: "claude-sonnet" }, inputs: { repo_url: "https://github.com/org/service", branch: "main" },
vars: { repo_url: "https://github.com/org/service", branch: "main" }, model: { name: "claude-sonnet" },
sandbox: { sandbox: {
provider: "daytona", provider: "daytona",
daytona: { daytona: {
auto_stop_interval: 60, auto_stop_interval: 60,
labels: { project: "fix-build" }, labels: { project: "fix-build" },
snapshot: { name: "fix-build-dev", cpu: 4, memory: 8, disk: 10 }, snapshot: { name: "fix-build-dev", cpu: 4, memory: "8GB", disk: "10GB" },
},
}, },
}, },
}, },
@ -62,18 +66,25 @@ export const workflowData: Record<string, WorkflowEntry> = {
filename: "implement.fabro", filename: "implement.fabro",
description: "Generates production-ready code from a technical blueprint, including tests, documentation, and a pull request ready for review.", description: "Generates production-ready code from a technical blueprint, including tests, documentation, and a pull request ready for review.",
settings: { settings: {
version: 1, _version: 1,
goal: "Implement feature from technical blueprint", run: {
graph: "implement.fabro", goal: "Implement feature from technical blueprint",
llm: { model: "claude-sonnet" }, inputs: { spec_path: "specs/feature.md", test_framework: "vitest" },
vars: { spec_path: "specs/feature.md", test_framework: "vitest" }, model: { name: "claude-sonnet" },
setup: { commands: ["bun install", "bun run typecheck"], timeout_ms: 120000 }, prepare: {
sandbox: { steps: [
provider: "daytona", { command: ["bun", "install"] },
daytona: { { command: ["bun", "run", "typecheck"] },
auto_stop_interval: 120, ],
labels: { project: "implement", team: "engineering" }, timeout: "120s",
snapshot: { name: "implement-dev", cpu: 4, memory: 8, disk: 20 }, },
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<string, WorkflowEntry> = {
filename: "sync_drift.fabro", filename: "sync_drift.fabro",
description: "Detects configuration and code drift between environments, then generates reconciliation patches to bring everything back in sync.", description: "Detects configuration and code drift between environments, then generates reconciliation patches to bring everything back in sync.",
settings: { settings: {
version: 1, _version: 1,
goal: "Detect and reconcile configuration drift across environments", run: {
graph: "sync_drift.fabro", goal: "Detect and reconcile configuration drift across environments",
llm: { model: "claude-sonnet" }, inputs: { source_env: "production", target_env: "staging", drift_threshold: "warn" },
vars: { source_env: "production", target_env: "staging", drift_threshold: "warn" }, model: { name: "claude-sonnet" },
sandbox: { sandbox: {
provider: "daytona", provider: "daytona",
daytona: { daytona: {
auto_stop_interval: 120, auto_stop_interval: 120,
labels: { project: "sync-drift", team: "platform" }, labels: { project: "sync-drift", team: "platform" },
snapshot: { name: "sync-drift-dev", cpu: 2, memory: 4, disk: 10 }, snapshot: { name: "sync-drift-dev", cpu: 2, memory: "4GB", disk: "10GB" },
},
}, },
}, },
}, },
@ -163,17 +175,18 @@ export const workflowData: Record<string, WorkflowEntry> = {
filename: "expand.fabro", filename: "expand.fabro",
description: "Evolves the product by analyzing usage patterns and specifications to propose and implement incremental improvements.", description: "Evolves the product by analyzing usage patterns and specifications to propose and implement incremental improvements.",
settings: { settings: {
version: 1, _version: 1,
goal: "Propose and implement incremental product improvements", run: {
graph: "expand.fabro", goal: "Propose and implement incremental product improvements",
llm: { model: "claude-sonnet" }, inputs: { analytics_window: "30d", min_confidence: "0.8" },
vars: { analytics_window: "30d", min_confidence: "0.8" }, model: { name: "claude-sonnet" },
sandbox: { sandbox: {
provider: "daytona", provider: "daytona",
daytona: { daytona: {
auto_stop_interval: 180, auto_stop_interval: 180,
labels: { project: "expand", team: "product" }, labels: { project: "expand", team: "product" },
snapshot: { name: "expand-dev", cpu: 2, memory: 4, disk: 10 }, snapshot: { name: "expand-dev", cpu: 2, memory: "4GB", disk: "10GB" },
},
}, },
}, },
}, },