diff --git a/lib/crates/fabro-cli/src/store.rs b/lib/crates/fabro-cli/src/store.rs index 8242edb8f..2f1dad234 100644 --- a/lib/crates/fabro-cli/src/store.rs +++ b/lib/crates/fabro-cli/src/store.rs @@ -14,7 +14,7 @@ pub(crate) fn build_store(storage_dir: &Path) -> Result> { Ok(Arc::new(SlateStore::new( object_store, "", - Duration::from_millis(5), + Duration::from_millis(1), ))) } diff --git a/lib/crates/fabro-cli/tests/it/cmd/attach.rs b/lib/crates/fabro-cli/tests/it/cmd/attach.rs index b3fd9596a..9684e979c 100644 --- a/lib/crates/fabro-cli/tests/it/cmd/attach.rs +++ b/lib/crates/fabro-cli/tests/it/cmd/attach.rs @@ -396,7 +396,7 @@ fn attach_json_errors_without_prompting_for_human_input() { }, "host_repo_path": "[TEMP_DIR]", "labels": {}, - "run_dir": "[STORAGE_DIR]/runs/20260401-[ULID]", + "run_dir": "[RUN_DIR]", "settings": { "goal": "Wait for approval", "llm": { diff --git a/lib/crates/fabro-cli/tests/it/cmd/diff.rs b/lib/crates/fabro-cli/tests/it/cmd/diff.rs index aa63f0673..b7e1d0147 100644 --- a/lib/crates/fabro-cli/tests/it/cmd/diff.rs +++ b/lib/crates/fabro-cli/tests/it/cmd/diff.rs @@ -19,7 +19,7 @@ fn build_store(storage_dir: &std::path::Path) -> Arc { Arc::new(fabro_store::SlateStore::new( object_store, "", - std::time::Duration::from_millis(5), + std::time::Duration::from_millis(1), )) } diff --git a/lib/crates/fabro-cli/tests/it/cmd/pr_view.rs b/lib/crates/fabro-cli/tests/it/cmd/pr_view.rs index ed844e28c..ae157c2d8 100644 --- a/lib/crates/fabro-cli/tests/it/cmd/pr_view.rs +++ b/lib/crates/fabro-cli/tests/it/cmd/pr_view.rs @@ -19,7 +19,7 @@ fn build_store(storage_dir: &std::path::Path) -> Arc { Arc::new(fabro_store::SlateStore::new( object_store, "", - std::time::Duration::from_millis(5), + std::time::Duration::from_millis(1), )) } diff --git a/lib/crates/fabro-cli/tests/it/cmd/run.rs b/lib/crates/fabro-cli/tests/it/cmd/run.rs index 2c79d65b1..9c4885318 100644 --- a/lib/crates/fabro-cli/tests/it/cmd/run.rs +++ b/lib/crates/fabro-cli/tests/it/cmd/run.rs @@ -342,7 +342,7 @@ fn json_run_implies_auto_approve_for_human_gates() { }, "host_repo_path": "[TEMP_DIR]", "labels": {}, - "run_dir": "[STORAGE_DIR]/runs/20260401-[ULID]", + "run_dir": "[RUN_DIR]", "settings": { "auto_approve": true, "goal": "Route through the default approval path", diff --git a/lib/crates/fabro-cli/tests/it/cmd/support.rs b/lib/crates/fabro-cli/tests/it/cmd/support.rs index 9a7ebb4ed..e40fb330b 100644 --- a/lib/crates/fabro-cli/tests/it/cmd/support.rs +++ b/lib/crates/fabro-cli/tests/it/cmd/support.rs @@ -59,13 +59,6 @@ pub(crate) fn output_stdout(output: &Output) -> String { stdout(output) } -pub(crate) fn read_json(path: &Path) -> Value { - let content = std::fs::read_to_string(path) - .unwrap_or_else(|err| panic!("failed to read {}: {err}", path.display())); - serde_json::from_str(&content) - .unwrap_or_else(|err| panic!("failed to parse {}: {err}", path.display())) -} - pub(crate) fn read_text(path: &Path) -> String { std::fs::read_to_string(path) .unwrap_or_else(|err| panic!("failed to read {}: {err}", path.display())) @@ -490,7 +483,7 @@ fn run_store(run_dir: &Path) -> Option> { let storage_dir = runs_dir.parent()?; let run_id: RunId = infer_run_id(run_dir).parse().ok()?; let object_store = Arc::new(LocalFileSystem::new_with_prefix(storage_dir.join("store")).ok()?); - let store = Arc::new(SlateStore::new(object_store, "", Duration::from_millis(5))); + let store = Arc::new(SlateStore::new(object_store, "", Duration::from_millis(1))); block_on(store.open_run_reader(&run_id)).ok().flatten() } @@ -693,13 +686,6 @@ pub(crate) fn compact_git_inspect(output: &Output) -> Value { ) } -fn read_json_if_exists(path: &Path) -> Option { - if !path.exists() { - return None; - } - Some(read_json(path)) -} - fn setup_git_backed_run(context: &TestContext, workflow: GitWorkflowKind) -> GitRunSetup { let repo_dir = context.temp_dir.join(match workflow { GitWorkflowKind::Changed => "git-changed", diff --git a/lib/crates/fabro-cli/tests/it/scenario/mod.rs b/lib/crates/fabro-cli/tests/it/scenario/mod.rs index 6aa4c2a55..0b4d5e379 100644 --- a/lib/crates/fabro-cli/tests/it/scenario/mod.rs +++ b/lib/crates/fabro-cli/tests/it/scenario/mod.rs @@ -9,21 +9,12 @@ use std::time::Duration; use fabro_store::{RunSnapshot, RunStore, SlateStore, Store}; use fabro_types::RunId; use object_store::local::LocalFileSystem; -use serde_json::Value; - pub(super) fn fixture(name: &str) -> PathBuf { Path::new(env!("CARGO_MANIFEST_DIR")) .join("tests/it/workflow/fixtures") .join(name) } -pub(super) fn read_json(path: &Path) -> Value { - let content = std::fs::read_to_string(path) - .unwrap_or_else(|e| panic!("failed to read {}: {e}", path.display())); - serde_json::from_str(&content) - .unwrap_or_else(|e| panic!("failed to parse {}: {e}", path.display())) -} - fn block_on(future: impl std::future::Future) -> T { tokio::runtime::Builder::new_current_thread() .enable_all() @@ -47,7 +38,7 @@ fn run_store(run_dir: &Path) -> Option> { .parse() .ok()?; let object_store = Arc::new(LocalFileSystem::new_with_prefix(storage_dir.join("store")).ok()?); - let store = Arc::new(SlateStore::new(object_store, "", Duration::from_millis(5))); + let store = Arc::new(SlateStore::new(object_store, "", Duration::from_millis(1))); block_on(store.open_run_reader(&run_id)).ok().flatten() } diff --git a/lib/crates/fabro-cli/tests/it/support/mod.rs b/lib/crates/fabro-cli/tests/it/support/mod.rs index 067afb449..4e6f7dc56 100644 --- a/lib/crates/fabro-cli/tests/it/support/mod.rs +++ b/lib/crates/fabro-cli/tests/it/support/mod.rs @@ -1,8 +1,6 @@ use std::path::{Path, PathBuf}; use fabro_test::TestContext; -use serde_json::Value; - macro_rules! fabro_json_snapshot { ($context:expr, $value:expr, @$snapshot:literal) => {{ let mut filters = $context.filters(); @@ -18,6 +16,10 @@ macro_rules! fabro_json_snapshot { r#""duration_ms":\s*\d+"#.to_string(), r#""duration_ms": "[DURATION_MS]""#.to_string(), )); + filters.push(( + r#""run_dir":\s*"\[STORAGE_DIR\]/runs/\d{8}-\[ULID\]""#.to_string(), + r#""run_dir": "[RUN_DIR]""#.to_string(), + )); let filters: Vec<(&str, &str)> = filters .iter() .map(|(pattern, replacement)| (pattern.as_str(), replacement.as_str())) @@ -38,19 +40,6 @@ pub(crate) fn example_fixture(name: &str) -> PathBuf { .expect("fixture path should exist") } -pub(crate) fn read_json(path: impl AsRef) -> Value { - serde_json::from_str(&std::fs::read_to_string(path).unwrap()).unwrap() -} - -pub(crate) fn read_jsonl(path: impl AsRef) -> Vec { - std::fs::read_to_string(path) - .unwrap() - .lines() - .map(serde_json::from_str) - .collect::, _>>() - .unwrap() -} - pub(crate) fn run_output_filters(context: &TestContext) -> Vec<(String, String)> { let mut filters = context.filters(); filters.push((r"\b\d+ms\b".to_string(), "[TIME]".to_string())); diff --git a/lib/crates/fabro-server/src/serve.rs b/lib/crates/fabro-server/src/serve.rs index 8901234d3..2ad1811fb 100644 --- a/lib/crates/fabro-server/src/serve.rs +++ b/lib/crates/fabro-server/src/serve.rs @@ -148,7 +148,7 @@ pub async fn serve_command( let store = Arc::new(fabro_store::SlateStore::new( object_store, "", - Duration::from_millis(5), + Duration::from_millis(1), )); let state = create_app_state_with_store(db, Arc::clone(&shared_settings), max_concurrent_runs, store); diff --git a/lib/crates/fabro-store/src/slate/mod.rs b/lib/crates/fabro-store/src/slate/mod.rs index 294059bab..a075d733d 100644 --- a/lib/crates/fabro-store/src/slate/mod.rs +++ b/lib/crates/fabro-store/src/slate/mod.rs @@ -72,7 +72,7 @@ impl SlateStore { self.object_store.clone(), None, DbReaderOptions { - manifest_poll_interval: Duration::from_millis(100), + manifest_poll_interval: Duration::from_millis(5), ..DbReaderOptions::default() }, ) @@ -404,7 +404,7 @@ mod tests { fn make_store() -> (Arc, SlateStore) { let object_store: Arc = Arc::new(InMemory::new()); - let store = SlateStore::new(object_store.clone(), "runs/", Duration::from_millis(5)); + let store = SlateStore::new(object_store.clone(), "runs/", Duration::from_millis(1)); (object_store, store) } @@ -531,7 +531,7 @@ mod tests { ) -> slatedb::Db { let db = slatedb::Db::builder(record.db_prefix.clone(), object_store) .with_settings(Settings { - flush_interval: Some(Duration::from_millis(5)), + flush_interval: Some(Duration::from_millis(1)), ..Settings::default() }) .build() @@ -960,7 +960,7 @@ mod tests { let db_prefix = catalog::db_prefix("runs/", created_at, &test_run_id("run-1")); let db = slatedb::Db::builder(db_prefix.clone(), object_store) .with_settings(Settings { - flush_interval: Some(Duration::from_millis(5)), + flush_interval: Some(Duration::from_millis(1)), ..Settings::default() }) .build() diff --git a/lib/crates/fabro-workflow/src/operations/create.rs b/lib/crates/fabro-workflow/src/operations/create.rs index 2399f08f1..83cdea270 100644 --- a/lib/crates/fabro-workflow/src/operations/create.rs +++ b/lib/crates/fabro-workflow/src/operations/create.rs @@ -808,7 +808,7 @@ mod tests { std::fs::create_dir_all(storage_dir.join("store")).unwrap(); let object_store = Arc::new(LocalFileSystem::new_with_prefix(storage_dir.join("store")).unwrap()); - let store = Arc::new(SlateStore::new(object_store, "", Duration::from_millis(5))); + let store = Arc::new(SlateStore::new(object_store, "", Duration::from_millis(1))); let created = create( store.as_ref(), CreateRunInput {