mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-05 16:03:47 +00:00
fix: clean up stale dependency map entries for renamed scripts (#8492)
* fix: clean up stale dependency map entries for renamed scripts When a script is renamed, trigger_dependents_to_recompute_dependencies() could find the archived script at the old path and create a dependency job for it. This job would process the old code and recreate stale dependency_map entries, causing incorrect deployment warnings. Add `AND archived = false` to the script lookup query so that renamed (archived) scripts at old paths trigger clear_map_for_item() cleanup instead of spawning dependency jobs for obsolete code. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: also filter archived flows in trigger_dependents Apply the same archived check to the flow lookup query. The flow table has an archived column, so when a flow is renamed/archived its flow_version rows would still be found. Join against the flow table and filter archived = false to trigger cleanup instead. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * revert: remove unnecessary flow archived check Flow renames delete the old flow row and INSERT a new one at the new path (for FK constraints on flow_version). There is no archived flow row left behind, so the original query is already correct for flows. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
54f5a19377
commit
47c0c363f4
+1
-1
@@ -15,7 +15,7 @@
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
null
|
||||
true
|
||||
]
|
||||
},
|
||||
"hash": "5a219a2532517869578c4504ff3153c43903f929ae5d62fbba12610f89c36d55"
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "SELECT hash FROM script WHERE path = $1 AND workspace_id = $2 AND deleted = false ORDER BY created_at DESC LIMIT 1",
|
||||
"query": "SELECT hash FROM script WHERE path = $1 AND workspace_id = $2 AND deleted = false AND archived = false ORDER BY created_at DESC LIMIT 1",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
@@ -19,5 +19,5 @@
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "d5661c7557cf3a8dee7cf799cd364d21d38edb827d2c08b0ca7d72311b78d574"
|
||||
"hash": "a32d7ba43745226fd65328475731526e0b20ea6eeafeb937eb01cdc2cdfcb859"
|
||||
}
|
||||
@@ -68,7 +68,7 @@ pub async fn trigger_dependents_to_recompute_dependencies(
|
||||
|
||||
let job_payload = match importer_kind.as_str() {
|
||||
"script" => match sqlx::query_scalar!(
|
||||
"SELECT hash FROM script WHERE path = $1 AND workspace_id = $2 AND deleted = false ORDER BY created_at DESC LIMIT 1",
|
||||
"SELECT hash FROM script WHERE path = $1 AND workspace_id = $2 AND deleted = false AND archived = false ORDER BY created_at DESC LIMIT 1",
|
||||
importer_path,
|
||||
w_id
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user