Skip to content

fix(workflows): migrate per-node inventory/environment overrides#4026

Draft
cursor[bot] wants to merge 1 commit into
developfrom
cursor/critical-bug-investigation-44bb
Draft

fix(workflows): migrate per-node inventory/environment overrides#4026
cursor[bot] wants to merge 1 commit into
developfrom
cursor/critical-bug-investigation-44bb

Conversation

@cursor

@cursor cursor Bot commented Jul 10, 2026

Copy link
Copy Markdown

Bug and impact

PR #4024 (workflow params) introduced migration 2.19.11, which moved per-node Ansible limit values into project__task_params but did not migrate inventory_id or environment_id from legacy project__workflow_node columns.

Impact: On upgrade, any workflow node with per-node inventory or environment overrides (supported since v2.18.15) silently loses those settings. Tasks spawned from affected nodes run with the template defaults instead of the configured overrides — a data-loss bug with direct user-facing breakage.

Trigger scenario:

  1. User configures a workflow node with a custom inventory and/or environment (no limit override).
  2. Instance upgrades to a build containing PR feat/workflow params #4024.
  3. Migration 2.19.11 runs; task_params_id stays NULL because the node has no limit.
  4. The application no longer reads the legacy columns; overrides are gone.

Backup/restore was also affected: pre-2.19.11 backups stored inventory/environment by name on workflow nodes, but restore no longer mapped those fields into TaskParams.

Root cause

WorkflowNode was refactored from direct InventoryID/EnvironmentID/Limit fields to TaskParams, but migration_2_19_11 PostApply only queried nodes with non-empty limit and only copied the limit JSON into task_params.

Fix

  • 2.19.11: Migrate all three override types (limit, inventory, environment) into project__task_params.
  • 2.19.12: Idempotent repair migration for databases that already ran the buggy 2.19.11 (backfills inventory/environment into existing or new task_params rows).
  • Backup restore: Re-read deprecated top-level inventory/environment name fields from pre-2.19.11 backups into TaskParams.

Validation

  • go test ./db/sql/... -run TestMigration_2_19 — pass (limit, inventory/environment, partial-migration repair)
  • go test ./services/project/... — pass
Open in Web View Automation 

Migration 2.19.11 only copied ansible limit values into task_params,
silently dropping per-node inventory and environment overrides that
existed since v2.18.15.

- Extend 2.19.11 PostApply to copy inventory_id and environment_id
- Add idempotent 2.19.12 repair for DBs that already ran buggy 2.19.11
- Restore legacy backup inventory/environment fields on import
- Add migration tests for inventory/env and partial-migration repair

Co-authored-by: Denis Gukov <fiftin@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant