Files
windmill/backend/windmill-trigger
Ruben Fiszel 6a6f12960e fix(forks): reset diff tally on trigger delete + guard compare visibility for admins (#9866)
Deleting a trigger left a stale `workspace_diff` row: `delete_trigger` (the
generic TriggerCrud handler) was the only delete path that never called
`handle_deployment_metadata`, unlike every other kind. Because
`compare_workspaces` trusts a cached `has_changes=true` row for non-script/flow
kinds and the visibility filter then drops it (the trigger no longer exists), a
deleted trigger became a phantom "ahead" item that flipped
`all_ahead_items_visible` to false — hiding the deploy button and showing a
"changes not visible to your user" warning that even a superadmin could not
resolve (`reset_diff_tally` doesn't clear a `has_changes=true` row either).

- delete_trigger now re-tallies via handle_deployment_metadata, so the next
  compare re-evaluates and corrects/removes the row (matches resource/variable/
  folder/schedule deletes).
- compare_workspaces forces the visibility flags true per side for anyone who
  sees that side in full: target/fork admin (or superadmin) for ahead items,
  source/parent admin (or superadmin) for behind items. The flag is a pure
  visibility guarantee — the deploy itself is authorized separately — so for
  such users a dropped diff is provably a phantom, never a permission gap.
- Add a regression test asserting a phantom trigger diff row no longer blocks a
  superadmin while still (conservatively) warning a partial-context user.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 18:36:55 +02:00
..