Skip to content

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

style(flows): reformat update_flow_graph and imports

Steven Enamakel0a5225f81eec
diff --git a/crates/openhuman-core/src/flows/ops/updates.rs b/crates/openhuman-core/src/flows/ops/updates.rs
index 532d5334f7..e5c403f2d3 100644
--- a/crates/openhuman-core/src/flows/ops/updates.rs
+++ b/crates/openhuman-core/src/flows/ops/updates.rs
@@ -6,9 +6,7 @@ use super::*;
/// reload/diff instead of silently clobbering; other variants are plain text.
fn map_flow_update_error(e: tinyflows_bus::catalog::FlowUpdateError) -> String {
match e {
- tinyflows_bus::catalog::FlowUpdateError::NotFound { .. } => {
- "flow not found".to_string()
- }
+ tinyflows_bus::catalog::FlowUpdateError::NotFound { .. } => "flow not found".to_string(),
tinyflows_bus::catalog::FlowUpdateError::VersionConflict { message, current } => {
serde_json::to_string(&json!({
"code": "version_conflict",
diff --git a/crates/openhuman-core/src/flows/store.rs b/crates/openhuman-core/src/flows/store.rs
index 50a764d7f3..c060c88c70 100644
--- a/crates/openhuman-core/src/flows/store.rs
+++ b/crates/openhuman-core/src/flows/store.rs
@@ -14,9 +14,7 @@ use tinyflows_bus::catalog::{
ListRevisionsRequest, ListWorkflowsResult, PutWorkflowRequest, PutWorkflowResponse,
SetEnabledRequest, Workflow, WorkflowRevision,
};
-use tinyflows_catalog::{
- Flow, FlowRevision, FlowSuggestion, SuggestionStatus,
-};
+use tinyflows_catalog::{Flow, FlowRevision, FlowSuggestion, SuggestionStatus};
use crate::config::Config;
use crate::modules::tinyflows as module;
@@ -243,33 +241,34 @@ pub fn update_flow_graph(
force_disarm_if_automatic: bool,
expected_updated_at: Option<&str>,
) -> std::result::Result<Flow, BusUpdateError> {
- let storage = super::catalog_storage::register_blocking(config)
- .map_err(|error| BusUpdateError::Store {
+ let storage = super::catalog_storage::register_blocking(config).map_err(|error| {
+ BusUpdateError::Store {
message: error.to_string(),
- })?;
+ }
+ })?;
let request = PutWorkflowRequest::Update {
storage,
id: id.to_owned(),
name,
- graph: serde_json::to_value(graph)
- .map_err(|error| BusUpdateError::Store {
- message: error.to_string(),
- })?,
+ graph: serde_json::to_value(graph).map_err(|error| BusUpdateError::Store {
+ message: error.to_string(),
+ })?,
require_approval,
expected_version: expected_updated_at.map(str::to_owned),
force_disarm_automatic: force_disarm_if_automatic,
};
let response: PutWorkflowResponse =
- call_catalog(config, catalog::members::PUT_WORKFLOW, (request,))
- .map_err(|error| BusUpdateError::Store {
- message: error.to_string(),
- })?;
- match response {
- PutWorkflowResponse::Ok(result) => flow_from_wire(result.workflow).map_err(|error| {
+ call_catalog(config, catalog::members::PUT_WORKFLOW, (request,)).map_err(|error| {
BusUpdateError::Store {
message: error.to_string(),
}
- }),
+ })?;
+ match response {
+ PutWorkflowResponse::Ok(result) => {
+ flow_from_wire(result.workflow).map_err(|error| BusUpdateError::Store {
+ message: error.to_string(),
+ })
+ }
PutWorkflowResponse::Error(error) => Err(error),
}
}