Skip to content

Avoid syncing cluster policy values into shared bundle config - #7170

Draft
ilyakuz-db wants to merge 4 commits into
mainfrom
ilyakuz-db/fix-policy-values-in-remote-sync
Draft

ilyakuz-db wants to merge 4 commits into
mainfrom
ilyakuz-db/fix-policy-values-in-remote-sync

Conversation

@ilyakuz-db

@ilyakuz-db ilyakuz-db commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Changes

Exclude omitted, policy-supplied cluster values from bundle config-remote-sync, using the effective definition read by the remote policy ID. Preserve authored values, required fields, and positional arrays. Select applicable resources at the configsync entry point. Traverse normalized changes directly, reusing typed field metadata and keyed-slice paths.

Why

Syncing a description-only UI edit can copy one target's policy values into shared YAML. Deploying that YAML to a target with different policy constraints then fails validation.

Tests

  • Cross-target acceptance tests cover policies managed by the bundle and policies created separately. The external-policy case reproduces the prod deployment failure with CLI v1.22.1 and passes with the fix.
  • Unit tests cover effective policy-family definitions and overrides, authored false/zero values, policy-added siblings, keyed reordering, log configuration, positional arrays, and lookup failures.
  • Repository formatting, checks, lint, unit tests, and acceptance tests pass locally; config-remote-sync cases cover both DMS modes.

This PR was written with assistance from Codex.

@github-actions github-actions Bot added the DABs DABs related issues label Oct 23, 2026
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Commit: a14d1cdf1 | Workflow run

Regression test report

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

8 tests: regression=6 unreleased=0 coverage=2 failing=0

test branch main (edebd84) latest (v1.22.1)
TestAccept/bundle/config-remote-sync/cluster_policy_cross_target/DMS= ✅ ❌ ❌
TestAccept/bundle/config-remote-sync/cluster_policy_cross_target/DMS=true ✅ ❌ ❌
TestAccept/bundle/config-remote-sync/cluster_policy_remote_addition/DMS= ✅ ❌ ❌
TestAccept/bundle/config-remote-sync/cluster_policy_remote_addition/DMS=true ✅ ❌ ❌
TestAccept/bundle/config-remote-sync/external_cluster_policy_cross_target/DMS= ✅ ❌ ❌
TestAccept/bundle/config-remote-sync/external_cluster_policy_cross_target/DMS=true ✅ ❌ ❌
TestAccept/bundle/config-remote-sync/policy_injected_cluster_fields/DMS= ✅ ✅ ✅
TestAccept/bundle/config-remote-sync/policy_injected_cluster_fields/DMS=true ✅ ✅ ✅
TestAccept/bundle/config-remote-sync/cluster_policy_cross_target/DMS=: branch ✅ | main (edebd84) ❌ | latest (v1.22.1) ❌

main (edebd84):

acceptance_test.go:1311: Diff:
        --- bundle/config-remote-sync/cluster_policy_cross_target/output.txt
        +++ /tmp/TestAcceptbundleconfig-remote-synccluster_policy_cross_target612527385/002/output.txt
        @@ -13,6 +13,9 @@
         
         Resource: resources.jobs.policy_sync
           description: replace
        +  job_clusters[job_cluster_key='main'].new_cluster.custom_tags['workspace']: add
        +  job_clusters[job_cluster_key='main'].new_cluster.spark_env_vars: add
        +  job_clusters[job_cluster_key='main'].new_cluster.workload_type: add
         
         
         
        @@ -26,23 +29,41 @@
         +      description: Edited in the UI
                job_clusters:
                  - job_cluster_key: main
        +@@ -39,4 +39,11 @@
        +             custom_tags:
        +               owner: bundle-author
        ++              workspace: dev
        ++            spark_env_vars:
        ++              ENVIRONMENT: dev
        ++            workload_type:
        ++              clients:
        ++                jobs: true
        ++                notebooks: false
        +       tasks:
        +         - task_key: main
         
         === Deploy shared YAML with the prod policy
         >>> errcode [CLI] bundle deploy -t prod
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/[UNIQUE_NAME]/prod/files...
         Created cluster_policies.policy
        -Created jobs.policy_sync
        +Error: cannot create resources.jobs.policy_sync: Cluster validation error: Validation failed for custom_tags, workspace must be prod (is "dev") (400 INVALID_PARAMETER_VALUE)
        +
        +Endpoint: POST [DATABRICKS_URL]/api/2.2/jobs/create
        +HTTP Status: 400 Bad Request
        +API error_code: INVALID_PARAMETER_VALUE
        +API message: Cluster validation error: Validation failed for custom_tags, workspace must be prod (is "dev")
        +
         Files: 4 uploaded, 0 deleted
        -Resources: 2 created, 0 changed, 0 deleted, 0 unchanged
         
        +Exit code: 1
        +
         >>> [CLI] bundle destroy -t prod --auto-approve
         The following resources will be deleted:
           delete resources.cluster_policies.policy
        -  delete resources.jobs.policy_sync
         
         All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/[UNIQUE_NAME]/prod
         
        -Destroy: 2 deleted
        +Destroy: 1 deleted
         
         >>> [CLI] bundle destroy -t dev --auto-approve
         The following resources will be deleted:

latest (v1.22.1): same output as main (edebd84)

TestAccept/bundle/config-remote-sync/cluster_policy_cross_target/DMS=true: branch ✅ | main (edebd84) ❌ | latest (v1.22.1) ❌

main (edebd84):

acceptance_test.go:1311: Diff:
        --- bundle/config-remote-sync/cluster_policy_cross_target/output.txt
        +++ /tmp/TestAcceptbundleconfig-remote-synccluster_policy_cross_target3160611353/002/output.txt
        @@ -13,6 +13,9 @@
         
         Resource: resources.jobs.policy_sync
           description: replace
        +  job_clusters[job_cluster_key='main'].new_cluster.custom_tags['workspace']: add
        +  job_clusters[job_cluster_key='main'].new_cluster.spark_env_vars: add
        +  job_clusters[job_cluster_key='main'].new_cluster.workload_type: add
         
         
         
        @@ -26,23 +29,41 @@
         +      description: Edited in the UI
                job_clusters:
                  - job_cluster_key: main
        +@@ -39,4 +39,11 @@
        +             custom_tags:
        +               owner: bundle-author
        ++              workspace: dev
        ++            spark_env_vars:
        ++              ENVIRONMENT: dev
        ++            workload_type:
        ++              clients:
        ++                jobs: true
        ++                notebooks: false
        +       tasks:
        +         - task_key: main
         
         === Deploy shared YAML with the prod policy
         >>> errcode [CLI] bundle deploy -t prod
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/[UNIQUE_NAME]/prod/files...
         Created cluster_policies.policy
        -Created jobs.policy_sync
        +Error: cannot create resources.jobs.policy_sync: Cluster validation error: Validation failed for custom_tags, workspace must be prod (is "dev") (400 INVALID_PARAMETER_VALUE)
        +
        +Endpoint: POST [DATABRICKS_URL]/api/2.2/jobs/create
        +HTTP Status: 400 Bad Request
        +API error_code: INVALID_PARAMETER_VALUE
        +API message: Cluster validation error: Validation failed for custom_tags, workspace must be prod (is "dev")
        +
         Files: 4 uploaded, 0 deleted
        -Resources: 2 created, 0 changed, 0 deleted, 0 unchanged
         
        +Exit code: 1
        +
         >>> [CLI] bundle destroy -t prod --auto-approve
         The following resources will be deleted:
           delete resources.cluster_policies.policy
        -  delete resources.jobs.policy_sync
         
         All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/[UNIQUE_NAME]/prod
         
        -Destroy: 2 deleted
        +Destroy: 1 deleted
         
         >>> [CLI] bundle destroy -t dev --auto-approve
         The following resources will be deleted:

latest (v1.22.1): same output as main (edebd84)

TestAccept/bundle/config-remote-sync/cluster_policy_remote_addition/DMS=: branch ✅ | main (edebd84) ❌ | latest (v1.22.1) ❌

main (edebd84):

acceptance_test.go:1311: Diff:
        --- bundle/config-remote-sync/cluster_policy_remote_addition/output.txt
        +++ /tmp/TestAcceptbundleconfig-remote-synccluster_policy_remote_addit2502239177/002/output.txt
        @@ -10,7 +10,6 @@
         Detected changes in 1 resource(s):
         
         Resource: resources.jobs.test_job
        -  tasks[task_key='test'].new_cluster.custom_tags: add
           tasks[task_key='test'].new_cluster.spark_conf: add
         
         
        @@ -18,11 +17,9 @@
         >>> diff.py databricks.yml.backup databricks.yml
         --- databricks.yml.backup
         +++ databricks.yml
        -@@ -24,4 +24,8 @@
        +@@ -24,4 +24,6 @@
                      node_type_id: [NODE_TYPE_ID]
                      num_workers: 1
        -+            custom_tags:
        -+              UserTag: edited-in-ui
         +            spark_conf:
         +              spark.sql.shuffle.partitions: "7"
                    spark_python_task:

latest (v1.22.1): same output as main (edebd84)

TestAccept/bundle/config-remote-sync/cluster_policy_remote_addition/DMS=true: branch ✅ | main (edebd84) ❌ | latest (v1.22.1) ❌

main (edebd84):

acceptance_test.go:1311: Diff:
        --- bundle/config-remote-sync/cluster_policy_remote_addition/output.txt
        +++ /tmp/TestAcceptbundleconfig-remote-synccluster_policy_remote_addit3044029598/002/output.txt
        @@ -10,7 +10,6 @@
         Detected changes in 1 resource(s):
         
         Resource: resources.jobs.test_job
        -  tasks[task_key='test'].new_cluster.custom_tags: add
           tasks[task_key='test'].new_cluster.spark_conf: add
         
         
        @@ -18,11 +17,9 @@
         >>> diff.py databricks.yml.backup databricks.yml
         --- databricks.yml.backup
         +++ databricks.yml
        -@@ -24,4 +24,8 @@
        +@@ -24,4 +24,6 @@
                      node_type_id: [NODE_TYPE_ID]
                      num_workers: 1
        -+            custom_tags:
        -+              UserTag: edited-in-ui
         +            spark_conf:
         +              spark.sql.shuffle.partitions: "7"
                    spark_python_task:
        
FAIL

latest (v1.22.1): same output as main (edebd84)

TestAccept/bundle/config-remote-sync/external_cluster_policy_cross_target/DMS=: branch ✅ | main (edebd84) ❌ | latest (v1.22.1) ❌

main (edebd84):

acceptance_test.go:1311: Diff:
        --- bundle/config-remote-sync/external_cluster_policy_cross_target/output.txt
        +++ /tmp/TestAcceptbundleconfig-remote-syncexternal_cluster_policy_cro946652817/002/output.txt
        @@ -13,6 +13,8 @@
         
         Resource: resources.jobs.policy_sync
           description: replace
        +  job_clusters[job_cluster_key='main'].new_cluster.custom_tags['workspace']: add
        +  job_clusters[job_cluster_key='main'].new_cluster.spark_env_vars: add
         
         
         
        @@ -26,21 +28,33 @@
         +      description: Edited in the UI
                job_clusters:
                  - job_cluster_key: main
        +@@ -23,4 +23,7 @@
        +             custom_tags:
        +               owner: bundle-author
        ++              workspace: dev
        ++            spark_env_vars:
        ++              ENVIRONMENT: dev
        +       tasks:
        +         - task_key: main
         
         === Deploy shared YAML with the prod policy
         >>> errcode [CLI] bundle deploy -t prod
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/[UNIQUE_NAME]/prod/files...
        -Created jobs.policy_sync
        +Error: cannot create resources.jobs.policy_sync: Cluster validation error: Validation failed for custom_tags, workspace must be prod (is "dev") (400 INVALID_PARAMETER_VALUE)
        +
        +Endpoint: POST [DATABRICKS_URL]/api/2.2/jobs/create
        +HTTP Status: 400 Bad Request
        +API error_code: INVALID_PARAMETER_VALUE
        +API message: Cluster validation error: Validation failed for custom_tags, workspace must be prod (is "dev")
        +
         Files: 5 uploaded, 0 deleted
        -Resources: 1 created, 0 changed, 0 deleted, 0 unchanged
         
        ->>> [CLI] bundle destroy -t prod --auto-approve
        -The following resources will be deleted:
        -  delete resources.jobs.policy_sync
        +Exit code: 1
         
        +>>> [CLI] bundle destroy -t prod --auto-approve
         All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/[UNIQUE_NAME]/prod
         
        -Destroy: 1 deleted
        +Destroy: 0 deleted
         
         >>> [CLI] bundle destroy -t dev --auto-approve
         The following resources will be deleted:

latest (v1.22.1): same output as main (edebd84)

TestAccept/bundle/config-remote-sync/external_cluster_policy_cross_target/DMS=true: branch ✅ | main (edebd84) ❌ | latest (v1.22.1) ❌

main (edebd84):

acceptance_test.go:1311: Diff:
        --- bundle/config-remote-sync/external_cluster_policy_cross_target/output.txt
        +++ /tmp/TestAcceptbundleconfig-remote-syncexternal_cluster_policy_cro2710230214/002/output.txt
        @@ -13,6 +13,8 @@
         
         Resource: resources.jobs.policy_sync
           description: replace
        +  job_clusters[job_cluster_key='main'].new_cluster.custom_tags['workspace']: add
        +  job_clusters[job_cluster_key='main'].new_cluster.spark_env_vars: add
         
         
         
        @@ -26,21 +28,33 @@
         +      description: Edited in the UI
                job_clusters:
                  - job_cluster_key: main
        +@@ -23,4 +23,7 @@
        +             custom_tags:
        +               owner: bundle-author
        ++              workspace: dev
        ++            spark_env_vars:
        ++              ENVIRONMENT: dev
        +       tasks:
        +         - task_key: main
         
         === Deploy shared YAML with the prod policy
         >>> errcode [CLI] bundle deploy -t prod
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/[UNIQUE_NAME]/prod/files...
        -Created jobs.policy_sync
        +Error: cannot create resources.jobs.policy_sync: Cluster validation error: Validation failed for custom_tags, workspace must be prod (is "dev") (400 INVALID_PARAMETER_VALUE)
        +
        +Endpoint: POST [DATABRICKS_URL]/api/2.2/jobs/create
        +HTTP Status: 400 Bad Request
        +API error_code: INVALID_PARAMETER_VALUE
        +API message: Cluster validation error: Validation failed for custom_tags, workspace must be prod (is "dev")
        +
         Files: 5 uploaded, 0 deleted
        -Resources: 1 created, 0 changed, 0 deleted, 0 unchanged
         
        ->>> [CLI] bundle destroy -t prod --auto-approve
        -The following resources will be deleted:
        -  delete resources.jobs.policy_sync
        +Exit code: 1
         
        +>>> [CLI] bundle destroy -t prod --auto-approve
         All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/[UNIQUE_NAME]/prod
         
        -Destroy: 1 deleted
        +Destroy: 0 deleted
         
         >>> [CLI] bundle destroy -t dev --auto-approve
         The following resources will be deleted:

latest (v1.22.1): same output as main (edebd84)

@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: a14d1cd

Run: 39989147186

Env 🔄​flaky ✅​pass 🙈​skip Time
✅​ aws linux-2core-8gb 293 15 4:23
✅​ aws-windows-latest-4core-16gb 283 17 3:14
✅​ azure linux-2core-8gb 292 15 4:15
🔄​ azure-windows-latest-4core-16gb 2 280 17 4:08
✅​ gcp linux-2core-8gb 293 15 4:24
✅​ gcp-windows-latest-4core-16gb 283 17 3:17
Test Name azure-windows-latest-4core-16gb
🔄​ TestFsCpFileToDirFileNotOverwritten 🔄​f
🔄​ TestFsCpFileToDirFileNotOverwritten/uc-volumes_to_uc-volumes 🔄​f
Top 3 slowest tests (at least 2 minutes):
duration env testname
3:47 azure-windows-latest-4core-16gb TestAccept
3:03 aws-windows-latest-4core-16gb TestAccept
2:55 gcp-windows-latest-4core-16gb TestAccept

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants