Skip to content

Fix config-remote-sync error when a remote rename is reverted before redeploy#5251

Open
ilyakuz-db wants to merge 1 commit into
mainfrom
fix/config-sync-task-rename-revert
Open

Fix config-remote-sync error when a remote rename is reverted before redeploy#5251
ilyakuz-db wants to merge 1 commit into
mainfrom
fix/config-sync-task-rename-revert

Conversation

@ilyakuz-db
Copy link
Copy Markdown
Contributor

@ilyakuz-db ilyakuz-db commented May 13, 2026

Changes

In convertChangeDesc, use only the current local config (cd.New) to decide whether a path exists "on the config side"; do not include the saved state (cd.Old).

Why

When a keyed element (such as a job task) is renamed on the remote workspace, synced into local config via databricks bundle config-remote-sync --save without an intervening redeploy, and then renamed back to the original key, the next sync would fail with:

failed to resolve selectors in path resources.jobs.X.tasks[task_key='Y']:
no array element found with task_key='Y'

In that state the saved state still held the original key Y, the local config held the intermediate key from the first sync, and the remote held Y again. The old hasConfigValue := cd.Old != nil || cd.New != nil classified the change on the Y path as Replace, but the YAML no longer contained Y, so resolveSelectors errored out.

With the change, the operation is correctly classified as Add, and the existing indicesToReplaceMap logic in ResolveChanges pairs it with the matching Remove to produce a clean rename in the YAML.

Tests

  • Adds a table-driven unit test for convertChangeDesc covering Add / Remove / Replace / Skip and the regression case.
  • Adds acceptance/bundle/config-remote-sync/task_rename_revert which walks through the full rename-and-revert flow end-to-end.

…redeploy

When a keyed element (e.g. a job task) is renamed in the workspace, synced
into local config via `config-remote-sync --save` without an intervening
redeploy, and then renamed back to the original key, the next sync errored
with:

  failed to resolve selectors in path resources.jobs.X.tasks[task_key=Y]:
  no array element found with task_key=Y

In that state the saved state still holds the original key, the local
config holds the intermediate key from the first sync, and the remote
holds the original key again. `convertChangeDesc` was using
`hasConfigValue := cd.Old != nil || cd.New != nil`, so the change on the
original-key path was classified as `Replace` even though the YAML no
longer contains that key — `resolveSelectors` then failed.

Only the current config (`cd.New`) should decide whether a path exists on
"the config side". With this change the operation becomes `Add` and the
existing `indicesToReplaceMap` logic in `ResolveChanges` pairs it with the
matching `Remove` to produce a clean rename in the YAML.

Adds a table-driven unit test for `convertChangeDesc` and an acceptance
test (`acceptance/bundle/config-remote-sync/task_rename_revert`) that
reproduces the full rename-and-revert flow.
@ilyakuz-db ilyakuz-db temporarily deployed to test-trigger-is May 13, 2026 16:23 — with GitHub Actions Inactive
@ilyakuz-db ilyakuz-db temporarily deployed to test-trigger-is May 13, 2026 16:23 — with GitHub Actions Inactive
@github-actions
Copy link
Copy Markdown
Contributor

Approval status: pending

/acceptance/bundle/ - needs approval

5 files changed
Suggested: @denik
Also eligible: @andrewnester, @anton-107, @janniklasrose, @pietern, @shreyas-goenka, @lennartkats-db

/bundle/ - needs approval

Files: bundle/configsync/diff.go, bundle/configsync/diff_test.go
Suggested: @denik
Also eligible: @andrewnester, @anton-107, @janniklasrose, @pietern, @shreyas-goenka, @lennartkats-db

Any maintainer (@andrewnester, @anton-107, @denik, @pietern, @shreyas-goenka, @simonfaltum, @renaudhartert-db) can approve all areas.
See OWNERS for ownership rules.

@ilyakuz-db ilyakuz-db requested a review from denik May 13, 2026 16:28
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