use super::*;
#[test]
fn the_shipped_worker_grant_is_the_whole_tool_pool() {
let raw = crate::template::TEMPLATE
.get_file("providers.yaml")
.expect("the template ships providers.yaml")
.contents_utf8()
.expect("providers.yaml is UTF-8");
let shipped = crate::config::PerRepoProviders::parse(raw, Path::new("template/providers.yaml"))
.expect("the shipped template parses");
let mut granted = shipped.roles["worker"].tools.clone();
granted.sort();
let mut pool: Vec<String> = TOOLS
.files()
.map(|f| {
f.path()
.file_stem()
.expect("a pooled schema has a stem")
.to_string_lossy()
.into_owned()
})
.collect();
pool.sort();
assert_eq!(
granted, pool,
"template/providers.yaml's worker `tools:` must grant every tool \
schemas/tools/ ships (ARCH §4.3)"
);
assert!(shipped.roles["compactor"].tools.is_empty());
}
#[test]
fn the_retired_multi_tool_ships_no_schema_and_no_skill() {
assert!(
TOOLS.get_file("multi_tool.json").is_none(),
"the retired multi-tool still ships a schema"
);
assert!(
SKILLS.get_dir("multi_tool").is_none(),
"the retired multi-tool still ships a skill"
);
}
#[test]
fn the_shipped_compactor_entry_composes_the_summary_chain() {
let raw = crate::template::TEMPLATE
.get_file("manifest.yaml")
.expect("the template ships manifest.yaml")
.contents_utf8()
.expect("manifest.yaml is UTF-8");
let shipped =
crate::config::manifest::Manifest::parse(raw, Path::new("template/manifest.yaml"))
.expect("the shipped template parses");
assert_eq!(shipped.roles["compactor"].order, vec!["summary/**"]);
}
#[test]
fn prime_seeds_the_basic_agentic_loop_into_the_workflow_pool() {
let home = TempDir::new().unwrap();
prime(&collapsed(home.path())).unwrap();
let seeded = home.path().join(WORKFLOWS_DIR).join(BASIC_AGENTIC_LOOP);
let template = crate::template::TEMPLATE
.get_file("workflow.yaml")
.expect("the template ships workflow.yaml")
.contents();
assert_eq!(fs::read(&seeded).unwrap(), template);
fs::write(&seeded, "events: {}\n").unwrap();
prime(&collapsed(home.path())).unwrap();
assert_eq!(fs::read_to_string(&seeded).unwrap(), "events: {}\n");
}
#[test]
fn the_shipped_worker_entry_pins_the_facts_file() {
let raw = crate::template::TEMPLATE
.get_file("manifest.yaml")
.expect("the template ships manifest.yaml")
.contents_utf8()
.expect("manifest.yaml is UTF-8");
let shipped =
crate::config::manifest::Manifest::parse(raw, Path::new("template/manifest.yaml"))
.expect("the shipped template parses");
let facts = crate::facts::FILE.to_string();
assert!(shipped.roles["worker"].pinned.contains(&facts));
assert!(!shipped.roles["compactor"].pinned.contains(&facts));
assert!(!shipped.roles["compactor"].order.contains(&facts));
}
#[test]
fn the_embedded_template_ships_no_facts_file() {
assert!(
crate::template::TEMPLATE
.get_file(crate::facts::FILE)
.is_none()
);
}
#[test]
fn the_shipped_workflow_pins_the_context_economy_numbers() {
let raw = crate::template::TEMPLATE
.get_file("workflow.yaml")
.expect("the template ships workflow.yaml")
.contents_utf8()
.expect("workflow.yaml is UTF-8");
let shipped = crate::config::Workflow::parse(raw, Path::new("template/workflow.yaml"))
.expect("the shipped template parses");
let bound = shipped.tool_output.expect("the shipped bound is declared");
assert_eq!(
(bound.head_bytes, bound.tail_bytes),
(2048, 2048),
"a tool result is ~1000 tokens; see workflow.yaml's comment before moving it"
);
let intermediate = &shipped
.compaction
.as_ref()
.expect("the shipped clock is declared")
.intermediate;
assert_eq!(
intermediate.n,
Some(60),
"about thirty steps at two commits each"
);
assert_eq!(intermediate.extract_bytes, Some(8192));
}