From 1bbdefd0cc3778d642ded502025f029ffe6bf6d2 Mon Sep 17 00:00:00 2001 From: HugoCasa Date: Thu, 16 Oct 2025 11:29:52 +0200 Subject: [PATCH] fix(backend): only apply new flow node format on latest version --- backend/windmill-common/src/worker.rs | 2 ++ .../windmill-worker/src/worker_lockfiles.rs | 34 ++++++++----------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/backend/windmill-common/src/worker.rs b/backend/windmill-common/src/worker.rs index 704a31e6e0..b785e23d9d 100644 --- a/backend/windmill-common/src/worker.rs +++ b/backend/windmill-common/src/worker.rs @@ -254,6 +254,7 @@ lazy_static::lazy_static! { pub static ref MIN_VERSION_IS_AT_LEAST_1_427: Arc> = Arc::new(RwLock::new(false)); pub static ref MIN_VERSION_IS_AT_LEAST_1_432: Arc> = Arc::new(RwLock::new(false)); pub static ref MIN_VERSION_IS_AT_LEAST_1_440: Arc> = Arc::new(RwLock::new(false)); + pub static ref MIN_VERSION_IS_AT_LEAST_1_560: Arc> = Arc::new(RwLock::new(false)); // Features flags: pub static ref DISABLE_FLOW_SCRIPT: bool = std::env::var("DISABLE_FLOW_SCRIPT").ok().is_some_and(|x| x == "1" || x == "true"); @@ -1069,6 +1070,7 @@ pub async fn update_min_version(conn: &Connection) -> bool { *MIN_VERSION_IS_AT_LEAST_1_427.write().await = min_version >= Version::new(1, 427, 0); *MIN_VERSION_IS_AT_LEAST_1_432.write().await = min_version >= Version::new(1, 432, 0); *MIN_VERSION_IS_AT_LEAST_1_440.write().await = min_version >= Version::new(1, 440, 0); + *MIN_VERSION_IS_AT_LEAST_1_560.write().await = min_version >= Version::new(1, 560, 0); *MIN_VERSION.write().await = min_version.clone(); min_version >= cur_version diff --git a/backend/windmill-worker/src/worker_lockfiles.rs b/backend/windmill-worker/src/worker_lockfiles.rs index 621012aa9a..fe28cb7ab1 100644 --- a/backend/windmill-worker/src/worker_lockfiles.rs +++ b/backend/windmill-worker/src/worker_lockfiles.rs @@ -22,7 +22,9 @@ use windmill_common::jobs::JobPayload; use windmill_common::scripts::{hash_script, NewScript, ScriptHash}; #[cfg(feature = "python")] use windmill_common::worker::PythonAnnotations; -use windmill_common::worker::{to_raw_value, to_raw_value_owned, write_file, Connection}; +use windmill_common::worker::{ + to_raw_value, to_raw_value_owned, write_file, Connection, MIN_VERSION_IS_AT_LEAST_1_560, +}; #[cfg(feature = "python")] use windmill_parser_yaml::AnsibleRequirements; @@ -1655,27 +1657,21 @@ async fn insert_flow_modules<'c>( return Ok(tx); } - let flow_node_flow = FlowNodeFlow { - value: FlowValue { - modules: std::mem::take(modules), - failure_module: failure_module.cloned(), - same_worker, - ..Default::default() - }, - summary, + let flow_value = FlowValue { + modules: std::mem::take(modules), + failure_module: failure_module.cloned(), + same_worker, + ..Default::default() + }; + let flow = if *MIN_VERSION_IS_AT_LEAST_1_560.read().await { + to_raw_value(&FlowNodeFlow { value: flow_value, summary }) + } else { + to_raw_value(&flow_value) }; let id; - (tx, id) = insert_flow_node( - tx, - path, - workspace_id, - None, - None, - Some(&Json(to_raw_value(&flow_node_flow))), - None, - ) - .await?; + (tx, id) = + insert_flow_node(tx, path, workspace_id, None, None, Some(&Json(flow)), None).await?; *modules_node = Some(id); Ok(tx) }