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.
This commit is contained in:
Bryan Helmkamp 2026-04-03 11:27:32 -07:00
parent 0e1730a6a3
commit 3270136281
No known key found for this signature in database
3 changed files with 1 additions and 117 deletions

View file

@ -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<String> {
Some(file_stem.into_owned())
}
fn cached_workflow_graph_path(path: &Path) -> Option<PathBuf> {
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 {

View file

@ -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<Creat
goal_override.as_deref(),
)?;
write_run_config_snapshot(&run_dir, resolved.workflow_toml_path.as_deref())?;
let workflow_config = resolved
.workflow_toml_path
.as_deref()
@ -215,20 +212,6 @@ fn validate_sandbox_provider(settings: &Settings) -> 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();

View file

@ -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();