Skip to content

Do not add name_prefix twice to a reference to a prefixed name - #7230

Open
denik wants to merge 4 commits into
mainfrom
denik/fix-name-prefix-reference
Open

denik wants to merge 4 commits into
mainfrom
denik/fix-name-prefix-reference

Conversation

@denik

@denik denik commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Changes

ApplyPresets leaves a name unprefixed when it is a pure reference to a name field that ApplyPresets prefixes itself (prefixedNameFields: jobs/pipelines/... name, clusters cluster_name, dashboards display_name, ...; schemas only without experimental.skip_name_prefix_for_schema). References to other fields (e.g. .id) and non-pure strings ("${...} copy") are prefixed as before.

Why

name: ${resources.jobs.base.name} with name_prefix: "pre-" resolved to pre-pre-base ([dev u] [dev u] base in development mode). The referenced value already carries the prefix (in normalized form for UC names), so the dev-mode marker is kept. Note: an already deployed resource with such a name is renamed on the next deploy.

Port note: the fix lives in bundle/config/mutator/resourcemutator/apply_presets.go and works on typed fields (not dyn-specific), so it ports as is.

Tests

  • Unit test TestApplyPresetsNamePrefixReferenceToName.
  • acceptance/bundle/presets/name_prefix_reference_to_name: now pre-base, Badness removed.
  • acceptance/bundle/resource_deps/resources_var_presets: schema foo named ${resources.schemas.bar.name} is now dev_<user>_myschema instead of dev_<user>_dev_<user>_myschema. Its name is now the same as bar's in the same catalog, as it already was without development mode.

This pull request and its description were written by Isaac.

@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Commit: 092fce36f | Workflow run

Regression test report

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

4 tests: regression=4 unreleased=0 coverage=0 failing=0

test branch main (d3e5dde) latest (v1.22.1)
TestAccept/bundle/presets/name_prefix_reference_to_name/DMS= ✅ ❌ ❌
TestAccept/bundle/presets/name_prefix_reference_to_name/DMS=true ✅ ❌ ❌
TestAccept/bundle/resource_deps/resources_var_presets/DMS= ✅ ❌ ❌
TestAccept/bundle/resource_deps/resources_var_presets/DMS=true ✅ ❌ ❌
TestAccept/bundle/presets/name_prefix_reference_to_name/DMS=: branch ✅ | main (d3e5dde) ❌ | latest (v1.22.1) ❌

main (d3e5dde):

acceptance_test.go:1341: 
        	Error Trace:	/home/runner/work/cli/cli/libs/testdiff/testdiff.go:22
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1341
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1082
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:659
        	Error:      	Not equal: 
        	            	expected: "\n>>> [CLI] bundle plan -o json\n\"pre-base\"\n"
        	            	actual  : "\n>>> [CLI] bundle plan -o json\n\"pre-pre-base\"\n"
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -2,3 +2,3 @@
        	            	 >>> [CLI] bundle plan -o json
        	            	-"pre-base"
        	            	+"pre-pre-base"
        	            	 
        	Test:       	TestAccept/bundle/presets/name_prefix_reference_to_name/DMS=
        	Messages:   	bundle/presets/name_prefix_reference_to_name/output.txt vs /tmp/TestAcceptbundlepresetsname_prefix_reference_to_nameDMS=2022298416/002/output.txt

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

TestAccept/bundle/presets/name_prefix_reference_to_name/DMS=true: branch ✅ | main (d3e5dde) ❌ | latest (v1.22.1) ❌

main (d3e5dde):

acceptance_test.go:1341: 
        	Error Trace:	/home/runner/work/cli/cli/libs/testdiff/testdiff.go:22
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1341
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1082
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:659
        	Error:      	Not equal: 
        	            	expected: "\n>>> [CLI] bundle plan -o json\n\"pre-base\"\n"
        	            	actual  : "\n>>> [CLI] bundle plan -o json\n\"pre-pre-base\"\n"
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -2,3 +2,3 @@
        	            	 >>> [CLI] bundle plan -o json
        	            	-"pre-base"
        	            	+"pre-pre-base"
        	            	 
        	Test:       	TestAccept/bundle/presets/name_prefix_reference_to_name/DMS=true
        	Messages:   	bundle/presets/name_prefix_reference_to_name/output.txt vs /tmp/TestAcceptbundlepresetsname_prefix_reference_to_nameDMS=true744080546/002/output.txt

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

TestAccept/bundle/resource_deps/resources_var_presets/DMS=: branch ✅ | main (d3e5dde) ❌ | latest (v1.22.1) ❌

main (d3e5dde):

acceptance_test.go:1341: Diff:
        --- bundle/resource_deps/resources_var_presets/output.txt
        +++ /tmp/TestAcceptbundleresource_depsresources_var_presetsDMS=2178027763/002/output.txt
        @@ -23,7 +23,7 @@
             },
             "foo": {
               "catalog_name": "${resources.schemas.bar.catalog_name}",
        -      "name": "${resources.schemas.bar.name}"
        +      "name": "dev_[USERNAME]_${resources.schemas.bar.name}"
             }
           }
         }
        @@ -37,4 +37,4 @@
         Resources: 3 created, 0 changed, 0 deleted, 0 unchanged
         
         >>> jq -s .[] | select(.path=="/api/2.0/pipelines") | .body.name [OUTPUT_DIR]/out.requests.txt
        -"[dev [USERNAME]] pipeline for mycatalog.dev_[USERNAME]_myschema"
        +"[dev [USERNAME]] pipeline for mycatalog.dev_[USERNAME]_dev_[USERNAME]_myschema"

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

TestAccept/bundle/resource_deps/resources_var_presets/DMS=true: branch ✅ | main (d3e5dde) ❌ | latest (v1.22.1) ❌

main (d3e5dde):

acceptance_test.go:1341: Diff:
        --- bundle/resource_deps/resources_var_presets/output.txt
        +++ /tmp/TestAcceptbundleresource_depsresources_var_presetsDMS=true2270508347/002/output.txt
        @@ -23,7 +23,7 @@
             },
             "foo": {
               "catalog_name": "${resources.schemas.bar.catalog_name}",
        -      "name": "${resources.schemas.bar.name}"
        +      "name": "dev_[USERNAME]_${resources.schemas.bar.name}"
             }
           }
         }
        @@ -37,4 +37,4 @@
         Resources: 3 created, 0 changed, 0 deleted, 0 unchanged
         
         >>> jq -s .[] | select(.path=="/api/2.0/pipelines") | .body.name [OUTPUT_DIR]/out.requests.txt
        -"[dev [USERNAME]] pipeline for mycatalog.dev_[USERNAME]_myschema"
        +"[dev [USERNAME]] pipeline for mycatalog.dev_[USERNAME]_dev_[USERNAME]_myschema"
        
FAIL

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

Base automatically changed from denik/acc-record-main-behaviour to main October 28, 2026 15:00
denik and others added 3 commits October 28, 2026 16:14
With presets.name_prefix "pre-", a job named "${resources.jobs.base.name}" ended
up as "pre-pre-base": the reference was prefixed and so was the referenced name.
Skip the prefix when the name is a pure reference to a name field that
ApplyPresets prefixes itself.

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

Co-authored-by: Isaac <no-reply@databricks.com>
@denik
denik force-pushed the denik/fix-name-prefix-reference branch from 4679415 to 434f09a Compare October 28, 2026 15:16
@github-actions github-actions Bot added the DABs DABs related issues label Oct 28, 2026
@denik
denik marked this pull request as ready for review October 28, 2026 15:30
@denik
denik requested review from a team as code owners October 28, 2026 15:30
@denik
denik requested a review from pietern October 28, 2026 15:30
"experiments": "name",
"model_serving_endpoints": "name",
"registered_models": "name",
"schemas": "name",

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.

note: this could be a breaking change for reosurces like schemas which refer by name. In practice this scenario should be fairly rare but lets call this out in our noteable changes section in the change log.

@eng-dev-ecosystem-bot

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 092fce3

Run: 40716291723

Env ✅​pass 🙈​skip Time
✅​ aws linux-2core-8gb 281 17 5:16
✅​ aws-windows-latest-4core-16gb 283 15 3:27
✅​ azure linux-2core-8gb 280 17 5:15
✅​ azure-windows-latest-4core-16gb 282 15 3:41
✅​ gcp linux-2core-8gb 281 17 5:22
✅​ gcp-windows-latest-4core-16gb 283 15 3:38
Top 6 slowest tests (at least 2 minutes):
duration env testname
3:48 gcp linux-2core-8gb TestAccept
3:36 azure linux-2core-8gb TestAccept
3:30 aws linux-2core-8gb TestAccept
3:21 aws-windows-latest-4core-16gb TestAccept
3:20 gcp-windows-latest-4core-16gb TestAccept
3:19 azure-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.

3 participants