Skip to content

Don't update or delete a schema or volume that is not the bundle's - #8056

Open
denik wants to merge 17 commits into
mainfrom
denik/schema-volume-identity
Open

denik wants to merge 17 commits into
mainfrom
denik/schema-volume-identity

Conversation

@denik

@denik denik commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Changes

The direct engine now checks a schema's schema_id or a volume's volume_id before it updates or deletes what is at the recorded name. An object there with a different internal id is someone else's, or the bundle's was deleted and created again: the CLI never updates or deletes it.

  • Plan (resource in config): the object at the recorded ID is treated as not the bundle's. The plan falls through to the existing findMoved lookup at the config's ID, so it finds the bundle's object when the config follows the rename. Otherwise it plans a create, which fails on the name. A warning (a diagnostic) names the object and the ways out: point the config at the renamed object, or unbind and bind.
  • Delete (destroy, or a resource removed from config): the entry is planned as gone. No delete is sent, the state entry is dropped, and a warning names the object. If the bundle also deletes the parent schema, that delete still removes everything in it, as on main. The bundle's own, if it was renamed out of band, is not looked for and is left behind, as before.
  • acceptance/bin/replay_tfstate.py: matches a create request to its tfstate entry case-insensitively. UC lowercases names, so a mixed-case schema's schema_id was not remapped on replay, and the migrated state carried a stale id that the new check rejected (migrate/auto/schema-name-normalized).

This PR was narrowed to the identity check during review. Finding a renamed schema or volume by its internal id on destroy, and handling the resources inside a renamed schema, moved to the follow-up #8096.

Why

This PR fixes the destructive half of the behavior recorded as Badness in acceptance/bundle/resources/schemas/foreign_at_recorded_name:

The plan reads the recorded name and takes whatever schema is there without checking schema_id: a schema someone else created at that name after ours was renamed is planned as an update and then deleted by destroy, while ours is left behind. A schema_id mismatch should mean the bundle's schema is not there, and the plan should look for it by its schema_id.

Before, the plan was "action": "update" on the other schema (schema_id: [FOREIGN_SCHEMA_ID]) and destroy sent DELETE /api/2.1/unity-catalog/schemas/main.test-schema-[UNIQUE_NAME]. Now the plan is "action": "create" with a warning, deploy fails with SCHEMA_ALREADY_EXISTS, and destroy sends no DELETE: Destroy: 0 deleted, with a warning. The other schema is left alone.

The rest of that note, the bundle's renamed schema being left behind, is still true. The test keeps a narrower Badness note for it, and so does the new volumes/foreign_at_recorded_name. schemas/destroy_after_rename_out_of_band is unchanged and keeps its Badness note. Both are fixed in the follow-up.

Tests

  • schemas/foreign_at_recorded_name: the Badness note is narrowed to the leak; the destroy step now shows that nothing is deleted.
  • New: volumes/foreign_at_recorded_name (the same for volumes), and schemas/recreated_at_recorded_name (documents the behavior change below, and that unbind + bind recovers).
  • Unit tests: otherInternalID, otherObjectAtRecordedID (ID-only state entries, no recorded internal id).
  • Every new or changed test fails without the production change (checked against main's bundle_plan.go). The Cloud tests passed on AWS locally.

Gaps and risks

Overall risk: low. The change only narrows what the CLI updates or deletes, and touches only schemas and volumes, the two resources with an internal id today.

Judgment call: a schema or volume deleted and created again outside the bundle is no longer adopted. The CLI cannot tell it from an object someone else created under the same name: both have another schema_id/volume_id at the recorded name. Adopting it silently is what let destroy delete other people's schemas, so it is now left alone: deploy fails with ALREADY_EXISTS and destroy drops it from the state, until the user runs bundle deployment unbind and bundle deployment bind. A warning on every plan names the object and the way out, and schemas/recreated_at_recorded_name shows the recovery. Risk: medium. A user who drops and recreates schemas by hand sees deploys fail where they used to succeed; nothing is deleted or changed in the workspace.

Destroy still leaves a schema or volume renamed out of band behind, now also when another object took its old name; it drops the state entry and warns. That is a leak, not a wrong delete, and the follow-up fixes it. Risk: low.

plan_version: this PR adds no plan field and no new meaning to one. A plan saved by an older CLI and applied by this one deletes at the recorded name without the check, as that CLI would; a plan saved by this one marks the other object's delete gone, which an older CLI already honors. A saved plan means the same to both CLIs, so a bump would only reject plans without protecting anything; this PR does not bump it. The question comes back in #8096, where a Delete's id gets a new meaning.

  • bundle deployment bind does not record the internal id; the next deploy does. Until then the check has nothing to compare, as with state from an older CLI. Risk: low.

Related PRs

  • Follow-up: #8096 (draft): destroy finds a renamed schema or volume by its internal id, and the resources in a renamed schema. To be reviewed after this one merges.
  • #7418 (internal ids for catalogs, registered models and secrets) touches the same files. When it lands, its resources get this check automatically. #7931 (delete errors in apply.go) has merged; this PR no longer changes apply.go.

Dashboard

🤖 AI agent (opus5.5, isaac_claude)

This pull request and its description were written by Isaac.

@github-actions github-actions Bot added the DABs DABs related issues label Nov 26, 2026
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Regression test report ✅

Commit: d91d6688d | Workflow run

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

8 tests: regression=6 unreleased=0 coverage=2 failing=0
test branch main (e6f3460) latest (v1.28.0)
TestAccept/bundle/resources/schemas/destroy_after_rename_out_of_band/DMS= ✅ ✅ ✅
TestAccept/bundle/resources/schemas/destroy_after_rename_out_of_band/DMS=true ✅ ✅ ✅
TestAccept/bundle/resources/schemas/foreign_at_recorded_name/DMS= ✅ ❌ ❌
TestAccept/bundle/resources/schemas/foreign_at_recorded_name/DMS=true ✅ ❌ ❌
TestAccept/bundle/resources/schemas/recreated_at_recorded_name/DMS= ✅ ❌ ❌
TestAccept/bundle/resources/schemas/recreated_at_recorded_name/DMS=true ✅ ❌ ❌
TestAccept/bundle/resources/volumes/foreign_at_recorded_name/DMS= ✅ ❌ ❌
TestAccept/bundle/resources/volumes/foreign_at_recorded_name/DMS=true ✅ ❌ ❌
TestAccept/bundle/resources/schemas/foreign_at_recorded_name/DMS=: branch ✅ | main (e6f3460) ❌ | latest (v1.28.0) ❌

main (e6f3460):

acceptance_test.go:1402: Diff:
        --- bundle/resources/schemas/foreign_at_recorded_name/output.txt
        +++ /tmp/TestAcceptbundleresourcesschemasforeign_at_recorded_nameDMS627721274/002/output.txt
        @@ -18,8 +18,6 @@
         === The other schema has another schema_id, so the plan does not take it for the bundle's: it plans a create
         
         >>> [CLI] bundle plan --output json
        -Warning: resources.schemas.schema1: id="main.test-schema-[UNIQUE_NAME]" holds another object: its schema_id is "[FOREIGN_SCHEMA_ID]", not "[SCHEMA_ID]" as recorded, so this bundle does not take it for its own. If the bundle's was renamed outside the bundle, set its name in the config to the new one. If this object is the bundle's (deleted and created again outside the bundle), run 'bundle deployment unbind' and then 'bundle deployment bind' to manage it again.
        -
         {
           "plan_version": [PLAN_VERSION],
           "cli_version": "[CLI_VERSION]",
        @@ -27,7 +25,7 @@
           "serial": 1,
           "plan": {
             "resources.schemas.schema1": {
        -      "action": "create",
        +      "action": "update",
               "new_state": {
                 "value": {
                   "catalog_name": "main",
        @@ -36,10 +34,16 @@
                 }
               },
               "changes": {
        +        "comment": {
        +          "action": "update",
        +          "old": "c1",
        +          "new": "c1"
        +        },
                 "schema_id": {
                   "action": "skip",
                   "reason": "internal_id",
        -          "old": "[SCHEMA_ID]"
        +          "old": "[SCHEMA_ID]",
        +          "remote": "[FOREIGN_SCHEMA_ID]"
                 }
               }
             }
        @@ -50,49 +51,10 @@
         
         >>> musterr [CLI] bundle deploy
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
        -Warning: resources.schemas.schema1: id="main.test-schema-[UNIQUE_NAME]" holds another object: its schema_id is "[FOREIGN_SCHEMA_ID]", not "[SCHEMA_ID]" as recorded, so this bundle does not take it for its own. If the bundle's was renamed outside the bundle, set its name in the config to the new one. If this object is the bundle's (deleted and created again outside the bundle), run 'bundle deployment unbind' and then 'bundle deployment bind' to manage it again.
        -
        -Error: cannot create resources.schemas.schema1: Schema 'test-schema-[UNIQUE_NAME]' already exists (400 SCHEMA_ALREADY_EXISTS)
        -
        -Endpoint: POST [DATABRICKS_URL]/api/2.1/unity-catalog/schemas
        -HTTP Status: 400 Bad Request
        -API error_code: SCHEMA_ALREADY_EXISTS
        -API message: Schema 'test-schema-[UNIQUE_NAME]' already exists
        -
        +Updated schemas.schema1
         Files: 2 uploaded, 0 deleted
        +Resources: 0 created, 1 changed, 0 deleted, 0 unchanged
         
        ->>> print_requests.py //unity-catalog
        -{
        -  "method": "POST",
        -  "path": "/api/2.1/unity-catalog/schemas",
        -  "body": {
        -    "catalog_name": "main",
        -    "comment": "c1",
        -    "name": "test-schema-[UNIQUE_NAME]"
        -  }
        -}
        +Unexpected success
         
        -=== Destroy does not delete the other schema: it only drops the bundle's from the state
        -
        ->>> [CLI] bundle destroy --auto-approve
        -Warning: resources.schemas.schema1: id="main.test-schema-[UNIQUE_NAME]" holds another object: its schema_id is "[FOREIGN_SCHEMA_ID]", not "[SCHEMA_ID]" as recorded, so no delete is sent for it, and resources.schemas.schema1 is dropped from the deployment state. If it is the bundle's (deleted and created again outside the bundle), delete it outside the bundle.
        -
        -All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default
        -
        -Destroy: 0 deleted
        -
        ->>> print_requests.py //unity-catalog
        -
        ->>> [CLI] schemas get main.test-schema-moved-[UNIQUE_NAME]
        -{
        -  "full_name": "main.test-schema-moved-[UNIQUE_NAME]",
        -  "schema_id": "[SCHEMA_ID]"
        -}
        -
        -=== The other schema is left alone
        -
        ->>> [CLI] schemas get main.test-schema-[UNIQUE_NAME]
        -{
        -  "full_name": "main.test-schema-[UNIQUE_NAME]",
        -  "schema_id": "[FOREIGN_SCHEMA_ID]"
        -}
        +Exit code: 1
        
    acceptance_test.go:1180: LOG.cleanup: 
    acceptance_test.go:1180: 
        LOG.deploy_requests: {
        LOG.deploy_requests:   "method": "POST",
        LOG.deploy_requests:   "path": "/api/2.1/unity-catalog/schemas",
        LOG.deploy_requests:   "body": {
        LOG.deploy_requests:     "catalog_name": "main",
        LOG.deploy_requests:     "comment": "c1",
        LOG.deploy_requests:     "name": "test-schema-ctpmoaez3jc25nv3jd4hryfrqy"
        LOG.deploy_requests:   }
        LOG.deploy_requests: }
    acceptance_test.go:1180: 
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "PATCH",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-ctpmoaez3jc25nv3jd4hryfrqy",
        LOG.destroy_requests:   "body": {
        LOG.destroy_requests:     "comment": "c1",
        LOG.destroy_requests:     "custom_max_retention_hours": 0
        LOG.destroy_requests:   }
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-moved-ctpmoaez3jc25nv3jd4hryfrqy",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-ctpmoaez3jc25nv3jd4hryfrqy",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
        LOG.destroy_requests: }
    acceptance_test.go:1180: 
        LOG.oob_requests: {
        LOG.oob_requests:   "method": "PATCH",
        LOG.oob_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-ctpmoaez3jc25nv3jd4hryfrqy",
        LOG.oob_requests:   "body": {
        LOG.oob_requests:     "new_name": "test-schema-moved-ctpmoaez3jc25nv3jd4hryfrqy"
        LOG.oob_requests:   }
        LOG.oob_requests: }
        LOG.oob_requests: {
        LOG.oob_requests:   "method": "POST",
        LOG.oob_requests:   "path": "/api/2.1/unity-catalog/schemas",
        LOG.oob_requests:   "body": {
        LOG.oob_requests:     "catalog_name": "main",
        LOG.oob_requests:     "name": "test-schema-ctpmoaez3jc25nv3jd4hryfrqy"
        LOG.oob_requests:   }
        LOG.oob_requests: }

latest (v1.28.0):

acceptance_test.go:1402: Diff:
        --- bundle/resources/schemas/foreign_at_recorded_name/output.txt
        +++ /tmp/TestAcceptbundleresourcesschemasforeign_at_recorded_nameDMS583286563/002/output.txt
        @@ -18,8 +18,6 @@
         === The other schema has another schema_id, so the plan does not take it for the bundle's: it plans a create
         
         >>> [CLI] bundle plan --output json
        -Warning: resources.schemas.schema1: id="main.test-schema-[UNIQUE_NAME]" holds another object: its schema_id is "[FOREIGN_SCHEMA_ID]", not "[SCHEMA_ID]" as recorded, so this bundle does not take it for its own. If the bundle's was renamed outside the bundle, set its name in the config to the new one. If this object is the bundle's (deleted and created again outside the bundle), run 'bundle deployment unbind' and then 'bundle deployment bind' to manage it again.
        -
         {
           "plan_version": [PLAN_VERSION],
           "cli_version": "[CLI_VERSION]",
        @@ -27,7 +25,7 @@
           "serial": 1,
           "plan": {
             "resources.schemas.schema1": {
        -      "action": "create",
        +      "action": "update",
               "new_state": {
                 "value": {
                   "catalog_name": "main",
        @@ -36,10 +34,16 @@
                 }
               },
               "changes": {
        +        "comment": {
        +          "action": "update",
        +          "old": "c1",
        +          "new": "c1"
        +        },
                 "schema_id": {
                   "action": "skip",
                   "reason": "internal_id",
        -          "old": "[SCHEMA_ID]"
        +          "old": "[SCHEMA_ID]",
        +          "remote": "[FOREIGN_SCHEMA_ID]"
                 }
               }
             }
        @@ -50,49 +51,10 @@
         
         >>> musterr [CLI] bundle deploy
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
        -Warning: resources.schemas.schema1: id="main.test-schema-[UNIQUE_NAME]" holds another object: its schema_id is "[FOREIGN_SCHEMA_ID]", not "[SCHEMA_ID]" as recorded, so this bundle does not take it for its own. If the bundle's was renamed outside the bundle, set its name in the config to the new one. If this object is the bundle's (deleted and created again outside the bundle), run 'bundle deployment unbind' and then 'bundle deployment bind' to manage it again.
        -
        -Error: cannot create resources.schemas.schema1: Schema 'test-schema-[UNIQUE_NAME]' already exists (400 SCHEMA_ALREADY_EXISTS)
        -
        -Endpoint: POST [DATABRICKS_URL]/api/2.1/unity-catalog/schemas
        -HTTP Status: 400 Bad Request
        -API error_code: SCHEMA_ALREADY_EXISTS
        -API message: Schema 'test-schema-[UNIQUE_NAME]' already exists
        -
        +Updated schemas.schema1
         Files: 2 uploaded, 0 deleted
        +Resources: 0 created, 1 changed, 0 deleted, 0 unchanged
         
        ->>> print_requests.py //unity-catalog
        -{
        -  "method": "POST",
        -  "path": "/api/2.1/unity-catalog/schemas",
        -  "body": {
        -    "catalog_name": "main",
        -    "comment": "c1",
        -    "name": "test-schema-[UNIQUE_NAME]"
        -  }
        -}
        +Unexpected success
         
        -=== Destroy does not delete the other schema: it only drops the bundle's from the state
        -
        ->>> [CLI] bundle destroy --auto-approve
        -Warning: resources.schemas.schema1: id="main.test-schema-[UNIQUE_NAME]" holds another object: its schema_id is "[FOREIGN_SCHEMA_ID]", not "[SCHEMA_ID]" as recorded, so no delete is sent for it, and resources.schemas.schema1 is dropped from the deployment state. If it is the bundle's (deleted and created again outside the bundle), delete it outside the bundle.
        -
        -All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default
        -
        -Destroy: 0 deleted
        -
        ->>> print_requests.py //unity-catalog
        -
        ->>> [CLI] schemas get main.test-schema-moved-[UNIQUE_NAME]
        -{
        -  "full_name": "main.test-schema-moved-[UNIQUE_NAME]",
        -  "schema_id": "[SCHEMA_ID]"
        -}
        -
        -=== The other schema is left alone
        -
        ->>> [CLI] schemas get main.test-schema-[UNIQUE_NAME]
        -{
        -  "full_name": "main.test-schema-[UNIQUE_NAME]",
        -  "schema_id": "[FOREIGN_SCHEMA_ID]"
        -}
        +Exit code: 1
        
    acceptance_test.go:1180: LOG.cleanup: 
    acceptance_test.go:1180: 
        LOG.deploy_requests: {
        LOG.deploy_requests:   "method": "POST",
        LOG.deploy_requests:   "path": "/api/2.1/unity-catalog/schemas",
        LOG.deploy_requests:   "body": {
        LOG.deploy_requests:     "catalog_name": "main",
        LOG.deploy_requests:     "comment": "c1",
        LOG.deploy_requests:     "name": "test-schema-ozxguce6njaonemnebyqo5p3uq"
        LOG.deploy_requests:   }
        LOG.deploy_requests: }
    acceptance_test.go:1180: 
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "PATCH",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-ozxguce6njaonemnebyqo5p3uq",
        LOG.destroy_requests:   "body": {
        LOG.destroy_requests:     "comment": "c1",
        LOG.destroy_requests:     "custom_max_retention_hours": 0
        LOG.destroy_requests:   }
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-moved-ozxguce6njaonemnebyqo5p3uq",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-ozxguce6njaonemnebyqo5p3uq",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
        LOG.destroy_requests: }
    acceptance_test.go:1180: 
        LOG.oob_requests: {
        LOG.oob_requests:   "method": "PATCH",
        LOG.oob_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-ozxguce6njaonemnebyqo5p3uq",
        LOG.oob_requests:   "body": {
        LOG.oob_requests:     "new_name": "test-schema-moved-ozxguce6njaonemnebyqo5p3uq"
        LOG.oob_requests:   }
        LOG.oob_requests: }
        LOG.oob_requests: {
        LOG.oob_requests:   "method": "POST",
        LOG.oob_requests:   "path": "/api/2.1/unity-catalog/schemas",
        LOG.oob_requests:   "body": {
        LOG.oob_requests:     "catalog_name": "main",
        LOG.oob_requests:     "name": "test-schema-ozxguce6njaonemnebyqo5p3uq"
        LOG.oob_requests:   }
        LOG.oob_requests: }
TestAccept/bundle/resources/schemas/foreign_at_recorded_name/DMS=true: branch ✅ | main (e6f3460) ❌ | latest (v1.28.0) ❌

main (e6f3460):

acceptance_test.go:1402: Diff:
        --- bundle/resources/schemas/foreign_at_recorded_name/output.txt
        +++ /tmp/TestAcceptbundleresourcesschemasforeign_at_recorded_nameDMS940308498/002/output.txt
        @@ -18,8 +18,6 @@
         === The other schema has another schema_id, so the plan does not take it for the bundle's: it plans a create
         
         >>> [CLI] bundle plan --output json
        -Warning: resources.schemas.schema1: id="main.test-schema-[UNIQUE_NAME]" holds another object: its schema_id is "[FOREIGN_SCHEMA_ID]", not "[SCHEMA_ID]" as recorded, so this bundle does not take it for its own. If the bundle's was renamed outside the bundle, set its name in the config to the new one. If this object is the bundle's (deleted and created again outside the bundle), run 'bundle deployment unbind' and then 'bundle deployment bind' to manage it again.
        -
         {
           "plan_version": [PLAN_VERSION],
           "cli_version": "[CLI_VERSION]",
        @@ -27,7 +25,7 @@
           "serial": 1,
           "plan": {
             "resources.schemas.schema1": {
        -      "action": "create",
        +      "action": "update",
               "new_state": {
                 "value": {
                   "catalog_name": "main",
        @@ -36,10 +34,16 @@
                 }
               },
               "changes": {
        +        "comment": {
        +          "action": "update",
        +          "old": "c1",
        +          "new": "c1"
        +        },
                 "schema_id": {
                   "action": "skip",
                   "reason": "internal_id",
        -          "old": "[SCHEMA_ID]"
        +          "old": "[SCHEMA_ID]",
        +          "remote": "[FOREIGN_SCHEMA_ID]"
                 }
               }
             }
        @@ -50,49 +51,10 @@
         
         >>> musterr [CLI] bundle deploy
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
        -Warning: resources.schemas.schema1: id="main.test-schema-[UNIQUE_NAME]" holds another object: its schema_id is "[FOREIGN_SCHEMA_ID]", not "[SCHEMA_ID]" as recorded, so this bundle does not take it for its own. If the bundle's was renamed outside the bundle, set its name in the config to the new one. If this object is the bundle's (deleted and created again outside the bundle), run 'bundle deployment unbind' and then 'bundle deployment bind' to manage it again.
        -
        -Error: cannot create resources.schemas.schema1: Schema 'test-schema-[UNIQUE_NAME]' already exists (400 SCHEMA_ALREADY_EXISTS)
        -
        -Endpoint: POST [DATABRICKS_URL]/api/2.1/unity-catalog/schemas
        -HTTP Status: 400 Bad Request
        -API error_code: SCHEMA_ALREADY_EXISTS
        -API message: Schema 'test-schema-[UNIQUE_NAME]' already exists
        -
        +Updated schemas.schema1
         Files: 2 uploaded, 0 deleted
        +Resources: 0 created, 1 changed, 0 deleted, 0 unchanged
         
        ->>> print_requests.py //unity-catalog
        -{
        -  "method": "POST",
        -  "path": "/api/2.1/unity-catalog/schemas",
        -  "body": {
        -    "catalog_name": "main",
        -    "comment": "c1",
        -    "name": "test-schema-[UNIQUE_NAME]"
        -  }
        -}
        +Unexpected success
         
        -=== Destroy does not delete the other schema: it only drops the bundle's from the state
        -
        ->>> [CLI] bundle destroy --auto-approve
        -Warning: resources.schemas.schema1: id="main.test-schema-[UNIQUE_NAME]" holds another object: its schema_id is "[FOREIGN_SCHEMA_ID]", not "[SCHEMA_ID]" as recorded, so no delete is sent for it, and resources.schemas.schema1 is dropped from the deployment state. If it is the bundle's (deleted and created again outside the bundle), delete it outside the bundle.
        -
        -All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default
        -
        -Destroy: 0 deleted
        -
        ->>> print_requests.py //unity-catalog
        -
        ->>> [CLI] schemas get main.test-schema-moved-[UNIQUE_NAME]
        -{
        -  "full_name": "main.test-schema-moved-[UNIQUE_NAME]",
        -  "schema_id": "[SCHEMA_ID]"
        -}
        -
        -=== The other schema is left alone
        -
        ->>> [CLI] schemas get main.test-schema-[UNIQUE_NAME]
        -{
        -  "full_name": "main.test-schema-[UNIQUE_NAME]",
        -  "schema_id": "[FOREIGN_SCHEMA_ID]"
        -}
        +Exit code: 1
        
    acceptance_test.go:1180: LOG.cleanup: 
    acceptance_test.go:1180: 
        LOG.deploy_requests: {
        LOG.deploy_requests:   "method": "POST",
        LOG.deploy_requests:   "path": "/api/2.1/unity-catalog/schemas",
        LOG.deploy_requests:   "body": {
        LOG.deploy_requests:     "catalog_name": "main",
        LOG.deploy_requests:     "comment": "c1",
        LOG.deploy_requests:     "name": "test-schema-hxehyyibvrdxlc5tmcfucked3i"
        LOG.deploy_requests:   }
        LOG.deploy_requests: }
    acceptance_test.go:1180: 
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "PATCH",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-hxehyyibvrdxlc5tmcfucked3i",
        LOG.destroy_requests:   "body": {
        LOG.destroy_requests:     "comment": "c1",
        LOG.destroy_requests:     "custom_max_retention_hours": 0
        LOG.destroy_requests:   }
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-moved-hxehyyibvrdxlc5tmcfucked3i",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-hxehyyibvrdxlc5tmcfucked3i",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
        LOG.destroy_requests: }
    acceptance_test.go:1180: 
        LOG.oob_requests: {
        LOG.oob_requests:   "method": "PATCH",
        LOG.oob_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-hxehyyibvrdxlc5tmcfucked3i",
        LOG.oob_requests:   "body": {
        LOG.oob_requests:     "new_name": "test-schema-moved-hxehyyibvrdxlc5tmcfucked3i"
        LOG.oob_requests:   }
        LOG.oob_requests: }
        LOG.oob_requests: {
        LOG.oob_requests:   "method": "POST",
        LOG.oob_requests:   "path": "/api/2.1/unity-catalog/schemas",
        LOG.oob_requests:   "body": {
        LOG.oob_requests:     "catalog_name": "main",
        LOG.oob_requests:     "name": "test-schema-hxehyyibvrdxlc5tmcfucked3i"
        LOG.oob_requests:   }
        LOG.oob_requests: }
FAIL

latest (v1.28.0):

acceptance_test.go:1402: Diff:
        --- bundle/resources/schemas/foreign_at_recorded_name/output.txt
        +++ /tmp/TestAcceptbundleresourcesschemasforeign_at_recorded_nameDMS3892164755/002/output.txt
        @@ -18,8 +18,6 @@
         === The other schema has another schema_id, so the plan does not take it for the bundle's: it plans a create
         
         >>> [CLI] bundle plan --output json
        -Warning: resources.schemas.schema1: id="main.test-schema-[UNIQUE_NAME]" holds another object: its schema_id is "[FOREIGN_SCHEMA_ID]", not "[SCHEMA_ID]" as recorded, so this bundle does not take it for its own. If the bundle's was renamed outside the bundle, set its name in the config to the new one. If this object is the bundle's (deleted and created again outside the bundle), run 'bundle deployment unbind' and then 'bundle deployment bind' to manage it again.
        -
         {
           "plan_version": [PLAN_VERSION],
           "cli_version": "[CLI_VERSION]",
        @@ -27,7 +25,7 @@
           "serial": 1,
           "plan": {
             "resources.schemas.schema1": {
        -      "action": "create",
        +      "action": "update",
               "new_state": {
                 "value": {
                   "catalog_name": "main",
        @@ -36,10 +34,16 @@
                 }
               },
               "changes": {
        +        "comment": {
        +          "action": "update",
        +          "old": "c1",
        +          "new": "c1"
        +        },
                 "schema_id": {
                   "action": "skip",
                   "reason": "internal_id",
        -          "old": "[SCHEMA_ID]"
        +          "old": "[SCHEMA_ID]",
        +          "remote": "[FOREIGN_SCHEMA_ID]"
                 }
               }
             }
        @@ -50,49 +51,10 @@
         
         >>> musterr [CLI] bundle deploy
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
        -Warning: resources.schemas.schema1: id="main.test-schema-[UNIQUE_NAME]" holds another object: its schema_id is "[FOREIGN_SCHEMA_ID]", not "[SCHEMA_ID]" as recorded, so this bundle does not take it for its own. If the bundle's was renamed outside the bundle, set its name in the config to the new one. If this object is the bundle's (deleted and created again outside the bundle), run 'bundle deployment unbind' and then 'bundle deployment bind' to manage it again.
        -
        -Error: cannot create resources.schemas.schema1: Schema 'test-schema-[UNIQUE_NAME]' already exists (400 SCHEMA_ALREADY_EXISTS)
        -
        -Endpoint: POST [DATABRICKS_URL]/api/2.1/unity-catalog/schemas
        -HTTP Status: 400 Bad Request
        -API error_code: SCHEMA_ALREADY_EXISTS
        -API message: Schema 'test-schema-[UNIQUE_NAME]' already exists
        -
        +Updated schemas.schema1
         Files: 2 uploaded, 0 deleted
        +Resources: 0 created, 1 changed, 0 deleted, 0 unchanged
         
        ->>> print_requests.py //unity-catalog
        -{
        -  "method": "POST",
        -  "path": "/api/2.1/unity-catalog/schemas",
        -  "body": {
        -    "catalog_name": "main",
        -    "comment": "c1",
        -    "name": "test-schema-[UNIQUE_NAME]"
        -  }
        -}
        +Unexpected success
         
        -=== Destroy does not delete the other schema: it only drops the bundle's from the state
        -
        ->>> [CLI] bundle destroy --auto-approve
        -Warning: resources.schemas.schema1: id="main.test-schema-[UNIQUE_NAME]" holds another object: its schema_id is "[FOREIGN_SCHEMA_ID]", not "[SCHEMA_ID]" as recorded, so no delete is sent for it, and resources.schemas.schema1 is dropped from the deployment state. If it is the bundle's (deleted and created again outside the bundle), delete it outside the bundle.
        -
        -All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default
        -
        -Destroy: 0 deleted
        -
        ->>> print_requests.py //unity-catalog
        -
        ->>> [CLI] schemas get main.test-schema-moved-[UNIQUE_NAME]
        -{
        -  "full_name": "main.test-schema-moved-[UNIQUE_NAME]",
        -  "schema_id": "[SCHEMA_ID]"
        -}
        -
        -=== The other schema is left alone
        -
        ->>> [CLI] schemas get main.test-schema-[UNIQUE_NAME]
        -{
        -  "full_name": "main.test-schema-[UNIQUE_NAME]",
        -  "schema_id": "[FOREIGN_SCHEMA_ID]"
        -}
        +Exit code: 1
        
    acceptance_test.go:1180: LOG.cleanup: 
    acceptance_test.go:1180: 
        LOG.deploy_requests: {
        LOG.deploy_requests:   "method": "POST",
        LOG.deploy_requests:   "path": "/api/2.1/unity-catalog/schemas",
        LOG.deploy_requests:   "body": {
        LOG.deploy_requests:     "catalog_name": "main",
        LOG.deploy_requests:     "comment": "c1",
        LOG.deploy_requests:     "name": "test-schema-spildbhzjferlcxlux5xkfdjpe"
        LOG.deploy_requests:   }
        LOG.deploy_requests: }
    acceptance_test.go:1180: 
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "PATCH",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-spildbhzjferlcxlux5xkfdjpe",
        LOG.destroy_requests:   "body": {
        LOG.destroy_requests:     "comment": "c1",
        LOG.destroy_requests:     "custom_max_retention_hours": 0
        LOG.destroy_requests:   }
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-moved-spildbhzjferlcxlux5xkfdjpe",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-spildbhzjferlcxlux5xkfdjpe",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
        LOG.destroy_requests: }
    acceptance_test.go:1180: 
        LOG.oob_requests: {
        LOG.oob_requests:   "method": "PATCH",
        LOG.oob_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-spildbhzjferlcxlux5xkfdjpe",
        LOG.oob_requests:   "body": {
        LOG.oob_requests:     "new_name": "test-schema-moved-spildbhzjferlcxlux5xkfdjpe"
        LOG.oob_requests:   }
        LOG.oob_requests: }
        LOG.oob_requests: {
        LOG.oob_requests:   "method": "POST",
        LOG.oob_requests:   "path": "/api/2.1/unity-catalog/schemas",
        LOG.oob_requests:   "body": {
        LOG.oob_requests:     "catalog_name": "main",
        LOG.oob_requests:     "name": "test-schema-spildbhzjferlcxlux5xkfdjpe"
        LOG.oob_requests:   }
        LOG.oob_requests: }
FAIL
TestAccept/bundle/resources/schemas/recreated_at_recorded_name/DMS=: branch ✅ | main (e6f3460) ❌ | latest (v1.28.0) ❌

main (e6f3460):

acceptance_test.go:1402: Diff:
        --- bundle/resources/schemas/recreated_at_recorded_name/output.txt
        +++ /tmp/TestAcceptbundleresourcesschemasrecreated_at_recorded_nameD3147446711/002/output.txt
        @@ -14,52 +14,17 @@
         === The new schema has another schema_id: the bundle does not take it for its own, and deploy fails on its name
         
         >>> [CLI] bundle plan
        -Warning: resources.schemas.schema1: id="main.test-schema-[UNIQUE_NAME]" holds another object: its schema_id is "[NEW_SCHEMA_ID]", not "[SCHEMA_ID]" as recorded, so this bundle does not take it for its own. If the bundle's was renamed outside the bundle, set its name in the config to the new one. If this object is the bundle's (deleted and created again outside the bundle), run 'bundle deployment unbind' and then 'bundle deployment bind' to manage it again.
        +update schemas.schema1
         
        -create schemas.schema1
        +Plan: 0 to add, 1 to change, 0 to delete, 0 unchanged
         
        -Plan: 1 to add, 0 to change, 0 to delete, 0 unchanged
        -
         >>> musterr [CLI] bundle deploy
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
        -Warning: resources.schemas.schema1: id="main.test-schema-[UNIQUE_NAME]" holds another object: its schema_id is "[NEW_SCHEMA_ID]", not "[SCHEMA_ID]" as recorded, so this bundle does not take it for its own. If the bundle's was renamed outside the bundle, set its name in the config to the new one. If this object is the bundle's (deleted and created again outside the bundle), run 'bundle deployment unbind' and then 'bundle deployment bind' to manage it again.
        -
        -Error: cannot create resources.schemas.schema1: Schema 'test-schema-[UNIQUE_NAME]' already exists (400 SCHEMA_ALREADY_EXISTS)
        -
        -Endpoint: POST [DATABRICKS_URL]/api/2.1/unity-catalog/schemas
        -HTTP Status: 400 Bad Request
        -API error_code: SCHEMA_ALREADY_EXISTS
        -API message: Schema 'test-schema-[UNIQUE_NAME]' already exists
        -
        -Files: 2 uploaded, 0 deleted
        -
        ->>> print_requests.py //unity-catalog
        -{
        -  "method": "POST",
        -  "path": "/api/2.1/unity-catalog/schemas",
        -  "body": {
        -    "catalog_name": "main",
        -    "comment": "c1",
        -    "name": "test-schema-[UNIQUE_NAME]"
        -  }
        -}
        -
        -=== Binding it again makes it the bundle's
        -
        ->>> [CLI] bundle deployment unbind schema1
        -
        ->>> [CLI] bundle deployment bind schema1 main.test-schema-[UNIQUE_NAME] --auto-approve
        -Successfully bound schema with an id 'main.test-schema-[UNIQUE_NAME]'
        -Run 'bundle deploy' to deploy changes to your workspace
        -
        ->>> [CLI] bundle deploy
        -Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
         Updated schemas.schema1
        -Files: 0 uploaded, 0 deleted
        +Files: 2 uploaded, 0 deleted
         Resources: 0 created, 1 changed, 0 deleted, 0 unchanged
         
        ->>> [CLI] bundle plan
        -Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged
        +Unexpected success
         
         >>> [CLI] bundle destroy --auto-approve
         The following resources will be deleted:
        @@ -71,3 +29,5 @@
         All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default
         
         Destroy: 1 deleted
        +
        +Exit code: 1
        
    acceptance_test.go:1180: 
        LOG.cleanup: Error: Not Found
        LOG.cleanup: 
        LOG.cleanup: Exit code: 1
    acceptance_test.go:1180: 
        LOG.deploy_requests: {
        LOG.deploy_requests:   "method": "POST",
        LOG.deploy_requests:   "path": "/api/2.1/unity-catalog/schemas",
        LOG.deploy_requests:   "body": {
        LOG.deploy_requests:     "catalog_name": "main",
        LOG.deploy_requests:     "comment": "c1",
        LOG.deploy_requests:     "name": "test-schema-nlwyzadnanfjhas4wrwd22ya5a"
        LOG.deploy_requests:   }
        LOG.deploy_requests: }
    acceptance_test.go:1180: 
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "PATCH",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-nlwyzadnanfjhas4wrwd22ya5a",
        LOG.destroy_requests:   "body": {
        LOG.destroy_requests:     "comment": "c1",
        LOG.destroy_requests:     "custom_max_retention_hours": 0
        LOG.destroy_requests:   }
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-nlwyzadnanfjhas4wrwd22ya5a",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-nlwyzadnanfjhas4wrwd22ya5a",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
        LOG.destroy_requests: }
    acceptance_test.go:1180: 
        LOG.oob_requests: {
        LOG.oob_requests:   "method": "DELETE",
        LOG.oob_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-nlwyzadnanfjhas4wrwd22ya5a",
        LOG.oob_requests:   "q": {
        LOG.oob_requests:     "force": "true"
        LOG.oob_requests:   }
        LOG.oob_requests: }
        LOG.oob_requests: {
        LOG.oob_requests:   "method": "POST",
        LOG.oob_requests:   "path": "/api/2.1/unity-catalog/schemas",
        LOG.oob_requests:   "body": {
        LOG.oob_requests:     "catalog_name": "main",
        LOG.oob_requests:     "name": "test-schema-nlwyzadnanfjhas4wrwd22ya5a"
        LOG.oob_requests:   }
        LOG.oob_requests: }

latest (v1.28.0):

acceptance_test.go:1402: Diff:
        --- bundle/resources/schemas/recreated_at_recorded_name/output.txt
        +++ /tmp/TestAcceptbundleresourcesschemasrecreated_at_recorded_nameD369469647/002/output.txt
        @@ -14,52 +14,17 @@
         === The new schema has another schema_id: the bundle does not take it for its own, and deploy fails on its name
         
         >>> [CLI] bundle plan
        -Warning: resources.schemas.schema1: id="main.test-schema-[UNIQUE_NAME]" holds another object: its schema_id is "[NEW_SCHEMA_ID]", not "[SCHEMA_ID]" as recorded, so this bundle does not take it for its own. If the bundle's was renamed outside the bundle, set its name in the config to the new one. If this object is the bundle's (deleted and created again outside the bundle), run 'bundle deployment unbind' and then 'bundle deployment bind' to manage it again.
        +update schemas.schema1
         
        -create schemas.schema1
        +Plan: 0 to add, 1 to change, 0 to delete, 0 unchanged
         
        -Plan: 1 to add, 0 to change, 0 to delete, 0 unchanged
        -
         >>> musterr [CLI] bundle deploy
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
        -Warning: resources.schemas.schema1: id="main.test-schema-[UNIQUE_NAME]" holds another object: its schema_id is "[NEW_SCHEMA_ID]", not "[SCHEMA_ID]" as recorded, so this bundle does not take it for its own. If the bundle's was renamed outside the bundle, set its name in the config to the new one. If this object is the bundle's (deleted and created again outside the bundle), run 'bundle deployment unbind' and then 'bundle deployment bind' to manage it again.
        -
        -Error: cannot create resources.schemas.schema1: Schema 'test-schema-[UNIQUE_NAME]' already exists (400 SCHEMA_ALREADY_EXISTS)
        -
        -Endpoint: POST [DATABRICKS_URL]/api/2.1/unity-catalog/schemas
        -HTTP Status: 400 Bad Request
        -API error_code: SCHEMA_ALREADY_EXISTS
        -API message: Schema 'test-schema-[UNIQUE_NAME]' already exists
        -
        -Files: 2 uploaded, 0 deleted
        -
        ->>> print_requests.py //unity-catalog
        -{
        -  "method": "POST",
        -  "path": "/api/2.1/unity-catalog/schemas",
        -  "body": {
        -    "catalog_name": "main",
        -    "comment": "c1",
        -    "name": "test-schema-[UNIQUE_NAME]"
        -  }
        -}
        -
        -=== Binding it again makes it the bundle's
        -
        ->>> [CLI] bundle deployment unbind schema1
        -
        ->>> [CLI] bundle deployment bind schema1 main.test-schema-[UNIQUE_NAME] --auto-approve
        -Successfully bound schema with an id 'main.test-schema-[UNIQUE_NAME]'
        -Run 'bundle deploy' to deploy changes to your workspace
        -
        ->>> [CLI] bundle deploy
        -Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
         Updated schemas.schema1
        -Files: 0 uploaded, 0 deleted
        +Files: 2 uploaded, 0 deleted
         Resources: 0 created, 1 changed, 0 deleted, 0 unchanged
         
        ->>> [CLI] bundle plan
        -Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged
        +Unexpected success
         
         >>> [CLI] bundle destroy --auto-approve
         The following resources will be deleted:
        @@ -71,3 +29,5 @@
         All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default
         
         Destroy: 1 deleted
        +
        +Exit code: 1
        
    acceptance_test.go:1180: 
        LOG.cleanup: Error: Not Found
        LOG.cleanup: 
        LOG.cleanup: Exit code: 1
    acceptance_test.go:1180: 
        LOG.deploy_requests: {
        LOG.deploy_requests:   "method": "POST",
        LOG.deploy_requests:   "path": "/api/2.1/unity-catalog/schemas",
        LOG.deploy_requests:   "body": {
        LOG.deploy_requests:     "catalog_name": "main",
        LOG.deploy_requests:     "comment": "c1",
        LOG.deploy_requests:     "name": "test-schema-hixa2ea2gzc63idi7x5i6ziiou"
        LOG.deploy_requests:   }
        LOG.deploy_requests: }
    acceptance_test.go:1180: 
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "PATCH",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-hixa2ea2gzc63idi7x5i6ziiou",
        LOG.destroy_requests:   "body": {
        LOG.destroy_requests:     "comment": "c1",
        LOG.destroy_requests:     "custom_max_retention_hours": 0
        LOG.destroy_requests:   }
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-hixa2ea2gzc63idi7x5i6ziiou",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-hixa2ea2gzc63idi7x5i6ziiou",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
        LOG.destroy_requests: }
    acceptance_test.go:1180: 
        LOG.oob_requests: {
        LOG.oob_requests:   "method": "DELETE",
        LOG.oob_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-hixa2ea2gzc63idi7x5i6ziiou",
        LOG.oob_requests:   "q": {
        LOG.oob_requests:     "force": "true"
        LOG.oob_requests:   }
        LOG.oob_requests: }
        LOG.oob_requests: {
        LOG.oob_requests:   "method": "POST",
        LOG.oob_requests:   "path": "/api/2.1/unity-catalog/schemas",
        LOG.oob_requests:   "body": {
        LOG.oob_requests:     "catalog_name": "main",
        LOG.oob_requests:     "name": "test-schema-hixa2ea2gzc63idi7x5i6ziiou"
        LOG.oob_requests:   }
        LOG.oob_requests: }
TestAccept/bundle/resources/schemas/recreated_at_recorded_name/DMS=true: branch ✅ | main (e6f3460) ❌ | latest (v1.28.0) ❌

main (e6f3460):

acceptance_test.go:1402: Diff:
        --- bundle/resources/schemas/recreated_at_recorded_name/output.txt
        +++ /tmp/TestAcceptbundleresourcesschemasrecreated_at_recorded_nameD3789235639/002/output.txt
        @@ -14,52 +14,17 @@
         === The new schema has another schema_id: the bundle does not take it for its own, and deploy fails on its name
         
         >>> [CLI] bundle plan
        -Warning: resources.schemas.schema1: id="main.test-schema-[UNIQUE_NAME]" holds another object: its schema_id is "[NEW_SCHEMA_ID]", not "[SCHEMA_ID]" as recorded, so this bundle does not take it for its own. If the bundle's was renamed outside the bundle, set its name in the config to the new one. If this object is the bundle's (deleted and created again outside the bundle), run 'bundle deployment unbind' and then 'bundle deployment bind' to manage it again.
        +update schemas.schema1
         
        -create schemas.schema1
        +Plan: 0 to add, 1 to change, 0 to delete, 0 unchanged
         
        -Plan: 1 to add, 0 to change, 0 to delete, 0 unchanged
        -
         >>> musterr [CLI] bundle deploy
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
        -Warning: resources.schemas.schema1: id="main.test-schema-[UNIQUE_NAME]" holds another object: its schema_id is "[NEW_SCHEMA_ID]", not "[SCHEMA_ID]" as recorded, so this bundle does not take it for its own. If the bundle's was renamed outside the bundle, set its name in the config to the new one. If this object is the bundle's (deleted and created again outside the bundle), run 'bundle deployment unbind' and then 'bundle deployment bind' to manage it again.
        -
        -Error: cannot create resources.schemas.schema1: Schema 'test-schema-[UNIQUE_NAME]' already exists (400 SCHEMA_ALREADY_EXISTS)
        -
        -Endpoint: POST [DATABRICKS_URL]/api/2.1/unity-catalog/schemas
        -HTTP Status: 400 Bad Request
        -API error_code: SCHEMA_ALREADY_EXISTS
        -API message: Schema 'test-schema-[UNIQUE_NAME]' already exists
        -
        -Files: 2 uploaded, 0 deleted
        -
        ->>> print_requests.py //unity-catalog
        -{
        -  "method": "POST",
        -  "path": "/api/2.1/unity-catalog/schemas",
        -  "body": {
        -    "catalog_name": "main",
        -    "comment": "c1",
        -    "name": "test-schema-[UNIQUE_NAME]"
        -  }
        -}
        -
        -=== Binding it again makes it the bundle's
        -
        ->>> [CLI] bundle deployment unbind schema1
        -
        ->>> [CLI] bundle deployment bind schema1 main.test-schema-[UNIQUE_NAME] --auto-approve
        -Successfully bound schema with an id 'main.test-schema-[UNIQUE_NAME]'
        -Run 'bundle deploy' to deploy changes to your workspace
        -
        ->>> [CLI] bundle deploy
        -Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
         Updated schemas.schema1
        -Files: 0 uploaded, 0 deleted
        +Files: 2 uploaded, 0 deleted
         Resources: 0 created, 1 changed, 0 deleted, 0 unchanged
         
        ->>> [CLI] bundle plan
        -Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged
        +Unexpected success
         
         >>> [CLI] bundle destroy --auto-approve
         The following resources will be deleted:
        @@ -71,3 +29,5 @@
         All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default
         
         Destroy: 1 deleted
        +
        +Exit code: 1
        
    acceptance_test.go:1180: 
        LOG.cleanup: Error: Not Found
        LOG.cleanup: 
        LOG.cleanup: Exit code: 1
    acceptance_test.go:1180: 
        LOG.deploy_requests: {
        LOG.deploy_requests:   "method": "POST",
        LOG.deploy_requests:   "path": "/api/2.1/unity-catalog/schemas",
        LOG.deploy_requests:   "body": {
        LOG.deploy_requests:     "catalog_name": "main",
        LOG.deploy_requests:     "comment": "c1",
        LOG.deploy_requests:     "name": "test-schema-zln5ythaobctpmguruv5nhfu34"
        LOG.deploy_requests:   }
        LOG.deploy_requests: }
    acceptance_test.go:1180: 
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "PATCH",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-zln5ythaobctpmguruv5nhfu34",
        LOG.destroy_requests:   "body": {
        LOG.destroy_requests:     "comment": "c1",
        LOG.destroy_requests:     "custom_max_retention_hours": 0
        LOG.destroy_requests:   }
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-zln5ythaobctpmguruv5nhfu34",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-zln5ythaobctpmguruv5nhfu34",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
        LOG.destroy_requests: }
    acceptance_test.go:1180: 
        LOG.oob_requests: {
        LOG.oob_requests:   "method": "DELETE",
        LOG.oob_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-zln5ythaobctpmguruv5nhfu34",
        LOG.oob_requests:   "q": {
        LOG.oob_requests:     "force": "true"
        LOG.oob_requests:   }
        LOG.oob_requests: }
        LOG.oob_requests: {
        LOG.oob_requests:   "method": "POST",
        LOG.oob_requests:   "path": "/api/2.1/unity-catalog/schemas",
        LOG.oob_requests:   "body": {
        LOG.oob_requests:     "catalog_name": "main",
        LOG.oob_requests:     "name": "test-schema-zln5ythaobctpmguruv5nhfu34"
        LOG.oob_requests:   }
        LOG.oob_requests: }

latest (v1.28.0):

acceptance_test.go:1402: Diff:
        --- bundle/resources/schemas/recreated_at_recorded_name/output.txt
        +++ /tmp/TestAcceptbundleresourcesschemasrecreated_at_recorded_nameD2849656799/002/output.txt
        @@ -14,52 +14,17 @@
         === The new schema has another schema_id: the bundle does not take it for its own, and deploy fails on its name
         
         >>> [CLI] bundle plan
        -Warning: resources.schemas.schema1: id="main.test-schema-[UNIQUE_NAME]" holds another object: its schema_id is "[NEW_SCHEMA_ID]", not "[SCHEMA_ID]" as recorded, so this bundle does not take it for its own. If the bundle's was renamed outside the bundle, set its name in the config to the new one. If this object is the bundle's (deleted and created again outside the bundle), run 'bundle deployment unbind' and then 'bundle deployment bind' to manage it again.
        +update schemas.schema1
         
        -create schemas.schema1
        +Plan: 0 to add, 1 to change, 0 to delete, 0 unchanged
         
        -Plan: 1 to add, 0 to change, 0 to delete, 0 unchanged
        -
         >>> musterr [CLI] bundle deploy
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
        -Warning: resources.schemas.schema1: id="main.test-schema-[UNIQUE_NAME]" holds another object: its schema_id is "[NEW_SCHEMA_ID]", not "[SCHEMA_ID]" as recorded, so this bundle does not take it for its own. If the bundle's was renamed outside the bundle, set its name in the config to the new one. If this object is the bundle's (deleted and created again outside the bundle), run 'bundle deployment unbind' and then 'bundle deployment bind' to manage it again.
        -
        -Error: cannot create resources.schemas.schema1: Schema 'test-schema-[UNIQUE_NAME]' already exists (400 SCHEMA_ALREADY_EXISTS)
        -
        -Endpoint: POST [DATABRICKS_URL]/api/2.1/unity-catalog/schemas
        -HTTP Status: 400 Bad Request
        -API error_code: SCHEMA_ALREADY_EXISTS
        -API message: Schema 'test-schema-[UNIQUE_NAME]' already exists
        -
        -Files: 2 uploaded, 0 deleted
        -
        ->>> print_requests.py //unity-catalog
        -{
        -  "method": "POST",
        -  "path": "/api/2.1/unity-catalog/schemas",
        -  "body": {
        -    "catalog_name": "main",
        -    "comment": "c1",
        -    "name": "test-schema-[UNIQUE_NAME]"
        -  }
        -}
        -
        -=== Binding it again makes it the bundle's
        -
        ->>> [CLI] bundle deployment unbind schema1
        -
        ->>> [CLI] bundle deployment bind schema1 main.test-schema-[UNIQUE_NAME] --auto-approve
        -Successfully bound schema with an id 'main.test-schema-[UNIQUE_NAME]'
        -Run 'bundle deploy' to deploy changes to your workspace
        -
        ->>> [CLI] bundle deploy
        -Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
         Updated schemas.schema1
        -Files: 0 uploaded, 0 deleted
        +Files: 2 uploaded, 0 deleted
         Resources: 0 created, 1 changed, 0 deleted, 0 unchanged
         
        ->>> [CLI] bundle plan
        -Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged
        +Unexpected success
         
         >>> [CLI] bundle destroy --auto-approve
         The following resources will be deleted:
        @@ -71,3 +29,5 @@
         All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default
         
         Destroy: 1 deleted
        +
        +Exit code: 1
        
    acceptance_test.go:1180: 
        LOG.cleanup: Error: Not Found
        LOG.cleanup: 
        LOG.cleanup: Exit code: 1
    acceptance_test.go:1180: 
        LOG.deploy_requests: {
        LOG.deploy_requests:   "method": "POST",
        LOG.deploy_requests:   "path": "/api/2.1/unity-catalog/schemas",
        LOG.deploy_requests:   "body": {
        LOG.deploy_requests:     "catalog_name": "main",
        LOG.deploy_requests:     "comment": "c1",
        LOG.deploy_requests:     "name": "test-schema-avcribsigvechoc2jxaoreuneu"
        LOG.deploy_requests:   }
        LOG.deploy_requests: }
    acceptance_test.go:1180: 
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "PATCH",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-avcribsigvechoc2jxaoreuneu",
        LOG.destroy_requests:   "body": {
        LOG.destroy_requests:     "comment": "c1",
        LOG.destroy_requests:     "custom_max_retention_hours": 0
        LOG.destroy_requests:   }
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-avcribsigvechoc2jxaoreuneu",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-avcribsigvechoc2jxaoreuneu",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
        LOG.destroy_requests: }
    acceptance_test.go:1180: 
        LOG.oob_requests: {
        LOG.oob_requests:   "method": "DELETE",
        LOG.oob_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-avcribsigvechoc2jxaoreuneu",
        LOG.oob_requests:   "q": {
        LOG.oob_requests:     "force": "true"
        LOG.oob_requests:   }
        LOG.oob_requests: }
        LOG.oob_requests: {
        LOG.oob_requests:   "method": "POST",
        LOG.oob_requests:   "path": "/api/2.1/unity-catalog/schemas",
        LOG.oob_requests:   "body": {
        LOG.oob_requests:     "catalog_name": "main",
        LOG.oob_requests:     "name": "test-schema-avcribsigvechoc2jxaoreuneu"
        LOG.oob_requests:   }
        LOG.oob_requests: }

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

@eng-dev-ecosystem-bot

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

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: d91d668

Run: 46078875760

Env 🤯​MISS 💚​RECOVERED ✅​pass 🙈​skip Time
💚​ aws linux-2core-8gb 1 185 17 3:48
💚​ aws-windows-latest-4core-16gb 1 185 17 4:25
🤯​ azure linux-2core-8gb 1 1 181 17 4:06
🤯​ azure-windows-latest-4core-16gb 1 1 181 17 3:25
🤯​ gcp linux-2core-8gb 1 1 182 17 4:04
🤯​ gcp-windows-latest-4core-16gb 1 1 182 17 3:37
Test Name aws linux-2core-8gb aws-windows-latest-4core-16gb azure linux-2core-8gb azure-windows-latest-4core-16gb gcp linux-2core-8gb gcp-windows-latest-4core-16gb
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🤯​ TestAccept/bundle/resources/schemas/destroy_after_rename_out_of_band ✅​p ✅​p 🤯​M 🤯​M 🤯​M 🤯​M
Top 6 slowest tests (at least 2 minutes):
duration env testname
3:39 azure linux-2core-8gb TestAccept
3:39 aws-windows-latest-4core-16gb TestAccept
3:34 gcp linux-2core-8gb TestAccept
3:18 aws linux-2core-8gb TestAccept
3:00 gcp-windows-latest-4core-16gb TestAccept
2:48 azure-windows-latest-4core-16gb TestAccept

@denik
denik marked this pull request as ready for review November 26, 2026 14:20
@denik
denik requested review from a team as code owners November 26, 2026 14:20

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

Not ready yet: 2 blocking issue(s), tagged [blocking].

This PR makes the direct engine compare schema_id/volume_id before updating or deleting a schema or volume, and makes delete look for one that was renamed out of band (catalog/schema listing plus the follow-the-renamed-parent pass). The identity check on the plan side does what it should. The new parent-follow path in findInMovedParents has two real holes. It can send a DELETE to a volume that is not the bundle's. And because it relies only on depends_on, it can let a schema force-delete take a prevent_destroy volume with it. The rest are comment and wording fixes.

Comment thread bundle/direct/bundle_plan.go Resolved
Comment thread bundle/direct/bundle_plan.go Resolved
Comment thread bundle/direct/bundle_plan.go Resolved
Comment thread bundle/direct/bundle_plan.go Resolved
Comment thread bundle/direct/dresources/volume.go Resolved
Comment thread bundle/deployplan/plan.go Resolved
Comment thread acceptance/bin/replay_tfstate.py Resolved

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

Holding my approval until the open thread on bundle/direct/bundle_plan.go is settled.

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

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

This PR makes the direct engine check schema_id/volume_id before it updates or deletes a schema or volume, and it lets destroy find the bundle's own object after an out-of-band rename, either through DoFindByInternalID or under a parent that has moved. The main fix holds up in the code and the acceptance tests. The edge most worth fixing is how findInMovedParents maps a child to its moved parent: it can send a DELETE to a volume that isn't the bundle's, and a case-sensitive prefix match can miss a protected volume entirely. The rest are smaller points about the changelog, stale comments and repo conventions.

Comments outside the changed lines

  • [nice to have] bundle/direct/bundle_plan.go:1011: A schema renamed by the bundle to a mixed-case name is saved at UC's lowercased response.FullName (DoUpdateWithID), while its volume's state-only Rekey saves IDFromState in config case (main.MixedSchema.v). After a later out-of-band rename of the schema, CutPrefix("main.MixedSchema.v", "main.mixedschema.") misses. The volume stays Gone, and the schema's force delete removes it without its prevent_destroy being checked. Should this compare the parent components case-insensitively, with a test for that sequence?

Comment thread bundle/direct/bundle_plan.go Resolved
Comment thread bundle/direct/bundle_plan.go Resolved
Comment thread bundle/direct/bundle_plan.go Resolved
Comment thread bundle/deployplan/plan.go Resolved

@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/direct/bundle_plan.go Resolved
Comment thread bundle/direct/bundle_plan.go Resolved
Comment thread bundle/direct/bundle_plan.go Resolved
denik and others added 11 commits November 26, 2026 17:36
…the recorded name

A schema or volume someone else created under the recorded name, after
ours was renamed out of band, was planned as an update and deleted by
destroy. The plan now treats it as not ours. Destroy, which has no config
to give a renamed resource's new name, finds it by its internal id
(listing the parent) and deletes it there.

Co-authored-by: Isaac <no-reply@databricks.com>
…e other object

Address review: a failed search or identity read fails the plan instead of
dropping the state entry or deleting at the recorded name; ID-only state
entries skip the check; one helper compares internal ids for findMoved and
findByInternalID; a warning names the object left alone and how to take it
over; the replay helper maps lowercased UC names.

Co-authored-by: Isaac <no-reply@databricks.com>
…ours is not found

A volume in a schema renamed out of band was dropped from state and went
with the schema's force delete, past its prevent_destroy. Look it up
under the parent's new name and delete it as itself. Warn about the other
object only when the bundle's own is not found elsewhere, and document
that a resource deleted and created again out of band needs rebinding.

Co-authored-by: Isaac <no-reply@databricks.com>
…arent's new one

Address review: map the child's ID by its parent's ID prefix instead of
by field value (a schema named like its catalog); follow a parent re-keyed
in a deploy too; and when the parent is deleted, delete the child at its
new ID even if not found there, so prevent_destroy applies.

Co-authored-by: Isaac <no-reply@databricks.com>
aws: TestAccept/bundle/resources/schemas/foreign_at_recorded_name TestAccept/bundle/resources/schemas/destroy_after_rename_out_of_band TestAccept/bundle/resources/schemas/recreated_at_recorded_name TestAccept/bundle/resources/volumes/foreign_at_recorded_name TestAccept/bundle/resources/volumes/prevent_destroy_in_renamed_schema

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

aws: TestAccept/bundle/resources/schemas/foreign_at_recorded_name TestAccept/bundle/resources/schemas/destroy_after_rename_out_of_band TestAccept/bundle/resources/schemas/recreated_at_recorded_name TestAccept/bundle/resources/volumes/foreign_at_recorded_name TestAccept/bundle/resources/volumes/prevent_destroy_in_renamed_schema

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

Address review on #8056:
- a child under a parent deleted at a moved ID that cannot be verified there
  (models and secrets included) gets with_parent: listed, counted and
  checked for prevent_destroy, but no delete is sent at the guessed name;
- parents are matched by case-insensitive full-name prefix over every UC
  resource the plan found at a moved ID, not through depends_on;
- warnings are diagnostics, a Delete's is told after the parent pass, and
  errors name schema_id/volume_id;
- comments, README and changelog updated; schema_fields/volume_fields
  helpers for the new tests.

Co-authored-by: Isaac <no-reply@databricks.com>
…nts for any child

Address the review round on #8056:
- a with_parent child is applied after its parent's delete and selected
  with it, so its state is dropped only once that delete succeeded;
- a child of any type under a moved parent is looked for there, and one
  without an internal ID that is not there stays Gone;
- a child at its old path under a moved parent is never deleted there;
- a 403 at the recorded ID searches by internal ID first;
- the completed plan is checked for cycles again; doc fixes.

Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
A child whose recorded read was forbidden and not found by its internal ID
is looked for under the moved parent too; an entry found at its recorded ID
is re-targeted only for UC full-name types, so a secret scope named like a
schema is deleted where it is.

Co-authored-by: Isaac <no-reply@databricks.com>
It sends no request, so its other delete edges are not needed; one to a
sibling in the same parent closed a cycle through the parent.

aws: TestAccept/bundle/resources/schemas/foreign_at_recorded_name TestAccept/bundle/resources/schemas/destroy_after_rename_out_of_band TestAccept/bundle/resources/schemas/recreated_at_recorded_name TestAccept/bundle/resources/schemas/destroy_renamed_with_model_and_secret TestAccept/bundle/resources/volumes/foreign_at_recorded_name TestAccept/bundle/resources/volumes/prevent_destroy_in_renamed_schema TestAccept/bundle/resources/volumes/removed_from_renamed_schema TestAccept/bundle/resources/volumes/prevent_destroy_schema_without_dependency TestAccept/bundle/resources/volumes/prevent_destroy_mixed_case_schema TestAccept/bundle/resources/volumes/select_renamed_schema

Co-authored-by: Isaac <no-reply@databricks.com>
@denik
denik force-pushed the denik/schema-volume-identity branch from 87ab7b3 to c33cefa Compare November 26, 2026 17:48
@denik

denik commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Addressed all review comments on 87ab7b3 in one push, c33cefaf1; each thread has its own reply. Main changes:

  • A child under a parent deleted at a moved ID is deleted there only when its internal ID matches. Otherwise it gets the new plan field with_parent: no delete is sent at a guessed name, but approval, lifecycle.prevent_destroy and the counts see it, it is applied only after the parent's delete succeeded, and --select keeps the two together.
  • Moved parents are matched by case-insensitive full-name prefix for children of any type, instead of through depends_on. That also answers the review-oss-bot note outside the changed lines (bundle_plan.go:1011, a schema renamed by the bundle to a mixed-case name): covered by volumes/prevent_destroy_mixed_case_schema, which fails without the change.
  • A 403 at the recorded ID now searches by schema_id/volume_id first; the warnings are diagnostics; the docs and changelog are updated.

A second review round on this push (two more independent reviewers and a devil's-advocate pass) found and closed more instances of the same classes: a child left at its old path under a moved parent, a secret scope named like the schema, a cycle through a sibling, and a parent delete that fails. Each has a test that fails without the fix. The cloud tests passed on AWS locally, and the last commit names them for the PR's cloud run.

One open question for an owner, in "Gaps and risks": should this PR bump plan_version? A plan saved by a CLI without this change and applied by one with it deletes at the recorded ID without the new check (and the reverse is rejected, or does what the old CLI does on its own). A bump rejects both mixes with a clear error, but changes plan_version in bundle plan -o json, so I did not include it.

AI agent (opus5.5, isaac_claude)

@denik

denik commented Nov 26, 2026

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

Not ready yet: 1 blocking issue(s), tagged [blocking].

This PR makes the direct engine check schema_id/volume_id before updating or deleting a schema or volume. Destroy can now find the bundle's own object after a rename out of band, and children of a renamed parent are tracked through the new with_parent field. The main fix holds up when traced through the code, but one gap remains: the prefix lookup under a moved parent can still delete an unrelated secret scope at a guessed name, and that should be fixed before merge. The rest are smaller issues: delete ordering for with_parent entries, --select widening to a forced schema delete, and some test-convention items.

Questions

  1. Saved plans can now carry a Delete id that apply honours and a new with_parent field, while currentPlanVersion stays 2. A plan saved by the previous CLI has no id for its Delete, so after a rename out of band this CLI would delete the other schema at the recorded name. Should plan_version be bumped so mixed-version plans are rejected, or is the change in bundle plan -o json output the reason to keep it? (non-blocking)

Comment thread bundle/direct/bundle_plan.go Resolved
Comment thread bundle/direct/graph.go Resolved
Comment thread bundle/deployplan/plan.go Resolved
Comment thread bundle/deployplan/plan.go Resolved
Comment thread bundle/direct/bundle_plan.go Resolved
@denik
denik requested a review from Sankalp-Mittal November 26, 2026 23:00

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

Not ready yet: 1 blocking issue(s), tagged [blocking]; 1 open question(s) about a change users could be hurt by.

This PR makes the direct engine check schema_id/volume_id before it updates or deletes a schema or volume. Destroy now searches for the bundle's object by internal ID after an out-of-band rename, and children of a moved parent are either deleted at their new path or marked with_parent. The core identity check holds up. One gap undermines the safety goal: a model renamed together with its schema loses its prevent_destroy protection while the schema's forced delete removes it. Smaller issues: saved plans are still compatible across CLI versions, one test stubs a modelled route, and the new search warning text is misleading.

Questions

  1. [blocking] A schema or volume with an internal ID that returns 404 at its recorded ID now triggers a full catalog (or schema) listing. The most common cause is a plain out-of-band delete, and that used to be a single GET followed by Gone. Any non-404/403 error from that listing or from the read now fails destroy where it used to succeed (bundle_plan.go 1278, 1287). Should the search be limited (for example only when another object sits at the recorded name, or only for a 403), or should these errors stay warnings on the destroy path?

Comment thread bundle/direct/bundle_plan.go Resolved
Comment thread bundle/deployplan/plan.go Resolved
Comment thread bundle/direct/bundle_plan.go Resolved
Comment thread bundle/direct/bundle_plan.go Resolved
Comment thread bundle/deployplan/action.go Resolved

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

No new issues found.

- A child under a parent deleted at a moved ID that is not verified there gets with_parent, also on a 404 and without an internal ID: a 404 cannot tell a model renamed too from one deleted.
- The search warning says what was searched; the Action.Gone comment matches PlanEntry.Gone.
- Tests: registered_models/prevent_destroy_in_renamed_schema, registered_models/removed_from_renamed_schema; fault.py instead of [[Server]] stubs in destroy_forbidden_at_recorded_name.

aws: TestAccept/bundle/resources/schemas/foreign_at_recorded_name TestAccept/bundle/resources/schemas/destroy_after_rename_out_of_band TestAccept/bundle/resources/schemas/recreated_at_recorded_name TestAccept/bundle/resources/schemas/destroy_renamed_with_model_and_secret TestAccept/bundle/resources/volumes/foreign_at_recorded_name TestAccept/bundle/resources/volumes/prevent_destroy_in_renamed_schema TestAccept/bundle/resources/volumes/removed_from_renamed_schema TestAccept/bundle/resources/volumes/prevent_destroy_schema_without_dependency TestAccept/bundle/resources/volumes/prevent_destroy_mixed_case_schema TestAccept/bundle/resources/volumes/select_renamed_schema TestAccept/bundle/resources/registered_models/prevent_destroy_in_renamed_schema TestAccept/bundle/resources/registered_models/removed_from_renamed_schema

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

denik commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Addressed the review on 29e7309 in 69e2c1978; each inline thread has its own reply. The two plan_version threads stay open for an owner.

On the question in the review body (a plain out-of-band delete now triggers a listing, and a failing listing fails destroy): this is deliberate, and it is listed in "Gaps and risks".

  • A 404 at the recorded ID cannot tell a rename from a delete. The listing is the only way to find the bundle's schema or volume after a rename, which is the destroy_after_rename_out_of_band case. Searching only when another object is at the recorded name would miss exactly that case, where nothing is left there.
  • Reads and lists go through the client's retries for transient errors (retry.IsTransientRead). Not found and permission denied still finish the destroy as before; a forbidden list warns.
  • Any other failure fails the plan, so the state keeps the record and the command can be run again. Turning it into a warning would drop the record of a schema that may only have been renamed and leave it behind with its data, which is what this PR fixes.

If an owner prefers the warning, it is a small change in findByInternalID; I would add a test for the dropped record.

AI agent (opus5.5, isaac_claude)

@denik

denik commented Nov 27, 2026

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

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

This PR makes the direct engine check schema_id/volume_id before it updates or deletes a schema or volume. Destroy now finds the bundle's object by internal ID after a rename out of band, and children of a moved parent are either deleted at their new path or marked with_parent. The identity check closes the data-loss case it targets, and the acceptance coverage is thorough. Remaining issues: the plan version stays at 2 even though older CLIs read these plans differently, there is a gap in delete ordering for with_parent dependencies across two renamed parents, and a few wording and test-layout nits.

Comment thread bundle/direct/bundle_apply.go Resolved
Comment thread bundle/direct/graph.go Resolved
@@ -0,0 +1,7 @@
Cloud = true

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[nit] This file is identical in about ten of the new or changed tests under registered_models/, schemas/ and volumes/. .agents/rules/testing.md asks to put common test.toml options in a parent directory, and it says .databricks and .gitignore are already removed by acceptance/script.cleanup. Could the shared Ignore move to a parent test.toml, without those two entries?

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.

🤖 Since the narrowing, three tests in this PR have this file. Ten tests already on main under schemas/ have the same test.toml, .databricks and .gitignore entries included (for example rename_out_of_band, recreate_out_of_band, rename_with_volume_ref). These three follow that convention. A parent test.toml for schemas/ and volumes/ would change every test in those directories, so I'd leave it to a separate cleanup and not change it here.

AI agent (opus5.5, isaac_claude)

Comment thread bundle/deployplan/plan.go Resolved
Comment thread bundle/direct/bundle_plan.go Resolved

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

…rents move to a follow-up

Keep: a schema or volume at the recorded name with another schema_id/volume_id is never updated or deleted; deploy falls through to findMoved, a delete drops the state entry and warns.
Move to the follow-up: DoFindByInternalID and the list routes, findInMovedParents, with_parent, the makeGraph and --select handling, Destroy at a moved ID, and their tests. destroy_after_rename_out_of_band is back to main, Badness note included.

aws: TestAccept/bundle/resources/schemas/foreign_at_recorded_name TestAccept/bundle/resources/schemas/destroy_after_rename_out_of_band TestAccept/bundle/resources/schemas/recreated_at_recorded_name TestAccept/bundle/resources/volumes/foreign_at_recorded_name

Co-authored-by: Isaac <no-reply@databricks.com>
denik added a commit that referenced this pull request Nov 27, 2026
… resources in it

Restores what was narrowed out of #8056: DoFindByInternalID (schemas, volumes) with the testserver list routes, findInMovedParents, the with_parent plan field and its makeGraph and --select handling, Destroy at a moved ID, and their tests. Removes the Badness notes of destroy_after_rename_out_of_band and foreign_at_recorded_name.

aws: TestAccept/bundle/resources/schemas/foreign_at_recorded_name TestAccept/bundle/resources/schemas/destroy_after_rename_out_of_band TestAccept/bundle/resources/schemas/recreated_at_recorded_name TestAccept/bundle/resources/schemas/destroy_renamed_with_model_and_secret TestAccept/bundle/resources/volumes/foreign_at_recorded_name TestAccept/bundle/resources/volumes/prevent_destroy_in_renamed_schema TestAccept/bundle/resources/volumes/removed_from_renamed_schema TestAccept/bundle/resources/volumes/prevent_destroy_schema_without_dependency TestAccept/bundle/resources/volumes/prevent_destroy_mixed_case_schema TestAccept/bundle/resources/volumes/select_renamed_schema TestAccept/bundle/resources/registered_models/prevent_destroy_in_renamed_schema TestAccept/bundle/resources/registered_models/removed_from_renamed_schema

Co-authored-by: Isaac <no-reply@databricks.com>
@denik denik changed the title Don't update or delete a schema or volume that is not the bundle's; destroy finds one renamed out of band Don't update or delete a schema or volume that is not the bundle's Nov 27, 2026
@denik

denik commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

🤖 This PR is now narrowed to the identity check, in 30938bb31. The rest moved to the draft follow-up #8096. That one should be reviewed after this PR merges.

Why: every blocking finding in the review rounds was in the half that handles resources inside a renamed schema. Each round found one more edge case, so it was not converging. The identity check itself has had no blocking finding since the first round. The two halves fix different things: this one stops a wrong delete of someone else's schema, the other fixes a leak.

Stays here:

  • A schema or volume at the recorded name whose schema_id/volume_id differs is never updated or deleted. Deploy falls through to findMoved. A delete drops the state entry and warns, and nothing else changes for it.
  • schemas/foreign_at_recorded_name, volumes/foreign_at_recorded_name, schemas/recreated_at_recorded_name, and the replay_tfstate.py fix.

Moved to #8096:

  • DoFindByInternalID and the testserver list routes.
  • findInMovedParents, the with_parent plan field and its makeGraph and --select handling.
  • Destroy at a moved ID, and the tests for all of these.
  • The fix for destroy_after_rename_out_of_band. That test is back to main here, Badness note included. foreign_at_recorded_name keeps a narrower Badness note for the renamed schema that destroy still leaves behind.

The threads about the moved code are all resolved here, and their fixes are in #8096. They include:

  • the unverified child delete (1, 2);
  • finding the parent (1, 2);
  • the secret scope named like a schema (thread);
  • --select (thread);
  • the model renamed with its schema (thread);
  • the forbidden read and search (1, 2);
  • the delete ordering, test helpers and comment nits from the same rounds.

The question in the last review's body, about the search failing a destroy, also moved.

plan_version: this PR no longer adds a plan field or a new meaning for one, so the question is smaller. It is answered in its thread, which stays open for an owner.

The narrowing is easy to undo: #8096's branch is this PR plus one commit, and its tree is the full version that was reviewed here.

Checks: the unit tests, lint and the bundle acceptance suite pass locally. The one exception is deploy/mlops-stacks, which fails at template init in my environment. The four cloud tests pass on AWS, and the commit names them for CI. Each changed test fails against main's bundle_plan.go.

AI agent (opus5.5, isaac_claude)

@denik

denik commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

/review

@denik
denik requested a review from Sankalp-Mittal November 27, 2026 03:09

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

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

This PR makes the direct engine compare a schema's schema_id or a volume's volume_id before it updates or deletes whatever sits at the recorded name. That fixes bundle destroy deleting a schema someone else created under the bundle's old name. The core check is correct: otherInternalID sends deploy to findMoved or a create, and sends delete to a gone entry with no DELETE request. My remaining comments cover a create that is planned even though it can only fail, warning advice that doesn't fit every case, and two test goldens that don't show what their titles claim.

return false
}
}
if otherID != "" && remoteState == nil {

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] When the config still gives the recorded ID, findMoved returns right away (id == storedID), so the plan becomes a create at a name where we just read another object. This happens in both the recreated case and the foreign case when the config is unchanged. bundle plan then exits 0 with "1 to add", and bundle deploy uploads files before it fails with SCHEMA_ALREADY_EXISTS, as both goldens show. Should this be a plan error with the same message when the config's ID equals dbentry.ID, and stay a warning only when the create targets a different name?

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'd keep this a warning plus a planned create, and not change it in this PR. The create is what the plan honestly is: the bundle's schema is not at the name the config gives, and the plan does not update or delete what is there. A plan error would make bundle plan fail for the whole bundle over one resource, and the user would see the same message either way. The one cost is the file upload before the create fails, which the goldens show. If owners prefer to fail at plan time, it is a small change (when findMoved returns nothing and the config's ID equals the recorded one), and it can go in on its own.

AI agent (opus5.5, isaac_claude)

Comment thread bundle/direct/bundle_plan.go Resolved

@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/bundle_plan.go Resolved
denik added a commit that referenced this pull request Nov 27, 2026
… resources in it

Restores what was narrowed out of #8056: DoFindByInternalID (schemas, volumes) with the testserver list routes, findInMovedParents, the with_parent plan field and its makeGraph and --select handling, Destroy at a moved ID, and their tests. Adds its own changelog fragment (schema-moved-parent.md); #8056's fragment is unchanged. Removes the Badness notes of destroy_after_rename_out_of_band and foreign_at_recorded_name.

aws: TestAccept/bundle/resources/schemas/foreign_at_recorded_name TestAccept/bundle/resources/schemas/destroy_after_rename_out_of_band TestAccept/bundle/resources/schemas/recreated_at_recorded_name TestAccept/bundle/resources/schemas/destroy_renamed_with_model_and_secret TestAccept/bundle/resources/volumes/foreign_at_recorded_name TestAccept/bundle/resources/volumes/prevent_destroy_in_renamed_schema TestAccept/bundle/resources/volumes/removed_from_renamed_schema TestAccept/bundle/resources/volumes/prevent_destroy_schema_without_dependency TestAccept/bundle/resources/volumes/prevent_destroy_mixed_case_schema TestAccept/bundle/resources/volumes/select_renamed_schema TestAccept/bundle/resources/registered_models/prevent_destroy_in_renamed_schema TestAccept/bundle/resources/registered_models/removed_from_renamed_schema

Co-authored-by: Isaac <no-reply@databricks.com>
denik added a commit that referenced this pull request Nov 27, 2026
… resources in it

Restores what was narrowed out of #8056: DoFindByInternalID (schemas, volumes) with the testserver list routes, findInMovedParents, the with_parent plan field and its makeGraph and --select handling, Destroy at a moved ID, and their tests. Adds its own changelog fragment (schema-moved-parent.md); #8056's fragment is unchanged. Removes the Badness notes of destroy_after_rename_out_of_band and foreign_at_recorded_name.

aws: TestAccept/bundle/resources/schemas/foreign_at_recorded_name TestAccept/bundle/resources/schemas/destroy_after_rename_out_of_band TestAccept/bundle/resources/schemas/recreated_at_recorded_name TestAccept/bundle/resources/schemas/destroy_renamed_with_model_and_secret TestAccept/bundle/resources/volumes/foreign_at_recorded_name TestAccept/bundle/resources/volumes/prevent_destroy_in_renamed_schema TestAccept/bundle/resources/volumes/removed_from_renamed_schema TestAccept/bundle/resources/volumes/prevent_destroy_schema_without_dependency TestAccept/bundle/resources/volumes/prevent_destroy_mixed_case_schema TestAccept/bundle/resources/volumes/select_renamed_schema TestAccept/bundle/resources/registered_models/prevent_destroy_in_renamed_schema TestAccept/bundle/resources/registered_models/removed_from_renamed_schema

Co-authored-by: Isaac <no-reply@databricks.com>
@denik
denik requested a review from Sankalp-Mittal November 27, 2026 19:39
…at the recorded ID

- Deploy suggests pointing the config at the renamed object, or unbind and bind; delete says no delete is sent and suggests deleting it outside the bundle.
- The Gone comments mention another object at the recorded ID.
- foreign_at_recorded_name and recreated_at_recorded_name show the failed deploy's requests; the plan step uses plan_filter.py.

aws: TestAccept/bundle/resources/schemas/foreign_at_recorded_name TestAccept/bundle/resources/schemas/destroy_after_rename_out_of_band TestAccept/bundle/resources/schemas/recreated_at_recorded_name TestAccept/bundle/resources/volumes/foreign_at_recorded_name

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

denik commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

/review

@denik
denik requested a review from andrewnester November 27, 2026 22:50

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

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

This PR makes the direct engine compare a schema's schema_id or a volume's volume_id before it updates or deletes whatever sits at the recorded name. If the IDs differ, the object is treated as not the bundle's: the plan creates instead of updating, and destroy only drops the state entry. The identity check looks correct, and so do its interactions with findMoved and with ID-only state entries. The two points below are about wording: the README and changelog promise more than the code delivers when a bundle-managed parent schema is force-deleted, and one doc comment describes only one of its two callers.

Comments outside the changed lines

  • [nice to have] bundle/direct/dresources/README.md:768: "it only drops the state entry and leaves the other object in place" doesn't hold when the bundle also manages the parent schema. Take a bundle with schema s1 and volume v1 in it, where v1 was renamed out of band and someone else created a volume at s1.v1. destroy marks v1 gone, but ResourceSchema.DoDelete (dresources/schema.go) still sends Force: true for s1, which deletes the other volume. The changelog in .nextchanges/bundles/schema-volume-identity.md makes the same promise ("bundle destroy no longer deletes it"). Can both say this only applies when the parent schema isn't deleted in the same destroy? While you're editing the changelog, splitting that long sentence into two entries would make it easier to read.

}

// otherObjectMessage says that what is at the recorded ID id is not the bundle's. It is told when
// the bundle's own is not found elsewhere either; a resource deleted and created again out of band

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[nit] "It is told when the bundle's own is not found elsewhere either" is true for the deploy caller, but otherObjectAtRecordedID never looks elsewhere (its own comment says "The bundle's own is not looked for"). Maybe: "otherObjectMessage describes the object at the recorded ID id, whose internal ID is otherID and not the one savedState records. Callers add the advice, because a resource deleted and created again out of band looks the same."

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

No new issues found.

This branch has not been deployed

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

Labels

DABs DABs related issues factory-generated

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants