Skip to content

Record bind history outside StateDB - #7817

Open
shreyas-goenka wants to merge 10 commits into
mainfrom
shreyas-goenka_data/shreyas-goenka/out-of-band-bind-history
Open

shreyas-goenka wants to merge 10 commits into
mainfrom
shreyas-goenka_data/shreyas-goenka/out-of-band-bind-history

Conversation

@shreyas-goenka

@shreyas-goenka shreyas-goenka commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Changes

Record committed bundle deployment bind operations as UPDATE in deployment history. Recording is best effort and runs separately from StateDB, after approval and the existing temporary-file commit. A failed history upload warns and the bind still succeeds, but the version completes with failure, as a deploy's does: the service then holds no record of the binding. A failed remote state upload fails the bind and the version.

This covers every bind path: bundle deployment bind, bundle generate --bind, and apps import. A resource type the service does not know (such as feature_specs) binds as before and prints a warning that its history was not recorded.

Why

Bind changes resource state without recording history today. This preserves the existing preparation flow, two state writes, and serial increments. Bind omits uploaded-file metadata; existing deployment metadata is preserved. Bind is not a deploy, so it does not consult workspace enrollment (#7895): an explicit deployment_history setting wins, otherwise the loaded state's marker is kept.

Tests

  • Existing bind routes and the DMS fault tests, which now also verify remote state after bind.
  • New dms/bind-upload-failure: a failed state upload fails the command and the version, leaving the resource out of remote state; a failed history upload warns, fails only the version, and the resource is in remote state.
  • New dms/bind-immutable: the deployment records no file_path after a bind.
  • dms/bind-unbind: shadow history markers and resource IDs across bind, deploy, unbind, and rebind.

This PR was written by Codex.

@shreyas-goenka shreyas-goenka added the DABs DABs related issues label Nov 19, 2026
@shreyas-goenka
shreyas-goenka force-pushed the shreyas-goenka_data/shreyas-goenka/out-of-band-bind-history branch from a99be74 to e02cd13 Compare November 19, 2026 16:19
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Regression test report ✅

Commit: 545d6ad16 | Workflow run

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

19 tests: regression=9 unreleased=0 coverage=10 failing=0
test branch main (3442593) latest (v1.28.0)
TestAccept/bundle/deployment/bind/dashboard/recreation/DMS=/READPLAN= ✅ ✅ ✅
TestAccept/bundle/deployment/bind/dashboard/recreation/DMS=/READPLAN=1 ✅ ✅ ✅
TestAccept/bundle/deployment/bind/dashboard/recreation/DMS=true/READPLAN= ✅ ✅ ✅
TestAccept/bundle/deployment/bind/dashboard/recreation/DMS=true/READPLAN=1 ✅ ✅ ✅
TestAccept/bundle/deployment/bind/feature_spec/DMS=/OUTPUT_MODE=plain ✅ ✅ ✅
TestAccept/bundle/deployment/bind/feature_spec/DMS=true/OUTPUT_MODE=recorded ✅ ❌ ❌
TestAccept/bundle/deployment/bind/pipelines/recreate/DMS= ✅ ✅ ✅
TestAccept/bundle/deployment/bind/pipelines/recreate/DMS=true ✅ ✅ ✅
TestAccept/bundle/deployment/bind/pipelines/update/DMS= ✅ ✅ ✅
TestAccept/bundle/deployment/bind/pipelines/update/DMS=true ✅ ✅ ✅
TestAccept/bundle/dms/bind-immutable/DMS=true ✅ ❌ ❌
TestAccept/bundle/dms/bind-unbind/DMS=true ✅ ❌ ❌
TestAccept/bundle/dms/bind-upload-failure/DMS=true ✅ ❌ ❌
TestAccept/bundle/dms/suppress-transport-warnings/DMS=true ✅ ✅ ✅
TestAccept/bundle/dms_fault/complete_version/DMS=true ✅ ❌ ❌
TestAccept/bundle/dms_fault/create_deployment/DMS=true ✅ ❌ ❌
TestAccept/bundle/dms_fault/create_version/DMS=true ✅ ❌ ❌
TestAccept/bundle/dms_fault/get_deployment/DMS=true ✅ ❌ ❌
TestAccept/bundle/dms_fault/update_operation/DMS=true ✅ ❌ ❌
TestAccept/bundle/deployment/bind/feature_spec/DMS=true/OUTPUT_MODE=recorded: branch ✅ | main (3442593) ❌ | latest (v1.28.0) ❌

main (3442593):

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:1155
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:704
        	Error:      	Not equal: 
        	            	expected: "\n>>> [CLI] bundle deployment bind spec1 main.fspec_[UNIQUE_NAME].boundspec --auto-approve\nWarn: Failed to record deployment history for bind: failed to create deployment version: operations.resource_key must have a known resource type prefix (e.g. 'jobs.', 'pipelines.'): feature_specs.spec1\nSuccessfully bound feature_spec with an id 'main.fspec_[UNIQUE_NAME].boundspec'\nRun 'bundle deploy' to deploy changes to your workspace\n"
        	            	actual  : "\n>>> [CLI] bundle deployment bind spec1 main.fspec_[UNIQUE_NAME].boundspec --auto-approve\nSuccessfully bound feature_spec with an id 'main.fspec_[UNIQUE_NAME].boundspec'\nRun 'bundle deploy' to deploy changes to your workspace\n"
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -2,3 +2,2 @@
        	            	 >>> [CLI] bundle deployment bind spec1 main.fspec_[UNIQUE_NAME].boundspec --auto-approve
        	            	-Warn: Failed to record deployment history for bind: failed to create deployment version: operations.resource_key must have a known resource type prefix (e.g. 'jobs.', 'pipelines.'): feature_specs.spec1
        	            	 Successfully bound feature_spec with an id 'main.fspec_[UNIQUE_NAME].boundspec'
        	Test:       	TestAccept/bundle/deployment/bind/feature_spec/DMS=true/OUTPUT_MODE=recorded
        	Messages:   	bundle/deployment/bind/feature_spec/out.bind.recorded.txt vs /tmp/TestAcceptbundledeploymentbindfeature_specDMS=trueOUTPUT_M116946990/001/out.bind.recorded.txt
    acceptance_test.go:1180: 
        LOG.cleanup: All files and directories at the following location will be deleted: /Workspace/Users/tester@databricks.com/.bundle/test-bind-feature-spec-35rjzhn7ebaajisnwkrwdjq4ke/default
        LOG.cleanup: 
        LOG.cleanup: Destroy: 0 deleted

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:1155
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:704
        	Error:      	Not equal: 
        	            	expected: "\n>>> [CLI] bundle deployment bind spec1 main.fspec_[UNIQUE_NAME].boundspec --auto-approve\nWarn: Failed to record deployment history for bind: failed to create deployment version: operations.resource_key must have a known resource type prefix (e.g. 'jobs.', 'pipelines.'): feature_specs.spec1\nSuccessfully bound feature_spec with an id 'main.fspec_[UNIQUE_NAME].boundspec'\nRun 'bundle deploy' to deploy changes to your workspace\n"
        	            	actual  : "\n>>> [CLI] bundle deployment bind spec1 main.fspec_[UNIQUE_NAME].boundspec --auto-approve\nSuccessfully bound feature_spec with an id 'main.fspec_[UNIQUE_NAME].boundspec'\nRun 'bundle deploy' to deploy changes to your workspace\n"
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -2,3 +2,2 @@
        	            	 >>> [CLI] bundle deployment bind spec1 main.fspec_[UNIQUE_NAME].boundspec --auto-approve
        	            	-Warn: Failed to record deployment history for bind: failed to create deployment version: operations.resource_key must have a known resource type prefix (e.g. 'jobs.', 'pipelines.'): feature_specs.spec1
        	            	 Successfully bound feature_spec with an id 'main.fspec_[UNIQUE_NAME].boundspec'
        	Test:       	TestAccept/bundle/deployment/bind/feature_spec/DMS=true/OUTPUT_MODE=recorded
        	Messages:   	bundle/deployment/bind/feature_spec/out.bind.recorded.txt vs /tmp/TestAcceptbundledeploymentbindfeature_specDMS=trueOUTPUT_M1915010369/001/out.bind.recorded.txt
    acceptance_test.go:1180: 
        LOG.cleanup: All files and directories at the following location will be deleted: /Workspace/Users/tester@databricks.com/.bundle/test-bind-feature-spec-r5c4beoxkvf5fc7tr6tdgj2mr4/default
        LOG.cleanup: 
        LOG.cleanup: Destroy: 0 deleted
FAIL
TestAccept/bundle/dms/bind-immutable/DMS=true: branch ✅ | main (3442593) ❌ | latest (v1.28.0) ❌

main (3442593):

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>>> [CLI] bundle deployment bind foo [JOB_ID] --auto-approve\nSuccessfully bound job with an id '[JOB_ID]'\nRun 'bundle deploy' to deploy changes to your workspace\n\n>>> MSYS_NO_PATHCONV=1 [CLI] bundle-deployments list-resources deployments/[DEPLOYMENT_ID] -o json\n[\n  {\n    \"last_action_type\": \"OPERATION_ACTION_TYPE_UPDATE\",\n    \"resource_id\": \"[JOB_ID]\",\n    \"resource_key\": \"jobs.foo\"\n  }\n]\n\n=== Bind uploads no files, so the deployment records no file_path\n\n>>> MSYS_NO_PATHCONV=1 [CLI] api get /api/2.0/bundle/deployments/[DEPLOYMENT_ID]\n{\n  \"root_path\": \"/Workspace/Users/[USERNAME]/.bundle/dms-bind-immutable-[UNIQUE_NAME]/default\"\n}\n"
        	            	actual  : "\n>>> [CLI] bundle deployment bind foo [JOB_ID] --auto-approve\nSuccessfully bound job with an id '[JOB_ID]'\nRun 'bundle deploy' to deploy changes to your workspace\nError: Path (/Workspace/Users/[USERNAME]/.bundle/dms-bind-immutable-[UNIQUE_NAME]/default/state/resources.deployment.json) doesn't exist.\n\nExit code: 1\n"
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -4,18 +4,5 @@
        	            	 Run 'bundle deploy' to deploy changes to your workspace
        	            	+Error: Path (/Workspace/Users/[USERNAME]/.bundle/dms-bind-immutable-[UNIQUE_NAME]/default/state/resources.deployment.json) doesn't exist.
        	            	 
        	            	->>> MSYS_NO_PATHCONV=1 [CLI] bundle-deployments list-resources deployments/[DEPLOYMENT_ID] -o json
        	            	-[
        	            	-  {
        	            	-    "last_action_type": "OPERATION_ACTION_TYPE_UPDATE",
        	            	-    "resource_id": "[JOB_ID]",
        	            	-    "resource_key": "jobs.foo"
        	            	-  }
        	            	-]
        	            	+Exit code: 1
        	            	 
        	            	-=== Bind uploads no files, so the deployment records no file_path
        	            	-
        	            	->>> MSYS_NO_PATHCONV=1 [CLI] api get /api/2.0/bundle/deployments/[DEPLOYMENT_ID]
        	            	-{
        	            	-  "root_path": "/Workspace/Users/[USERNAME]/.bundle/dms-bind-immutable-[UNIQUE_NAME]/default"
        	            	-}
        	            	-
        	Test:       	TestAccept/bundle/dms/bind-immutable/DMS=true
        	Messages:   	bundle/dms/bind-immutable/output.txt vs /tmp/TestAcceptbundledmsbind-immutableDMS=true386409546/002/output.txt

latest (v1.28.0): same output as main (3442593)

TestAccept/bundle/dms/bind-unbind/DMS=true: branch ✅ | main (3442593) ❌ | latest (v1.28.0) ❌

main (3442593):

acceptance_test.go:1402: Diff:
        --- bundle/dms/bind-unbind/output.txt
        +++ /tmp/TestAcceptbundledmsbind-unbindDMS=true1674933342/002/output.txt
        @@ -24,142 +24,17 @@
         >>> jq {serial, features, resource_id: .state["resources.jobs.foo"].__id__} .databricks/bundle/default/resources.json
         {
           "serial": 2,
        -  "features": {
        -    "deployment_history_shadow": {}
        -  },
        +  "features": null,
           "resource_id": "[JOB_ID]"
         }
         
         >>> print_requests.py --dms //versions --oneline
        -{"method": "POST", "path": "/api/2.0/bundle/deployments/[DEPLOYMENT_ID]/versions", "q": {"version_id": "2"}, "body": {"cli_version": "[CLI_VERSION]", "operations": [{"action_type": "OPERATION_ACTION_TYPE_UPDATE", "resource_key": "jobs.foo"}], "version_type": "VERSION_TYPE_DEPLOY"}}
        -{"method": "PATCH", "path": "/api/2.0/bundle/deployments/[DEPLOYMENT_ID]/versions/2/operations/jobs.foo", "q": {"update_mask": "state,error_message,resource_id,status"}, "body": {"error_message": "", "resource_id": "[JOB_ID]", "sequence_id": 0, "state": "{\"state\":{\"deployment\":{\"kind\":\"BUNDLE\",\"metadata_file_path\":\"/Workspace/Users/[USERNAME]/.bundle/dms-bind-unbind-[UNIQUE_NAME]/default/state/metadata.json\"},\"edit_mode\":\"UI_LOCKED\",\"format\":\"MULTI_TASK\",\"max_concurrent_runs\":1,\"name\":\"foo\",\"queue\":{\"enabled\":true}}}", "status": "OPERATION_STATUS_SUCCEEDED"}}
        -{"method": "POST", "path": "/api/2.0/bundle/deployments/[DEPLOYMENT_ID]/versions/2/complete", "body": {"completion_reason": "VERSION_COMPLETE_SUCCESS"}}
         
         >>> [CLI] jobs get [JOB_ID]
         {
           "job_id": [JOB_ID],
           "name": "bind-target-[UNIQUE_NAME]"
         }
        +Error: Path (/Workspace/Users/[USERNAME]/.bundle/dms-bind-unbind-[UNIQUE_NAME]/default/state/resources.deployment.json) doesn't exist.
         
        ->>> MSYS_NO_PATHCONV=1 [CLI] bundle-deployments list-resources deployments/[DEPLOYMENT_ID] -o json
        -[
        -  {
        -    "last_action_type": "OPERATION_ACTION_TYPE_UPDATE",
        -    "resource_id": "[JOB_ID]",
        -    "resource_key": "jobs.foo"
        -  }
        -]
        -
        -=== Deploy keeps the bound job ID with recorded history
        -
        ->>> [CLI] bundle deploy
        -Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-bind-unbind-[UNIQUE_NAME]/default/files...
        -Updated jobs.foo
        -Files: 2 uploaded, 0 deleted
        -Resources: 0 created, 1 changed, 0 deleted, 0 unchanged
        -
        ->>> jq {features, resource_id: .state["resources.jobs.foo"].__id__} .databricks/bundle/default/resources.json
        -{
        -  "features": {
        -    "deployment_history_shadow": {}
        -  },
        -  "resource_id": "[JOB_ID]"
        -}
        -
        -=== Unbind preserves the shadow history marker and leaves the job intact
        -
        ->>> [CLI] bundle deployment unbind foo
        -
        ->>> jq {features, state} .databricks/bundle/default/resources.json
        -{
        -  "features": {
        -    "deployment_history_shadow": {}
        -  },
        -  "state": {}
        -}
        -
        ->>> [CLI] jobs get [JOB_ID]
        -{
        -  "job_id": [JOB_ID]
        -}
        -
        -=== Rebind preserves the existing shadow history marker without configuration
        -
        ->>> DATABRICKS_BUNDLE_DEPLOYMENT_HISTORY= [CLI] bundle deployment bind foo [JOB_ID] --auto-approve
        -Successfully bound job with an id '[JOB_ID]'
        -Run 'bundle deploy' to deploy changes to your workspace
        -
        ->>> jq {features, resource_id: .state["resources.jobs.foo"].__id__} .databricks/bundle/default/resources.json
        -{
        -  "features": {
        -    "deployment_history_shadow": {}
        -  },
        -  "resource_id": "[JOB_ID]"
        -}
        -
        ->>> print_requests.py --dms //versions --oneline
        -{"method": "POST", "path": "/api/2.0/bundle/deployments/[DEPLOYMENT_ID]/versions", "q": {"version_id": "6"}, "body": {"cli_version": "[CLI_VERSION]", "operations": [{"action_type": "OPERATION_ACTION_TYPE_UPDATE", "resource_key": "jobs.foo"}], "previous_version_id": "3", "version_type": "VERSION_TYPE_DEPLOY"}}
        -{"method": "PATCH", "path": "/api/2.0/bundle/deployments/[DEPLOYMENT_ID]/versions/6/operations/jobs.foo", "q": {"update_mask": "state,error_message,resource_id,status"}, "body": {"error_message": "", "resource_id": "[JOB_ID]", "sequence_id": 0, "state": "{\"state\":{\"deployment\":{\"kind\":\"BUNDLE\",\"metadata_file_path\":\"/Workspace/Users/[USERNAME]/.bundle/dms-bind-unbind-[UNIQUE_NAME]/default/state/metadata.json\"},\"edit_mode\":\"UI_LOCKED\",\"format\":\"MULTI_TASK\",\"max_concurrent_runs\":1,\"name\":\"foo\",\"queue\":{\"enabled\":true}}}", "status": "OPERATION_STATUS_SUCCEEDED"}}
        -{"method": "POST", "path": "/api/2.0/bundle/deployments/[DEPLOYMENT_ID]/versions/6/complete", "body": {"completion_reason": "VERSION_COMPLETE_SUCCESS"}}
        -
        -=== An explicit false drops the marker, so this bind records no history
        -
        ->>> [CLI] bundle deployment unbind foo
        -
        ->>> DATABRICKS_BUNDLE_DEPLOYMENT_HISTORY=false [CLI] bundle deployment bind foo [JOB_ID] --auto-approve
        -Successfully bound job with an id '[JOB_ID]'
        -Run 'bundle deploy' to deploy changes to your workspace
        -
        ->>> jq {features, resource_id: .state["resources.jobs.foo"].__id__} .databricks/bundle/default/resources.json
        -{
        -  "features": null,
        -  "resource_id": "[JOB_ID]"
        -}
        -
        ->>> print_requests.py --dms //versions
        -
        -=== An explicit true restores the marker
        -
        ->>> [CLI] bundle deployment unbind foo
        -
        ->>> DATABRICKS_BUNDLE_DEPLOYMENT_HISTORY=true [CLI] bundle deployment bind foo [JOB_ID] --auto-approve
        -Successfully bound job with an id '[JOB_ID]'
        -Run 'bundle deploy' to deploy changes to your workspace
        -
        ->>> jq {features, resource_id: .state["resources.jobs.foo"].__id__} .databricks/bundle/default/resources.json
        -{
        -  "features": {
        -    "deployment_history_shadow": {}
        -  },
        -  "resource_id": "[JOB_ID]"
        -}
        -
        ->>> print_requests.py --dms //versions --oneline
        -{"method": "POST", "path": "/api/2.0/bundle/deployments/[DEPLOYMENT_ID]/versions", "q": {"version_id": "12"}, "body": {"cli_version": "[CLI_VERSION]", "operations": [{"action_type": "OPERATION_ACTION_TYPE_UPDATE", "resource_key": "jobs.foo"}], "previous_version_id": "6", "version_type": "VERSION_TYPE_DEPLOY"}}
        -{"method": "PATCH", "path": "/api/2.0/bundle/deployments/[DEPLOYMENT_ID]/versions/12/operations/jobs.foo", "q": {"update_mask": "state,error_message,resource_id,status"}, "body": {"error_message": "", "resource_id": "[JOB_ID]", "sequence_id": 0, "state": "{\"state\":{\"deployment\":{\"kind\":\"BUNDLE\",\"metadata_file_path\":\"/Workspace/Users/[USERNAME]/.bundle/dms-bind-unbind-[UNIQUE_NAME]/default/state/metadata.json\"},\"edit_mode\":\"UI_LOCKED\",\"format\":\"MULTI_TASK\",\"max_concurrent_runs\":1,\"name\":\"foo\",\"queue\":{\"enabled\":true}}}", "status": "OPERATION_STATUS_SUCCEEDED"}}
        -{"method": "POST", "path": "/api/2.0/bundle/deployments/[DEPLOYMENT_ID]/versions/12/complete", "body": {"completion_reason": "VERSION_COMPLETE_SUCCESS"}}
        -
        -=== A subsequent deploy continues managing the same job
        -
        ->>> [CLI] bundle deploy
        -Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-bind-unbind-[UNIQUE_NAME]/default/files...
        -Files: 0 uploaded, 0 deleted
        -Resources: 0 created, 0 changed, 0 deleted, 1 unchanged
        -
        ->>> jq {features, resource_id: .state["resources.jobs.foo"].__id__} .databricks/bundle/default/resources.json
        -{
        -  "features": {
        -    "deployment_history_shadow": {}
        -  },
        -  "resource_id": "[JOB_ID]"
        -}
        -
        -=== A rejected duplicate bind creates no history version
        -
        ->>> musterr [CLI] bundle deployment bind foo [JOB_ID] --auto-approve
        -Error: Resource already managed
        -
        -The bundle is already managing resource for resources.jobs.foo and it is bound to the requested ID [JOB_ID].
        -
        -
        ->>> print_requests.py --dms //versions
        +Exit code: 1
        
    acceptance_test.go:1180: 
        LOG.cleanup: The following resources will be deleted:
        LOG.cleanup:   delete resources.jobs.foo
        LOG.cleanup: 
        LOG.cleanup: All files and directories at the following location will be deleted: /Workspace/Users/tester@databricks.com/.bundle/dms-bind-unbind-quptdf4c5bfwhgdi5mxw3dmbgi/default
        LOG.cleanup: 
        LOG.cleanup: Destroy: 1 deleted

latest (v1.28.0):

acceptance_test.go:1402: Diff:
        --- bundle/dms/bind-unbind/output.txt
        +++ /tmp/TestAcceptbundledmsbind-unbindDMS=true3890801404/002/output.txt
        @@ -24,142 +24,17 @@
         >>> jq {serial, features, resource_id: .state["resources.jobs.foo"].__id__} .databricks/bundle/default/resources.json
         {
           "serial": 2,
        -  "features": {
        -    "deployment_history_shadow": {}
        -  },
        +  "features": null,
           "resource_id": "[JOB_ID]"
         }
         
         >>> print_requests.py --dms //versions --oneline
        -{"method": "POST", "path": "/api/2.0/bundle/deployments/[DEPLOYMENT_ID]/versions", "q": {"version_id": "2"}, "body": {"cli_version": "[CLI_VERSION]", "operations": [{"action_type": "OPERATION_ACTION_TYPE_UPDATE", "resource_key": "jobs.foo"}], "version_type": "VERSION_TYPE_DEPLOY"}}
        -{"method": "PATCH", "path": "/api/2.0/bundle/deployments/[DEPLOYMENT_ID]/versions/2/operations/jobs.foo", "q": {"update_mask": "state,error_message,resource_id,status"}, "body": {"error_message": "", "resource_id": "[JOB_ID]", "sequence_id": 0, "state": "{\"state\":{\"deployment\":{\"kind\":\"BUNDLE\",\"metadata_file_path\":\"/Workspace/Users/[USERNAME]/.bundle/dms-bind-unbind-[UNIQUE_NAME]/default/state/metadata.json\"},\"edit_mode\":\"UI_LOCKED\",\"format\":\"MULTI_TASK\",\"max_concurrent_runs\":1,\"name\":\"foo\",\"queue\":{\"enabled\":true}}}", "status": "OPERATION_STATUS_SUCCEEDED"}}
        -{"method": "POST", "path": "/api/2.0/bundle/deployments/[DEPLOYMENT_ID]/versions/2/complete", "body": {"completion_reason": "VERSION_COMPLETE_SUCCESS"}}
         
         >>> [CLI] jobs get [JOB_ID]
         {
           "job_id": [JOB_ID],
           "name": "bind-target-[UNIQUE_NAME]"
         }
        +Error: Path (/Workspace/Users/[USERNAME]/.bundle/dms-bind-unbind-[UNIQUE_NAME]/default/state/resources.deployment.json) doesn't exist.
         
        ->>> MSYS_NO_PATHCONV=1 [CLI] bundle-deployments list-resources deployments/[DEPLOYMENT_ID] -o json
        -[
        -  {
        -    "last_action_type": "OPERATION_ACTION_TYPE_UPDATE",
        -    "resource_id": "[JOB_ID]",
        -    "resource_key": "jobs.foo"
        -  }
        -]
        -
        -=== Deploy keeps the bound job ID with recorded history
        -
        ->>> [CLI] bundle deploy
        -Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-bind-unbind-[UNIQUE_NAME]/default/files...
        -Updated jobs.foo
        -Files: 2 uploaded, 0 deleted
        -Resources: 0 created, 1 changed, 0 deleted, 0 unchanged
        -
        ->>> jq {features, resource_id: .state["resources.jobs.foo"].__id__} .databricks/bundle/default/resources.json
        -{
        -  "features": {
        -    "deployment_history_shadow": {}
        -  },
        -  "resource_id": "[JOB_ID]"
        -}
        -
        -=== Unbind preserves the shadow history marker and leaves the job intact
        -
        ->>> [CLI] bundle deployment unbind foo
        -
        ->>> jq {features, state} .databricks/bundle/default/resources.json
        -{
        -  "features": {
        -    "deployment_history_shadow": {}
        -  },
        -  "state": {}
        -}
        -
        ->>> [CLI] jobs get [JOB_ID]
        -{
        -  "job_id": [JOB_ID]
        -}
        -
        -=== Rebind preserves the existing shadow history marker without configuration
        -
        ->>> DATABRICKS_BUNDLE_DEPLOYMENT_HISTORY= [CLI] bundle deployment bind foo [JOB_ID] --auto-approve
        -Successfully bound job with an id '[JOB_ID]'
        -Run 'bundle deploy' to deploy changes to your workspace
        -
        ->>> jq {features, resource_id: .state["resources.jobs.foo"].__id__} .databricks/bundle/default/resources.json
        -{
        -  "features": {
        -    "deployment_history_shadow": {}
        -  },
        -  "resource_id": "[JOB_ID]"
        -}
        -
        ->>> print_requests.py --dms //versions --oneline
        -{"method": "POST", "path": "/api/2.0/bundle/deployments/[DEPLOYMENT_ID]/versions", "q": {"version_id": "6"}, "body": {"cli_version": "[CLI_VERSION]", "operations": [{"action_type": "OPERATION_ACTION_TYPE_UPDATE", "resource_key": "jobs.foo"}], "previous_version_id": "3", "version_type": "VERSION_TYPE_DEPLOY"}}
        -{"method": "PATCH", "path": "/api/2.0/bundle/deployments/[DEPLOYMENT_ID]/versions/6/operations/jobs.foo", "q": {"update_mask": "state,error_message,resource_id,status"}, "body": {"error_message": "", "resource_id": "[JOB_ID]", "sequence_id": 0, "state": "{\"state\":{\"deployment\":{\"kind\":\"BUNDLE\",\"metadata_file_path\":\"/Workspace/Users/[USERNAME]/.bundle/dms-bind-unbind-[UNIQUE_NAME]/default/state/metadata.json\"},\"edit_mode\":\"UI_LOCKED\",\"format\":\"MULTI_TASK\",\"max_concurrent_runs\":1,\"name\":\"foo\",\"queue\":{\"enabled\":true}}}", "status": "OPERATION_STATUS_SUCCEEDED"}}
        -{"method": "POST", "path": "/api/2.0/bundle/deployments/[DEPLOYMENT_ID]/versions/6/complete", "body": {"completion_reason": "VERSION_COMPLETE_SUCCESS"}}
        -
        -=== An explicit false drops the marker, so this bind records no history
        -
        ->>> [CLI] bundle deployment unbind foo
        -
        ->>> DATABRICKS_BUNDLE_DEPLOYMENT_HISTORY=false [CLI] bundle deployment bind foo [JOB_ID] --auto-approve
        -Successfully bound job with an id '[JOB_ID]'
        -Run 'bundle deploy' to deploy changes to your workspace
        -
        ->>> jq {features, resource_id: .state["resources.jobs.foo"].__id__} .databricks/bundle/default/resources.json
        -{
        -  "features": null,
        -  "resource_id": "[JOB_ID]"
        -}
        -
        ->>> print_requests.py --dms //versions
        -
        -=== An explicit true restores the marker
        -
        ->>> [CLI] bundle deployment unbind foo
        -
        ->>> DATABRICKS_BUNDLE_DEPLOYMENT_HISTORY=true [CLI] bundle deployment bind foo [JOB_ID] --auto-approve
        -Successfully bound job with an id '[JOB_ID]'
        -Run 'bundle deploy' to deploy changes to your workspace
        -
        ->>> jq {features, resource_id: .state["resources.jobs.foo"].__id__} .databricks/bundle/default/resources.json
        -{
        -  "features": {
        -    "deployment_history_shadow": {}
        -  },
        -  "resource_id": "[JOB_ID]"
        -}
        -
        ->>> print_requests.py --dms //versions --oneline
        -{"method": "POST", "path": "/api/2.0/bundle/deployments/[DEPLOYMENT_ID]/versions", "q": {"version_id": "12"}, "body": {"cli_version": "[CLI_VERSION]", "operations": [{"action_type": "OPERATION_ACTION_TYPE_UPDATE", "resource_key": "jobs.foo"}], "previous_version_id": "6", "version_type": "VERSION_TYPE_DEPLOY"}}
        -{"method": "PATCH", "path": "/api/2.0/bundle/deployments/[DEPLOYMENT_ID]/versions/12/operations/jobs.foo", "q": {"update_mask": "state,error_message,resource_id,status"}, "body": {"error_message": "", "resource_id": "[JOB_ID]", "sequence_id": 0, "state": "{\"state\":{\"deployment\":{\"kind\":\"BUNDLE\",\"metadata_file_path\":\"/Workspace/Users/[USERNAME]/.bundle/dms-bind-unbind-[UNIQUE_NAME]/default/state/metadata.json\"},\"edit_mode\":\"UI_LOCKED\",\"format\":\"MULTI_TASK\",\"max_concurrent_runs\":1,\"name\":\"foo\",\"queue\":{\"enabled\":true}}}", "status": "OPERATION_STATUS_SUCCEEDED"}}
        -{"method": "POST", "path": "/api/2.0/bundle/deployments/[DEPLOYMENT_ID]/versions/12/complete", "body": {"completion_reason": "VERSION_COMPLETE_SUCCESS"}}
        -
        -=== A subsequent deploy continues managing the same job
        -
        ->>> [CLI] bundle deploy
        -Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/dms-bind-unbind-[UNIQUE_NAME]/default/files...
        -Files: 0 uploaded, 0 deleted
        -Resources: 0 created, 0 changed, 0 deleted, 1 unchanged
        -
        ->>> jq {features, resource_id: .state["resources.jobs.foo"].__id__} .databricks/bundle/default/resources.json
        -{
        -  "features": {
        -    "deployment_history_shadow": {}
        -  },
        -  "resource_id": "[JOB_ID]"
        -}
        -
        -=== A rejected duplicate bind creates no history version
        -
        ->>> musterr [CLI] bundle deployment bind foo [JOB_ID] --auto-approve
        -Error: Resource already managed
        -
        -The bundle is already managing resource for resources.jobs.foo and it is bound to the requested ID [JOB_ID].
        -
        -
        ->>> print_requests.py --dms //versions
        +Exit code: 1
        
    acceptance_test.go:1180: 
        LOG.cleanup: The following resources will be deleted:
        LOG.cleanup:   delete resources.jobs.foo
        LOG.cleanup: 
        LOG.cleanup: All files and directories at the following location will be deleted: /Workspace/Users/tester@databricks.com/.bundle/dms-bind-unbind-gydki77qhbfnfois5cluyh2dju/default
        LOG.cleanup: 
        LOG.cleanup: Destroy: 1 deleted
TestAccept/bundle/dms/bind-upload-failure/DMS=true: branch ✅ | main (3442593) ❌ | latest (v1.28.0) ❌

main (3442593):

acceptance_test.go:1402: Diff:
        --- bundle/dms/bind-upload-failure/output.txt
        +++ /tmp/TestAcceptbundledmsbind-upload-failureDMS=true3252332876/002/output.txt
        @@ -13,7 +13,6 @@
         
         
         >>> print_requests.py --dms //complete --oneline
        -{"method": "POST", "path": "/api/2.0/bundle/deployments/[DEPLOYMENT_ID]/versions/4/complete", "body": {"completion_reason": "VERSION_COMPLETE_FAILURE"}}
         
         === Remote state still contains only the successful bindings
         
        @@ -29,12 +28,10 @@
         >>> fault.py PATCH /api/2.0/bundle/deployments/*/versions/*/operations/* 500 0 1
         
         >>> [CLI] bundle deployment bind history_failed [JOB_ID] --auto-approve
        -Warn: Failed to record deployment history for bind: recording operation for resources.jobs.history_failed: Fault injected by test.
         Successfully bound job with an id '[JOB_ID]'
         Run 'bundle deploy' to deploy changes to your workspace
         
         >>> print_requests.py --dms //complete --oneline
        -{"method": "POST", "path": "/api/2.0/bundle/deployments/[DEPLOYMENT_ID]/versions/5/complete", "body": {"completion_reason": "VERSION_COMPLETE_FAILURE"}}
         
         === Remote state contains the binding whose history upload failed
         
        
    acceptance_test.go:1180: 
        LOG.setup: Successfully bound job with an id '8796044623473759158'
        LOG.setup: Run 'bundle deploy' to deploy changes to your workspace

latest (v1.28.0):

acceptance_test.go:1402: Diff:
        --- bundle/dms/bind-upload-failure/output.txt
        +++ /tmp/TestAcceptbundledmsbind-upload-failureDMS=true1706410128/002/output.txt
        @@ -13,7 +13,6 @@
         
         
         >>> print_requests.py --dms //complete --oneline
        -{"method": "POST", "path": "/api/2.0/bundle/deployments/[DEPLOYMENT_ID]/versions/4/complete", "body": {"completion_reason": "VERSION_COMPLETE_FAILURE"}}
         
         === Remote state still contains only the successful bindings
         
        @@ -29,12 +28,10 @@
         >>> fault.py PATCH /api/2.0/bundle/deployments/*/versions/*/operations/* 500 0 1
         
         >>> [CLI] bundle deployment bind history_failed [JOB_ID] --auto-approve
        -Warn: Failed to record deployment history for bind: recording operation for resources.jobs.history_failed: Fault injected by test.
         Successfully bound job with an id '[JOB_ID]'
         Run 'bundle deploy' to deploy changes to your workspace
         
         >>> print_requests.py --dms //complete --oneline
        -{"method": "POST", "path": "/api/2.0/bundle/deployments/[DEPLOYMENT_ID]/versions/5/complete", "body": {"completion_reason": "VERSION_COMPLETE_FAILURE"}}
         
         === Remote state contains the binding whose history upload failed
         
        
    acceptance_test.go:1180: 
        LOG.setup: Successfully bound job with an id '8796044648536253569'
        LOG.setup: Run 'bundle deploy' to deploy changes to your workspace
TestAccept/bundle/dms_fault/complete_version/DMS=true: branch ✅ | main (3442593) ❌ | latest (v1.28.0) ❌

main (3442593):

acceptance_test.go:1402: Diff:
        --- bundle/dms_fault/complete_version/output.txt
        +++ /tmp/TestAcceptbundledms_faultcomplete_versionDMS=true2838799239/002/output.txt
        @@ -51,7 +51,6 @@
         
         >>> bundle generate job --existing-job-id [FOO_ID] --key foo --config-dir resources --source-dir src --force --bind
           Job configuration successfully saved to resources/foo.job.yml
        -  Warn: Failed to complete deployment history version: Fault injected by test.
           Successfully bound job with an id '[FOO_ID]'
         
         >>> bundle generate pipeline --existing-pipeline-id [BAR_ID] --key bar --config-dir exported --source-dir exported-src --force
        @@ -71,7 +70,6 @@
         >>> bundle generate pipeline --existing-pipeline-id [BAR_ID] --key bar --config-dir resources --source-dir src --force --bind
           File successfully saved to src/pipeline.sql
           Pipeline configuration successfully saved to resources/bar.pipeline.yml
        -  Warn: Failed to complete deployment history version: Fault injected by test.
           Successfully bound pipeline with an id '[BAR_ID]'
         
         >>> bundle validate
        
    acceptance_test.go:1180: 
        LOG.commands: 
        LOG.commands: commands: ('bundle', 'deploy', '--auto-approve')
        LOG.commands: exit=0
        LOG.commands: Uploading bundle files to /Workspace/Users/tester@databricks.com/.bundle/dms-fault-complete_version-commands-phdltlhr5rbs7fhcjthko7i6du/files...
        LOG.commands: Current Deployment Version: http://127.0.0.1:34105/deployments/4000000000000698?version=1
        LOG.commands: Created pipelines.bar
        LOG.commands: Created jobs.foo
        LOG.commands: Files: 4 uploaded, 0 deleted
        LOG.commands: Resources: 2 created, 0 changed, 0 deleted, 0 unchanged
        LOG.commands: 
        LOG.commands: commands: ('workspace', 'get-status', '/Workspace/Users/tester@databricks.com/.bundle/dms-fault-complete_version-commands-phdltlhr5rbs7fhcjthko7i6du/state/resources.deployment.json', '-o', 'json')
        LOG.commands: exit=0
        LOG.commands: {
        LOG.commands:   "object_id": 4000000000000698,
        LOG.commands:   "object_type": "BUNDLE_DEPLOYMENT",
        LOG.commands:   "path": "/Workspace/Users/tester@databricks.com/.bundle/dms-fault-complete_version-commands-phdltlhr5rbs7fhcjthko7i6du/state/resources.deployment.json"
        LOG.commands: }
        LOG.commands: 
        LOG.commands: commands: ('bundle', 'deploy', '--auto-approve')
        LOG.commands: exit=0
        LOG.commands: Uploading bundle files to /Workspace/Users/tester@databricks.com/.bundle/dms-fault-complete_version-commands-phdltlhr5rbs7fhcjthko7i6du/files...
        LOG.commands: Current Deployment Version: http://127.0.0.1:34105/deployments/4000000000000698?version=2
        LOG.commands: Updated jobs.foo
        LOG.commands: Updated pipelines.bar
        LOG.commands: Files: 3 uploaded, 0 deleted
        LOG.commands: Resources: 0 created, 2 changed, 0 deleted, 0 unchanged
        LOG.commands: Warn: Failed to complete deployment history version: Fault injected by test.
        LOG.commands: 
        LOG.commands: commands: ('jobs', 'get', '8796044633929910748', '-o', 'json')
        LOG.commands: exit=0
        LOG.commands: {
        LOG.commands:   "created_time": 1796044633930,
        LOG.commands:   "creator_user_name": "tester@databricks.com",
        LOG.commands:   "job_id": 8796044633929910748,
        LOG.commands:   "run_as_user_name": "tester@databricks.com",
        LOG.commands:   "settings": {
        LOG.commands:     "deployment": {
        LOG.commands:       "deployment_id": "4000000000000698",
        LOG.commands:       "kind": "BUNDLE",
        LOG.commands:       "metadata_file_path": "/Workspace/Users/tester@databricks.com/.bundle/dms-fault-complete_version-commands-phdltlhr5rbs7fhcjthko7i6du/state/metadata.json",
        LOG.commands:       "version_id": "2"
        LOG.commands:     },
        LOG.commands:     "description": "history-true",
        LOG.commands:     "edit_mode": "UI_LOCKED",
        LOG.commands:     "email_notifications": {},
        LOG.commands:     "format": "MULTI_TASK",
        LOG.commands:     "max_concurrent_runs": 1,
        LOG.commands:     "name": "updated-dms-fault-complete_version-commands-phdltlhr5rbs7fhcjthko7i6du",
        LOG.commands:     "queue": {
        LOG.commands:       "enabled": true
        LOG.commands:     },
        LOG.commands:     "timeout_seconds": 0,
        LOG.commands:     "webhook_notifications": {}
        LOG.commands:   }
        LOG.commands: }
        LOG.commands: 
        LOG.commands: commands: ('pipelines', 'get', '7a11d3fd-b9cd-3608-7a11-d3fdb9cd3734', '-o', 'json')
        LOG.commands: exit=0
        LOG.commands: {
        LOG.commands:   "creator_user_name": "tester@databricks.com",
        LOG.commands:   "effective_publishing_mode": "DEFAULT_PUBLISHING_MODE",
        LOG.commands:   "last_modified": 1796044633928,
        LOG.commands:   "name": "updated-dms-fault-complete_version-commands-phdltlhr5rbs7fhcjthko7i6du",
        LOG.commands:   "pipeline_id": "7a11d3fd-b9cd-3608-7a11-d3fdb9cd3734",
        LOG.commands:   "run_as_user_name": "tester@databricks.com",
        LOG.commands:   "spec": {
        LOG.commands:     "catalog": "main",
        LOG.commands:     "channel": "CURRENT",
        LOG.commands:     "deployment": {
        LOG.commands:       "deployment_id": "4000000000000698",
        LOG.commands:       "kind": "BUNDLE",
        LOG.commands:       "metadata_file_path": "/Workspace/Users/tester@databricks.com/.bundle/dms-fault-complete_version-commands-phdltlhr5rbs7fhcjthko7i6du/state/metadata.json",
        LOG.commands:       "version_id": "2"
        LOG.commands:     },
        LOG.commands:     "edition": "ADVANCED",
        LOG.commands:     "id": "7a11d3fd-b9cd-3608-7a11-d3fdb9cd3734",
        LOG.commands:     "libraries": [
        LOG.commands:       {
        LOG.commands:         "file": {
        LOG.commands:           "path": "/Workspace/Users/tester@databricks.com/.bundle/dms-fault-complete_version-commands-phdltlhr5rbs7fhcjthko7i6du/files/pipeline.sql"
        LOG.commands:         }
        LOG.commands:       }
        LOG.commands:     ],
        LOG.commands:     "name": "updated-dms-fault-complete_version-commands-phdltlhr5rbs7fhcjthko7i6du",
        LOG.commands:     "schema": "default",
        LOG.commands:     "serverless": true
        LOG.commands:   },
        LOG.commands:   "state": "IDLE"
        LOG.commands: }
        LOG.commands: 
        LOG.commands: commands: ('bundle', 'summary')
        LOG.commands: exit=0
        LOG.commands: Name: updated-dms-fault-complete_version-commands-phdltlhr5rbs7fhcjthko7i6du
        LOG.commands: Target: default
        LOG.commands: Workspace:
        LOG.commands:   User: tester@databricks.com
        LOG.commands:   Path: /Workspace/Users/tester@databricks.com/.bundle/dms-fault-complete_version-commands-phdltlhr5rbs7fhcjthko7i6du
        LOG.commands: Resources:
        LOG.commands:   Jobs:
        LOG.commands:     foo:
        LOG.commands: ... (470 more lines truncated, raise DATABRICKS_CLI_TEST_MAX_LOG to see more)
FAIL

latest (v1.28.0):

acceptance_test.go:1402: Diff:
        --- bundle/dms_fault/complete_version/output.txt
        +++ /tmp/TestAcceptbundledms_faultcomplete_versionDMS=true372842179/002/output.txt
        @@ -51,7 +51,6 @@
         
         >>> bundle generate job --existing-job-id [FOO_ID] --key foo --config-dir resources --source-dir src --force --bind
           Job configuration successfully saved to resources/foo.job.yml
        -  Warn: Failed to complete deployment history version: Fault injected by test.
           Successfully bound job with an id '[FOO_ID]'
         
         >>> bundle generate pipeline --existing-pipeline-id [BAR_ID] --key bar --config-dir exported --source-dir exported-src --force
        @@ -71,7 +70,6 @@
         >>> bundle generate pipeline --existing-pipeline-id [BAR_ID] --key bar --config-dir resources --source-dir src --force --bind
           File successfully saved to src/pipeline.sql
           Pipeline configuration successfully saved to resources/bar.pipeline.yml
        -  Warn: Failed to complete deployment history version: Fault injected by test.
           Successfully bound pipeline with an id '[BAR_ID]'
         
         >>> bundle validate
        
    acceptance_test.go:1180: 
        LOG.commands: 
        LOG.commands: commands: ('bundle', 'deploy', '--auto-approve')
        LOG.commands: exit=0
        LOG.commands: Uploading bundle files to /Workspace/Users/tester@databricks.com/.bundle/dms-fault-complete_version-commands-k5guh3yewfeavdoluppwktz5mu/files...
        LOG.commands: Current Deployment Version: http://127.0.0.1:39589/deployments/4000000000000522?version=1
        LOG.commands: Created pipelines.bar
        LOG.commands: Created jobs.foo
        LOG.commands: Files: 4 uploaded, 0 deleted
        LOG.commands: Resources: 2 created, 0 changed, 0 deleted, 0 unchanged
        LOG.commands: 
        LOG.commands: commands: ('workspace', 'get-status', '/Workspace/Users/tester@databricks.com/.bundle/dms-fault-complete_version-commands-k5guh3yewfeavdoluppwktz5mu/state/resources.deployment.json', '-o', 'json')
        LOG.commands: exit=0
        LOG.commands: {
        LOG.commands:   "object_id": 4000000000000522,
        LOG.commands:   "object_type": "BUNDLE_DEPLOYMENT",
        LOG.commands:   "path": "/Workspace/Users/tester@databricks.com/.bundle/dms-fault-complete_version-commands-k5guh3yewfeavdoluppwktz5mu/state/resources.deployment.json"
        LOG.commands: }
        LOG.commands: 
        LOG.commands: commands: ('bundle', 'deploy', '--auto-approve')
        LOG.commands: exit=0
        LOG.commands: Uploading bundle files to /Workspace/Users/tester@databricks.com/.bundle/dms-fault-complete_version-commands-k5guh3yewfeavdoluppwktz5mu/files...
        LOG.commands: Current Deployment Version: http://127.0.0.1:39589/deployments/4000000000000522?version=2
        LOG.commands: Updated jobs.foo
        LOG.commands: Updated pipelines.bar
        LOG.commands: Files: 3 uploaded, 0 deleted
        LOG.commands: Resources: 0 created, 2 changed, 0 deleted, 0 unchanged
        LOG.commands: Warn: Failed to complete deployment history version: Fault injected by test.
        LOG.commands: 
        LOG.commands: commands: ('jobs', 'get', '8796044648670793333', '-o', 'json')
        LOG.commands: exit=0
        LOG.commands: {
        LOG.commands:   "created_time": 1796044648671,
        LOG.commands:   "creator_user_name": "tester@databricks.com",
        LOG.commands:   "job_id": 8796044648670793333,
        LOG.commands:   "run_as_user_name": "tester@databricks.com",
        LOG.commands:   "settings": {
        LOG.commands:     "deployment": {
        LOG.commands:       "deployment_id": "4000000000000522",
        LOG.commands:       "kind": "BUNDLE",
        LOG.commands:       "metadata_file_path": "/Workspace/Users/tester@databricks.com/.bundle/dms-fault-complete_version-commands-k5guh3yewfeavdoluppwktz5mu/state/metadata.json",
        LOG.commands:       "version_id": "2"
        LOG.commands:     },
        LOG.commands:     "description": "history-true",
        LOG.commands:     "edit_mode": "UI_LOCKED",
        LOG.commands:     "email_notifications": {},
        LOG.commands:     "format": "MULTI_TASK",
        LOG.commands:     "max_concurrent_runs": 1,
        LOG.commands:     "name": "updated-dms-fault-complete_version-commands-k5guh3yewfeavdoluppwktz5mu",
        LOG.commands:     "queue": {
        LOG.commands:       "enabled": true
        LOG.commands:     },
        LOG.commands:     "timeout_seconds": 0,
        LOG.commands:     "webhook_notifications": {}
        LOG.commands:   }
        LOG.commands: }
        LOG.commands: 
        LOG.commands: commands: ('pipelines', 'get', '7a11d401-285f-7d30-7a11-d401285f7ef5', '-o', 'json')
        LOG.commands: exit=0
        LOG.commands: {
        LOG.commands:   "creator_user_name": "tester@databricks.com",
        LOG.commands:   "effective_publishing_mode": "DEFAULT_PUBLISHING_MODE",
        LOG.commands:   "last_modified": 1796044648668,
        LOG.commands:   "name": "updated-dms-fault-complete_version-commands-k5guh3yewfeavdoluppwktz5mu",
        LOG.commands:   "pipeline_id": "7a11d401-285f-7d30-7a11-d401285f7ef5",
        LOG.commands:   "run_as_user_name": "tester@databricks.com",
        LOG.commands:   "spec": {
        LOG.commands:     "catalog": "main",
        LOG.commands:     "channel": "CURRENT",
        LOG.commands:     "deployment": {
        LOG.commands:       "deployment_id": "4000000000000522",
        LOG.commands:       "kind": "BUNDLE",
        LOG.commands:       "metadata_file_path": "/Workspace/Users/tester@databricks.com/.bundle/dms-fault-complete_version-commands-k5guh3yewfeavdoluppwktz5mu/state/metadata.json",
        LOG.commands:       "version_id": "2"
        LOG.commands:     },
        LOG.commands:     "edition": "ADVANCED",
        LOG.commands:     "id": "7a11d401-285f-7d30-7a11-d401285f7ef5",
        LOG.commands:     "libraries": [
        LOG.commands:       {
        LOG.commands:         "file": {
        LOG.commands:           "path": "/Workspace/Users/tester@databricks.com/.bundle/dms-fault-complete_version-commands-k5guh3yewfeavdoluppwktz5mu/files/pipeline.sql"
        LOG.commands:         }
        LOG.commands:       }
        LOG.commands:     ],
        LOG.commands:     "name": "updated-dms-fault-complete_version-commands-k5guh3yewfeavdoluppwktz5mu",
        LOG.commands:     "schema": "default",
        LOG.commands:     "serverless": true
        LOG.commands:   },
        LOG.commands:   "state": "IDLE"
        LOG.commands: }
        LOG.commands: 
        LOG.commands: commands: ('bundle', 'summary')
        LOG.commands: exit=0
        LOG.commands: Name: updated-dms-fault-complete_version-commands-k5guh3yewfeavdoluppwktz5mu
        LOG.commands: Target: default
        LOG.commands: Workspace:
        LOG.commands:   User: tester@databricks.com
        LOG.commands:   Path: /Workspace/Users/tester@databricks.com/.bundle/dms-fault-complete_version-commands-k5guh3yewfeavdoluppwktz5mu
        LOG.commands: Resources:
        LOG.commands:   Jobs:
        LOG.commands:     foo:
        LOG.commands: ... (470 more lines truncated, raise DATABRICKS_CLI_TEST_MAX_LOG to see more)

4 more failure details omitted, see the full report in the run.

@shreyas-goenka
shreyas-goenka force-pushed the shreyas-goenka_data/shreyas-goenka/out-of-band-bind-history branch 2 times, most recently from 1841b1a to fbccb43 Compare November 19, 2026 16:48
@eng-dev-ecosystem-bot

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

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: 545d6ad

Run: 46425662104

Env 💚​RECOVERED ✅​pass 🙈​skip Time
💚​ aws linux-2core-8gb 1 103 15 3:29
💚​ aws-windows-latest-4core-16gb 1 103 15 4:55
💚​ azure linux-2core-8gb 1 103 15 3:54
💚​ azure-windows-latest-4core-16gb 1 103 15 4:52
💚​ gcp linux-2core-8gb 1 103 15 4:08
💚​ gcp-windows-latest-4core-16gb 1 103 15 5:00
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 3 slowest tests (at least 2 minutes):
duration env testname
3:18 aws-windows-latest-4core-16gb TestAccept
3:18 azure-windows-latest-4core-16gb TestAccept
3:16 gcp-windows-latest-4core-16gb TestAccept

@shreyas-goenka
shreyas-goenka force-pushed the shreyas-goenka_data/shreyas-goenka/out-of-band-bind-history branch from fbccb43 to 51ec50c Compare November 19, 2026 18:32
@@ -0,0 +1,5 @@

>>> [CLI] bundle deployment bind spec1 main.fspec_[UNIQUE_NAME].boundspec --auto-approve
Warn: Failed to record deployment history for bind: failed to create deployment version: operations.resource_key must have a known resource type prefix (e.g. 'jobs.', 'pipelines.'): feature_specs.spec1

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.

I'm taking a look whether we need to add feature_spec as a resource to DMS.

@shreyas-goenka
shreyas-goenka force-pushed the shreyas-goenka_data/shreyas-goenka/out-of-band-bind-history branch from 51ec50c to c2454aa Compare November 20, 2026 09:50
$CLI bundle deployment bind kept "$job_id" --auto-approve &> LOG.setup
rm -f "$OUT_REQUESTS"

title "A remote state upload failure fails the bind version"

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.

Because of API failing, the remote deployment state is not updated. In this case, deployment history does capture the bind operation but marks it as a failed version.

@shreyas-goenka
shreyas-goenka force-pushed the shreyas-goenka_data/shreyas-goenka/out-of-band-bind-history branch 2 times, most recently from 365bce7 to 40d560d Compare November 20, 2026 10:38
@shreyas-goenka
shreyas-goenka marked this pull request as ready for review November 20, 2026 10:39
@shreyas-goenka
shreyas-goenka requested review from a team as code owners November 20, 2026 10:39
@shreyas-goenka

Copy link
Copy Markdown
Contributor Author

/review

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

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

This PR records committed bundle deployment bind operations as UPDATE versions in deployment history (DMS), running outside the StateDB. The implementation is correct: it creates a history version after bind commits, completes it after the remote state upload, handles failures gracefully with best-effort semantics, and has thorough fault-injection test coverage. The main concern is that createBindingVersion closely replicates DMS protocol logic already in dms.go, creating a maintenance risk.

Comment thread bundle/phases/bind.go
}

// createBindingVersion claims a history version for the staged binding operations.
func createBindingVersion(ctx context.Context, b *bundle.Bundle, serial int, staged []bundledeployments.StagedOperation) (*bindingHistory, error) {

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] createBindingVersion re-implements the create-deployment-if-absent block (lines 237–251, including the recoverCreatedDeployment fallback and DeploymentIDFromName extraction) and the git-info + CreateVersion construction (lines 255–270) that already live in createOrUpdateDeployment (dms.go:83–98) and startVersion (dms.go:220–241). A protocol change—say a new field on CreateVersion or a tweaked recovery rule—now needs updating in both places. Can you extract at least the "ensure deployment exists" block and the version-info builder into shared helpers that both paths call?

Comment thread bundle/phases/bind.go
}
history, err := createBindingVersion(ctx, b, metadata.Serial, []bundledeployments.StagedOperation{{
ResourceKey: strings.TrimPrefix(resourceKey, dms.StatePrefix),
ActionType: bundledeployments.OperationActionTypeOperationActionTypeUpdate,

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.

Bind leaves the resource unchanged, but history shows an update. Can we record OPERATION_ACTION_TYPE_BIND instead?

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.

Let's discuss this today. This is a open design question.

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.

We discussed offline - we'll proceed with an update operation type. The bind annotation will be captured in a separate new field added later.

@@ -0,0 +1,4 @@
# This test ensures that deployment history works with bind and immutable folders. This case is interesting
# because by default we record the snapshot path in deploy, but that is not available during bind. So it's important
# to ensure that we don't do that during deployment bind, and recording history continues to work.

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.

This test still passes when bind records the snapshot path as the deployment's file path. Could it print the deployment's workspace info, like dms/immutable-folder does?

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.

updated the test assertion to check that file_path is not being recorded.

@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 Opus 5.5 + Claude Sonnet 5.5, cross-verified). Only points the reviewers agreed on are posted.

Comment thread bundle/phases/bind.go
return nil, err
}
history.buffer.RecordOperation(ctx, resourceKey, false, entry.ID, state)
return history, history.buffer.Drain(ctx)

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] nit: recordBindHistory returns a non-nil history with the Drain error, and Bind relies on that to stop the heartbeat and complete the version. Can its doc comment say so?

@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] Follow-up review by review-factory (Claude Opus 5.5 + Claude Opus 5.5 + Claude Sonnet 5.5, cross-verified). Only points the reviewers agreed on are posted.

Earlier findings: 1 still open.

No new issues found.

Base automatically changed from shreyas-goenka_data/shreyas-goenka/out-of-band-dms-metadata to main November 26, 2026 00:26
shreyas-goenka and others added 3 commits November 26, 2026 01:26
Co-authored-by: Isaac <no-reply@databricks.com>
Print the deployment's workspace_info after bind, as dms/immutable-folder does, so the test fails if bind records the snapshot path as file_path.

Co-authored-by: Isaac <no-reply@databricks.com>
@shreyas-goenka
shreyas-goenka force-pushed the shreyas-goenka_data/shreyas-goenka/out-of-band-bind-history branch from 34ce009 to fce7ab5 Compare November 26, 2026 00:27

@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 Opus 5.5 + Claude Sonnet 5.5, cross-verified). Only points the reviewers agreed on are posted.

No issues found.

@shreyas-goenka

Copy link
Copy Markdown
Contributor Author

/review

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

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

This PR records a committed bundle deployment bind as an UPDATE version in deployment history. Recording is best effort, and the version is completed after the remote state upload. The flow works, and the acceptance coverage for rejection, rebind and upload failure is thorough. The main concern is that createBindingVersion and completeBindingHistory copy the deploy-side version code in dms.go and deploy.go instead of reusing it, and the copies already behave differently. Two smaller issues: a failed operation PATCH marks a committed bind as a failed version, and the new immutable test prints a whole nested GET object.

Comment thread bundle/phases/bind.go
}

// createBindingVersion claims a history version for the staged binding operations.
func createBindingVersion(ctx context.Context, b *bundle.Bundle, serial int, staged []bundledeployments.StagedOperation) (*bindingHistory, error) {

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] createBindingVersion copies code that already exists in bundle/phases/dms.go. The CreateDeployment / recoverCreatedDeployment / DeploymentIDFromName block comes from createOrUpdateDeployment. The GitInfo / Version{...} / CreateVersion block and the "failed to create deployment version" wrap come from startVersion. completeBindingHistory (line 143) likewise copies StateDB.CompleteVersion from the deferred block in deploy.go.

The copies already differ:

  • Bind numbers the version from the remote LastVersionId, while startVersion uses StateDB.VersionID.
  • Bind never writes a new deployment ID into StateDB.DeploymentID or b.Config.Bundle.Deployment.DeploymentID.
  • A completion error in bind is always a warning, while deploy treats it as fatal in DMS mode.

A later fix to numbering, recovery or completion would have to land in both places. Could startVersion take the deployment ID, previous version and serial as arguments so bind calls it, with bind reusing the deploy-side completion path, instead of keeping a second copy? (AGENTS.md: search for an existing helper before adding one.)

Comment thread bundle/phases/bind.go
return nil, err
}
history.buffer.RecordOperation(ctx, resourceKey, false, entry.ID, state)
return history, history.buffer.Drain(ctx)

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] If Drain fails (for example the operation PATCH fault in dms_fault/update_operation), historyErr is set, so the deferred completeBindingHistory sends VERSION_COMPLETE_FAILURE. That happens even though the state was committed and pushed. Deploy treats the same best-effort recording failure as a warning: it completes with !logdiag.HasError(ctx) and records SUCCESS. Should bind base the completion reason only on the command outcome, as deploy does, and keep the Drain error as a warning?


title "Bind uploads no files, so the deployment records no file_path"
# MSYS_NO_PATHCONV: Git Bash on Windows would rewrite the leading-'/' API path.
trace MSYS_NO_PATHCONV=1 $CLI api get "/api/2.0/bundle/deployments/${deployment_id}" | jq '{workspace_info}'

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] jq '{workspace_info}' prints the whole workspace_info object, but the test only asserts root_path and that file_path is absent. Any new field the testserver or backend adds to workspace_info would change this golden. testing.md asks to project GET responses to an allow-list. Something like jq '.workspace_info | {root_path, file_path} | with_entries(select(.value != null))' keeps the file_path check, and could live in a deployment_fields() helper in script.prepare.

@shreyas-goenka
shreyas-goenka added this pull request to the merge queue Nov 26, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 26, 2026
A failed history upload is a warning and no longer fails the version: the
binding was committed and pushed either way, so the version records success
as a deploy's would in the same case. A failed state upload still fails it.
Also project the immutable-folder test's workspace_info to the two fields it
asserts, so new backend fields do not change the golden.

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

Copy link
Copy Markdown
Contributor Author

/review

shreyas-goenka and others added 2 commits November 26, 2026 14:34
#7895 replaced RecordsDeploymentHistory with DeploymentHistoryChoice, and an
unset setting now means "ask the workspace", not "off". Bind is not a deploy,
so it does not consult enrollment: an explicit setting wins, otherwise it
follows the loaded state's marker, as other non-deploy commands do.

Co-authored-by: Isaac <no-reply@databricks.com>
Comment thread bundle/phases/bind.go Outdated
defer func() {
// Completion reflects the bind's outcome, as deploy's does: a failed history upload is
// only a warning, since the state was committed either way.
completeBindingHistory(ctx, b, history, !logdiag.HasError(ctx))

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.

Deploy's StateDB.CompleteVersion fails the version when a history upload failed, so this comment, the test title and the description are wrong. Should bind follow the same rule?

Reverts the completion rule to match CompleteVersion: the bind still succeeds
with a warning, but a version whose operation upload failed completes with
failure, since the service holds no record of the binding. The upload-failure
test now pins this case.

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

@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 + Claude Opus 5.5, cross-verified). Only points the reviewers agreed on are posted.

Comment thread bundle/direct/bind.go
if !explicit {
recordsHistory = b.StateDB.RecordsHistory()
}
if recordsHistory {

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] Major: With deployment_history: false and a state that already has deployment_history_shadow, this only skips adding the marker, so line 227 still records history. Delete the marker when false, as process.go:385 does?

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.

🤖 Should fix +1, reproduced: in dms/bind-unbind, changing the rebind step to DATABRICKS_BUNDLE_DEPLOYMENT_HISTORY=false leaves the golden unchanged apart from the echoed command. Bind still sends CreateVersion, the operation PATCH with the job's full state, and CompleteVersion. That step would make a good regression test once an explicit false clears the marker, as cmd/bundle/utils/process.go does for deploy.

The bind bumps the state serial before its version is created, so that serial
is the version's number; max with the service's next version keeps it from
falling behind either counter. The former serial+1 skipped a number on every
bind.

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

@denik denik 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.

🤖 Automated review of 4060ec91d by Opus, Fable and Astra; each finding verified against the code.

No blocking issues. One new should-fix is inline: history is recorded before the remote state push. I also added a reproduction to the open deployment_history: false thread.

Not posted inline (plausible; not checked against the real service):

  • bundle/phases/bind.go:241: on a fresh mode: development target, locking is off, so nothing creates workspace.state_path before CreateDeployment. If the service requires that parent folder (the testserver doesn't check), the first bind's history always fails with a warning. Pushing state before recording history would also fix this.

Comment thread bundle/phases/bind.go
return
}

history, historyErr = recordBindHistory(ctx, b, resourceKey, result.DMSMetadata)

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.

🤖 Should fix History is recorded after the local state is committed (result.Finalize(), L130) but before PushResourcesState (L141). FetchDeployment, CreateDeployment, CreateVersion and the deferred CompleteVersion all go through the bundle client, which retries 429/503 for up to 15 minutes (RetryTimeoutSeconds in bundle/config/workspace.go). Only the operation upload has a 5s budget. When the history service is throttled, bind holds the deploy lock for minutes, with the binding in local state but not in remote state, all for best-effort data. An interrupt in that window leaves this checkout ahead of the workspace, and other checkouts don't see the binding. Before this PR that window was one rename wide.

Pushing the state first and recording history after it closes the window. A failed push then creates no version at all, rather than a failed version whose operation was already recorded as succeeded, and bindingHistory and the deferred completion go away.

Comment thread bundle/direct/bind.go
if !explicit {
recordsHistory = b.StateDB.RecordsHistory()
}
if recordsHistory {

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.

🤖 Should fix +1, reproduced: in dms/bind-unbind, changing the rebind step to DATABRICKS_BUNDLE_DEPLOYMENT_HISTORY=false leaves the golden unchanged apart from the echoed command. Bind still sends CreateVersion, the operation PATCH with the job's full state, and CompleteVersion. That step would make a good regression test once an explicit false clears the marker, as cmd/bundle/utils/process.go does for deploy.

@denik

denik commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Heads-up: #7975 removed the errcode acceptance helper, so the errcode calls this PR adds will fail with errcode: command not found once it's tested against current main.

To fix: use musterr CMD for a command that must fail, and run commands expected to succeed without a wrapper. When the exact exit code is what the test checks, print it after musterr with printf '\nExit code: %s\n' "$MUSTERR_EXIT_CODE". cmd || true is only for best-effort cleanup. Details are in .agents/rules/testing.md.

@shreyas-goenka
shreyas-goenka added this pull request to the merge queue Nov 30, 2026
An explicit false only skipped adding the shadow marker, so a state that
already carried one kept recording history. Delete the marker instead, as
deploy does, so the bind records nothing. The bind-unbind test now covers an
explicit false and an explicit true rebind.

Co-authored-by: Isaac <no-reply@databricks.com>
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 30, 2026
The job is bound when the script ends, so bundle destroy already deletes it
and the explicit jobs delete 404s. errcode swallowed that status, but a
prepare-defined helper is not reliably in scope inside the EXIT trap in CI
("errcode: command not found", exit 127 appended to the golden). Call
destroy directly, as the other dms/ traps do.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants