Skip to content

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

chore(pipeline): add doc comments and fix reconciliation test assertion

Steven Enamakelcf161e734686
diff --git a/src/openhuman/integrations/task_sources/pipeline.rs b/src/openhuman/integrations/task_sources/pipeline.rs
index b0ac6c661c..471e43e84f 100644
--- a/src/openhuman/integrations/task_sources/pipeline.rs
+++ b/src/openhuman/integrations/task_sources/pipeline.rs
@@ -122,6 +122,7 @@ fn fetch_tasks_unavailable(
))
}
+/// Fetch, process, and reconcile one source pass.
async fn run_inner(
config: &Config,
source: &TaskSource,
@@ -234,6 +235,7 @@ async fn run_inner(
Ok(())
}
+/// Reconcile only when the fetched page is known not to be capped.
async fn reconcile_if_complete(
config: &Config,
source: &TaskSource,
diff --git a/src/openhuman/integrations/task_sources/pipeline_tests.rs b/src/openhuman/integrations/task_sources/pipeline_tests.rs
index 84feae5cdf..ce8cb6ac08 100644
--- a/src/openhuman/integrations/task_sources/pipeline_tests.rs
+++ b/src/openhuman/integrations/task_sources/pipeline_tests.rs
@@ -1,7 +1,9 @@
use super::*;
use crate::openhuman::config::Config;
use crate::openhuman::integrations::task_sources::store;
-use crate::openhuman::integrations::task_sources::types::{FilterSpec, ProviderSlug, SourceTarget};
+use crate::openhuman::integrations::task_sources::types::{
+ FilterSpec, NormalizedTask, ProviderSlug, SourceTarget,
+};
use serde_json::json;
use tempfile::TempDir;
@@ -111,6 +113,17 @@ async fn full_page_fetch_skips_prune_then_resumes_below_cap() {
let tmp = TempDir::new().unwrap();
let config = test_config(&tmp);
let source = add_github_source(&config);
+ let stale = NormalizedTask {
+ external_id: "stale-task".into(),
+ source_id: source.id.clone(),
+ provider: "github".into(),
+ title: "Stale task".into(),
+ ..Default::default()
+ };
+ // An empty card id keeps this focused on reconciliation: the store row is
+ // the stale ingestion that a complete fetch must retain and a later
+ // below-cap fetch must remove.
+ store::mark_ingested(&config, &source.id, &stale, "").unwrap();
let current_external_ids = std::collections::HashSet::new();
assert_eq!(
@@ -124,9 +137,10 @@ async fn full_page_fetch_skips_prune_then_resumes_below_cap() {
reconcile_if_complete(&config, &source, &current_external_ids, 1, 2)
.await
.unwrap(),
- 0,
- "a below-cap fetch resumes reconciliation"
+ 1,
+ "a below-cap fetch resumes reconciliation and prunes the stale task"
);
+ assert!(store::list_ingested_refs(&config, &source.id).unwrap().is_empty());
}
#[tokio::test]