From 3270136281b6abef9cfdcf5272ae4833b6cd2e6c Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Fri, 3 Apr 2026 11:27:32 -0700 Subject: [PATCH] refactor(run): drop workflow.toml run-dir fallback Remove the run_dir workflow.toml snapshot and the path resolver fallback that treated a missing workflow.toml as a sibling workflow.fabro. SlateDB and explicit workflow inputs are now the only supported sources. --- lib/crates/fabro-config/src/project.rs | 32 +---------- .../fabro-workflow/src/operations/create.rs | 56 ------------------- .../fabro-workflow/src/operations/source.rs | 30 ---------- 3 files changed, 1 insertion(+), 117 deletions(-) diff --git a/lib/crates/fabro-config/src/project.rs b/lib/crates/fabro-config/src/project.rs index 596c08887..91246125a 100644 --- a/lib/crates/fabro-config/src/project.rs +++ b/lib/crates/fabro-config/src/project.rs @@ -12,7 +12,6 @@ pub use fabro_types::settings::project::ProjectSettings; const CONFIG_FILENAME: &str = "fabro.toml"; const SUPPORTED_VERSION: u32 = 1; const RUN_GRAPH_FILE: &str = "workflow.fabro"; -const LEGACY_RUN_GRAPH_FILE: &str = "graph.fabro"; #[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize, crate::Combine)] pub struct ProjectConfig { @@ -98,24 +97,6 @@ fn workflow_slug_from_path(workflow_path: &Path) -> Option { Some(file_stem.into_owned()) } -fn cached_workflow_graph_path(path: &Path) -> Option { - if path.file_name().and_then(|name| name.to_str()) != Some("workflow.toml") { - return None; - } - - let canonical = path.with_file_name(RUN_GRAPH_FILE); - if canonical.exists() { - return Some(canonical); - } - - let legacy = path.with_file_name(LEGACY_RUN_GRAPH_FILE); - if legacy.exists() { - return Some(legacy); - } - - None -} - /// Resolve a workflow argument to a path. /// /// - If the arg has a file extension (`.toml`, `.fabro`, etc.), return it as-is. @@ -146,18 +127,7 @@ pub fn resolve_workflow_path( workflow_slug, }) } - Err(_) if !path.exists() => { - let Some(dot_path) = cached_workflow_graph_path(&path) else { - anyhow::bail!("Workflow not found: {}", path.display()); - }; - Ok(WorkflowPathResolution { - resolved_workflow_path: path, - dot_path, - workflow_config: None, - workflow_toml_path: None, - workflow_slug, - }) - } + Err(_) if !path.exists() => anyhow::bail!("Workflow not found: {}", path.display()), Err(err) => Err(err), } } else { diff --git a/lib/crates/fabro-workflow/src/operations/create.rs b/lib/crates/fabro-workflow/src/operations/create.rs index 98c97fb51..8210839e7 100644 --- a/lib/crates/fabro-workflow/src/operations/create.rs +++ b/lib/crates/fabro-workflow/src/operations/create.rs @@ -21,8 +21,6 @@ use crate::event::{ WorkflowRunEvent, append_workflow_event, canonicalize_event_at, normalize_json_value, }; -const RUN_CONFIG_FILE: &str = "workflow.toml"; - #[derive(Clone, Debug)] pub struct CreateRunInput { pub workflow: WorkflowInput, @@ -116,7 +114,6 @@ pub async fn create(store: &SlateStore, request: CreateRunInput) -> Result Result<(), FabroError> { Ok(()) } -fn write_run_config_snapshot( - run_dir: &Path, - workflow_toml_path: Option<&Path>, -) -> Result<(), FabroError> { - if let Some(toml_path) = workflow_toml_path { - if toml_path.is_file() { - std::fs::copy(toml_path, run_dir.join(RUN_CONFIG_FILE)) - .map_err(|err| FabroError::Io(err.to_string()))?; - } - } - - Ok(()) -} - fn create_from_source( dot_source: &str, options: PersistCreateOptions, @@ -717,45 +700,6 @@ mod tests { assert!(!created.run_dir.join("id.txt").exists()); } - #[tokio::test] - async fn create_copies_workflow_toml_snapshot() { - let dir = tempfile::tempdir().unwrap(); - let workflow_dir = dir.path().join("workflow"); - std::fs::create_dir_all(&workflow_dir).unwrap(); - std::fs::write(workflow_dir.join("workflow.fabro"), MINIMAL_DOT).unwrap(); - std::fs::write( - workflow_dir.join("workflow.toml"), - "version = 1\ngraph = \"workflow.fabro\"\n", - ) - .unwrap(); - - let store = memory_store(); - let created = create( - &store, - CreateRunInput { - workflow: WorkflowInput::Path(workflow_dir.join("workflow.toml")), - settings: Settings { - storage_dir: Some(dir.path().join("storage")), - dry_run: Some(true), - ..Default::default() - }, - cwd: dir.path().to_path_buf(), - workflow_slug: None, - run_dir: None, - run_id: None, - host_repo_path: None, - base_branch: None, - }, - ) - .await - .unwrap(); - - assert_eq!( - std::fs::read_to_string(created.run_dir.join("workflow.toml")).unwrap(), - "version = 1\ngraph = \"workflow.fabro\"\n" - ); - } - #[tokio::test] async fn create_resolves_working_directory_and_repo_path_from_request_cwd() { let dir = tempfile::tempdir().unwrap(); diff --git a/lib/crates/fabro-workflow/src/operations/source.rs b/lib/crates/fabro-workflow/src/operations/source.rs index 9b001042e..567138ead 100644 --- a/lib/crates/fabro-workflow/src/operations/source.rs +++ b/lib/crates/fabro-workflow/src/operations/source.rs @@ -109,36 +109,6 @@ pub(crate) fn resolve_workflow(request: ResolveWorkflowInput) -> anyhow::Result< mod tests { use super::*; - #[test] - fn resolve_workflow_uses_cached_graph_sibling_for_missing_workflow_toml() { - let dir = tempfile::tempdir().unwrap(); - let run_dir = dir - .path() - .join("custom-storage") - .join("runs") - .join("run-123"); - std::fs::create_dir_all(&run_dir).unwrap(); - std::fs::write( - run_dir.join("workflow.fabro"), - "digraph Test { start -> exit }", - ) - .unwrap(); - - let resolved = resolve_workflow(ResolveWorkflowInput { - workflow: WorkflowInput::Path(run_dir.join("workflow.toml")), - settings: Settings::default(), - cwd: dir.path().to_path_buf(), - }) - .unwrap(); - - let expected_dot_path = run_dir.join("workflow.fabro"); - assert_eq!( - resolved.dot_path.as_deref(), - Some(expected_dot_path.as_path()) - ); - assert!(resolved.workflow_toml_path.is_none()); - } - #[test] fn resolve_workflow_uses_explicit_cwd_for_relative_work_dir() { let dir = tempfile::tempdir().unwrap();