use super::tests::Fx;
use super::{ConfigSource, resolve_worker};
use crate::workspace::fixture;
fn providers_with(knob: &str) -> String {
format!(
"roles:\n worker:\n provider: anthropic\n model: claude-sonnet-5\n {knob}\n \
compactor:\n provider: anthropic\n model: claude-haiku-4-5\n"
)
}
#[test]
fn the_role_effort_follows_the_tip_to_the_resolved_shape() {
let (_h, ws) = fixture::workspace();
fixture::spawn_root(&ws, "20260101-r1");
let fx = Fx::new();
let before = resolve_worker(&ws, ConfigSource::Agent("20260101-r1"), &fx.deps()).unwrap();
assert_eq!(before.effort, None, "the shipped template requests none");
fixture::amend_config(
&ws,
&[("providers.yaml", &providers_with("effort: medium"))],
);
let cfg = resolve_worker(&ws, ConfigSource::Agent("20260101-r1"), &fx.deps()).unwrap();
assert_eq!(cfg.effort, Some(crate::config::Effort::Medium));
assert_eq!(
cfg.as_resolved().effort,
Some(crate::config::Effort::Medium)
);
}
#[test]
fn the_role_priority_follows_the_tip_to_the_resolved_shape() {
let (_h, ws) = fixture::workspace();
fixture::spawn_root(&ws, "20260101-r1");
let fx = Fx::new();
let before = resolve_worker(&ws, ConfigSource::Agent("20260101-r1"), &fx.deps()).unwrap();
assert_eq!(before.priority, None, "the shipped template asks no lane");
fixture::amend_config(
&ws,
&[("providers.yaml", &providers_with("priority: true"))],
);
let cfg = resolve_worker(&ws, ConfigSource::Agent("20260101-r1"), &fx.deps()).unwrap();
assert_eq!(cfg.priority, Some(true));
assert_eq!(cfg.as_resolved().priority, Some(true));
fixture::amend_config(
&ws,
&[("providers.yaml", &providers_with("priority: false"))],
);
let after = resolve_worker(&ws, ConfigSource::Agent("20260101-r1"), &fx.deps()).unwrap();
assert_eq!(after.priority, Some(false));
}
#[test]
fn the_role_output_cap_follows_the_tip_to_the_resolved_shape() {
let (_h, ws) = fixture::workspace();
fixture::spawn_root(&ws, "20260101-r1");
let fx = Fx::new();
let before = resolve_worker(&ws, ConfigSource::Agent("20260101-r1"), &fx.deps()).unwrap();
assert_eq!(
before.max_output_tokens, None,
"the shipped template states no ceiling"
);
fixture::amend_config(
&ws,
&[(
"providers.yaml",
&providers_with("max_output_tokens: 32000"),
)],
);
let cfg = resolve_worker(&ws, ConfigSource::Agent("20260101-r1"), &fx.deps()).unwrap();
assert_eq!(cfg.max_output_tokens, Some(32000));
assert_eq!(cfg.as_resolved().max_output_tokens, Some(32000));
}