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
test(tinyflows): gate published prompt e2e on skills feature
Steven Enamakel30d0a2eb8b26
diff --git a/tests/tinyflows_published_prompt_e2e.rs b/tests/tinyflows_published_prompt_e2e.rsindex 985b29bc9b..fa72e48164 100644--- a/tests/tinyflows_published_prompt_e2e.rs+++ b/tests/tinyflows_published_prompt_e2e.rs@@ -61,106 +61,113 @@ async fn published_module_prompts_render_through_the_normal_host_path() {assert!(prompt.text.contains("## Workspace"));}- // This is the actual published module path: the host must materialize the- // bus-owned skill, then the normal TinySkills discovery and resource reader- // must expose that Builtin under the separate dynamic root.- let config = openhuman_core::config::Config::load_from_config_path(&config_path, &workspace)- .await- .expect("load the same scoped Config used by the prompt dump");- let ctx = openhuman_core::core::runtime::DispatchCtx::host_default();- assert!(openhuman_core::modules::runtime::is_module_serving(- "tinyflows"- ));- let discovered = openhuman_core::skills::load_workflow_metadata_for(&ctx, &config);- let flow = discovered- .iter()- .find(|skill| skill.id() == "flow-authoring")- .expect("the published module's flow-authoring skill is discoverable");- assert_eq!(flow.scope, tinyskills::SkillScope::Builtin);- let flow_dir = flow- .location- .as_deref()- .and_then(std::path::Path::parent)- .expect("discovered flow-authoring location");- assert!(- flow_dir.starts_with(workspace.join(".openhuman").join("builtin-flow-skills")),- "the dynamic builtin uses the separate product root: {}",- flow_dir.display()- );- assert!(- !flow_dir.starts_with(workspace.join(".openhuman").join("builtin-skills")),- "TinyFlows resources must not share the static desktop-control root"- );- for resource in &flow.resources {- let body = openhuman_core::skills::read_workflow_resource_for(- &ctx,- &config,- "flow-authoring",- resource,- )- .unwrap_or_else(|error| {- panic!("reading published flow-authoring resource {resource:?}: {error}")- });- assert!(!body.is_empty(), "published resource {resource:?} is empty");- }+ #[cfg(feature = "skills")]+ {+ // This is the actual published module path: the host must materialize the+ // bus-owned skill, then the normal TinySkills discovery and resource reader+ // must expose that Builtin under the separate dynamic root.+ let config =+ openhuman_core::config::Config::load_from_config_path(&config_path, &workspace)+ .await+ .expect("load the same scoped Config used by the prompt dump");+ let ctx = openhuman_core::core::runtime::DispatchCtx::host_default();+ assert!(openhuman_core::modules::runtime::is_module_serving(+ "tinyflows"+ ));+ let discovered = openhuman_core::skills::load_workflow_metadata_for(&ctx, &config);+ let flow = discovered+ .iter()+ .find(|skill| skill.id() == "flow-authoring")+ .expect("the published module's flow-authoring skill is discoverable");+ assert_eq!(flow.scope, tinyskills::SkillScope::Builtin);+ let flow_dir = flow+ .location+ .as_deref()+ .and_then(std::path::Path::parent)+ .expect("discovered flow-authoring location");+ assert!(+ flow_dir.starts_with(workspace.join(".openhuman").join("builtin-flow-skills")),+ "the dynamic builtin uses the separate product root: {}",+ flow_dir.display()+ );+ assert!(+ !flow_dir.starts_with(workspace.join(".openhuman").join("builtin-skills")),+ "TinyFlows resources must not share the static desktop-control root"+ );+ for resource in &flow.resources {+ let body = openhuman_core::skills::read_workflow_resource_for(+ &ctx,+ &config,+ "flow-authoring",+ resource,+ )+ .unwrap_or_else(|error| {+ panic!("reading published flow-authoring resource {resource:?}: {error}")+ });+ assert!(!body.is_empty(), "published resource {resource:?} is empty");+ }- let disabled_config_path = temp.path().join("disabled-config.toml");- std::fs::write(+ let disabled_config_path = temp.path().join("disabled-config.toml");+ std::fs::write(&disabled_config_path,"api_url = \"http://127.0.0.1:1\"\n\n[components]\nskills = true\nflows = true\ntinyflows = true\n\n[modules]\nenabled = false\n",).expect("disabled components config");- let disabled_config =- openhuman_core::config::Config::load_from_config_path(&disabled_config_path, &workspace)- .await- .expect("load disabled profile config");- let disabled = openhuman_core::skills::load_workflow_metadata_for(&ctx, &disabled_config);- assert!(- !disabled.iter().any(|skill| skill.id() == "flow-authoring"),- "a profile with modules disabled cannot see the shared workspace builtin"- );- let mut disabled_options = openhuman_core::agent::debug::DumpPromptOptions::new("orchestrator");- disabled_options.workspace_dir_override = Some(workspace.clone());- disabled_options.config_path_override = Some(disabled_config_path);- let ordinary_prompt = openhuman_core::agent::debug::dump_agent_prompt(disabled_options)+ let disabled_config = openhuman_core::config::Config::load_from_config_path(+ &disabled_config_path,+ &workspace,+ ).await- .expect("ordinary prompt construction continues when modules are disabled");- assert!(ordinary_prompt.text.contains("## Workspace"));+ .expect("load disabled profile config");+ let disabled = openhuman_core::skills::load_workflow_metadata_for(&ctx, &disabled_config);+ assert!(+ !disabled.iter().any(|skill| skill.id() == "flow-authoring"),+ "a profile with modules disabled cannot see the shared workspace builtin"+ );+ let mut disabled_options =+ openhuman_core::agent::debug::DumpPromptOptions::new("orchestrator");+ disabled_options.workspace_dir_override = Some(workspace.clone());+ disabled_options.config_path_override = Some(disabled_config_path);+ let ordinary_prompt = openhuman_core::agent::debug::dump_agent_prompt(disabled_options)+ .await+ .expect("ordinary prompt construction continues when modules are disabled");+ assert!(ordinary_prompt.text.contains("## Workspace"));- // Re-enable the same profile after the disabled view and ensure the- // async host preflight restores the module-backed catalogue.- let mut enabled_options =- openhuman_core::agent::debug::DumpPromptOptions::new("workflow_builder");- enabled_options.workspace_dir_override = Some(workspace.clone());- enabled_options.config_path_override = Some(config_path.clone());- openhuman_core::agent::debug::dump_agent_prompt(enabled_options)- .await- .expect("enabled profile prompt after disabled profile");- let reenabled = openhuman_core::skills::load_workflow_metadata_for(&ctx, &config);- assert!(- reenabled.iter().any(|skill| skill.id() == "flow-authoring"),- "re-enabling TinyFlows restores the module-backed builtin"- );+ // Re-enable the same profile after the disabled view and ensure the+ // async host preflight restores the module-backed catalogue.+ let mut enabled_options =+ openhuman_core::agent::debug::DumpPromptOptions::new("workflow_builder");+ enabled_options.workspace_dir_override = Some(workspace.clone());+ enabled_options.config_path_override = Some(config_path.clone());+ openhuman_core::agent::debug::dump_agent_prompt(enabled_options)+ .await+ .expect("enabled profile prompt after disabled profile");+ let reenabled = openhuman_core::skills::load_workflow_metadata_for(&ctx, &config);+ assert!(+ reenabled.iter().any(|skill| skill.id() == "flow-authoring"),+ "re-enabling TinyFlows restores the module-backed builtin"+ );- // A live disk edit must invalidate both the cached metadata and the- // resource-read path; cached Builtin metadata cannot bless changed bytes.- let resource = flow.resources.first().expect("published reference files");- std::fs::write(flow_dir.join(resource), "tampered resource").expect("tamper resource");- let after_tamper = openhuman_core::skills::load_workflow_metadata_for(&ctx, &config);- assert!(- !after_tamper- .iter()- .any(|skill| skill.id() == "flow-authoring"),- "a cache hit must not advertise tampered module resources"- );- assert!(- openhuman_core::skills::read_workflow_resource_for(- &ctx,- &config,- "flow-authoring",- resource,- )- .is_err(),- "the resource reader must refuse tampered module bytes"- );+ // A live disk edit must invalidate both the cached metadata and the+ // resource-read path; cached Builtin metadata cannot bless changed bytes.+ let resource = flow.resources.first().expect("published reference files");+ std::fs::write(flow_dir.join(resource), "tampered resource").expect("tamper resource");+ let after_tamper = openhuman_core::skills::load_workflow_metadata_for(&ctx, &config);+ assert!(+ !after_tamper+ .iter()+ .any(|skill| skill.id() == "flow-authoring"),+ "a cache hit must not advertise tampered module resources"+ );+ assert!(+ openhuman_core::skills::read_workflow_resource_for(+ &ctx,+ &config,+ "flow-authoring",+ resource,+ )+ .is_err(),+ "the resource reader must refuse tampered module bytes"+ );+ }}