Skip to content

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

refactor(flows): improve graph node counting logic

Steven Enamakela284f54b7d95
diff --git a/crates/openhuman-core/src/flows/builder_tools_validate_and_create_tests.rs b/crates/openhuman-core/src/flows/builder_tools_validate_and_create_tests.rs
index 242810b62c..ddbf109fa4 100644
--- a/crates/openhuman-core/src/flows/builder_tools_validate_and_create_tests.rs
+++ b/crates/openhuman-core/src/flows/builder_tools_validate_and_create_tests.rs
@@ -371,8 +371,8 @@ async fn edit_workflow_surfaces_draft_write_back_failure() {
[],
|row| row.get(0),
)
- .unwrap()
- .workflow;
+ .unwrap()
+ .workflow;
conn.execute_batch(&format!(
"CREATE TRIGGER refuse_draft_updates BEFORE UPDATE ON {docs_table}
WHEN NEW.coll = 'flows.drafts'
diff --git a/crates/openhuman-core/src/flows/bus/run_digest.rs b/crates/openhuman-core/src/flows/bus/run_digest.rs
index d746b787dc..0537d933ce 100644
--- a/crates/openhuman-core/src/flows/bus/run_digest.rs
+++ b/crates/openhuman-core/src/flows/bus/run_digest.rs
@@ -5,7 +5,7 @@
use crate::config::Config;
use crate::core::events::DomainEvent;
-use crate::flows::{catalog_storage, store};
+use crate::flows::catalog_storage;
use crate::memory::types::{ForgetParams, ItemsListParams, MAX_LIMIT};
use async_trait::async_trait;
use std::sync::Arc;
diff --git a/crates/openhuman-core/src/flows/ops/builder_gates.rs b/crates/openhuman-core/src/flows/ops/builder_gates.rs
index 373b41e250..aee5ca27c6 100644
--- a/crates/openhuman-core/src/flows/ops/builder_gates.rs
+++ b/crates/openhuman-core/src/flows/ops/builder_gates.rs
@@ -176,7 +176,10 @@ pub(crate) async fn build_builder_proposal(
tracing::info!(
target: "flows",
%name,
- node_count = graph.get("nodes").and_then(Value::as_array).map_or(0, Vec::len),
+ node_count = graph
+ .get("nodes")
+ .and_then(serde_json::Value::as_array)
+ .map_or(0, Vec::len),
require_approval,
warning_count = warnings.len(),
revision,
diff --git a/crates/openhuman-core/src/flows/ops/definitions.rs b/crates/openhuman-core/src/flows/ops/definitions.rs
index a113ad0831..270392e3f2 100644
--- a/crates/openhuman-core/src/flows/ops/definitions.rs
+++ b/crates/openhuman-core/src/flows/ops/definitions.rs
@@ -52,7 +52,10 @@ pub(crate) async fn flows_create_with_context(
tracing::debug!(
target: "flows",
%name,
- node_count = graph.get("nodes").and_then(Value::as_array).map_or(0, Vec::len),
+ node_count = graph
+ .get("nodes")
+ .and_then(serde_json::Value::as_array)
+ .map_or(0, Vec::len),
require_approval,
"[flows] flows_create: persisting new flow"
);