fabro/lib/crates/fabro-workflow/tests/materialize_run.rs
Bryan Helmkamp 8014f61054 chore(lint): fix all clippy warnings including --tests
Resolve every clippy warning across the workspace when running with
--tests enabled. Previously only library code was lint-clean; test
code had accumulated issues that were invisible without --tests.

Fixes:
- redundant_closure_for_method_calls: |s| s.as_source() -> InterpString::as_source
  (effective_settings, resolve_cli/root/server/features, run_event/record_serde,
  materialize_run) — add InterpString imports where needed
- absolute_paths: inline fabro_types::settings::* paths -> use imports;
  add #![allow(clippy::absolute_paths)] to fabro-cli and fabro-server
  IT test harnesses (matching the existing pattern in integration.rs)
- bool_assert_comparison: assert_eq!(x, true) -> assert!(x)
- needless_raw_string_hashes: r#"..."# -> r"..." where no inner quotes
- field_reassign_with_default: mut + field assign -> struct literal with ..Default
- match_same_arms: merge Timeout | Disconnected arms in attach.rs
- needless_pass_by_value: signal_rx by ref in attach.rs
- unreadable_literal: 9999999999 -> 9_999_999_999
- default_trait_access: Default::default() -> BTreeMap::default()
- items_after_statements: move use to function top
- large_futures: allow in integration.rs test module (test-only, not prod)
- filter_map_bool_then: .filter_map(bool::then) -> .filter().map()

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 10:16:24 -04:00

62 lines
1.8 KiB
Rust

use fabro_graphviz::graph::Graph;
use fabro_graphviz::parser;
use fabro_model::Catalog;
use fabro_types::settings::run::{RunGoalLayer, RunLayer, RunModelLayer, RunPullRequestLayer};
use fabro_types::settings::{InterpString, SettingsLayer};
use fabro_workflow::run_materialization::materialize_run;
fn graph(source: &str) -> Graph {
parser::parse(source).expect("graph should parse")
}
#[test]
fn materialize_run_applies_graph_and_catalog_defaults() {
let source = r#"digraph Test {
graph [goal="Build feature"]
start [shape=Mdiamond]
exit [shape=Msquare]
start -> exit
}"#;
let settings = SettingsLayer {
run: Some(RunLayer {
model: Some(RunModelLayer {
name: Some(InterpString::parse("sonnet")),
..RunModelLayer::default()
}),
pull_request: Some(RunPullRequestLayer {
enabled: Some(false),
..RunPullRequestLayer::default()
}),
..RunLayer::default()
}),
..SettingsLayer::default()
};
let materialized = materialize_run(settings, &graph(source), Catalog::builtin());
let resolved = fabro_config::resolve_run_from_file(&materialized).unwrap();
assert_eq!(
resolved
.model
.name
.as_ref()
.map(InterpString::as_source)
.as_deref(),
Some("claude-sonnet-4-6")
);
assert_eq!(
resolved
.model
.provider
.as_ref()
.map(InterpString::as_source)
.as_deref(),
Some("anthropic")
);
assert_eq!(
materialized.run.as_ref().and_then(|run| run.goal.as_ref()),
Some(&RunGoalLayer::Inline(InterpString::parse("Build feature")))
);
assert!(resolved.pull_request.is_none());
}