fix stale dense run fixtures in types and store tests

This commit is contained in:
Bryan Helmkamp 2026-04-23 17:51:20 -04:00
parent b9fe542c5b
commit b5684ead94
No known key found for this signature in database
8 changed files with 34 additions and 137 deletions

View file

@ -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"),

View file

@ -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": {},

View file

@ -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}")),

View file

@ -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"),

View file

@ -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",

View file

@ -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 }}")))
);
}

View file

@ -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!(

View file

@ -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 }}")))
);
}