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
fix(route_tests): correct test assertion for task source routing
Steven Enamakel65f148c0fe76
diff --git a/crates/openhuman-core/src/integrations/task_sources/route_tests.rs b/crates/openhuman-core/src/integrations/task_sources/route_tests.rsindex 7dae7d87cd..8e8cd2ab80 100644--- a/crates/openhuman-core/src/integrations/task_sources/route_tests.rs+++ b/crates/openhuman-core/src/integrations/task_sources/route_tests.rs@@ -1,17 +1,9 @@use super::*;-use crate::integrations::task_sources::types::ProviderSlug;+use crate::integrations::task_sources::types::{FilterSpec, ProviderSlug};use crate::integrations::task_sources::NormalizedTask;use chrono::Utc;-#[test]-fn provider_label_titlecases_known_and_unknown() {- assert_eq!(provider_label("github"), "GitHub");- assert_eq!(provider_label("clickup"), "ClickUp");- assert_eq!(provider_label("asana"), "Asana");- assert_eq!(provider_label(""), "");-}--fn github_source(repo: Option<&str>) -> TaskSource {+fn github_source(target: SourceTarget) -> TaskSource {TaskSource {id: "ts-1".into(),provider: ProviderSlug::Github,@@ -19,7 +11,7 @@ fn github_source(repo: Option<&str>) -> TaskSource {name: None,enabled: true,filter: FilterSpec::Github {- repo: repo.map(str::to_string),+ repo: Some("octo/repo".into()),labels: vec![],assignee_is_me: true,state: None,@@ -27,7 +19,7 @@ fn github_source(repo: Option<&str>) -> TaskSource {extra: json!({}),},interval_secs: 1800,- target: SourceTarget::AgentTodoProactive,+ target,max_tasks_per_fetch: 25,created_at: Utc::now(),last_fetch_at: None,@@ -35,21 +27,18 @@ fn github_source(repo: Option<&str>) -> TaskSource {}}-fn enriched(external_id: &str, url: Option<&str>, urgency: f32) -> EnrichedTask {+fn enriched(external_id: &str) -> EnrichedTask {let task = NormalizedTask {external_id: external_id.into(),provider: "github".into(),title: "Fix the bug".into(),- url: url.map(str::to_string),..Default::default()};- // Objective is derived in enrichment — mirror that here so the helper- // stays truthful (generic kind → bare title).let objective = crate::integrations::task_sources::enrich::derive_objective(&task);EnrichedTask {task,summary: "Fix the bug".into(),- urgency,+ urgency: 0.7,linked_people: vec![],linked_memory_ids: vec![],agent_prompt: "do it".into(),@@ -58,127 +47,15 @@ fn enriched(external_id: &str, url: Option<&str>, urgency: f32) -> EnrichedTask}}-#[test]-fn source_metadata_carries_github_repo_and_identifiers() {- let src = github_source(Some("octo/repo"));- let e = enriched("123", Some("https://github.com/octo/repo/issues/123"), 0.7);- let meta = build_source_metadata(&src, &e);- assert_eq!(meta["provider"], json!("github"));- assert_eq!(meta["source_id"], json!("ts-1"));- assert_eq!(meta["external_id"], json!("123"));- assert_eq!(meta["repo"], json!("octo/repo"));- assert_eq!(- meta["url"],- json!("https://github.com/octo/repo/issues/123")- );- let urgency = meta["urgency"].as_f64().expect("urgency is a number");- assert!((urgency - 0.7).abs() < 1e-6, "urgency was {urgency}");-}--#[test]-fn source_metadata_omits_absent_repo_and_url() {- let src = github_source(None);- let e = enriched("9", None, 0.4);- let meta = build_source_metadata(&src, &e);- assert!(meta.get("repo").is_none());- assert!(meta.get("url").is_none());- assert_eq!(meta["external_id"], json!("9"));- let urgency = meta["urgency"].as_f64().expect("urgency is a number");- assert!((urgency - 0.4).abs() < 1e-6, "urgency was {urgency}");-}--fn temp_config() -> (tempfile::TempDir, Config) {- let tmp = tempfile::tempdir().unwrap();- let config = Config {- workspace_dir: tmp.path().join("workspace"),- action_dir: tmp.path().join("workspace"),- config_path: tmp.path().join("config.toml"),- ..Config::default()- };- std::fs::create_dir_all(&config.workspace_dir).unwrap();- (tmp, config)-}-+/// A collect-only source stops at the ledger the pipeline writes: no board+/// card (there is no board any more) and no agent turn, so routing needs+/// nothing from the environment and cannot fail.#[tokio::test]-async fn add_card_stamps_objective_and_metadata() {- let (_tmp, config) = temp_config();- let src = github_source(Some("octo/repo"));- let e = enriched("123", Some("https://github.com/octo/repo/issues/123"), 0.7);+async fn collect_only_target_routes_without_side_effects() {+ let config = Config::default();+ let src = github_source(SourceTarget::TodoOnly);- add_card(&config, &src, &e, None)+ route_enriched(&config, &src, &enriched("123")).await- .expect("add_card succeeds");-- let cards = board_cards(&config).await.expect("board_cards");- assert_eq!(cards.len(), 1);- let card = &cards[0];- // Display title is the `[provider] title` form; objective is the bare title.- assert_eq!(card.title, "[GitHub] Fix the bug");- assert_eq!(card.objective.as_deref(), Some("Fix the bug"));- let meta = card- .source_metadata- .as_ref()- .expect("source_metadata present");- assert_eq!(meta["external_id"], json!("123"));- assert_eq!(meta["repo"], json!("octo/repo"));- // Generic kind is not stamped onto metadata.- assert!(meta.get("kind").is_none());-}--#[tokio::test]-async fn pull_request_card_carries_review_objective_and_kind_metadata() {- let (_tmp, config) = temp_config();- let src = github_source(Some("octo/repo"));- let mut task = NormalizedTask {- external_id: "55".into(),- provider: "github".into(),- title: "Add retry".into(),- ..Default::default()- };- task.kind = TaskKind::PullRequest;- let objective = crate::integrations::task_sources::enrich::derive_objective(&task);- let e = EnrichedTask {- task,- summary: "Add retry".into(),- urgency: 0.5,- linked_people: vec![],- linked_memory_ids: vec![],- agent_prompt: "review it".into(),- objective,- enriched_at: Utc::now(),- };-- add_card(&config, &src, &e, None)- .await- .expect("add_card succeeds");-- let cards = board_cards(&config).await.expect("board_cards");- let card = &cards[0];- // The objective tells the picking agent (and triage) the job is a review.- assert_eq!(- card.objective.as_deref(),- Some("Review pull request: Add retry")- );- let meta = card- .source_metadata- .as_ref()- .expect("source_metadata present");- assert_eq!(meta["kind"], json!("pull_request"));-}--#[test]-fn source_metadata_has_no_repo_for_non_github_provider() {- let mut src = github_source(Some("octo/repo"));- // A non-GitHub filter carries no repo concept.- src.provider = ProviderSlug::Linear;- src.filter = FilterSpec::Linear {- team_id: None,- assignee_is_me: true,- state: None,- extra: json!({}),- };- let e = enriched("LIN-5", None, 0.5);- let meta = build_source_metadata(&src, &e);- assert!(meta.get("repo").is_none());- assert_eq!(meta["source_id"], json!("ts-1"));+ .expect("collect-only routing is a no-op");}