The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
chore: files changed src/openhuman/skills/bundled/mod_tests.rs
Steven Enamakel302a976ecb16
diff --git a/src/openhuman/skills/bundled/mod_tests.rs b/src/openhuman/skills/bundled/mod_tests.rsindex 3611746853..11d40cfbb1 100644--- a/src/openhuman/skills/bundled/mod_tests.rs+++ b/src/openhuman/skills/bundled/mod_tests.rs@@ -171,3 +171,101 @@ fn install_reports_rather_than_fails_the_boot() {"every bundled skill must be accounted for");}++#[test]+fn a_materialised_bundle_is_discoverable_and_readable_end_to_end() {+ // The test that proves the whole mechanism, because every other test here+ // stops at the filesystem. A bundle can be written correctly and still be+ // useless: discovery could skip the builtin root, the scope could be+ // rejected, the frontmatter could fail to parse, or the resource reader+ // could refuse a path under a root it does not recognise. This walks the+ // real path the model walks — install, discover, read a page.+ let tmp = tempfile::tempdir().expect("tempdir");+ let workspace = tmp.path();+ let report = install(workspace);+ assert!(report.failed.is_empty(), "install failed: {report:?}");++ for skill in BUNDLED {+ let found = crate::openhuman::skills::discover_workflows(None, Some(workspace), false);+ let entry = found+ .iter()+ .find(|w| w.dir_name == skill.dir_name)+ .unwrap_or_else(|| {+ panic!(+ "`{}` was written but discovery did not find it; discovered: {:?}",+ skill.dir_name,+ found.iter().map(|w| &w.dir_name).collect::<Vec<_>>()+ )+ });+ assert_eq!(+ entry.scope,+ crate::openhuman::skills::ops_types::WorkflowScope::Builtin,+ "a materialised bundle must carry the Builtin scope"+ );+ assert!(+ !entry.description.is_empty(),+ "`{}` frontmatter did not parse — discovery found the directory but \+ not its metadata",+ skill.dir_name+ );++ // `home_dir = None` above; the reader resolves through the real+ // discovery pipeline including `dirs::home_dir()`, which is fine here:+ // it can only ADD skills, and we look up ours by name.+ for file in skill.files {+ if file.path == super::super::ops_types::WORKFLOW_MD {+ continue;+ }+ let body = crate::openhuman::skills::read_workflow_resource(+ workspace,+ skill.dir_name,+ std::path::Path::new(file.path),+ )+ .unwrap_or_else(|e| {+ panic!("reading `{}` of `{}` failed: {e}", file.path, skill.dir_name)+ });+ assert_eq!(+ body, file.contents,+ "`{}` read back different bytes than it ships",+ file.path+ );+ }+ }+}++#[test]+fn a_user_skill_of_the_same_name_shadows_the_builtin() {+ // The precedence promise from the module docs, and the one that makes+ // shipping a bundle safe: adding a builtin can never take a name away from+ // a workspace that already used it.+ let Some(first) = BUNDLED.first() else {+ return;+ };+ let tmp = tempfile::tempdir().expect("tempdir");+ let workspace = tmp.path();+ install(workspace);++ // A legacy-scope skill (`<workspace>/skills/`) is the lowest non-builtin+ // scope, so if even that wins, every other scope does.+ let user_dir = workspace.join("skills").join(first.dir_name);+ std::fs::create_dir_all(&user_dir).expect("mkdir");+ std::fs::write(+ user_dir.join("SKILL.md"),+ format!(+ "---\nname: {}\ndescription: the user's own version\n---\n\nmine\n",+ first.dir_name+ ),+ )+ .expect("write");++ let found = crate::openhuman::skills::discover_workflows(None, Some(workspace), false);+ let entry = found+ .iter()+ .find(|w| w.dir_name == first.dir_name)+ .expect("found");+ assert_eq!(+ entry.description, "the user's own version",+ "the user's skill must win the name; got scope {:?}",+ entry.scope+ );+}