Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

chore: files changed src/openhuman/skills/bundled/mod_tests.rs,src/openhuman/tools/impl/meta/tool_se

Steven Enamakel78e72e70c3cf
diff --git a/src/openhuman/skills/bundled/mod_tests.rs b/src/openhuman/skills/bundled/mod_tests.rs
index 81eac7998a..3611746853 100644
--- a/src/openhuman/skills/bundled/mod_tests.rs
+++ b/src/openhuman/skills/bundled/mod_tests.rs
@@ -64,16 +64,38 @@ fn the_digest_covers_paths_as_well_as_contents() {
#[test]
fn a_traversal_path_is_rejected() {
- for bad in ["../escape.md", "refs/../../escape.md", "/etc/passwd", "refs//x.md"] {
- let skill = BundledSkill {
- dir_name: "sample",
- files: &[A, BundledFile { path: bad, contents: "x" }],
- };
+ // Checked against the free function rather than through `validate`,
+ // because `BundledSkill::files` is `&'static [_]` — a table compiled into
+ // the binary cannot be assembled from loop variables, which is itself part
+ // of why the table is safe.
+ for bad in [
+ "../escape.md",
+ "refs/../../escape.md",
+ "/etc/passwd",
+ "refs//x.md",
+ "C:/windows/system32",
+ ".hidden.md",
+ "",
+ ] {
assert!(
- skill.validate().is_err(),
+ validate_relative_path("sample", bad).is_err(),
"`{bad}` must be rejected as a bundled file path"
);
}
+ for good in ["WORKFLOW.md", "references/expressions.md", "scripts/run.py"] {
+ assert!(
+ validate_relative_path("sample", good).is_ok(),
+ "`{good}` must be accepted"
+ );
+ }
+}
+
+#[test]
+fn a_bad_dir_name_is_rejected() {
+ for bad in ["", ".hidden", "a/b", "a\\b"] {
+ let skill = BundledSkill { dir_name: bad, files: &[A] };
+ assert!(skill.validate().is_err(), "`{bad}` must be rejected as a dir_name");
+ }
}
#[test]
diff --git a/src/openhuman/tools/impl/meta/tool_search.rs b/src/openhuman/tools/impl/meta/tool_search.rs
index 03c8c736b5..f8a64f8c79 100644
--- a/src/openhuman/tools/impl/meta/tool_search.rs
+++ b/src/openhuman/tools/impl/meta/tool_search.rs
@@ -249,6 +249,7 @@ impl Tool for ToolSearchTool {
#[cfg(test)]
mod tests {
+ // The tokenizer's own tests live with it, in `util::bm25`.
use super::*;
fn spec(name: &str, description: &str) -> ToolSpec {
@@ -268,20 +269,7 @@ mod tests {
])
}
- #[test]
- fn snake_case_names_are_split_into_searchable_terms() {
- // The whole point: `memory_hybrid_search` as one opaque term would
- // score zero against "search memory", which is how a user would ask.
- assert_eq!(
- tokenize("memory_hybrid_search"),
- vec!["memory", "hybrid", "search"]
- );
- }
- #[test]
- fn camel_case_is_split_too() {
- assert_eq!(tokenize("getUserProfile"), vec!["get", "user", "profile"]);
- }
#[test]
fn a_plain_language_query_finds_the_right_tool() {