From b5684ead9427b9df4630225fb43e88ec6bcb1faa Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Thu, 23 Apr 2026 17:51:20 -0400 Subject: [PATCH] fix stale dense run fixtures in types and store tests --- lib/crates/fabro-checkpoint/src/metadata.rs | 5 +- lib/crates/fabro-store/src/run_state.rs | 8 +-- lib/crates/fabro-store/src/slate/mod.rs | 4 +- .../tests/serializable_projection.rs | 5 +- lib/crates/fabro-types/src/run_event/mod.rs | 7 +- .../fabro-types/tests/run_event_serde.rs | 67 +++--------------- .../fabro-types/tests/run_spec_methods.rs | 7 +- .../fabro-types/tests/run_spec_serde.rs | 68 +++---------------- 8 files changed, 34 insertions(+), 137 deletions(-) diff --git a/lib/crates/fabro-checkpoint/src/metadata.rs b/lib/crates/fabro-checkpoint/src/metadata.rs index c358863b3..9998abcf8 100644 --- a/lib/crates/fabro-checkpoint/src/metadata.rs +++ b/lib/crates/fabro-checkpoint/src/metadata.rs @@ -154,8 +154,7 @@ mod tests { use std::collections::HashMap; use chrono::{TimeZone, Utc}; - use fabro_types::settings::SettingsLayer; - use fabro_types::{Graph, fixtures}; + use fabro_types::{Graph, WorkflowSettings, fixtures}; use super::*; @@ -185,7 +184,7 @@ mod tests { fn test_run_spec(run_id: fabro_types::RunId) -> RunSpec { RunSpec { run_id, - settings: SettingsLayer::default(), + settings: WorkflowSettings::default(), graph: Graph::new("test"), workflow_slug: None, working_directory: PathBuf::from("/tmp"), diff --git a/lib/crates/fabro-store/src/run_state.rs b/lib/crates/fabro-store/src/run_state.rs index 7cbd25475..b4c3f39bf 100644 --- a/lib/crates/fabro-store/src/run_state.rs +++ b/lib/crates/fabro-store/src/run_state.rs @@ -559,10 +559,10 @@ mod tests { use fabro_types::run_event::{ InterviewCompletedProps, InterviewOption, InterviewStartedProps, RunControlEffectProps, }; - use fabro_types::settings::SettingsLayer; use fabro_types::{ BlockedReason, Checkpoint, EventBody, FailureReason, InterviewQuestionType, NodeState, - RunBlobId, RunControlAction, RunEvent, RunStatus, SuccessReason, TerminalStatus, fixtures, + RunBlobId, RunControlAction, RunEvent, RunStatus, SuccessReason, TerminalStatus, + WorkflowSettings, fixtures, }; use serde_json::json; @@ -980,7 +980,7 @@ mod tests { let mut state = RunProjection::default(); state.spec = Some(fabro_types::RunSpec { run_id: fixtures::RUN_1, - settings: SettingsLayer::default(), + settings: WorkflowSettings::default(), graph: fabro_types::Graph::new("test"), workflow_slug: Some("test".to_string()), working_directory: std::path::PathBuf::from("/tmp/run"), @@ -1011,7 +1011,7 @@ mod tests { "run_id": fixtures::RUN_1, "event": "run.created", "properties": { - "settings": SettingsLayer::default(), + "settings": WorkflowSettings::default(), "graph": { "name": "test", "nodes": {}, diff --git a/lib/crates/fabro-store/src/slate/mod.rs b/lib/crates/fabro-store/src/slate/mod.rs index 76b213371..dce39e16c 100644 --- a/lib/crates/fabro-store/src/slate/mod.rs +++ b/lib/crates/fabro-store/src/slate/mod.rs @@ -302,9 +302,9 @@ mod tests { use std::path::PathBuf; use chrono::{DateTime, Utc}; - use fabro_types::settings::SettingsLayer; use fabro_types::{ AttrValue, FailureReason, Graph, RunControlAction, RunSpec, RunStatus, SuccessReason, + WorkflowSettings, }; use futures::TryStreamExt; use object_store::memory::InMemory; @@ -355,7 +355,7 @@ mod tests { ); RunSpec { run_id: test_run_id(label), - settings: SettingsLayer::default(), + settings: WorkflowSettings::default(), graph, workflow_slug: Some("night-sky".to_string()), working_directory: PathBuf::from(format!("/tmp/{label}")), diff --git a/lib/crates/fabro-store/tests/serializable_projection.rs b/lib/crates/fabro-store/tests/serializable_projection.rs index 39288f902..fd5abb557 100644 --- a/lib/crates/fabro-store/tests/serializable_projection.rs +++ b/lib/crates/fabro-store/tests/serializable_projection.rs @@ -5,17 +5,16 @@ use chrono::{TimeZone, Utc}; use fabro_store::{NodeState, RunProjection, SerializableProjection, StageId}; use fabro_types::graph::Graph; use fabro_types::run::RunSpec; -use fabro_types::settings::SettingsLayer; use fabro_types::{ Checkpoint, NodeStatusRecord, RunStatus, SandboxRecord, StageStatus, StartRecord, - TerminalStatus, fixtures, + TerminalStatus, WorkflowSettings, fixtures, }; use serde_json::json; fn sample_run_spec() -> RunSpec { RunSpec { run_id: fixtures::RUN_1, - settings: SettingsLayer::default(), + settings: WorkflowSettings::default(), graph: Graph::new("ship"), workflow_slug: Some("demo".to_string()), working_directory: PathBuf::from("/tmp/project"), diff --git a/lib/crates/fabro-types/src/run_event/mod.rs b/lib/crates/fabro-types/src/run_event/mod.rs index cfea3dd4c..b34b83002 100644 --- a/lib/crates/fabro-types/src/run_event/mod.rs +++ b/lib/crates/fabro-types/src/run_event/mod.rs @@ -800,8 +800,7 @@ mod tests { use serde_json::json; use super::*; - use crate::settings::SettingsLayer; - use crate::{Edge, Graph, Node, RunBlobId, fixtures}; + use crate::{Edge, Graph, Node, RunBlobId, WorkflowSettings, fixtures}; #[test] fn run_event_round_trips_json() { @@ -850,7 +849,7 @@ mod tests { #[test] fn run_event_deserializes_adjacent_layout() { - let settings = SettingsLayer::default(); + let settings = WorkflowSettings::default(); let graph = Graph { name: "test".to_string(), nodes: HashMap::from([("start".to_string(), Node { @@ -892,7 +891,7 @@ mod tests { "run_id": fixtures::RUN_1, "event": "run.created", "properties": { - "settings": SettingsLayer::default(), + "settings": WorkflowSettings::default(), "graph": Graph::new("test"), "labels": {}, "run_dir": "/tmp/run", diff --git a/lib/crates/fabro-types/tests/run_event_serde.rs b/lib/crates/fabro-types/tests/run_event_serde.rs index 1ccb99cb1..8077807c8 100644 --- a/lib/crates/fabro-types/tests/run_event_serde.rs +++ b/lib/crates/fabro-types/tests/run_event_serde.rs @@ -1,37 +1,15 @@ use std::collections::BTreeMap; +use fabro_types::WorkflowSettings; use fabro_types::graph::Graph; use fabro_types::run_event::run::RunCreatedProps; -use fabro_types::settings::run::{RunGoalLayer, RunLayer}; -use fabro_types::settings::server::{ - GithubIntegrationLayer, ServerIntegrationsLayer, ServerLayer, ServerStorageLayer, -}; -use fabro_types::settings::{InterpString, SettingsLayer}; +use fabro_types::settings::InterpString; +use fabro_types::settings::run::RunGoal; -fn templated_settings() -> SettingsLayer { - SettingsLayer { - version: Some(1), - run: Some(RunLayer { - goal: Some(RunGoalLayer::Inline(InterpString::parse( - "Ship {{ env.TASK }}", - ))), - ..RunLayer::default() - }), - server: Some(ServerLayer { - storage: Some(ServerStorageLayer { - root: Some(InterpString::parse("{{ env.FABRO_STORAGE }}")), - }), - integrations: Some(ServerIntegrationsLayer { - github: Some(GithubIntegrationLayer { - app_id: Some(InterpString::parse("{{ env.GITHUB_APP_ID }}")), - ..GithubIntegrationLayer::default() - }), - ..ServerIntegrationsLayer::default() - }), - ..ServerLayer::default() - }), - ..SettingsLayer::default() - } +fn templated_settings() -> WorkflowSettings { + let mut settings = WorkflowSettings::default(); + settings.run.goal = Some(RunGoal::Inline(InterpString::parse("Ship {{ env.TASK }}"))); + settings } #[test] @@ -62,34 +40,7 @@ fn run_created_props_round_trip_templated_settings() { json ); assert_eq!( - round_trip - .settings - .run - .as_ref() - .and_then(|run| run.goal.as_ref()), - Some(&RunGoalLayer::Inline(InterpString::parse( - "Ship {{ env.TASK }}" - ))) - ); - assert_eq!( - round_trip - .settings - .server - .as_ref() - .and_then(|server| server.storage.as_ref()) - .and_then(|storage| storage.root.as_ref()) - .map(InterpString::as_source), - Some("{{ env.FABRO_STORAGE }}".to_string()) - ); - assert_eq!( - round_trip - .settings - .server - .as_ref() - .and_then(|server| server.integrations.as_ref()) - .and_then(|integrations| integrations.github.as_ref()) - .and_then(|github| github.app_id.as_ref()) - .map(InterpString::as_source), - Some("{{ env.GITHUB_APP_ID }}".to_string()) + round_trip.settings.run.goal, + Some(RunGoal::Inline(InterpString::parse("Ship {{ env.TASK }}"))) ); } diff --git a/lib/crates/fabro-types/tests/run_spec_methods.rs b/lib/crates/fabro-types/tests/run_spec_methods.rs index 20a4f2942..3d8078688 100644 --- a/lib/crates/fabro-types/tests/run_spec_methods.rs +++ b/lib/crates/fabro-types/tests/run_spec_methods.rs @@ -1,15 +1,14 @@ use std::collections::HashMap; use std::path::{Path, PathBuf}; -use fabro_types::fixtures; use fabro_types::graph::Graph; use fabro_types::run::RunSpec; -use fabro_types::settings::SettingsLayer; +use fabro_types::{WorkflowSettings, fixtures}; fn sample_run_spec() -> RunSpec { RunSpec { run_id: fixtures::RUN_1, - settings: SettingsLayer::default(), + settings: WorkflowSettings::default(), graph: Graph::new("ship"), workflow_slug: Some("demo".to_string()), working_directory: PathBuf::from("/tmp/project"), @@ -29,7 +28,7 @@ fn run_spec_getters_return_declared_fields() { assert_eq!(run_spec.id(), fixtures::RUN_1); assert_eq!(run_spec.graph().name, "ship"); - assert_eq!(run_spec.settings(), &SettingsLayer::default()); + assert_eq!(run_spec.settings(), &WorkflowSettings::default()); assert_eq!(run_spec.workflow_slug(), Some("demo")); assert_eq!(run_spec.working_directory(), Path::new("/tmp/project")); assert_eq!( diff --git a/lib/crates/fabro-types/tests/run_spec_serde.rs b/lib/crates/fabro-types/tests/run_spec_serde.rs index 8b9e59d05..da1f5e2e0 100644 --- a/lib/crates/fabro-types/tests/run_spec_serde.rs +++ b/lib/crates/fabro-types/tests/run_spec_serde.rs @@ -1,39 +1,16 @@ use std::collections::HashMap; use std::path::PathBuf; -use fabro_types::fixtures; use fabro_types::graph::Graph; use fabro_types::run::RunSpec; -use fabro_types::settings::run::{RunGoalLayer, RunLayer}; -use fabro_types::settings::server::{ - GithubIntegrationLayer, ServerIntegrationsLayer, ServerLayer, ServerStorageLayer, -}; -use fabro_types::settings::{InterpString, SettingsLayer}; +use fabro_types::settings::InterpString; +use fabro_types::settings::run::RunGoal; +use fabro_types::{WorkflowSettings, fixtures}; -fn templated_settings() -> SettingsLayer { - SettingsLayer { - version: Some(1), - run: Some(RunLayer { - goal: Some(RunGoalLayer::Inline(InterpString::parse( - "Ship {{ env.TASK }}", - ))), - ..RunLayer::default() - }), - server: Some(ServerLayer { - storage: Some(ServerStorageLayer { - root: Some(InterpString::parse("{{ env.FABRO_STORAGE }}")), - }), - integrations: Some(ServerIntegrationsLayer { - github: Some(GithubIntegrationLayer { - app_id: Some(InterpString::parse("{{ env.GITHUB_APP_ID }}")), - ..GithubIntegrationLayer::default() - }), - ..ServerIntegrationsLayer::default() - }), - ..ServerLayer::default() - }), - ..SettingsLayer::default() - } +fn templated_settings() -> WorkflowSettings { + let mut settings = WorkflowSettings::default(); + settings.run.goal = Some(RunGoal::Inline(InterpString::parse("Ship {{ env.TASK }}"))); + settings } #[test] @@ -62,34 +39,7 @@ fn run_spec_round_trips_templated_settings() { json ); assert_eq!( - round_trip - .settings - .run - .as_ref() - .and_then(|run| run.goal.as_ref()), - Some(&RunGoalLayer::Inline(InterpString::parse( - "Ship {{ env.TASK }}" - ))) - ); - assert_eq!( - round_trip - .settings - .server - .as_ref() - .and_then(|server| server.storage.as_ref()) - .and_then(|storage| storage.root.as_ref()) - .map(InterpString::as_source), - Some("{{ env.FABRO_STORAGE }}".to_string()) - ); - assert_eq!( - round_trip - .settings - .server - .as_ref() - .and_then(|server| server.integrations.as_ref()) - .and_then(|integrations| integrations.github.as_ref()) - .and_then(|github| github.app_id.as_ref()) - .map(InterpString::as_source), - Some("{{ env.GITHUB_APP_ID }}".to_string()) + round_trip.settings.run.goal, + Some(RunGoal::Inline(InterpString::parse("Ship {{ env.TASK }}"))) ); }