mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-12-03 16:10:37 +00:00
fix: tell a flow's steps from runs started by another job by flow_step_id
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
1dab938230
commit
9a3e409c51
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "SELECT s.id AS \"id!\", j.created_by AS \"created_by!\",\n CASE WHEN a.agent THEN regexp_replace(j.runnable_path, '\\.chat$', '')\n ELSE j.runnable_path END AS runnable_path,\n CASE\n WHEN a.agent THEN 'agent'\n WHEN j.kind IN ('script', 'script_hub', 'unassigned_script', 'preview')\n THEN 'script'\n WHEN j.kind IN ('flow', 'unassigned_flow', 'flowpreview') THEN 'flow'\n WHEN j.kind IN ('singlestepflow', 'unassigned_singlestepflow') THEN\n CASE WHEN COALESCE(\n (SELECT m->'value'->>'type'\n FROM jsonb_array_elements(j.raw_flow->'modules') m\n WHERE m->>'id' IN ('a', 'main')\n LIMIT 1),\n 'script'\n ) = 'flow' THEN 'flow' ELSE 'script' END\n END AS acl_kind\n FROM v2_job s\n -- Only a job with no runnable of its own climbs: a run started from another job\n -- (the SDK's `parent_job`) is still a run of its own runnable.\n JOIN v2_job j ON j.workspace_id = s.workspace_id AND j.id = CASE\n WHEN s.kind IN ('script', 'script_hub', 'unassigned_script', 'preview', 'flow',\n 'unassigned_flow', 'flowpreview', 'singlestepflow', 'unassigned_singlestepflow')\n THEN s.id\n ELSE COALESCE((SELECT r.id FROM v2_job r\n WHERE r.id = COALESCE(s.root_job, s.flow_innermost_root_job, s.parent_job)\n AND r.workspace_id = s.workspace_id), s.id)\n END,\n LATERAL (SELECT j.kind = 'flowpreview'\n AND j.raw_flow->'modules'->1 IS NULL\n AND j.raw_flow->'modules'->0->>'id' = '__wm_agent_root' AS agent) a\n WHERE s.id = ANY($1) AND s.workspace_id = $2",
|
||||
"query": "SELECT s.id AS \"id!\", j.created_by AS \"created_by!\",\n CASE WHEN a.agent THEN regexp_replace(j.runnable_path, '\\.chat$', '')\n ELSE j.runnable_path END AS runnable_path,\n CASE\n WHEN a.agent THEN 'agent'\n WHEN j.kind IN ('script', 'script_hub', 'unassigned_script', 'preview')\n THEN 'script'\n WHEN j.kind IN ('flow', 'unassigned_flow', 'flowpreview') THEN 'flow'\n WHEN j.kind IN ('singlestepflow', 'unassigned_singlestepflow') THEN\n CASE WHEN COALESCE(\n (SELECT m->'value'->>'type'\n FROM jsonb_array_elements(j.raw_flow->'modules') m\n WHERE m->>'id' IN ('a', 'main')\n LIMIT 1),\n 'script'\n ) = 'flow' THEN 'flow' ELSE 'script' END\n END AS acl_kind\n FROM v2_job s\n -- A flow's step, of whatever kind, climbs. A run started from another job (the SDK's\n -- `parent_job`, no `flow_step_id`) is still a run of its own runnable.\n JOIN v2_job j ON j.workspace_id = s.workspace_id AND j.id = CASE\n WHEN s.flow_step_id IS NULL AND s.kind IN ('script', 'script_hub',\n 'unassigned_script', 'preview', 'flow', 'unassigned_flow', 'flowpreview',\n 'singlestepflow', 'unassigned_singlestepflow')\n THEN s.id\n ELSE COALESCE((SELECT r.id FROM v2_job r\n WHERE r.id = COALESCE(s.root_job, s.flow_innermost_root_job, s.parent_job)\n AND r.workspace_id = s.workspace_id), s.id)\n END,\n LATERAL (SELECT j.kind = 'flowpreview'\n AND j.raw_flow->'modules'->1 IS NULL\n AND j.raw_flow->'modules'->0->>'id' = '__wm_agent_root' AS agent) a\n WHERE s.id = ANY($1) AND s.workspace_id = $2",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
@@ -37,5 +37,5 @@
|
||||
null
|
||||
]
|
||||
},
|
||||
"hash": "172af31a1dba319fd523272bd3260cccf268213a726d82d3c088453083288ab2"
|
||||
"hash": "f033e3be9c4f77a5ec97b6805b3aad9872e76234f1f97ff0bbe1d4dc001461f2"
|
||||
}
|
||||
@@ -2443,11 +2443,12 @@ async fn job_runnables(db: &DB, w_id: &str, ids: &[Uuid]) -> error::Result<Vec<J
|
||||
) = 'flow' THEN 'flow' ELSE 'script' END
|
||||
END AS acl_kind
|
||||
FROM v2_job s
|
||||
-- Only a job with no runnable of its own climbs: a run started from another job
|
||||
-- (the SDK's `parent_job`) is still a run of its own runnable.
|
||||
-- A flow's step, of whatever kind, climbs. A run started from another job (the SDK's
|
||||
-- `parent_job`, no `flow_step_id`) is still a run of its own runnable.
|
||||
JOIN v2_job j ON j.workspace_id = s.workspace_id AND j.id = CASE
|
||||
WHEN s.kind IN ('script', 'script_hub', 'unassigned_script', 'preview', 'flow',
|
||||
'unassigned_flow', 'flowpreview', 'singlestepflow', 'unassigned_singlestepflow')
|
||||
WHEN s.flow_step_id IS NULL AND s.kind IN ('script', 'script_hub',
|
||||
'unassigned_script', 'preview', 'flow', 'unassigned_flow', 'flowpreview',
|
||||
'singlestepflow', 'unassigned_singlestepflow')
|
||||
THEN s.id
|
||||
ELSE COALESCE((SELECT r.id FROM v2_job r
|
||||
WHERE r.id = COALESCE(s.root_job, s.flow_innermost_root_job, s.parent_job)
|
||||
|
||||
Reference in New Issue
Block a user