Skip to content

Fix target overrides when the bundle key is null - #8166

Merged
denik merged 1 commit into
mainfrom
denik/fix-null-bundle-key
Nov 29, 2026
Merged

denik merged 1 commit into
mainfrom
denik/fix-null-bundle-key

Conversation

@denik

@denik denik commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Changes

MergeTargetOverrides in bundle/config/root.go now creates the bundle map before setting mode, cluster_id and git when the key is null, not only when it is missing. The new map keeps the null value's location, so diagnostics at bundle still point to databricks.yml.

Effect in acceptance/bundle/override/null-bundle-key (from the test PR): the targets with mode, cluster_id and git now validate and show the overridden value (json.bundle.mode = "development";, json.bundle.cluster_id = "0123-456789-abcdef";, json.bundle.git.branch = "main";) instead of failing with expected a map to index "bundle.mode", found nil. Badness is removed.

Why

This PR was created by analyzing coverage gaps. Coverage: http://go/cli/dashboard/coverage/file/bundle/config/root.go ((*Root).MergeTargetOverrides, lines 329-451).
bundle: with all its fields commented out is valid YAML and behaves like bundle: {} everywhere else; only a target that sets mode, cluster_id or git failed, with a message that doesn't point at the config.

Test: #8165

Gaps and risks

  • Only bundle validate is tested; deploy goes through the same SelectTarget mutator.
  • A bundle with a null bundle key has no name, so it already gets a required field "name" is not set warning; the fix doesn't change that.
  • Not in this PR (same function, found during the analysis, separate follow-ups): a target git: ${var.g} with a complex variable fails with cannot merge map with string when the root has no bundle.git; and target variable shorthands under the deprecated environments key are not rewritten, so the override is dropped with a warning.
  • Risk: low.

🤖 AI agent (opus5.5, isaac_claude)

This pull request and its description were written by Isaac.

@github-actions

github-actions Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Regression test report ✅

Commit: bbee4655b | Workflow run

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

2 tests: regression=2 unreleased=0 coverage=0 failing=0
test branch main (d164fcc) latest (v1.28.0)
TestAccept/bundle/override/null-bundle-key/DMS= ✅ ❌ ❌
TestAccept/bundle/override/null-bundle-key/DMS=true ✅ ❌ ❌
TestAccept/bundle/override/null-bundle-key/DMS=: branch ✅ | main (d164fcc) ❌ | latest (v1.28.0) ❌

main (d164fcc):

acceptance_test.go:1402: 
        	Error Trace:	/home/runner/work/cli/cli/libs/testdiff/testdiff.go:22
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1402
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1143
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:704
        	Error:      	Not equal: 
        	            	expected: "\n>>> errcode [CLI] bundle validate -o json -t with_mode\nWarning: required field \"name\" is not set\n  at bundle\n  in databricks.yml:3:8\n\njson.bundle.mode = \"development\";\n\n>>> errcode [CLI] bundle validate -o json -t with_cluster_id\nWarning: required field \"name\" is not set\n  at bundle\n  in databricks.yml:3:8\n\njson.bundle.cluster_id = \"0123-456789-abcdef\";\n\n>>> errcode [CLI] bundle validate -o json -t with_git\nWarning: required field \"name\" is not set\n  at bundle\n  in databricks.yml:3:8\n\njson.bundle.git.branch = \"main\";\n\n>>> errcode [CLI] bundle validate -o json -t without_overrides\nWarning: required field \"name\" is not set\n  at bundle\n  in databricks.yml:3:8\n\n"
        	            	actual  : "\n>>> errcode [CLI] bundle validate -o json -t with_mode\nError: failed to perform target override for target=with_mode: expected a map to index \"bundle.mode\", found nil\n\n\nExit code: 1\n\n>>> errcode [CLI] bundle validate -o json -t with_cluster_id\nError: failed to perform target override for target=with_cluster_id: expected a map to index \"bundle.cluster_id\", found nil\n\n\nExit code: 1\n\n>>> errcode [CLI] bundle validate -o json -t with_git\nError: failed to perform target override for target=with_git: expected a map to index \"bundle.git\", found nil\n\n\nExit code: 1\n\n>>> errcode [CLI] bundle validate -o json -t without_overrides\nWarning: required field \"name\" is not set\n  at bundle\n  in databricks.yml:3:8\n\n"
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -2,21 +2,18 @@
        	            	 >>> errcode [CLI] bundle validate -o json -t with_mode
        	            	-Warning: required field "name" is not set
        	            	-  at bundle
        	            	-  in databricks.yml:3:8
        	            	+Error: failed to perform target override for target=with_mode: expected a map to index "bundle.mode", found nil
        	            	 
        	            	-json.bundle.mode = "development";
        	            	+
        	            	+Exit code: 1
        	            	 
        	            	 >>> errcode [CLI] bundle validate -o json -t with_cluster_id
        	            	-Warning: required field "name" is not set
        	            	-  at bundle
        	            	-  in databricks.yml:3:8
        	            	+Error: failed to perform target override for target=with_cluster_id: expected a map to index "bundle.cluster_id", found nil
        	            	 
        	            	-json.bundle.cluster_id = "0123-456789-abcdef";
        	            	+
        	            	+Exit code: 1
        	            	 
        	            	 >>> errcode [CLI] bundle validate -o json -t with_git
        	            	-Warning: required field "name" is not set
        	            	-  at bundle
        	            	-  in databricks.yml:3:8
        	            	+Error: failed to perform target override for target=with_git: expected a map to index "bundle.git", found nil
        	            	 
        	            	-json.bundle.git.branch = "main";
        	            	+
        	            	+Exit code: 1
        	            	 
        	Test:       	TestAccept/bundle/override/null-bundle-key/DMS=
        	Messages:   	bundle/override/null-bundle-key/output.txt vs /tmp/TestAcceptbundleoverridenull-bundle-keyDMS=3647255930/002/output.txt

latest (v1.28.0):

acceptance_test.go:1402: 
        	Error Trace:	/home/runner/work/cli/cli/libs/testdiff/testdiff.go:22
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1402
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1143
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:704
        	Error:      	Not equal: 
        	            	expected: "\n>>> errcode [CLI] bundle validate -o json -t with_mode\nWarning: required field \"name\" is not set\n  at bundle\n  in databricks.yml:3:8\n\njson.bundle.mode = \"development\";\n\n>>> errcode [CLI] bundle validate -o json -t with_cluster_id\nWarning: required field \"name\" is not set\n  at bundle\n  in databricks.yml:3:8\n\njson.bundle.cluster_id = \"0123-456789-abcdef\";\n\n>>> errcode [CLI] bundle validate -o json -t with_git\nWarning: required field \"name\" is not set\n  at bundle\n  in databricks.yml:3:8\n\njson.bundle.git.branch = \"main\";\n\n>>> errcode [CLI] bundle validate -o json -t without_overrides\nWarning: required field \"name\" is not set\n  at bundle\n  in databricks.yml:3:8\n\n"
        	            	actual  : "\n>>> errcode [CLI] bundle validate -o json -t with_mode\nError: failed to perform target override for target=with_mode: expected a map to index \"bundle.mode\", found nil\n\n\nExit code: 1\n\n>>> errcode [CLI] bundle validate -o json -t with_cluster_id\nError: failed to perform target override for target=with_cluster_id: expected a map to index \"bundle.cluster_id\", found nil\n\n\nExit code: 1\n\n>>> errcode [CLI] bundle validate -o json -t with_git\nError: failed to perform target override for target=with_git: expected a map to index \"bundle.git\", found nil\n\n\nExit code: 1\n\n>>> errcode [CLI] bundle validate -o json -t without_overrides\nWarning: required field \"name\" is not set\n  at bundle\n  in databricks.yml:3:8\n\n"
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -2,21 +2,18 @@
        	            	 >>> errcode [CLI] bundle validate -o json -t with_mode
        	            	-Warning: required field "name" is not set
        	            	-  at bundle
        	            	-  in databricks.yml:3:8
        	            	+Error: failed to perform target override for target=with_mode: expected a map to index "bundle.mode", found nil
        	            	 
        	            	-json.bundle.mode = "development";
        	            	+
        	            	+Exit code: 1
        	            	 
        	            	 >>> errcode [CLI] bundle validate -o json -t with_cluster_id
        	            	-Warning: required field "name" is not set
        	            	-  at bundle
        	            	-  in databricks.yml:3:8
        	            	+Error: failed to perform target override for target=with_cluster_id: expected a map to index "bundle.cluster_id", found nil
        	            	 
        	            	-json.bundle.cluster_id = "0123-456789-abcdef";
        	            	+
        	            	+Exit code: 1
        	            	 
        	            	 >>> errcode [CLI] bundle validate -o json -t with_git
        	            	-Warning: required field "name" is not set
        	            	-  at bundle
        	            	-  in databricks.yml:3:8
        	            	+Error: failed to perform target override for target=with_git: expected a map to index "bundle.git", found nil
        	            	 
        	            	-json.bundle.git.branch = "main";
        	            	+
        	            	+Exit code: 1
        	            	 
        	Test:       	TestAccept/bundle/override/null-bundle-key/DMS=
        	Messages:   	bundle/override/null-bundle-key/output.txt vs /tmp/TestAcceptbundleoverridenull-bundle-keyDMS=3294543705/002/output.txt
FAIL
TestAccept/bundle/override/null-bundle-key/DMS=true: branch ✅ | main (d164fcc) ❌ | latest (v1.28.0) ❌

main (d164fcc):

acceptance_test.go:1402: 
        	Error Trace:	/home/runner/work/cli/cli/libs/testdiff/testdiff.go:22
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1402
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1143
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:704
        	Error:      	Not equal: 
        	            	expected: "\n>>> errcode [CLI] bundle validate -o json -t with_mode\nWarning: required field \"name\" is not set\n  at bundle\n  in databricks.yml:3:8\n\njson.bundle.mode = \"development\";\n\n>>> errcode [CLI] bundle validate -o json -t with_cluster_id\nWarning: required field \"name\" is not set\n  at bundle\n  in databricks.yml:3:8\n\njson.bundle.cluster_id = \"0123-456789-abcdef\";\n\n>>> errcode [CLI] bundle validate -o json -t with_git\nWarning: required field \"name\" is not set\n  at bundle\n  in databricks.yml:3:8\n\njson.bundle.git.branch = \"main\";\n\n>>> errcode [CLI] bundle validate -o json -t without_overrides\nWarning: required field \"name\" is not set\n  at bundle\n  in databricks.yml:3:8\n\n"
        	            	actual  : "\n>>> errcode [CLI] bundle validate -o json -t with_mode\nError: failed to perform target override for target=with_mode: expected a map to index \"bundle.mode\", found nil\n\n\nExit code: 1\n\n>>> errcode [CLI] bundle validate -o json -t with_cluster_id\nError: failed to perform target override for target=with_cluster_id: expected a map to index \"bundle.cluster_id\", found nil\n\n\nExit code: 1\n\n>>> errcode [CLI] bundle validate -o json -t with_git\nError: failed to perform target override for target=with_git: expected a map to index \"bundle.git\", found nil\n\n\nExit code: 1\n\n>>> errcode [CLI] bundle validate -o json -t without_overrides\nWarning: required field \"name\" is not set\n  at bundle\n  in databricks.yml:3:8\n\n"
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -2,21 +2,18 @@
        	            	 >>> errcode [CLI] bundle validate -o json -t with_mode
        	            	-Warning: required field "name" is not set
        	            	-  at bundle
        	            	-  in databricks.yml:3:8
        	            	+Error: failed to perform target override for target=with_mode: expected a map to index "bundle.mode", found nil
        	            	 
        	            	-json.bundle.mode = "development";
        	            	+
        	            	+Exit code: 1
        	            	 
        	            	 >>> errcode [CLI] bundle validate -o json -t with_cluster_id
        	            	-Warning: required field "name" is not set
        	            	-  at bundle
        	            	-  in databricks.yml:3:8
        	            	+Error: failed to perform target override for target=with_cluster_id: expected a map to index "bundle.cluster_id", found nil
        	            	 
        	            	-json.bundle.cluster_id = "0123-456789-abcdef";
        	            	+
        	            	+Exit code: 1
        	            	 
        	            	 >>> errcode [CLI] bundle validate -o json -t with_git
        	            	-Warning: required field "name" is not set
        	            	-  at bundle
        	            	-  in databricks.yml:3:8
        	            	+Error: failed to perform target override for target=with_git: expected a map to index "bundle.git", found nil
        	            	 
        	            	-json.bundle.git.branch = "main";
        	            	+
        	            	+Exit code: 1
        	            	 
        	Test:       	TestAccept/bundle/override/null-bundle-key/DMS=true
        	Messages:   	bundle/override/null-bundle-key/output.txt vs /tmp/TestAcceptbundleoverridenull-bundle-keyDMS=true1960152608/002/output.txt
FAIL

latest (v1.28.0):

acceptance_test.go:1402: 
        	Error Trace:	/home/runner/work/cli/cli/libs/testdiff/testdiff.go:22
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1402
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1143
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:704
        	Error:      	Not equal: 
        	            	expected: "\n>>> errcode [CLI] bundle validate -o json -t with_mode\nWarning: required field \"name\" is not set\n  at bundle\n  in databricks.yml:3:8\n\njson.bundle.mode = \"development\";\n\n>>> errcode [CLI] bundle validate -o json -t with_cluster_id\nWarning: required field \"name\" is not set\n  at bundle\n  in databricks.yml:3:8\n\njson.bundle.cluster_id = \"0123-456789-abcdef\";\n\n>>> errcode [CLI] bundle validate -o json -t with_git\nWarning: required field \"name\" is not set\n  at bundle\n  in databricks.yml:3:8\n\njson.bundle.git.branch = \"main\";\n\n>>> errcode [CLI] bundle validate -o json -t without_overrides\nWarning: required field \"name\" is not set\n  at bundle\n  in databricks.yml:3:8\n\n"
        	            	actual  : "\n>>> errcode [CLI] bundle validate -o json -t with_mode\nError: failed to perform target override for target=with_mode: expected a map to index \"bundle.mode\", found nil\n\n\nExit code: 1\n\n>>> errcode [CLI] bundle validate -o json -t with_cluster_id\nError: failed to perform target override for target=with_cluster_id: expected a map to index \"bundle.cluster_id\", found nil\n\n\nExit code: 1\n\n>>> errcode [CLI] bundle validate -o json -t with_git\nError: failed to perform target override for target=with_git: expected a map to index \"bundle.git\", found nil\n\n\nExit code: 1\n\n>>> errcode [CLI] bundle validate -o json -t without_overrides\nWarning: required field \"name\" is not set\n  at bundle\n  in databricks.yml:3:8\n\n"
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -2,21 +2,18 @@
        	            	 >>> errcode [CLI] bundle validate -o json -t with_mode
        	            	-Warning: required field "name" is not set
        	            	-  at bundle
        	            	-  in databricks.yml:3:8
        	            	+Error: failed to perform target override for target=with_mode: expected a map to index "bundle.mode", found nil
        	            	 
        	            	-json.bundle.mode = "development";
        	            	+
        	            	+Exit code: 1
        	            	 
        	            	 >>> errcode [CLI] bundle validate -o json -t with_cluster_id
        	            	-Warning: required field "name" is not set
        	            	-  at bundle
        	            	-  in databricks.yml:3:8
        	            	+Error: failed to perform target override for target=with_cluster_id: expected a map to index "bundle.cluster_id", found nil
        	            	 
        	            	-json.bundle.cluster_id = "0123-456789-abcdef";
        	            	+
        	            	+Exit code: 1
        	            	 
        	            	 >>> errcode [CLI] bundle validate -o json -t with_git
        	            	-Warning: required field "name" is not set
        	            	-  at bundle
        	            	-  in databricks.yml:3:8
        	            	+Error: failed to perform target override for target=with_git: expected a map to index "bundle.git", found nil
        	            	 
        	            	-json.bundle.git.branch = "main";
        	            	+
        	            	+Exit code: 1
        	            	 
        	Test:       	TestAccept/bundle/override/null-bundle-key/DMS=true
        	Messages:   	bundle/override/null-bundle-key/output.txt vs /tmp/TestAcceptbundleoverridenull-bundle-keyDMS=true2565138647/002/output.txt

@eng-dev-ecosystem-bot

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

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: bbee465

Run: 46216579225

Env 💚​RECOVERED ✅​pass 🙈​skip Time
💚​ aws linux-2core-8gb 1 173 18 3:49
💚​ aws-windows-latest-4core-16gb 1 173 18 3:04
💚​ azure linux-2core-8gb 1 172 18 3:32
💚​ azure-windows-latest-4core-16gb 1 172 18 2:45
💚​ gcp linux-2core-8gb 1 173 18 3:30
💚​ gcp-windows-latest-4core-16gb 1 173 18 3:12
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
Top 6 slowest tests (at least 2 minutes):
duration env testname
3:31 azure linux-2core-8gb TestAccept
3:27 gcp linux-2core-8gb TestAccept
3:23 aws linux-2core-8gb TestAccept
3:10 gcp-windows-latest-4core-16gb TestAccept
3:02 aws-windows-latest-4core-16gb TestAccept
2:43 azure-windows-latest-4core-16gb TestAccept

@denik
denik marked this pull request as ready for review November 29, 2026 00:45
@denik
denik requested review from a team as code owners November 29, 2026 00:45

@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 0f1623b. Each finding was verified against the code.

No blocking issues found.

This PR makes MergeTargetOverrides treat a null bundle key the same way as a missing one. It creates an empty map that keeps the null value's location, so overrides of mode, cluster_id and git now work instead of failing with expected a map to index ..., found nil. The guard is small and matches the existing KindInvalid handling, and the updated acceptance output covers all three overrides plus the case with no overrides. I found no problems that need changing.

@denik
denik force-pushed the denik/fix-null-bundle-key branch from 0f1623b to 7c5bef5 Compare November 29, 2026 01:11
@denik
denik requested a review from andrewnester November 29, 2026 01:12

@Sankalp-Mittal Sankalp-Mittal left a comment

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.

[AI Generated] Review by review-factory (Claude Opus 5.5 + Claude Sonnet 5.5, cross-verified). Only points the reviewers agreed on are posted.

No issues found.

Base automatically changed from denik/acc-null-bundle-key to main November 29, 2026 02:21
@denik denik closed this in #8165 Nov 29, 2026
@denik denik reopened this Nov 29, 2026
@github-actions github-actions Bot added the DABs DABs related issues label Nov 29, 2026
An empty bundle key in databricks.yml is a null value, not a missing one,
so the guard that creates the bundle map before setting mode, cluster_id
and git did not fire and SetByPath failed with 'expected a map to index
"bundle.mode", found nil'. Treat null like missing and keep its location.

Co-authored-by: Isaac <no-reply@databricks.com>
@denik
denik force-pushed the denik/fix-null-bundle-key branch from 7c5bef5 to bbee465 Compare November 29, 2026 02:34

@Sankalp-Mittal Sankalp-Mittal left a comment

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.

[AI Generated] Review by review-factory (Claude Sonnet 5.5 + Claude Opus 5.5, cross-verified). Only points the reviewers agreed on are posted.

No issues found.

@denik
denik added this pull request to the merge queue Nov 29, 2026
Merged via the queue into main with commit 608f126 Nov 29, 2026
28 checks passed
@denik
denik deleted the denik/fix-null-bundle-key branch November 29, 2026 03:45
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.

4 participants