From f91edbf4da0438f46456a9cdf57391c849368a8f Mon Sep 17 00:00:00 2001 From: Guilhem Lemouel Date: Mon, 26 Oct 2026 13:53:12 -0700 Subject: [PATCH] perf: tell workflow-as-code tasks apart by their status's nullness Co-Authored-By: Claude Opus 5.5 (1M context) --- backend/windmill-api-inputs/src/history.rs | 11 ++++++----- .../windmill-api-integration-tests/tests/inputs.rs | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/backend/windmill-api-inputs/src/history.rs b/backend/windmill-api-inputs/src/history.rs index b1443ec819..09b0d167ac 100644 --- a/backend/windmill-api-inputs/src/history.rs +++ b/backend/windmill-api-inputs/src/history.rs @@ -190,9 +190,10 @@ fn own_category(prefix: &str) -> String { /// Whether the run `s`, whose parent `p` has the same path, is listed through that parent: a /// single-step-flow wrapper's inner run, or a task of a workflow-as-code run or editor preview -/// of the script. An inline task re-runs the script with a checkpoint key its parent seeds; a -/// call the script makes to itself through the SDK has none and is listed. A flow or an agent -/// may share the path and is another runnable. +/// of the script. An inline task re-runs the script with the checkpoint its parent seeds as its +/// workflow-as-code status; a call a plain script makes to itself through the SDK has no status +/// and is listed. Only the column's nullness is read: the checkpoint holds every earlier step's +/// result. A flow or an agent may share the path and is another runnable. fn listed_through_parent(runnable_type: &RunnableType) -> &'static str { match runnable_type { RunnableType::FlowPath => "p.kind = 'singlestepflow'", @@ -200,9 +201,9 @@ fn listed_through_parent(runnable_type: &RunnableType) -> &'static str { "CASE WHEN p.kind = 'singlestepflow' THEN true \ WHEN p.kind IN ('script', 'preview') THEN \ EXISTS (SELECT 1 FROM v2_job_status w WHERE w.id = s.id \ - AND w.workflow_as_code_status->'_checkpoint' ? '_executing_key') \ + AND w.workflow_as_code_status IS NOT NULL) \ OR EXISTS (SELECT 1 FROM v2_job_completed w WHERE w.id = s.id \ - AND w.workflow_as_code_status->'_checkpoint' ? '_executing_key') \ + AND w.workflow_as_code_status IS NOT NULL) \ ELSE false END" } } diff --git a/backend/windmill-api-integration-tests/tests/inputs.rs b/backend/windmill-api-integration-tests/tests/inputs.rs index ab8d8c57e1..129ca85c75 100644 --- a/backend/windmill-api-integration-tests/tests/inputs.rs +++ b/backend/windmill-api-integration-tests/tests/inputs.rs @@ -194,8 +194,8 @@ async fn test_input_history_started_by(db: Pool) -> anyhow::Result<()> .bind(retry) .execute(&db) .await?; - // Under a run of the same script: a workflow-as-code task, which its checkpoint key marks, - // is hidden; a call the script makes to itself through the SDK is a script call. + // Under a run of the same script: a workflow-as-code task, which its seeded checkpoint + // marks, is hidden; a call the script makes to itself through the SDK is a script call. let wac_task = insert_run( &db, Run { path: STEP, parent_job: Some(manual), at: 4, ..Run::default() },