From a60719c036f725a20a16b594eb30f540f1a6fce8 Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Wed, 25 Mar 2026 11:21:16 -0400 Subject: [PATCH] refactor(workflows): move checkpoint, run_record, start_record, sandbox_record into records/ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Consolidate all record types under the records module. Files are renamed to drop the _record suffix (run_record→run, start_record→start, sandbox_record→sandbox) since the module path provides that context. Co-Authored-By: Claude Opus 4.6 (1M context) --- lib/crates/fabro-api/src/server.rs | 6 +++--- lib/crates/fabro-cli/src/commands/attach.rs | 2 +- lib/crates/fabro-cli/src/commands/cp.rs | 2 +- lib/crates/fabro-cli/src/commands/create.rs | 2 +- .../fabro-cli/src/commands/detached_support.rs | 2 +- lib/crates/fabro-cli/src/commands/diff.rs | 4 ++-- lib/crates/fabro-cli/src/commands/inspect.rs | 8 ++++---- lib/crates/fabro-cli/src/commands/pr.rs | 4 ++-- lib/crates/fabro-cli/src/commands/preview.rs | 2 +- lib/crates/fabro-cli/src/commands/resume.rs | 10 +++++----- lib/crates/fabro-cli/src/commands/run.rs | 10 +++++----- lib/crates/fabro-cli/src/commands/runs.rs | 2 +- lib/crates/fabro-cli/src/commands/shared.rs | 2 +- lib/crates/fabro-cli/src/commands/ssh.rs | 2 +- lib/crates/fabro-cli/src/commands/start.rs | 4 ++-- lib/crates/fabro-cli/src/main.rs | 2 +- lib/crates/fabro-workflows/src/git.rs | 16 ++++++++-------- lib/crates/fabro-workflows/src/lib.rs | 6 +----- lib/crates/fabro-workflows/src/lifecycle/disk.rs | 2 +- lib/crates/fabro-workflows/src/lifecycle/git.rs | 2 +- .../fabro-workflows/src/operations/fork.rs | 4 ++-- .../fabro-workflows/src/operations/rewind.rs | 4 ++-- .../fabro-workflows/src/pipeline/execute.rs | 2 +- .../src/pipeline/execute/tests.rs | 4 ++-- .../fabro-workflows/src/pipeline/finalize.rs | 2 +- lib/crates/fabro-workflows/src/pipeline/retro.rs | 4 ++-- lib/crates/fabro-workflows/src/pipeline/types.rs | 2 +- lib/crates/fabro-workflows/src/pull_request.rs | 2 +- .../src/{ => records}/checkpoint.rs | 0 lib/crates/fabro-workflows/src/records/mod.rs | 8 ++++++++ .../src/{run_record.rs => records/run.rs} | 0 .../{sandbox_record.rs => records/sandbox.rs} | 0 .../src/{start_record.rs => records/start.rs} | 0 lib/crates/fabro-workflows/src/run_dir.rs | 4 ++-- lib/crates/fabro-workflows/src/run_lookup.rs | 4 ++-- .../fabro-workflows/src/sandbox_reconnect.rs | 2 +- lib/crates/fabro-workflows/src/test_support.rs | 2 +- .../fabro-workflows/tests/cp_integration.rs | 2 +- .../fabro-workflows/tests/daytona_integration.rs | 4 ++-- lib/crates/fabro-workflows/tests/integration.rs | 6 +++--- 40 files changed, 75 insertions(+), 71 deletions(-) rename lib/crates/fabro-workflows/src/{ => records}/checkpoint.rs (100%) rename lib/crates/fabro-workflows/src/{run_record.rs => records/run.rs} (100%) rename lib/crates/fabro-workflows/src/{sandbox_record.rs => records/sandbox.rs} (100%) rename lib/crates/fabro-workflows/src/{start_record.rs => records/start.rs} (100%) diff --git a/lib/crates/fabro-api/src/server.rs b/lib/crates/fabro-api/src/server.rs index 9279208e4..5cd1ea639 100644 --- a/lib/crates/fabro-api/src/server.rs +++ b/lib/crates/fabro-api/src/server.rs @@ -21,7 +21,7 @@ use fabro_agent::LocalSandbox; use crate::error::ApiError; use crate::jwt_auth::{AuthMode, AuthenticatedService, AuthenticatedUser}; use fabro_interview::{Answer, Interviewer, QuestionType, WebInterviewer}; -use fabro_workflows::checkpoint::Checkpoint; +use fabro_workflows::records::Checkpoint; use fabro_workflows::context::Context; use fabro_workflows::event::{EventEmitter, WorkflowRunEvent}; use fabro_workflows::handler::HandlerRegistry; @@ -503,7 +503,7 @@ async fn start_run( .into_response(); } - let run_record = fabro_workflows::run_record::RunRecord { + let run_record = fabro_workflows::records::RunRecord { run_id: run_id.clone(), created_at, config: fabro_config::config::FabroConfig { @@ -640,7 +640,7 @@ async fn execute_run(state: Arc, run_id: String) { } } - let run_record = match fabro_workflows::run_record::RunRecord::load(&run_dir) { + let run_record = match fabro_workflows::records::RunRecord::load(&run_dir) { Ok(r) => r, Err(e) => { tracing::error!(run_id = %run_id, error = %e, "Failed to load RunRecord"); diff --git a/lib/crates/fabro-cli/src/commands/attach.rs b/lib/crates/fabro-cli/src/commands/attach.rs index c5b8cf236..31dfffc4d 100644 --- a/lib/crates/fabro-cli/src/commands/attach.rs +++ b/lib/crates/fabro-cli/src/commands/attach.rs @@ -41,7 +41,7 @@ pub async fn attach_run( let mut engine_guard = engine_child.map(EngineChildGuard::new); let is_tty = std::io::stderr().is_terminal(); - let verbose = fabro_workflows::run_record::RunRecord::load(run_dir) + let verbose = fabro_workflows::records::RunRecord::load(run_dir) .map(|record| record.config.verbose_enabled()) .unwrap_or(false); let mut progress_ui = run_progress::ProgressUI::new(is_tty, verbose); diff --git a/lib/crates/fabro-cli/src/commands/cp.rs b/lib/crates/fabro-cli/src/commands/cp.rs index cd2f5471c..cd18f8160 100644 --- a/lib/crates/fabro-cli/src/commands/cp.rs +++ b/lib/crates/fabro-cli/src/commands/cp.rs @@ -105,7 +105,7 @@ async fn load_sandbox( let run_dir = fabro_workflows::run_lookup::resolve_run(base, run_prefix)?.path; let sandbox_json = run_dir.join("sandbox.json"); debug!(path = %sandbox_json.display(), "Loading sandbox record"); - let record = fabro_workflows::sandbox_record::SandboxRecord::load(&sandbox_json).context( + let record = fabro_workflows::records::SandboxRecord::load(&sandbox_json).context( "Failed to load sandbox.json — was this run started with a recent version of arc?", )?; diff --git a/lib/crates/fabro-cli/src/commands/create.rs b/lib/crates/fabro-cli/src/commands/create.rs index d89669af0..eecc56265 100644 --- a/lib/crates/fabro-cli/src/commands/create.rs +++ b/lib/crates/fabro-cli/src/commands/create.rs @@ -2,7 +2,7 @@ use std::path::PathBuf; use chrono::Utc; use fabro_config::config::FabroConfig; -use fabro_workflows::run_record::RunRecord; +use fabro_workflows::records::RunRecord; use fabro_workflows::sandbox_provider::SandboxProvider; use super::run::{ diff --git a/lib/crates/fabro-cli/src/commands/detached_support.rs b/lib/crates/fabro-cli/src/commands/detached_support.rs index 472d4a56b..6e6298911 100644 --- a/lib/crates/fabro-cli/src/commands/detached_support.rs +++ b/lib/crates/fabro-cli/src/commands/detached_support.rs @@ -99,7 +99,7 @@ impl Drop for DetachedRunCompletionGuard { } pub(crate) fn load_run_id(run_dir: &Path) -> Option { - fabro_workflows::run_record::RunRecord::load(run_dir) + fabro_workflows::records::RunRecord::load(run_dir) .ok() .map(|record| record.run_id) .filter(|run_id| !run_id.trim().is_empty()) diff --git a/lib/crates/fabro-cli/src/commands/diff.rs b/lib/crates/fabro-cli/src/commands/diff.rs index 13457a1c2..e595872a0 100644 --- a/lib/crates/fabro-cli/src/commands/diff.rs +++ b/lib/crates/fabro-cli/src/commands/diff.rs @@ -48,7 +48,7 @@ async fn resolve_diff(run_dir: &Path, args: &DiffArgs) -> Result { }); } - let start = fabro_workflows::start_record::StartRecord::load(run_dir) + let start = fabro_workflows::records::StartRecord::load(run_dir) .context("Failed to load start.json")?; let base_sha = start @@ -71,7 +71,7 @@ async fn resolve_diff(run_dir: &Path, args: &DiffArgs) -> Result { debug!("No final.patch found; attempting live diff from sandbox"); let sandbox_json = run_dir.join("sandbox.json"); - let record = fabro_workflows::sandbox_record::SandboxRecord::load(&sandbox_json).context( + let record = fabro_workflows::records::SandboxRecord::load(&sandbox_json).context( "Failed to load sandbox.json — was this run started with a recent version of arc?", )?; diff --git a/lib/crates/fabro-cli/src/commands/inspect.rs b/lib/crates/fabro-cli/src/commands/inspect.rs index a05490f32..47d716a28 100644 --- a/lib/crates/fabro-cli/src/commands/inspect.rs +++ b/lib/crates/fabro-cli/src/commands/inspect.rs @@ -36,21 +36,21 @@ fn inspect_run_dir( run_dir: &Path, status: fabro_workflows::run_status::RunStatus, ) -> Result { - let run_record = fabro_workflows::run_record::RunRecord::load(run_dir) + let run_record = fabro_workflows::records::RunRecord::load(run_dir) .ok() .and_then(|v| serde_json::to_value(v).ok()); - let start_record = fabro_workflows::start_record::StartRecord::load(run_dir) + let start_record = fabro_workflows::records::StartRecord::load(run_dir) .ok() .and_then(|v| serde_json::to_value(v).ok()); let conclusion = fabro_workflows::records::Conclusion::load(&run_dir.join("conclusion.json")) .ok() .and_then(|v| serde_json::to_value(v).ok()); let checkpoint = - fabro_workflows::checkpoint::Checkpoint::load(&run_dir.join("checkpoint.json")) + fabro_workflows::records::Checkpoint::load(&run_dir.join("checkpoint.json")) .ok() .and_then(|v| serde_json::to_value(v).ok()); let sandbox = - fabro_workflows::sandbox_record::SandboxRecord::load(&run_dir.join("sandbox.json")) + fabro_workflows::records::SandboxRecord::load(&run_dir.join("sandbox.json")) .ok() .and_then(|v| serde_json::to_value(v).ok()); diff --git a/lib/crates/fabro-cli/src/commands/pr.rs b/lib/crates/fabro-cli/src/commands/pr.rs index 8ab9fbf08..8bf47bb5f 100644 --- a/lib/crates/fabro-cli/src/commands/pr.rs +++ b/lib/crates/fabro-cli/src/commands/pr.rs @@ -325,10 +325,10 @@ async fn create_from( ) -> Result<()> { let run_dir = fabro_workflows::run_lookup::resolve_run(base, &args.run_id)?.path; - let record = fabro_workflows::run_record::RunRecord::load(&run_dir) + let record = fabro_workflows::records::RunRecord::load(&run_dir) .context("Failed to load run.json")?; - let start = fabro_workflows::start_record::StartRecord::load(&run_dir) + let start = fabro_workflows::records::StartRecord::load(&run_dir) .context("Failed to load start.json")?; let conclusion = fabro_workflows::records::Conclusion::load(&run_dir.join("conclusion.json")) diff --git a/lib/crates/fabro-cli/src/commands/preview.rs b/lib/crates/fabro-cli/src/commands/preview.rs index 540027dbd..95747f3b6 100644 --- a/lib/crates/fabro-cli/src/commands/preview.rs +++ b/lib/crates/fabro-cli/src/commands/preview.rs @@ -31,7 +31,7 @@ pub async fn run(args: PreviewArgs) -> Result<()> { let base = fabro_workflows::run_lookup::default_runs_base(); let run_dir = fabro_workflows::run_lookup::resolve_run(&base, &args.run)?.path; let sandbox_json = run_dir.join("sandbox.json"); - let record = fabro_workflows::sandbox_record::SandboxRecord::load(&sandbox_json).context( + let record = fabro_workflows::records::SandboxRecord::load(&sandbox_json).context( "Failed to load sandbox.json — was this run started with a recent version of arc?", )?; diff --git a/lib/crates/fabro-cli/src/commands/resume.rs b/lib/crates/fabro-cli/src/commands/resume.rs index 974fc3daa..f9192a4bc 100644 --- a/lib/crates/fabro-cli/src/commands/resume.rs +++ b/lib/crates/fabro-cli/src/commands/resume.rs @@ -10,7 +10,7 @@ use fabro_config::config::FabroConfig; use fabro_interview::{AutoApproveInterviewer, ConsoleInterviewer, Interviewer}; use fabro_model::{Catalog, Provider}; use fabro_util::terminal::Styles; -use fabro_workflows::checkpoint::Checkpoint; +use fabro_workflows::records::Checkpoint; use fabro_workflows::event::{EventEmitter, RunNoticeLevel}; use fabro_workflows::handler::llm::{AgentApiBackend, AgentCliBackend, BackendRouter}; use fabro_workflows::operations::{ @@ -20,7 +20,7 @@ use fabro_workflows::outcome::StageStatus; use fabro_workflows::pipeline::{ build_conclusion, classify_engine_result, persist_terminal_outcome, }; -use fabro_workflows::run_record::RunRecord; +use fabro_workflows::records::RunRecord; use fabro_workflows::run_settings::{GitCheckpointSettings, LifecycleConfig, RunSettings}; use fabro_workflows::sandbox_provider::SandboxProvider; @@ -254,7 +254,7 @@ async fn prepare_from_checkpoint( &graph, cli_flags, ); - let record = fabro_workflows::run_record::RunRecord { + let record = fabro_workflows::records::RunRecord { run_id: run_id.clone(), created_at: chrono::Utc::now(), config: normalized.clone(), @@ -649,7 +649,7 @@ async fn prepare_from_branch( &graph, cli_flags, ); - let record = fabro_workflows::run_record::RunRecord { + let record = fabro_workflows::records::RunRecord { run_id: run_id.clone(), created_at: chrono::Utc::now(), config: normalized.clone(), @@ -1032,7 +1032,7 @@ async fn run_resumed( }; let is_docker = provider == SandboxProvider::Docker; - let record = fabro_workflows::sandbox_record::SandboxRecord { + let record = fabro_workflows::records::SandboxRecord { provider: provider.to_string(), working_directory: working_directory.clone(), identifier: sandbox_info_opt, diff --git a/lib/crates/fabro-cli/src/commands/run.rs b/lib/crates/fabro-cli/src/commands/run.rs index 573bbe267..a69a186ba 100644 --- a/lib/crates/fabro-cli/src/commands/run.rs +++ b/lib/crates/fabro-cli/src/commands/run.rs @@ -15,7 +15,7 @@ use fabro_config::{project as project_config, run as run_config, sandbox as sand use fabro_interview::{AutoApproveInterviewer, ConsoleInterviewer, FileInterviewer, Interviewer}; use fabro_model::{Catalog, FallbackTarget, Provider}; use fabro_util::terminal::Styles; -use fabro_workflows::checkpoint::Checkpoint; +use fabro_workflows::records::Checkpoint; use fabro_workflows::cost::{compute_stage_cost, format_cost}; use fabro_workflows::devcontainer_bridge; use fabro_workflows::event::{EventEmitter, RunNoticeLevel, WorkflowRunEvent}; @@ -761,7 +761,7 @@ struct RecordBasedRun { /// /// Used by `run_engine_entrypoint` for detached runs that already have a RunRecord on disk. pub async fn run_from_record( - record: fabro_workflows::run_record::RunRecord, + record: fabro_workflows::records::RunRecord, run_dir: PathBuf, run_defaults: FabroConfig, styles: &'static Styles, @@ -962,7 +962,7 @@ async fn run_command_impl( is_cached_run_restart(workflow_path, &run_dir) }; let existing_record = if cached_run_restart { - fabro_workflows::run_record::RunRecord::load(&run_dir).ok() + fabro_workflows::records::RunRecord::load(&run_dir).ok() } else { None }; @@ -1004,7 +1004,7 @@ async fn run_command_impl( &graph, cli_flags, ); - let record = fabro_workflows::run_record::RunRecord { + let record = fabro_workflows::records::RunRecord { run_id: run_id.clone(), created_at: chrono::Utc::now(), config: normalized_config.clone(), @@ -1404,7 +1404,7 @@ async fn run_command_impl( }); let is_docker = provider == SandboxProvider::Docker; - let record = fabro_workflows::sandbox_record::SandboxRecord { + let record = fabro_workflows::records::SandboxRecord { provider: provider.to_string(), working_directory: working_directory.clone(), identifier: sandbox_info_opt, diff --git a/lib/crates/fabro-cli/src/commands/runs.rs b/lib/crates/fabro-cli/src/commands/runs.rs index c124a9d97..c8ef6bb8b 100644 --- a/lib/crates/fabro-cli/src/commands/runs.rs +++ b/lib/crates/fabro-cli/src/commands/runs.rs @@ -539,7 +539,7 @@ async fn remove_from(args: &RunsRemoveArgs, base: &Path) -> Result<()> { ); let sandbox_path = run.path.join("sandbox.json"); - if let Ok(record) = fabro_workflows::sandbox_record::SandboxRecord::load(&sandbox_path) { + if let Ok(record) = fabro_workflows::records::SandboxRecord::load(&sandbox_path) { if record.provider != "local" { match fabro_workflows::sandbox_reconnect::reconnect(&record).await { Ok(sandbox) => { diff --git a/lib/crates/fabro-cli/src/commands/shared.rs b/lib/crates/fabro-cli/src/commands/shared.rs index 760477017..2fda35951 100644 --- a/lib/crates/fabro-cli/src/commands/shared.rs +++ b/lib/crates/fabro-cli/src/commands/shared.rs @@ -85,7 +85,7 @@ pub fn split_run_path(s: &str) -> Option<(&str, &str)> { } pub fn validate_daytona_provider( - record: &fabro_workflows::sandbox_record::SandboxRecord, + record: &fabro_workflows::records::SandboxRecord, feature: &str, ) -> Result<()> { if record.provider != "daytona" { diff --git a/lib/crates/fabro-cli/src/commands/ssh.rs b/lib/crates/fabro-cli/src/commands/ssh.rs index f86bdbb07..88763e210 100644 --- a/lib/crates/fabro-cli/src/commands/ssh.rs +++ b/lib/crates/fabro-cli/src/commands/ssh.rs @@ -20,7 +20,7 @@ pub async fn run(args: SshArgs) -> Result<()> { let base = fabro_workflows::run_lookup::default_runs_base(); let run_dir = fabro_workflows::run_lookup::resolve_run(&base, &args.run)?.path; let sandbox_json = run_dir.join("sandbox.json"); - let record = fabro_workflows::sandbox_record::SandboxRecord::load(&sandbox_json).context( + let record = fabro_workflows::records::SandboxRecord::load(&sandbox_json).context( "Failed to load sandbox.json — was this run started with a recent version of arc?", )?; diff --git a/lib/crates/fabro-cli/src/commands/start.rs b/lib/crates/fabro-cli/src/commands/start.rs index 8ac693782..7e6a3463b 100644 --- a/lib/crates/fabro-cli/src/commands/start.rs +++ b/lib/crates/fabro-cli/src/commands/start.rs @@ -23,7 +23,7 @@ pub fn start_run(run_dir: &Path) -> Result { } // Validate run.json is loadable - fabro_workflows::run_record::RunRecord::load(run_dir) + fabro_workflows::records::RunRecord::load(run_dir) .map_err(|e| anyhow::anyhow!("Cannot start run: failed to load run.json: {e}"))?; // Write Starting status before spawning to prevent duplicate engines @@ -105,7 +105,7 @@ mod tests { use chrono::Utc; use fabro_config::config::FabroConfig; use fabro_graphviz::graph::Graph; - use fabro_workflows::run_record::RunRecord; + use fabro_workflows::records::RunRecord; use fabro_workflows::run_status::{write_run_status, RunStatus, RunStatusRecord, StatusReason}; use std::collections::HashMap; use std::path::PathBuf; diff --git a/lib/crates/fabro-cli/src/main.rs b/lib/crates/fabro-cli/src/main.rs index 8128710f6..ed6d536fb 100644 --- a/lib/crates/fabro-cli/src/main.rs +++ b/lib/crates/fabro-cli/src/main.rs @@ -324,7 +324,7 @@ async fn run_engine_entrypoint( cli_config.git_author().and_then(|a| a.email.clone()), ); - let record = match fabro_workflows::run_record::RunRecord::load(&run_dir) { + let record = match fabro_workflows::records::RunRecord::load(&run_dir) { Ok(record) => record, Err(err) => { let anyhow_err: anyhow::Error = anyhow::anyhow!("Failed to load run record: {err}"); diff --git a/lib/crates/fabro-workflows/src/git.rs b/lib/crates/fabro-workflows/src/git.rs index e281d93f8..fa4b91f1a 100644 --- a/lib/crates/fabro-workflows/src/git.rs +++ b/lib/crates/fabro-workflows/src/git.rs @@ -5,7 +5,7 @@ use fabro_git_storage::branchstore::BranchStore; use fabro_git_storage::gitobj::Store; use git2::{Repository, Signature}; -use crate::checkpoint::Checkpoint; +use crate::records::Checkpoint; use crate::error::{FabroError, Result}; /// Branch prefix for workflow run branches (e.g. `fabro/run/{run_id}`). @@ -485,10 +485,10 @@ impl MetadataStore { pub fn read_run_record( repo_path: &Path, run_id: &str, - ) -> Result> { + ) -> Result> { match Self::read_file(repo_path, run_id, "run.json")? { Some(bytes) => { - let record: crate::run_record::RunRecord = serde_json::from_slice(&bytes) + let record: crate::records::RunRecord = serde_json::from_slice(&bytes) .map_err(|e| git_error(format!("run record deserialize failed: {e}")))?; Ok(Some(record)) } @@ -500,10 +500,10 @@ impl MetadataStore { pub fn read_start_record( repo_path: &Path, run_id: &str, - ) -> Result> { + ) -> Result> { match Self::read_file(repo_path, run_id, "start.json")? { Some(bytes) => { - let record: crate::start_record::StartRecord = serde_json::from_slice(&bytes) + let record: crate::records::StartRecord = serde_json::from_slice(&bytes) .map_err(|e| git_error(format!("start record deserialize failed: {e}")))?; Ok(Some(record)) } @@ -634,7 +634,7 @@ mod tests { let ctx = crate::context::Context::new(); ctx.set("goal", serde_json::json!("test")); - let cp = crate::checkpoint::Checkpoint::from_context( + let cp = crate::records::Checkpoint::from_context( &ctx, "node_a", vec!["start".to_string()], @@ -669,7 +669,7 @@ mod tests { store.init_run("RUN3", &[]).unwrap(); let ctx = crate::context::Context::new(); - let cp1 = crate::checkpoint::Checkpoint::from_context( + let cp1 = crate::records::Checkpoint::from_context( &ctx, "node_a", vec!["start".to_string()], @@ -683,7 +683,7 @@ mod tests { let cp1_json = serde_json::to_vec_pretty(&cp1).unwrap(); store.write_checkpoint("RUN3", &cp1_json, &[]).unwrap(); - let cp2 = crate::checkpoint::Checkpoint::from_context( + let cp2 = crate::records::Checkpoint::from_context( &ctx, "node_b", vec!["start".to_string(), "node_a".to_string()], diff --git a/lib/crates/fabro-workflows/src/lib.rs b/lib/crates/fabro-workflows/src/lib.rs index 33d7d2558..ec451f336 100644 --- a/lib/crates/fabro-workflows/src/lib.rs +++ b/lib/crates/fabro-workflows/src/lib.rs @@ -28,7 +28,7 @@ pub(crate) fn load_json( /// Build `Vec` from a `Checkpoint`, mapping workflow-engine /// types into the flat struct expected by `fabro_retro::retro::derive_retro`. pub fn build_completed_stages( - cp: &checkpoint::Checkpoint, + cp: &records::Checkpoint, run_failed: bool, ) -> Vec { use outcome::{OutcomeExt, StageStatus}; @@ -91,7 +91,6 @@ pub fn build_completed_stages( pub mod artifact; pub mod asset_snapshot; pub mod assets; -pub mod checkpoint; pub mod condition; pub mod context; pub mod cost; @@ -111,14 +110,11 @@ pub mod pull_request; pub mod records; pub mod run_dir; pub mod run_lookup; -pub mod run_record; pub mod run_settings; pub mod run_status; pub mod sandbox_git; pub mod sandbox_provider; pub mod sandbox_reconnect; -pub mod sandbox_record; -pub mod start_record; #[doc(hidden)] pub mod test_support; pub mod transforms; diff --git a/lib/crates/fabro-workflows/src/lifecycle/disk.rs b/lib/crates/fabro-workflows/src/lifecycle/disk.rs index f22e91ecf..fa2116ebe 100644 --- a/lib/crates/fabro-workflows/src/lifecycle/disk.rs +++ b/lib/crates/fabro-workflows/src/lifecycle/disk.rs @@ -9,7 +9,7 @@ use fabro_core::outcome::NodeResult; use fabro_core::state::RunState; use super::circuit_breaker::CircuitBreakerLifecycle; -use crate::checkpoint::Checkpoint; +use crate::records::Checkpoint; use crate::event::{EventEmitter, RunNoticeLevel, WorkflowRunEvent}; use crate::graph::WorkflowGraph; use crate::graph::WorkflowNode; diff --git a/lib/crates/fabro-workflows/src/lifecycle/git.rs b/lib/crates/fabro-workflows/src/lifecycle/git.rs index 0bc5efc1f..da96e1c15 100644 --- a/lib/crates/fabro-workflows/src/lifecycle/git.rs +++ b/lib/crates/fabro-workflows/src/lifecycle/git.rs @@ -172,7 +172,7 @@ impl RunLifecycle for GitLifecycle { // Re-save checkpoint.json with SHA let checkpoint_path = self.run_dir.join("checkpoint.json"); - if let Ok(mut cp) = crate::checkpoint::Checkpoint::load(&checkpoint_path) { + if let Ok(mut cp) = crate::records::Checkpoint::load(&checkpoint_path) { cp.git_commit_sha = Some(sha.clone()); if let Err(e) = cp.save(&checkpoint_path) { self.emitter.emit(&WorkflowRunEvent::RunNotice { diff --git a/lib/crates/fabro-workflows/src/operations/fork.rs b/lib/crates/fabro-workflows/src/operations/fork.rs index 769228876..70128832e 100644 --- a/lib/crates/fabro-workflows/src/operations/fork.rs +++ b/lib/crates/fabro-workflows/src/operations/fork.rs @@ -4,8 +4,8 @@ use fabro_git_storage::gitobj::Store; use git2::{Oid, Signature}; use crate::git::MetadataStore; -use crate::run_record::RunRecord; -use crate::start_record::StartRecord; +use crate::records::RunRecord; +use crate::records::StartRecord; use super::rewind::TimelineEntry; diff --git a/lib/crates/fabro-workflows/src/operations/rewind.rs b/lib/crates/fabro-workflows/src/operations/rewind.rs index 96603672c..e22f4e90b 100644 --- a/lib/crates/fabro-workflows/src/operations/rewind.rs +++ b/lib/crates/fabro-workflows/src/operations/rewind.rs @@ -5,7 +5,7 @@ use fabro_git_storage::branchstore::{BranchStore, CommitInfo}; use fabro_git_storage::gitobj::Store; use git2::{Oid, Repository, Signature}; -use crate::checkpoint::Checkpoint; +use crate::records::Checkpoint; use crate::git::MetadataStore; use fabro_graphviz::graph::Graph; @@ -322,7 +322,7 @@ pub fn load_parallel_map(store: &Store, run_id: &str) -> HashMap let bs = BranchStore::new(store, &branch, &sig); if let Ok(Some(run_bytes)) = bs.read_entry("run.json") { - if let Ok(record) = serde_json::from_slice::(&run_bytes) { + if let Ok(record) = serde_json::from_slice::(&run_bytes) { return detect_parallel_interior(&record.graph); } } diff --git a/lib/crates/fabro-workflows/src/pipeline/execute.rs b/lib/crates/fabro-workflows/src/pipeline/execute.rs index c3adfc8b5..82c896727 100644 --- a/lib/crates/fabro-workflows/src/pipeline/execute.rs +++ b/lib/crates/fabro-workflows/src/pipeline/execute.rs @@ -16,7 +16,7 @@ use crate::sandbox_git::GitState; use super::types::{Executed, Initialized}; -fn seed_context_from_checkpoint(checkpoint: Option<&crate::checkpoint::Checkpoint>) -> Context { +fn seed_context_from_checkpoint(checkpoint: Option<&crate::records::Checkpoint>) -> Context { let context = Context::new(); if let Some(cp) = checkpoint { for (k, v) in &cp.context_values { diff --git a/lib/crates/fabro-workflows/src/pipeline/execute/tests.rs b/lib/crates/fabro-workflows/src/pipeline/execute/tests.rs index 1c574af57..7d124ff4c 100644 --- a/lib/crates/fabro-workflows/src/pipeline/execute/tests.rs +++ b/lib/crates/fabro-workflows/src/pipeline/execute/tests.rs @@ -12,7 +12,7 @@ use fabro_hooks::HookConfig; use fabro_interview::AutoApproveInterviewer; use super::*; -use crate::checkpoint::Checkpoint; +use crate::records::Checkpoint; use crate::context::{self, Context}; use crate::error::FabroError; use crate::event::{EventEmitter, WorkflowRunEvent}; @@ -497,7 +497,7 @@ async fn execute_writes_start_json_and_node_status() { .await .unwrap(); - let start = crate::start_record::StartRecord::load(dir.path()).unwrap(); + let start = crate::records::StartRecord::load(dir.path()).unwrap(); assert_eq!(start.run_id, "test-run"); assert_eq!(start.run_branch.as_deref(), Some("fabro/run/test-run")); assert_eq!(start.base_sha.as_deref(), Some("abc123")); diff --git a/lib/crates/fabro-workflows/src/pipeline/finalize.rs b/lib/crates/fabro-workflows/src/pipeline/finalize.rs index 72b6adef7..366a322fe 100644 --- a/lib/crates/fabro-workflows/src/pipeline/finalize.rs +++ b/lib/crates/fabro-workflows/src/pipeline/finalize.rs @@ -1,7 +1,7 @@ use std::path::Path; use std::sync::Arc; -use crate::checkpoint::Checkpoint; +use crate::records::Checkpoint; use crate::error::FabroError; use crate::event::{EventEmitter, RunNoticeLevel, WorkflowRunEvent}; use crate::outcome::{Outcome, OutcomeExt, StageStatus}; diff --git a/lib/crates/fabro-workflows/src/pipeline/retro.rs b/lib/crates/fabro-workflows/src/pipeline/retro.rs index 4b1b72981..77cff9950 100644 --- a/lib/crates/fabro-workflows/src/pipeline/retro.rs +++ b/lib/crates/fabro-workflows/src/pipeline/retro.rs @@ -3,7 +3,7 @@ use std::sync::Arc; use fabro_agent::SessionEvent; use fabro_retro::retro::Retro; -use crate::checkpoint::Checkpoint; +use crate::records::Checkpoint; use crate::event::WorkflowRunEvent; use super::types::{Executed, RetroOptions, Retroed}; @@ -151,7 +151,7 @@ mod tests { use fabro_graphviz::graph::Graph; use super::*; - use crate::checkpoint::Checkpoint; + use crate::records::Checkpoint; use crate::context::Context; use crate::event::{EventEmitter, WorkflowRunEvent}; use crate::pipeline::types::Executed; diff --git a/lib/crates/fabro-workflows/src/pipeline/types.rs b/lib/crates/fabro-workflows/src/pipeline/types.rs index 98c1a66b2..0186a9221 100644 --- a/lib/crates/fabro-workflows/src/pipeline/types.rs +++ b/lib/crates/fabro-workflows/src/pipeline/types.rs @@ -7,7 +7,7 @@ use fabro_graphviz::graph::Graph; use fabro_hooks::HookRunner; use fabro_validate::Diagnostic; -use crate::checkpoint::Checkpoint; +use crate::records::Checkpoint; use crate::context::Context; use crate::error::FabroError; use crate::event::EventEmitter; diff --git a/lib/crates/fabro-workflows/src/pull_request.rs b/lib/crates/fabro-workflows/src/pull_request.rs index a55df5c7c..bce1e02a8 100644 --- a/lib/crates/fabro-workflows/src/pull_request.rs +++ b/lib/crates/fabro-workflows/src/pull_request.rs @@ -7,7 +7,7 @@ use tracing::{debug, info}; use fabro_github::{self as github_app, ssh_url_to_https, GitHubAppCredentials}; use crate::records::Conclusion; -use crate::run_record::RunRecord; +use crate::records::RunRecord; use fabro_retro::retro::Retro; /// Record of a pull request created for a workflow run. diff --git a/lib/crates/fabro-workflows/src/checkpoint.rs b/lib/crates/fabro-workflows/src/records/checkpoint.rs similarity index 100% rename from lib/crates/fabro-workflows/src/checkpoint.rs rename to lib/crates/fabro-workflows/src/records/checkpoint.rs diff --git a/lib/crates/fabro-workflows/src/records/mod.rs b/lib/crates/fabro-workflows/src/records/mod.rs index 03a27be2c..532cfa20d 100644 --- a/lib/crates/fabro-workflows/src/records/mod.rs +++ b/lib/crates/fabro-workflows/src/records/mod.rs @@ -1,3 +1,11 @@ +mod checkpoint; mod conclusion; +mod run; +mod sandbox; +mod start; +pub use checkpoint::Checkpoint; pub use conclusion::{Conclusion, StageSummary}; +pub use run::RunRecord; +pub use sandbox::SandboxRecord; +pub use start::StartRecord; diff --git a/lib/crates/fabro-workflows/src/run_record.rs b/lib/crates/fabro-workflows/src/records/run.rs similarity index 100% rename from lib/crates/fabro-workflows/src/run_record.rs rename to lib/crates/fabro-workflows/src/records/run.rs diff --git a/lib/crates/fabro-workflows/src/sandbox_record.rs b/lib/crates/fabro-workflows/src/records/sandbox.rs similarity index 100% rename from lib/crates/fabro-workflows/src/sandbox_record.rs rename to lib/crates/fabro-workflows/src/records/sandbox.rs diff --git a/lib/crates/fabro-workflows/src/start_record.rs b/lib/crates/fabro-workflows/src/records/start.rs similarity index 100% rename from lib/crates/fabro-workflows/src/start_record.rs rename to lib/crates/fabro-workflows/src/records/start.rs diff --git a/lib/crates/fabro-workflows/src/run_dir.rs b/lib/crates/fabro-workflows/src/run_dir.rs index 91d56ca37..a4577c193 100644 --- a/lib/crates/fabro-workflows/src/run_dir.rs +++ b/lib/crates/fabro-workflows/src/run_dir.rs @@ -10,9 +10,9 @@ use crate::run_settings::RunSettings; pub(crate) fn write_start_record( run_dir: &Path, settings: &RunSettings, -) -> crate::start_record::StartRecord { +) -> crate::records::StartRecord { let git_state = settings.git.as_ref(); - let record = crate::start_record::StartRecord { + let record = crate::records::StartRecord { run_id: settings.run_id.clone(), start_time: Utc::now(), run_branch: git_state.and_then(|g| g.run_branch.clone()), diff --git a/lib/crates/fabro-workflows/src/run_lookup.rs b/lib/crates/fabro-workflows/src/run_lookup.rs index 19285a8a4..2ea33c0fd 100644 --- a/lib/crates/fabro-workflows/src/run_lookup.rs +++ b/lib/crates/fabro-workflows/src/run_lookup.rs @@ -5,9 +5,9 @@ use anyhow::{bail, Context, Result}; use chrono::{DateTime, Utc}; use serde::Serialize; -use crate::run_record::RunRecord; +use crate::records::RunRecord; use crate::run_status::{RunStatus, RunStatusRecord, StatusReason}; -use crate::start_record::StartRecord; +use crate::records::StartRecord; #[derive(Debug, Clone, Serialize)] pub struct RunInfo { diff --git a/lib/crates/fabro-workflows/src/sandbox_reconnect.rs b/lib/crates/fabro-workflows/src/sandbox_reconnect.rs index 0f5151e13..e94b139b9 100644 --- a/lib/crates/fabro-workflows/src/sandbox_reconnect.rs +++ b/lib/crates/fabro-workflows/src/sandbox_reconnect.rs @@ -2,7 +2,7 @@ use std::path::PathBuf; use anyhow::{bail, Context, Result}; -use crate::sandbox_record::SandboxRecord; +use crate::records::SandboxRecord; /// Reconnect to a sandbox from a saved record. /// diff --git a/lib/crates/fabro-workflows/src/test_support.rs b/lib/crates/fabro-workflows/src/test_support.rs index 05fe18c68..57c8fbff0 100644 --- a/lib/crates/fabro-workflows/src/test_support.rs +++ b/lib/crates/fabro-workflows/src/test_support.rs @@ -3,7 +3,7 @@ use std::sync::Arc; use fabro_agent::Sandbox; -use crate::checkpoint::Checkpoint; +use crate::records::Checkpoint; use crate::error::Result; use crate::event::EventEmitter; use crate::handler::HandlerRegistry; diff --git a/lib/crates/fabro-workflows/tests/cp_integration.rs b/lib/crates/fabro-workflows/tests/cp_integration.rs index 8db417734..d5cebbbc8 100644 --- a/lib/crates/fabro-workflows/tests/cp_integration.rs +++ b/lib/crates/fabro-workflows/tests/cp_integration.rs @@ -5,7 +5,7 @@ //! Run Docker tests with: `cargo test --package arc-workflows --test cp_integration -- --ignored` use fabro_workflows::sandbox_reconnect::reconnect; -use fabro_workflows::sandbox_record::SandboxRecord; +use fabro_workflows::records::SandboxRecord; // --------------------------------------------------------------------------- // Local sandbox diff --git a/lib/crates/fabro-workflows/tests/daytona_integration.rs b/lib/crates/fabro-workflows/tests/daytona_integration.rs index 23ce1788a..99ccfea01 100644 --- a/lib/crates/fabro-workflows/tests/daytona_integration.rs +++ b/lib/crates/fabro-workflows/tests/daytona_integration.rs @@ -13,7 +13,7 @@ use fabro_graphviz::graph::{AttrValue, Edge, Graph, Node}; use fabro_llm::provider::Provider; use fabro_sandbox::daytona::{DaytonaConfig, DaytonaSandbox, DaytonaSnapshotConfig}; use fabro_workflows::artifact::sync_artifacts_to_env; -use fabro_workflows::checkpoint::Checkpoint; +use fabro_workflows::records::Checkpoint; use fabro_workflows::context::Context; use fabro_workflows::error::FabroError; use fabro_workflows::event::EventEmitter; @@ -1741,7 +1741,7 @@ async fn daytona_toolbox_idle_diagnostic() { #[ignore] async fn daytona_cp_upload_download_round_trip() { use fabro_workflows::sandbox_reconnect::reconnect; - use fabro_workflows::sandbox_record::SandboxRecord; + use fabro_workflows::records::SandboxRecord; // 1. Create and initialize a real Daytona sandbox let env = create_env().await; diff --git a/lib/crates/fabro-workflows/tests/integration.rs b/lib/crates/fabro-workflows/tests/integration.rs index 4bfd031a7..6fc248891 100644 --- a/lib/crates/fabro-workflows/tests/integration.rs +++ b/lib/crates/fabro-workflows/tests/integration.rs @@ -12,7 +12,7 @@ use fabro_interview::{ }; use fabro_llm::provider::Provider; use fabro_validate::{validate, validate_or_raise, Severity}; -use fabro_workflows::checkpoint::Checkpoint; +use fabro_workflows::records::Checkpoint; use fabro_workflows::context::Context; use fabro_workflows::error::FabroError; use fabro_workflows::event::{EventEmitter, WorkflowRunEvent}; @@ -5967,7 +5967,7 @@ mod real_llm { use super::local_env; use fabro_graphviz::graph::{AttrValue, Edge, Graph}; use fabro_interview::AutoApproveInterviewer; - use fabro_workflows::checkpoint::Checkpoint; + use fabro_workflows::records::Checkpoint; use fabro_workflows::event::EventEmitter; use fabro_workflows::handler::exit::ExitHandler; use fabro_workflows::handler::human::HumanHandler; @@ -8716,7 +8716,7 @@ async fn large_context_values_are_offloaded_to_artifact_store() { // The checkpoint context should contain an artifact pointer, not the full value let checkpoint = - fabro_workflows::checkpoint::Checkpoint::load(&dir.path().join("checkpoint.json")) + fabro_workflows::records::Checkpoint::load(&dir.path().join("checkpoint.json")) .expect("checkpoint should load"); let pointer_value = checkpoint .context_values