Skip to content

Skip config-remote-sync key adds that would hide keys inherited through YAML merge keys - #8175

Open
ilyakuz-db wants to merge 7 commits into
mainfrom
ilya/config-sync-inherited-key-adds
Open

ilyakuz-db wants to merge 7 commits into
mainfrom
ilya/config-sync-inherited-key-adds

Conversation

@ilyakuz-db

@ilyakuz-db ilyakuz-db commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Changes

config-remote-sync now checks a remote add of a new key against the file before writing it. This also covers a replace of a field the file does not declare, which is written as an add. The add is skipped, with the reason the mapping it would be added to is shared or inherited through a YAML anchor, when it would:

  • create a mapping next to a merge key (<<: *anchor) that already supplies that mapping, which hides every key inherited under it;
  • land in a mapping that an alias in the file refers to, which changes every place that uses the alias;
  • find no place the edit can take it, for example under an anchored null, which used to fail the whole sync.

An add under a parent the file sets to a scalar, such as new_cluster: ${var.cluster}, is skipped with its own reason, the file sets a parent of it to a scalar, instead of failing the whole sync.

A new element in a list that an alias refers to, or that is reached through one, is skipped too, with the reason the list it would be added to is shared through a YAML anchor, since it would show up everywhere the alias is used.

An add into a mapping the file writes itself is still written, also when that mapping has a merge key or an anchor nothing aliases.

Why

Take a task - <<: *base_task that has no notebook_task of its own. A base parameter added on the remote made the sync write notebook_task: {base_parameters: {added: c}} next to the merge key, so the task lost its notebook_path and the inherited parameters. In the same way, a new key on the task that holds the anchor showed up on every task that merges it. #8048 handled removes, replaces, renames and new elements on inherited keys, and listed new-key adds as a known gap.

The check follows the order in which applyChange tries an add (an existing mapping, then a null ancestor, then the ancestors it creates), so the two have to stay in step, as a note on applyChange says. A mapping counts as shared only when an alias refers to it or to a mapping on its path: an anchor nothing aliases shares nothing.

Tests

I extended config-remote-sync/merge_key_inherited. On main, the new add on c_task drops its notebook_path (validate warns about it), and the add on a_task shows up on c_task too. With this change both are skipped and the effective config keeps the inherited fields, while the same add on b_task, which writes its own base_parameters next to <<:, is still written. It also edits other_job, which my_job merges: a new task there, and a new max_concurrent_runs, which dev mode sets and the file does not declare, so it arrives as a replace. On main my_job gains the task; now both are skipped and my_job keeps its tasks and max_concurrent_runs. Unit cases for the check, including an anchor nothing aliases and a scalar parent, are in bundle/configsync/patch_test.go. The configsync unit tests, every config-remote-sync and telemetry config-remote-sync acceptance test, and lint pass locally. The head commit requests 7 config-remote-sync cloud tests on aws; merge_key_inherited itself runs locally only.

Status Check Revision Comments
✅ Local review 7ebd017 Codex approves with no findings; auto review approves, 1 optional P2 left
✅ Design review 7ebd017 RIGHT-SIZED: skips unsafe adds where the sync already decides skips
⏳ E2E validation 5e45a05 (latest) running; requested 7 aws test dirs
➖ Isaac review 5e45a05 (latest) n/a on CLI PRs
⏳ Code owners review c85744b requested from andrewnester; commented, no approval yet
⏳ CI / merge conflicts 5e45a05 (latest) no conflicts; checks running

✅ success · ⏳ pending · ⚠️ warning · ❌ failed · ➖ n/a

This pull request and its description were written by Isaac.

ilyakuz-db and others added 3 commits November 29, 2026 18:08
Co-authored-by: Isaac <no-reply@databricks.com>
…ason

Co-authored-by: Isaac <no-reply@databricks.com>
aws: TestAccept/bundle/config-remote-sync/cli_defaults TestAccept/bundle/config-remote-sync/config_edits TestAccept/bundle/config-remote-sync/job_fields TestAccept/bundle/config-remote-sync/multiple_files
aws: TestAccept/bundle/config-remote-sync/pipeline_fields TestAccept/bundle/config-remote-sync/target_override TestAccept/bundle/config-remote-sync/yaml_anchors

Co-authored-by: Isaac <no-reply@databricks.com>
@ilyakuz-db
ilyakuz-db requested review from a team as code owners November 29, 2026 18:32
@ilyakuz-db ilyakuz-db self-assigned this Nov 29, 2026
@github-actions github-actions Bot added the DABs DABs related issues label Nov 29, 2026
@github-actions

github-actions Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Regression test report ✅

Commit: 5e45a0595 | Workflow run

Selected 1 changed tests (limit=20, 0 not selected)

16 tests: regression=2 unreleased=2 coverage=12 failing=0
test branch main (bfcdd1f) latest (v1.28.0)
TestAccept/bundle/config-remote-sync/cli_defaults/DMS= ✅ ✅ ✅
TestAccept/bundle/config-remote-sync/cli_defaults/DMS=true ✅ ✅ ✅
TestAccept/bundle/config-remote-sync/config_edits/DMS= ✅ ✅ ✅
TestAccept/bundle/config-remote-sync/config_edits/DMS=true ✅ ✅ ✅
TestAccept/bundle/config-remote-sync/job_fields/DMS= ✅ ✅ ✅
TestAccept/bundle/config-remote-sync/job_fields/DMS=true ✅ ✅ ✅
TestAccept/bundle/config-remote-sync/merge_key_inherited/DMS= ✅ ❌ ❌
TestAccept/bundle/config-remote-sync/merge_key_inherited/DMS=true ✅ ❌ ❌
TestAccept/bundle/config-remote-sync/multiple_files/DMS= ✅ ✅ ✅
TestAccept/bundle/config-remote-sync/multiple_files/DMS=true ✅ ✅ ✅
TestAccept/bundle/config-remote-sync/pipeline_fields/DMS= ✅ ✅ ✅
TestAccept/bundle/config-remote-sync/pipeline_fields/DMS=true ✅ ✅ ✅
TestAccept/bundle/config-remote-sync/target_override/DMS= ✅ ✅ ✅
TestAccept/bundle/config-remote-sync/target_override/DMS=true ✅ ✅ ✅
TestAccept/bundle/config-remote-sync/yaml_anchors/DMS= ✅ ✅ ❌
TestAccept/bundle/config-remote-sync/yaml_anchors/DMS=true ✅ ✅ ❌
TestAccept/bundle/config-remote-sync/merge_key_inherited/DMS=: branch ✅ | main (bfcdd1f) ❌ | latest (v1.28.0) ❌

main (bfcdd1f):

acceptance_test.go:1402: Diff:
        --- bundle/config-remote-sync/merge_key_inherited/output.txt
        +++ /tmp/TestAcceptbundleconfig-remote-syncmerge_key_inheritedDMS=2071372438/002/output.txt
        @@ -14,7 +14,7 @@
         Resource: resources.jobs.my_job
           job_clusters[job_cluster_key='derived'].new_cluster.autoscale: add
           job_clusters[job_cluster_key='derived'].new_cluster.num_workers: skip (the file does not write it where it is defined)
        -  tasks[task_key='a_task'].timeout_seconds: skip (the mapping it would be added to is shared or inherited through a YAML anchor)
        +  tasks[task_key='a_task'].timeout_seconds: add
           tasks[task_key='b_task'].depends_on[task_key='a_task']: skip (the file does not write it where it is defined)
           tasks[task_key='b_task'].depends_on[task_key='prep']: skip (the file does not write it where it is defined)
           tasks[task_key='b_task'].max_retries: skip (the file does not write it where it is defined)
        @@ -23,14 +23,14 @@
           tasks[task_key='b_task'].notebook_task.base_parameters['input_file_name']: add
           tasks[task_key='c_task'].depends_on[task_key='a_task']: skip (the file does not write it where it is defined)
           tasks[task_key='c_task'].depends_on[task_key='setup']: skip (the file does not write it where it is defined)
        -  tasks[task_key='c_task'].notebook_task.base_parameters['added']: skip (the mapping it would be added to is shared or inherited through a YAML anchor)
        +  tasks[task_key='c_task'].notebook_task.base_parameters['added']: add
           tasks[task_key='prep']: skip (the file does not write it where it is defined)
           tasks[task_key='setup']: remove
           timeout_seconds: add
         
         Resource: resources.jobs.other_job
        -  max_concurrent_runs: skip (the mapping it would be added to is shared or inherited through a YAML anchor)
        -  tasks[task_key='extra']: skip (the list it would be added to is shared through a YAML anchor)
        +  max_concurrent_runs: add
        +  tasks[task_key='extra']: add
         
         Resource: resources.jobs.rename_job
           tasks[task_key='main']: skip (the file does not write it where it is defined)
        @@ -46,13 +41,19 @@
         >>> diff.py databricks.yml.backup databricks.yml
         --- databricks.yml.backup
         +++ databricks.yml
        -@@ -29,4 +29,5 @@
        +@@ -27,6 +27,11 @@
        +             - task_key: prep
        +               max_retries: 3
        ++            - notebook_task:
        ++                notebook_path: /Users/{{workspace_user_name}}/extra
        ++              task_key: extra
        ++          max_concurrent_runs: 10
                  my_job:
                    <<: [*job_overrides, *other_job]
         +          timeout_seconds: 1200
                  rename_job:
                    tasks:
        -@@ -56,4 +57,7 @@
        +@@ -56,4 +61,7 @@
                      spark_conf:
                        spark.speculation: "true"
         +            autoscale:
        @@ -60,7 +56,7 @@
         +              min_workers: 1
                tasks:
                  - task_key: prep
        -@@ -61,8 +65,4 @@
        +@@ -61,8 +69,4 @@
                    notebook_task:
                      notebook_path: /Users/{{workspace_user_name}}/prep
         -        - task_key: setup
        @@ -69,7 +65,13 @@
         -            notebook_path: /Users/{{workspace_user_name}}/setup
                  - &base_task
                    task_key: a_task
        -@@ -84,4 +84,7 @@
        +@@ -77,4 +81,5 @@
        +             base_parameters: &base_params
        +               input_file_name: ${var.input_a}
        ++          timeout_seconds: 60
        +         - <<: *base_task
        +           task_key: b_task
        +@@ -84,4 +89,10 @@
                        <<: *base_params
                        extra: b
         +              added: b
        @@ -77,17 +79,25 @@
         +          min_retry_interval_millis: 5000
                  - <<: *base_task
                    task_key: c_task
        ++          notebook_task:
        ++            base_parameters:
        ++              added: c
         
         >>> diff.py pipeline.yml.backup pipeline.yml
         
         === Effective configuration after the sync
        +Warning: required field "notebook_path" is not set
        +  at resources.jobs.my_job.tasks[2].notebook_task
        +  in databricks.yml:97:13
        +
         {
           "timeout_seconds": 1200,
        -  "max_concurrent_runs": 4,
        +  "max_concurrent_runs": 10,
           "task_keys": [
             "a_task",
             "b_task",
             "c_task",
        +    "extra",
             "prep"
           ],
           "b_task": {
        @@ -104,17 +104,20 @@
             "input_file_name": "other"
           },
           "c_task": {
        -    "timeout_seconds": null,
        +    "timeout_seconds": 60,
             "notebook_task": {
               "base_parameters": {
        -        "input_file_name": "original"
        -      },
        -      "notebook_path": "/Users/{{workspace_user_name}}/notebook"
        +        "added": "c"
        +      }
             }
           }
         }
         
         === Edit inherited fields with and without a target override supplying them
        +Warning: required field "notebook_path" is not set
        +  at resources.jobs.my_job.tasks[2].notebook_task
        +  in databricks.yml:97:13
        +
         Detected changes in 1 resource(s):
         
         Resource: resources.jobs.rename_job
        @@ -126,16 +122,24 @@
         >>> diff.py databricks.yml.backup databricks.yml
         --- databricks.yml.backup
         +++ databricks.yml
        -@@ -44,4 +44,5 @@
        +@@ -48,4 +48,5 @@
                    notebook_task:
                      notebook_path: /Users/{{workspace_user_name}}/notebook
         +      timeout_seconds: 900
              my_job:
                timeout_seconds: 300
        +Warning: required field "notebook_path" is not set
        +  at resources.jobs.my_job.tasks[2].notebook_task
        +  in databricks.yml:98:13
        +
         json.resources.jobs.rename_job.tasks[0].max_retries = 1;
         json.resources.jobs.rename_job.timeout_seconds = 900;
         
         >>> [CLI] bundle destroy --auto-approve
        +Warning: required field "notebook_path" is not set
        +  at resources.jobs.my_job.tasks[2].notebook_task
        +  in databricks.yml:98:13
        +
         The following resources will be deleted:
           delete resources.jobs.my_job
           delete resources.jobs.other_job

latest (v1.28.0):

acceptance_test.go:1402: Diff:
        --- bundle/config-remote-sync/merge_key_inherited/output.txt
        +++ /tmp/TestAcceptbundleconfig-remote-syncmerge_key_inheritedDMS=1430737496/002/output.txt
        @@ -9,132 +9,8 @@
         === Edit fields inherited through YAML merge keys
         
         === Detect and save changes
        -Detected changes in 4 resource(s):
        +Error: failed to generate YAML files: failed to apply change to file [TEST_TMP_DIR]/databricks.yml for a field resources.jobs.my_job.tasks[3].notebook_task.base_parameters.input_file_name: field not found in YAML configuration: op replace /resources/jobs/my_job/tasks/3/notebook_task/base_parameters/input_file_name: key input_file_name does not exist and can not be replaced
         
        -Resource: resources.jobs.my_job
        -  job_clusters[job_cluster_key='derived'].new_cluster.autoscale: add
        -  job_clusters[job_cluster_key='derived'].new_cluster.num_workers: skip (the file does not write it where it is defined)
        -  tasks[task_key='a_task'].timeout_seconds: skip (the mapping it would be added to is shared or inherited through a YAML anchor)
        -  tasks[task_key='b_task'].depends_on[task_key='a_task']: skip (the file does not write it where it is defined)
        -  tasks[task_key='b_task'].depends_on[task_key='prep']: skip (the file does not write it where it is defined)
        -  tasks[task_key='b_task'].max_retries: skip (the file does not write it where it is defined)
        -  tasks[task_key='b_task'].min_retry_interval_millis: add
        -  tasks[task_key='b_task'].notebook_task.base_parameters['added']: add
        -  tasks[task_key='b_task'].notebook_task.base_parameters['input_file_name']: add
        -  tasks[task_key='c_task'].depends_on[task_key='a_task']: skip (the file does not write it where it is defined)
        -  tasks[task_key='c_task'].depends_on[task_key='setup']: skip (the file does not write it where it is defined)
        -  tasks[task_key='c_task'].notebook_task.base_parameters['added']: skip (the mapping it would be added to is shared or inherited through a YAML anchor)
        -  tasks[task_key='prep']: skip (the file does not write it where it is defined)
        -  tasks[task_key='setup']: remove
        -  timeout_seconds: add
        -
        -Resource: resources.jobs.other_job
        -  max_concurrent_runs: skip (the mapping it would be added to is shared or inherited through a YAML anchor)
        -  tasks[task_key='extra']: skip (the list it would be added to is shared through a YAML anchor)
        -
        -Resource: resources.jobs.rename_job
        -  tasks[task_key='main']: skip (the file does not write it where it is defined)
        -  tasks[task_key='main2']: skip (the file does not write it where it is defined)
        -
        -Resource: resources.pipelines.my_pipeline
        -  clusters: skip (the file does not write it where it is defined)
        -
        -
        -
        -=== Configuration changes
        -
        ->>> diff.py databricks.yml.backup databricks.yml
        ---- databricks.yml.backup
        -+++ databricks.yml
        -@@ -29,4 +29,5 @@
        -         my_job:
        -           <<: [*job_overrides, *other_job]
        -+          timeout_seconds: 1200
        -         rename_job:
        -           tasks:
        -@@ -56,4 +57,7 @@
        -             spark_conf:
        -               spark.speculation: "true"
        -+            autoscale:
        -+              max_workers: 2
        -+              min_workers: 1
        -       tasks:
        -         - task_key: prep
        -@@ -61,8 +65,4 @@
        -           notebook_task:
        -             notebook_path: /Users/{{workspace_user_name}}/prep
        --        - task_key: setup
        --          job_cluster_key: base
        --          notebook_task:
        --            notebook_path: /Users/{{workspace_user_name}}/setup
        -         - &base_task
        -           task_key: a_task
        -@@ -84,4 +84,7 @@
        -               <<: *base_params
        -               extra: b
        -+              added: b
        -+              input_file_name: ${var.input_b}
        -+          min_retry_interval_millis: 5000
        -         - <<: *base_task
        -           task_key: c_task
        -
        ->>> diff.py pipeline.yml.backup pipeline.yml
        -
        -=== Effective configuration after the sync
        -{
        -  "timeout_seconds": 1200,
        -  "max_concurrent_runs": 4,
        -  "task_keys": [
        -    "a_task",
        -    "b_task",
        -    "c_task",
        -    "prep"
        -  ],
        -  "b_task": {
        -    "max_retries": 2,
        -    "min_retry_interval_millis": 5000,
        -    "depends_on": [
        -      {
        -        "task_key": "prep"
        -      },
        -      {
        -        "task_key": "setup"
        -      }
        -    ],
        -    "input_file_name": "other"
        -  },
        -  "c_task": {
        -    "timeout_seconds": null,
        -    "notebook_task": {
        -      "base_parameters": {
        -        "input_file_name": "original"
        -      },
        -      "notebook_path": "/Users/{{workspace_user_name}}/notebook"
        -    }
        -  }
        -}
        -
        -=== Edit inherited fields with and without a target override supplying them
        -Detected changes in 1 resource(s):
        -
        -Resource: resources.jobs.rename_job
        -  tasks[task_key='main'].max_retries: skip (the file does not write it where it is defined)
        -  timeout_seconds: add
        -
        -
        -
        ->>> diff.py databricks.yml.backup databricks.yml
        ---- databricks.yml.backup
        -+++ databricks.yml
        -@@ -44,4 +44,5 @@
        -           notebook_task:
        -             notebook_path: /Users/{{workspace_user_name}}/notebook
        -+      timeout_seconds: 900
        -     my_job:
        -       timeout_seconds: 300
        -json.resources.jobs.rename_job.tasks[0].max_retries = 1;
        -json.resources.jobs.rename_job.timeout_seconds = 900;
        -
         >>> [CLI] bundle destroy --auto-approve
         The following resources will be deleted:
           delete resources.jobs.my_job
        @@ -149,3 +24,5 @@
         All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default
         
         Destroy: 4 deleted
        +
        +Exit code: 1
TestAccept/bundle/config-remote-sync/merge_key_inherited/DMS=true: branch ✅ | main (bfcdd1f) ❌ | latest (v1.28.0) ❌

main (bfcdd1f):

acceptance_test.go:1402: Diff:
        --- bundle/config-remote-sync/merge_key_inherited/output.txt
        +++ /tmp/TestAcceptbundleconfig-remote-syncmerge_key_inheritedDMS=tru4176339402/002/output.txt
        @@ -14,7 +14,7 @@
         Resource: resources.jobs.my_job
           job_clusters[job_cluster_key='derived'].new_cluster.autoscale: add
           job_clusters[job_cluster_key='derived'].new_cluster.num_workers: skip (the file does not write it where it is defined)
        -  tasks[task_key='a_task'].timeout_seconds: skip (the mapping it would be added to is shared or inherited through a YAML anchor)
        +  tasks[task_key='a_task'].timeout_seconds: add
           tasks[task_key='b_task'].depends_on[task_key='a_task']: skip (the file does not write it where it is defined)
           tasks[task_key='b_task'].depends_on[task_key='prep']: skip (the file does not write it where it is defined)
           tasks[task_key='b_task'].max_retries: skip (the file does not write it where it is defined)
        @@ -23,14 +23,14 @@
           tasks[task_key='b_task'].notebook_task.base_parameters['input_file_name']: add
           tasks[task_key='c_task'].depends_on[task_key='a_task']: skip (the file does not write it where it is defined)
           tasks[task_key='c_task'].depends_on[task_key='setup']: skip (the file does not write it where it is defined)
        -  tasks[task_key='c_task'].notebook_task.base_parameters['added']: skip (the mapping it would be added to is shared or inherited through a YAML anchor)
        +  tasks[task_key='c_task'].notebook_task.base_parameters['added']: add
           tasks[task_key='prep']: skip (the file does not write it where it is defined)
           tasks[task_key='setup']: remove
           timeout_seconds: add
         
         Resource: resources.jobs.other_job
        -  max_concurrent_runs: skip (the mapping it would be added to is shared or inherited through a YAML anchor)
        -  tasks[task_key='extra']: skip (the list it would be added to is shared through a YAML anchor)
        +  max_concurrent_runs: add
        +  tasks[task_key='extra']: add
         
         Resource: resources.jobs.rename_job
           tasks[task_key='main']: skip (the file does not write it where it is defined)
        @@ -46,13 +41,19 @@
         >>> diff.py databricks.yml.backup databricks.yml
         --- databricks.yml.backup
         +++ databricks.yml
        -@@ -29,4 +29,5 @@
        +@@ -27,6 +27,11 @@
        +             - task_key: prep
        +               max_retries: 3
        ++            - notebook_task:
        ++                notebook_path: /Users/{{workspace_user_name}}/extra
        ++              task_key: extra
        ++          max_concurrent_runs: 10
                  my_job:
                    <<: [*job_overrides, *other_job]
         +          timeout_seconds: 1200
                  rename_job:
                    tasks:
        -@@ -56,4 +57,7 @@
        +@@ -56,4 +61,7 @@
                      spark_conf:
                        spark.speculation: "true"
         +            autoscale:
        @@ -60,7 +56,7 @@
         +              min_workers: 1
                tasks:
                  - task_key: prep
        -@@ -61,8 +65,4 @@
        +@@ -61,8 +69,4 @@
                    notebook_task:
                      notebook_path: /Users/{{workspace_user_name}}/prep
         -        - task_key: setup
        @@ -69,7 +65,13 @@
         -            notebook_path: /Users/{{workspace_user_name}}/setup
                  - &base_task
                    task_key: a_task
        -@@ -84,4 +84,7 @@
        +@@ -77,4 +81,5 @@
        +             base_parameters: &base_params
        +               input_file_name: ${var.input_a}
        ++          timeout_seconds: 60
        +         - <<: *base_task
        +           task_key: b_task
        +@@ -84,4 +89,10 @@
                        <<: *base_params
                        extra: b
         +              added: b
        @@ -77,17 +79,25 @@
         +          min_retry_interval_millis: 5000
                  - <<: *base_task
                    task_key: c_task
        ++          notebook_task:
        ++            base_parameters:
        ++              added: c
         
         >>> diff.py pipeline.yml.backup pipeline.yml
         
         === Effective configuration after the sync
        +Warning: required field "notebook_path" is not set
        +  at resources.jobs.my_job.tasks[2].notebook_task
        +  in databricks.yml:97:13
        +
         {
           "timeout_seconds": 1200,
        -  "max_concurrent_runs": 4,
        +  "max_concurrent_runs": 10,
           "task_keys": [
             "a_task",
             "b_task",
             "c_task",
        +    "extra",
             "prep"
           ],
           "b_task": {
        @@ -104,17 +104,20 @@
             "input_file_name": "other"
           },
           "c_task": {
        -    "timeout_seconds": null,
        +    "timeout_seconds": 60,
             "notebook_task": {
               "base_parameters": {
        -        "input_file_name": "original"
        -      },
        -      "notebook_path": "/Users/{{workspace_user_name}}/notebook"
        +        "added": "c"
        +      }
             }
           }
         }
         
         === Edit inherited fields with and without a target override supplying them
        +Warning: required field "notebook_path" is not set
        +  at resources.jobs.my_job.tasks[2].notebook_task
        +  in databricks.yml:97:13
        +
         Detected changes in 1 resource(s):
         
         Resource: resources.jobs.rename_job
        @@ -126,16 +122,24 @@
         >>> diff.py databricks.yml.backup databricks.yml
         --- databricks.yml.backup
         +++ databricks.yml
        -@@ -44,4 +44,5 @@
        +@@ -48,4 +48,5 @@
                    notebook_task:
                      notebook_path: /Users/{{workspace_user_name}}/notebook
         +      timeout_seconds: 900
              my_job:
                timeout_seconds: 300
        +Warning: required field "notebook_path" is not set
        +  at resources.jobs.my_job.tasks[2].notebook_task
        +  in databricks.yml:98:13
        +
         json.resources.jobs.rename_job.tasks[0].max_retries = 1;
         json.resources.jobs.rename_job.timeout_seconds = 900;
         
         >>> [CLI] bundle destroy --auto-approve
        +Warning: required field "notebook_path" is not set
        +  at resources.jobs.my_job.tasks[2].notebook_task
        +  in databricks.yml:98:13
        +
         The following resources will be deleted:
           delete resources.jobs.my_job
           delete resources.jobs.other_job
        
FAIL

latest (v1.28.0):

acceptance_test.go:1402: Diff:
        --- bundle/config-remote-sync/merge_key_inherited/output.txt
        +++ /tmp/TestAcceptbundleconfig-remote-syncmerge_key_inheritedDMS=tru1392603283/002/output.txt
        @@ -9,132 +9,8 @@
         === Edit fields inherited through YAML merge keys
         
         === Detect and save changes
        -Detected changes in 4 resource(s):
        +Error: failed to generate YAML files: failed to apply change to file [TEST_TMP_DIR]/databricks.yml for a field resources.jobs.my_job.tasks[3].notebook_task.base_parameters.input_file_name: field not found in YAML configuration: op replace /resources/jobs/my_job/tasks/3/notebook_task/base_parameters/input_file_name: key input_file_name does not exist and can not be replaced
         
        -Resource: resources.jobs.my_job
        -  job_clusters[job_cluster_key='derived'].new_cluster.autoscale: add
        -  job_clusters[job_cluster_key='derived'].new_cluster.num_workers: skip (the file does not write it where it is defined)
        -  tasks[task_key='a_task'].timeout_seconds: skip (the mapping it would be added to is shared or inherited through a YAML anchor)
        -  tasks[task_key='b_task'].depends_on[task_key='a_task']: skip (the file does not write it where it is defined)
        -  tasks[task_key='b_task'].depends_on[task_key='prep']: skip (the file does not write it where it is defined)
        -  tasks[task_key='b_task'].max_retries: skip (the file does not write it where it is defined)
        -  tasks[task_key='b_task'].min_retry_interval_millis: add
        -  tasks[task_key='b_task'].notebook_task.base_parameters['added']: add
        -  tasks[task_key='b_task'].notebook_task.base_parameters['input_file_name']: add
        -  tasks[task_key='c_task'].depends_on[task_key='a_task']: skip (the file does not write it where it is defined)
        -  tasks[task_key='c_task'].depends_on[task_key='setup']: skip (the file does not write it where it is defined)
        -  tasks[task_key='c_task'].notebook_task.base_parameters['added']: skip (the mapping it would be added to is shared or inherited through a YAML anchor)
        -  tasks[task_key='prep']: skip (the file does not write it where it is defined)
        -  tasks[task_key='setup']: remove
        -  timeout_seconds: add
        -
        -Resource: resources.jobs.other_job
        -  max_concurrent_runs: skip (the mapping it would be added to is shared or inherited through a YAML anchor)
        -  tasks[task_key='extra']: skip (the list it would be added to is shared through a YAML anchor)
        -
        -Resource: resources.jobs.rename_job
        -  tasks[task_key='main']: skip (the file does not write it where it is defined)
        -  tasks[task_key='main2']: skip (the file does not write it where it is defined)
        -
        -Resource: resources.pipelines.my_pipeline
        -  clusters: skip (the file does not write it where it is defined)
        -
        -
        -
        -=== Configuration changes
        -
        ->>> diff.py databricks.yml.backup databricks.yml
        ---- databricks.yml.backup
        -+++ databricks.yml
        -@@ -29,4 +29,5 @@
        -         my_job:
        -           <<: [*job_overrides, *other_job]
        -+          timeout_seconds: 1200
        -         rename_job:
        -           tasks:
        -@@ -56,4 +57,7 @@
        -             spark_conf:
        -               spark.speculation: "true"
        -+            autoscale:
        -+              max_workers: 2
        -+              min_workers: 1
        -       tasks:
        -         - task_key: prep
        -@@ -61,8 +65,4 @@
        -           notebook_task:
        -             notebook_path: /Users/{{workspace_user_name}}/prep
        --        - task_key: setup
        --          job_cluster_key: base
        --          notebook_task:
        --            notebook_path: /Users/{{workspace_user_name}}/setup
        -         - &base_task
        -           task_key: a_task
        -@@ -84,4 +84,7 @@
        -               <<: *base_params
        -               extra: b
        -+              added: b
        -+              input_file_name: ${var.input_b}
        -+          min_retry_interval_millis: 5000
        -         - <<: *base_task
        -           task_key: c_task
        -
        ->>> diff.py pipeline.yml.backup pipeline.yml
        -
        -=== Effective configuration after the sync
        -{
        -  "timeout_seconds": 1200,
        -  "max_concurrent_runs": 4,
        -  "task_keys": [
        -    "a_task",
        -    "b_task",
        -    "c_task",
        -    "prep"
        -  ],
        -  "b_task": {
        -    "max_retries": 2,
        -    "min_retry_interval_millis": 5000,
        -    "depends_on": [
        -      {
        -        "task_key": "prep"
        -      },
        -      {
        -        "task_key": "setup"
        -      }
        -    ],
        -    "input_file_name": "other"
        -  },
        -  "c_task": {
        -    "timeout_seconds": null,
        -    "notebook_task": {
        -      "base_parameters": {
        -        "input_file_name": "original"
        -      },
        -      "notebook_path": "/Users/{{workspace_user_name}}/notebook"
        -    }
        -  }
        -}
        -
        -=== Edit inherited fields with and without a target override supplying them
        -Detected changes in 1 resource(s):
        -
        -Resource: resources.jobs.rename_job
        -  tasks[task_key='main'].max_retries: skip (the file does not write it where it is defined)
        -  timeout_seconds: add
        -
        -
        -
        ->>> diff.py databricks.yml.backup databricks.yml
        ---- databricks.yml.backup
        -+++ databricks.yml
        -@@ -44,4 +44,5 @@
        -           notebook_task:
        -             notebook_path: /Users/{{workspace_user_name}}/notebook
        -+      timeout_seconds: 900
        -     my_job:
        -       timeout_seconds: 300
        -json.resources.jobs.rename_job.tasks[0].max_retries = 1;
        -json.resources.jobs.rename_job.timeout_seconds = 900;
        -
         >>> [CLI] bundle destroy --auto-approve
         The following resources will be deleted:
           delete resources.jobs.my_job
        @@ -149,3 +24,5 @@
         All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default
         
         Destroy: 4 deleted
        +
        +Exit code: 1
TestAccept/bundle/config-remote-sync/yaml_anchors/DMS=: branch ✅ | main (bfcdd1f) ✅ | latest (v1.28.0) ❌

latest (v1.28.0):

acceptance_test.go:1402: Diff:
        --- bundle/config-remote-sync/yaml_anchors/output.txt
        +++ /tmp/TestAcceptbundleconfig-remote-syncyaml_anchorsDMS=1744748834/002/output.txt
        @@ -6,46 +6,8 @@
         === Remove the libraries of the task that defines the anchor and move an aliased task to the large cluster
         
         === Detect and save changes
        -Detected changes in 1 resource(s):
        +Error: failed to generate YAML files: failed to apply change to file [TEST_TMP_DIR]/databricks.yml for a field resources.jobs.my_job.tasks[2].job_cluster_key: failed to apply change: failed to convert YAML bytes to node: unmarshal original yaml bytes: yaml: unknown anchor 'common_libs' referenced
         
        -Resource: resources.jobs.my_job
        -  tasks[task_key='setup'].libraries: remove
        -  tasks[task_key='transform'].job_cluster_key: replace
        -
        -
        -
        -=== Configuration changes
        -
        ->>> diff.py databricks.yml.backup databricks.yml
        ---- databricks.yml.backup
        -+++ databricks.yml
        -@@ -18,14 +18,13 @@
        -           notebook_task:
        -             notebook_path: /Users/{{workspace_user_name}}/setup
        --          libraries: &common_libs
        --            - pypi:
        --                package: requests
        -         - task_key: ingest
        -           job_cluster_key: main
        -           notebook_task:
        -             notebook_path: /Users/{{workspace_user_name}}/ingest
        --          libraries: *common_libs
        -+          libraries: &common_libs
        -+            - pypi:
        -+                package: requests
        -         - task_key: transform
        --          job_cluster_key: main
        -+          job_cluster_key: large
        -           notebook_task:
        -             notebook_path: /Users/{{workspace_user_name}}/transform
        -
        -=== Only the changed tasks differ
        -
        ->>> [CLI] bundle validate -o json
        -{"task_key":"ingest","job_cluster_key":"main","libraries":[{"pypi":{"package":"requests"}}]}
        -{"task_key":"setup","job_cluster_key":"main","libraries":null}
        -{"task_key":"transform","job_cluster_key":"large","libraries":[{"pypi":{"package":"requests"}}]}
        -
         >>> [CLI] bundle destroy --auto-approve
         The following resources will be deleted:
           delete resources.jobs.my_job
        @@ -53,3 +14,5 @@
         All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default
         
         Destroy: 1 deleted
        +
        +Exit code: 1
TestAccept/bundle/config-remote-sync/yaml_anchors/DMS=true: branch ✅ | main (bfcdd1f) ✅ | latest (v1.28.0) ❌

latest (v1.28.0):

acceptance_test.go:1402: Diff:
        --- bundle/config-remote-sync/yaml_anchors/output.txt
        +++ /tmp/TestAcceptbundleconfig-remote-syncyaml_anchorsDMS=true3085649521/002/output.txt
        @@ -6,46 +6,8 @@
         === Remove the libraries of the task that defines the anchor and move an aliased task to the large cluster
         
         === Detect and save changes
        -Detected changes in 1 resource(s):
        +Error: failed to generate YAML files: failed to apply change to file [TEST_TMP_DIR]/databricks.yml for a field resources.jobs.my_job.tasks[2].job_cluster_key: failed to apply change: failed to convert YAML bytes to node: unmarshal original yaml bytes: yaml: unknown anchor 'common_libs' referenced
         
        -Resource: resources.jobs.my_job
        -  tasks[task_key='setup'].libraries: remove
        -  tasks[task_key='transform'].job_cluster_key: replace
        -
        -
        -
        -=== Configuration changes
        -
        ->>> diff.py databricks.yml.backup databricks.yml
        ---- databricks.yml.backup
        -+++ databricks.yml
        -@@ -18,14 +18,13 @@
        -           notebook_task:
        -             notebook_path: /Users/{{workspace_user_name}}/setup
        --          libraries: &common_libs
        --            - pypi:
        --                package: requests
        -         - task_key: ingest
        -           job_cluster_key: main
        -           notebook_task:
        -             notebook_path: /Users/{{workspace_user_name}}/ingest
        --          libraries: *common_libs
        -+          libraries: &common_libs
        -+            - pypi:
        -+                package: requests
        -         - task_key: transform
        --          job_cluster_key: main
        -+          job_cluster_key: large
        -           notebook_task:
        -             notebook_path: /Users/{{workspace_user_name}}/transform
        -
        -=== Only the changed tasks differ
        -
        ->>> [CLI] bundle validate -o json
        -{"task_key":"ingest","job_cluster_key":"main","libraries":[{"pypi":{"package":"requests"}}]}
        -{"task_key":"setup","job_cluster_key":"main","libraries":null}
        -{"task_key":"transform","job_cluster_key":"large","libraries":[{"pypi":{"package":"requests"}}]}
        -
         >>> [CLI] bundle destroy --auto-approve
         The following resources will be deleted:
           delete resources.jobs.my_job
        @@ -53,3 +14,5 @@
         All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default
         
         Destroy: 1 deleted
        +
        +Exit code: 1

@review-oss-bot review-oss-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review at 55b5823. Each finding was verified against the code.

No blocking issues found. 3 non-blocking comment(s) and 1 question(s) below.

This PR makes config-remote-sync check each new-key add, including a replace of an undeclared field, against the file before writing it. An add is skipped when it would create a mapping next to a <<: *anchor that already supplies that mapping, or when it would land in a mapping shared through an anchor. The fix for the inherited-mapping case looks right and the acceptance test shows it. Three things to address: a mapping that has an anchor nothing aliases is now skipped on every run, cases unrelated to anchors are skipped under the anchor reason, and there is no changelog fragment.

Questions

  1. addsOnlyKey copies the order in which applyChange tries an add (addYAML, then addThroughNullAncestor, then addMissingAncestors), and the description says the two must stay in step. Nothing in applyChange mentions this, and the copy already differs: tiers 1 and 2 don't check nestYAMLValue or the container kind that addYAMLChild needs. So x.list[1].k with list missing still passes the check and then fails the edit. Could the shared and merge-supplied checks go into addYAML and addMissingAncestors themselves (as addThroughNullAncestor already does for shared nulls) and surface as a typed skip? Or could both use one function that picks the landing path, or at least carry a keep-in-sync note? (non-blocking)

Comments outside the changed lines

  • [nice to have] bundle/configsync/resolve.go: This changes what users see: adds that used to be written (and could drop an inherited notebook_path, or spread a key to every task that merges an anchor) are now skipped with a new reason, and some adds that failed the whole sync are now skipped. Can you add a .nextchanges/bundles/ entry for it?

Comment thread bundle/configsync/patch.go Outdated
if landingPath == nil {
return false
}
return !landing.shared && (tier < 2 || !mergeSupplies(landing.node, (*structpath.PathNode)(landingPath.AsSlice()[landing.depth])))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nice to have] walkYAMLPath sets shared for any node with an anchor, whether or not something aliases it, so this now rejects adds that are safe. Example: a task - &base_task with task_key: a_task, no *base_task in the file, and a remote that adds timeout_seconds. On main the key is written. Here it is skipped with the anchor reason, and the drift comes back on every later run with no way to sync it. The new branch at resolve.go:496 also sends undeclared-field replaces (CLI defaults) through this check, so they get skipped the same way. Could we count a mapping as shared only when an alias to its anchor exists in the document? Or is matching the replace behaviour worth this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[AI] Fixed in 4ed4d6c: for a new key add, a mapping now counts as shared only when an alias in the file refers to it or to a mapping on its path. An add under an anchor nothing aliases, such as timeout_seconds on a lone - &base_task, is written again, and so are the CLI-default replaces that turn into adds.

🤖 Factory-generated comment. I still review the code and double-check every claim myself.

[factory:30/254]

Comment thread bundle/configsync/resolve.go Outdated
}
writePath, altWritePath := writeAddress(blocks, block, target, path)
if !docs.addsOnlyKey(file, writePath, altWritePath) {
return nil, "the mapping it would be added to is shared or inherited through a YAML anchor"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nice to have] Every false from addsOnlyKey gets this one reason. That includes a walk that stops at a non-null scalar (patch.go:389-390), e.g. new_cluster: ${var.cluster} with a remote add under new_cluster, and paths that no candidate reaches (patch.go:396-397). In those cases nothing is shared or inherited. On main they failed with an edit error that named the cause. Now they are skipped quietly, and the message sends the user looking for anchors that may not exist. Could addsOnlyKey return a reason, so the scalar and no-landing cases get their own text?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[AI] Fixed in 4ed4d6c: an add whose parent the file sets to a scalar, such as new_cluster: ${var.cluster}, is skipped with the file sets a parent of it to a scalar. The anchor reason is left for adds into an aliased mapping, next to a merge key that supplies the mapping, or onto an anchored value the edit will not replace.

🤖 Factory-generated comment. I still review the code and double-check every claim myself.

[factory:30/254]

@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: 5e45a05

Run: 46455480713

Env 🤯​MISS 💚​RECOVERED ✅​pass 🙈​skip Time
💚​ aws linux-2core-8gb 1 109 7 2:41
💚​ aws-windows-latest-4core-16gb 1 88 14 3:09
🤯​ azure linux-2core-8gb 7 1 88 7 1:52
🤯​ azure-windows-latest-4core-16gb 7 1 88 7 3:23
🤯​ gcp linux-2core-8gb 7 1 88 7 1:58
🤯​ gcp-windows-latest-4core-16gb 7 1 88 7 3:16
8 interesting tests: 7 MISS, 1 RECOVERED
Test Name aws linux-2core-8gb aws-windows-latest-4core-16gb azure linux-2core-8gb azure-windows-latest-4core-16gb gcp linux-2core-8gb gcp-windows-latest-4core-16gb
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🤯​ TestAccept/bundle/config-remote-sync/cli_defaults ✅​p 🙈​s 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/config_edits ✅​p 🙈​s 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/job_fields ✅​p 🙈​s 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/multiple_files ✅​p 🙈​s 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/pipeline_fields ✅​p 🙈​s 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/target_override ✅​p 🙈​s 🤯​M 🤯​M 🤯​M 🤯​M
🤯​ TestAccept/bundle/config-remote-sync/yaml_anchors ✅​p 🙈​s 🤯​M 🤯​M 🤯​M 🤯​M
Top 3 slowest tests (at least 2 minutes):
duration env testname
3:21 azure-windows-latest-4core-16gb TestAccept
3:14 gcp-windows-latest-4core-16gb TestAccept
3:07 aws-windows-latest-4core-16gb TestAccept

@ilyakuz-db

Copy link
Copy Markdown
Contributor Author

check if this is still needed after vendor patcher replacement and request review

ilyakuz-db and others added 2 commits November 30, 2026 13:45
…n skip reason

Co-authored-by: Isaac <no-reply@databricks.com>
aws: TestAccept/bundle/config-remote-sync/cli_defaults TestAccept/bundle/config-remote-sync/config_edits TestAccept/bundle/config-remote-sync/job_fields TestAccept/bundle/config-remote-sync/multiple_files
aws: TestAccept/bundle/config-remote-sync/pipeline_fields TestAccept/bundle/config-remote-sync/target_override TestAccept/bundle/config-remote-sync/yaml_anchors

Co-authored-by: Isaac <no-reply@databricks.com>
@ilyakuz-db

Copy link
Copy Markdown
Contributor Author

[AI] Still needed. The patcher replacement (#8169) is this PR's base, and nothing in bundle/configsync has changed on main since. On current main with only this PR's test inputs, merge_key_inherited still writes notebook_task: {base_parameters: {added: c}} next to <<: *base_task on c_task (validate warns that notebook_path is not set), and a_task's new timeout_seconds shows up on c_task. Review requested from andrewnester.

On the review summary: the check stays at resolve time, because a failed edit aborts the whole sync and a change with several destinations has to be skipped as a whole before the index bookkeeping. applyChange now has a note to keep it in step with addSkipReason. Paths the edit cannot build, like x.list[1].k under a missing list, still fail as they do on main. No .nextchanges entry: config-remote-sync is a hidden experimental command, and the PR checklist skips entries for experimental features.

🤖 Factory-generated comment. I still review the code and double-check every claim myself.

[factory:30/254]

@@ -492,6 +493,17 @@ func writtenDestinations(docs sourceDocs, blocks *blockResolver, target string,
case !isDefinedInConfig && operation == OperationAdd && !addressesKey && block != nil:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A new element in a list shared through an alias lands in the anchor, so each job using it gains it. Should element adds skip too, or is this intended?

case !isDefinedInConfig && operation == OperationAdd && !addressesKey && block != nil:
// A new element goes into its sequence, which the block has to write.
file = block.file
case !isDefinedInConfig && addressesKey && operation != OperationRemove:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No test reaches the replace half of this case: limiting it to adds keeps every test green. Could one cover a replace of an undeclared field under a shared mapping?

ilyakuz-db and others added 2 commits November 30, 2026 15:36
…lace

Co-authored-by: Isaac <no-reply@databricks.com>
aws: TestAccept/bundle/config-remote-sync/cli_defaults TestAccept/bundle/config-remote-sync/config_edits TestAccept/bundle/config-remote-sync/job_fields TestAccept/bundle/config-remote-sync/multiple_files
aws: TestAccept/bundle/config-remote-sync/pipeline_fields TestAccept/bundle/config-remote-sync/target_override TestAccept/bundle/config-remote-sync/yaml_anchors

Co-authored-by: Isaac <no-reply@databricks.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DABs DABs related issues factory-generated

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants