Skip to content

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

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

denik wants to merge 22 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 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, and deploy fails with SCHEMA_ALREADY_EXISTS. Once the config names the renamed schema, the plan finds it there by its schema_id ("action": "update_id", "id": "main.test-schema-moved-[UNIQUE_NAME]"), deploy sends nothing to the other schema, and destroy sends DELETE /api/2.1/unity-catalog/schemas/main.test-schema-moved-[UNIQUE_NAME]. The other schema is left alone.

If the config does not follow the rename, destroy still leaves the bundle's renamed schema behind, now with a warning instead of deleting the other one. schemas/destroy_after_rename_out_of_band is unchanged and keeps its Badness note for that leak, which the follow-up fixes.

Tests

  • schemas/foreign_at_recorded_name: the Badness note is removed. The test shows the warning and the failed create, then a config that names the renamed schema, which the plan finds by schema_id, deploy keeps, and destroy deletes at its new name.
  • New: schemas/destroy_with_other_at_recorded_name (destroy while the config still names the recorded schema: a warning, no DELETE, the entry dropped, and both schemas left in place; its Badness note records the leak), volumes/foreign_at_recorded_name (the same for volumes, by volume_id), 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: efce9ca74 | Workflow run

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

10 tests: regression=8 unreleased=0 coverage=2 failing=0
test branch main (9a14ad6) 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/destroy_with_other_at_recorded_name/DMS= ✅ ❌ ❌
TestAccept/bundle/resources/schemas/destroy_with_other_at_recorded_name/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/destroy_with_other_at_recorded_name/DMS=: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌

main (9a14ad6):

acceptance_test.go:1402: Diff:
        --- bundle/resources/schemas/destroy_with_other_at_recorded_name/output.txt
        +++ /tmp/TestAcceptbundleresourcesschemasdestroy_with_other_at_record1355722255/002/output.txt
        @@ -18,13 +18,24 @@
         === Destroy sends no delete for the other schema: it warns and only drops the bundle's entry 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 its entry is dropped from the deployment state. If the bundle's was renamed outside the bundle, it is left in place under its new name: delete it outside the bundle. If this object is the bundle's (deleted and created again outside the bundle), delete it outside the bundle.
        +The following resources will be deleted:
        +  delete resources.schemas.schema1
         
        +This action will result in the deletion of the following UC schemas. Any underlying data may be lost:
        +  delete resources.schemas.schema1
        +
         All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default
         
        -Destroy: 0 deleted
        +Destroy: 1 deleted
         
         >>> print_requests.py //unity-catalog
        +{
        +  "method": "DELETE",
        +  "path": "/api/2.1/unity-catalog/schemas/main.test-schema-[UNIQUE_NAME]",
        +  "q": {
        +    "force": "true"
        +  }
        +}
         
         >>> [CLI] bundle summary --output json
         {
        @@ -35,15 +41,6 @@
         === 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]"
        -}
        +Error: Schema 'main.test-schema-[UNIQUE_NAME]' does not exist.
         
        -=== The bundle's renamed schema is left behind
        -
        ->>> [CLI] schemas get main.test-schema-moved-[UNIQUE_NAME]
        -{
        -  "full_name": "main.test-schema-moved-[UNIQUE_NAME]",
        -  "schema_id": "[SCHEMA_ID]"
        -}
        +Exit code: 1
        
    acceptance_test.go:1180: LOG.cleanup: Error: Not Found
    acceptance_test.go:1180: 
        LOG.cleanup_requests: {
        LOG.cleanup_requests:   "method": "DELETE",
        LOG.cleanup_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-moved-7pnfzwk4cfe6rdnhhbf6tx37oy",
        LOG.cleanup_requests:   "q": {
        LOG.cleanup_requests:     "force": "true"
        LOG.cleanup_requests:   }
        LOG.cleanup_requests: }
        LOG.cleanup_requests: {
        LOG.cleanup_requests:   "method": "DELETE",
        LOG.cleanup_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-7pnfzwk4cfe6rdnhhbf6tx37oy",
        LOG.cleanup_requests:   "q": {
        LOG.cleanup_requests:     "force": "true"
        LOG.cleanup_requests:   }
        LOG.cleanup_requests: }
    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-7pnfzwk4cfe6rdnhhbf6tx37oy"
        LOG.deploy_requests:   }
        LOG.deploy_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-7pnfzwk4cfe6rdnhhbf6tx37oy",
        LOG.oob_requests:   "body": {
        LOG.oob_requests:     "new_name": "test-schema-moved-7pnfzwk4cfe6rdnhhbf6tx37oy"
        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-7pnfzwk4cfe6rdnhhbf6tx37oy"
        LOG.oob_requests:   }
        LOG.oob_requests: }

latest (v1.28.0):

acceptance_test.go:1402: Diff:
        --- bundle/resources/schemas/destroy_with_other_at_recorded_name/output.txt
        +++ /tmp/TestAcceptbundleresourcesschemasdestroy_with_other_at_record3680071365/002/output.txt
        @@ -18,13 +18,24 @@
         === Destroy sends no delete for the other schema: it warns and only drops the bundle's entry 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 its entry is dropped from the deployment state. If the bundle's was renamed outside the bundle, it is left in place under its new name: delete it outside the bundle. If this object is the bundle's (deleted and created again outside the bundle), delete it outside the bundle.
        +The following resources will be deleted:
        +  delete resources.schemas.schema1
         
        +This action will result in the deletion of the following UC schemas. Any underlying data may be lost:
        +  delete resources.schemas.schema1
        +
         All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default
         
        -Destroy: 0 deleted
        +Destroy: 1 deleted
         
         >>> print_requests.py //unity-catalog
        +{
        +  "method": "DELETE",
        +  "path": "/api/2.1/unity-catalog/schemas/main.test-schema-[UNIQUE_NAME]",
        +  "q": {
        +    "force": "true"
        +  }
        +}
         
         >>> [CLI] bundle summary --output json
         {
        @@ -35,15 +41,6 @@
         === 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]"
        -}
        +Error: Schema 'main.test-schema-[UNIQUE_NAME]' does not exist.
         
        -=== The bundle's renamed schema is left behind
        -
        ->>> [CLI] schemas get main.test-schema-moved-[UNIQUE_NAME]
        -{
        -  "full_name": "main.test-schema-moved-[UNIQUE_NAME]",
        -  "schema_id": "[SCHEMA_ID]"
        -}
        +Exit code: 1
        
    acceptance_test.go:1180: LOG.cleanup: Error: Not Found
    acceptance_test.go:1180: 
        LOG.cleanup_requests: {
        LOG.cleanup_requests:   "method": "DELETE",
        LOG.cleanup_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-moved-2kp2rb5upng6bhvaxdjvuawjcu",
        LOG.cleanup_requests:   "q": {
        LOG.cleanup_requests:     "force": "true"
        LOG.cleanup_requests:   }
        LOG.cleanup_requests: }
        LOG.cleanup_requests: {
        LOG.cleanup_requests:   "method": "DELETE",
        LOG.cleanup_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-2kp2rb5upng6bhvaxdjvuawjcu",
        LOG.cleanup_requests:   "q": {
        LOG.cleanup_requests:     "force": "true"
        LOG.cleanup_requests:   }
        LOG.cleanup_requests: }
    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-2kp2rb5upng6bhvaxdjvuawjcu"
        LOG.deploy_requests:   }
        LOG.deploy_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-2kp2rb5upng6bhvaxdjvuawjcu",
        LOG.oob_requests:   "body": {
        LOG.oob_requests:     "new_name": "test-schema-moved-2kp2rb5upng6bhvaxdjvuawjcu"
        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-2kp2rb5upng6bhvaxdjvuawjcu"
        LOG.oob_requests:   }
        LOG.oob_requests: }
TestAccept/bundle/resources/schemas/destroy_with_other_at_recorded_name/DMS=true: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌

main (9a14ad6):

acceptance_test.go:1402: Diff:
        --- bundle/resources/schemas/destroy_with_other_at_recorded_name/output.txt
        +++ /tmp/TestAcceptbundleresourcesschemasdestroy_with_other_at_record1398240713/002/output.txt
        @@ -18,13 +18,24 @@
         === Destroy sends no delete for the other schema: it warns and only drops the bundle's entry 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 its entry is dropped from the deployment state. If the bundle's was renamed outside the bundle, it is left in place under its new name: delete it outside the bundle. If this object is the bundle's (deleted and created again outside the bundle), delete it outside the bundle.
        +The following resources will be deleted:
        +  delete resources.schemas.schema1
         
        +This action will result in the deletion of the following UC schemas. Any underlying data may be lost:
        +  delete resources.schemas.schema1
        +
         All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default
         
        -Destroy: 0 deleted
        +Destroy: 1 deleted
         
         >>> print_requests.py //unity-catalog
        +{
        +  "method": "DELETE",
        +  "path": "/api/2.1/unity-catalog/schemas/main.test-schema-[UNIQUE_NAME]",
        +  "q": {
        +    "force": "true"
        +  }
        +}
         
         >>> [CLI] bundle summary --output json
         {
        @@ -35,15 +41,6 @@
         === 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]"
        -}
        +Error: Schema 'main.test-schema-[UNIQUE_NAME]' does not exist.
         
        -=== The bundle's renamed schema is left behind
        -
        ->>> [CLI] schemas get main.test-schema-moved-[UNIQUE_NAME]
        -{
        -  "full_name": "main.test-schema-moved-[UNIQUE_NAME]",
        -  "schema_id": "[SCHEMA_ID]"
        -}
        +Exit code: 1
        
    acceptance_test.go:1180: LOG.cleanup: Error: Not Found
    acceptance_test.go:1180: 
        LOG.cleanup_requests: {
        LOG.cleanup_requests:   "method": "DELETE",
        LOG.cleanup_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-moved-rtycalvacjhh5ogpmp2fvxt4ji",
        LOG.cleanup_requests:   "q": {
        LOG.cleanup_requests:     "force": "true"
        LOG.cleanup_requests:   }
        LOG.cleanup_requests: }
        LOG.cleanup_requests: {
        LOG.cleanup_requests:   "method": "DELETE",
        LOG.cleanup_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-rtycalvacjhh5ogpmp2fvxt4ji",
        LOG.cleanup_requests:   "q": {
        LOG.cleanup_requests:     "force": "true"
        LOG.cleanup_requests:   }
        LOG.cleanup_requests: }
    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-rtycalvacjhh5ogpmp2fvxt4ji"
        LOG.deploy_requests:   }
        LOG.deploy_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-rtycalvacjhh5ogpmp2fvxt4ji",
        LOG.oob_requests:   "body": {
        LOG.oob_requests:     "new_name": "test-schema-moved-rtycalvacjhh5ogpmp2fvxt4ji"
        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-rtycalvacjhh5ogpmp2fvxt4ji"
        LOG.oob_requests:   }
        LOG.oob_requests: }
FAIL

latest (v1.28.0):

acceptance_test.go:1402: Diff:
        --- bundle/resources/schemas/destroy_with_other_at_recorded_name/output.txt
        +++ /tmp/TestAcceptbundleresourcesschemasdestroy_with_other_at_record66714802/002/output.txt
        @@ -18,13 +18,24 @@
         === Destroy sends no delete for the other schema: it warns and only drops the bundle's entry 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 its entry is dropped from the deployment state. If the bundle's was renamed outside the bundle, it is left in place under its new name: delete it outside the bundle. If this object is the bundle's (deleted and created again outside the bundle), delete it outside the bundle.
        +The following resources will be deleted:
        +  delete resources.schemas.schema1
         
        +This action will result in the deletion of the following UC schemas. Any underlying data may be lost:
        +  delete resources.schemas.schema1
        +
         All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default
         
        -Destroy: 0 deleted
        +Destroy: 1 deleted
         
         >>> print_requests.py //unity-catalog
        +{
        +  "method": "DELETE",
        +  "path": "/api/2.1/unity-catalog/schemas/main.test-schema-[UNIQUE_NAME]",
        +  "q": {
        +    "force": "true"
        +  }
        +}
         
         >>> [CLI] bundle summary --output json
         {
        @@ -35,15 +41,6 @@
         === 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]"
        -}
        +Error: Schema 'main.test-schema-[UNIQUE_NAME]' does not exist.
         
        -=== The bundle's renamed schema is left behind
        -
        ->>> [CLI] schemas get main.test-schema-moved-[UNIQUE_NAME]
        -{
        -  "full_name": "main.test-schema-moved-[UNIQUE_NAME]",
        -  "schema_id": "[SCHEMA_ID]"
        -}
        +Exit code: 1
        
    acceptance_test.go:1180: LOG.cleanup: Error: Not Found
    acceptance_test.go:1180: 
        LOG.cleanup_requests: {
        LOG.cleanup_requests:   "method": "DELETE",
        LOG.cleanup_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-moved-2ks5mffjr5bl5o2d5yuts3djda",
        LOG.cleanup_requests:   "q": {
        LOG.cleanup_requests:     "force": "true"
        LOG.cleanup_requests:   }
        LOG.cleanup_requests: }
        LOG.cleanup_requests: {
        LOG.cleanup_requests:   "method": "DELETE",
        LOG.cleanup_requests:   "path": "/api/2.1/unity-catalog/schemas/main.test-schema-2ks5mffjr5bl5o2d5yuts3djda",
        LOG.cleanup_requests:   "q": {
        LOG.cleanup_requests:     "force": "true"
        LOG.cleanup_requests:   }
        LOG.cleanup_requests: }
    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-2ks5mffjr5bl5o2d5yuts3djda"
        LOG.deploy_requests:   }
        LOG.deploy_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-2ks5mffjr5bl5o2d5yuts3djda",
        LOG.oob_requests:   "body": {
        LOG.oob_requests:     "new_name": "test-schema-moved-2ks5mffjr5bl5o2d5yuts3djda"
        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-2ks5mffjr5bl5o2d5yuts3djda"
        LOG.oob_requests:   }
        LOG.oob_requests: }
FAIL
TestAccept/bundle/resources/schemas/foreign_at_recorded_name/DMS=: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌

main (9a14ad6):

acceptance_test.go:1402: Diff:
        --- bundle/resources/schemas/foreign_at_recorded_name/output.txt
        +++ /tmp/TestAcceptbundleresourcesschemasforeign_at_recorded_nameDMS264125241/002/output.txt
        @@ -18,10 +18,8 @@
         === 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.
        -
         {
        -  "action": "create",
        +  "action": "update",
           "new_state": {
             "value": {
               "catalog_name": "main",
        @@ -30,10 +27,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]"
             }
           }
         }
        @@ -42,109 +42,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
         
        -=== Point the config at the bundle's renamed schema: the plan finds it there by its schema_id
        -
        ->>> [CLI] bundle plan --output json
        -{
        -  "id": "main.test-schema-moved-[UNIQUE_NAME]",
        -  "action": "update_id",
        -  "state_only": true,
        -  "new_state": {
        -    "value": {
        -      "catalog_name": "main",
        -      "comment": "c1",
        -      "name": "test-schema-moved-[UNIQUE_NAME]"
        -    }
        -  },
        -  "changes": {
        -    "name": {
        -      "action": "skip",
        -      "reason": "remote_already_set",
        -      "old": "test-schema-[UNIQUE_NAME]",
        -      "new": "test-schema-moved-[UNIQUE_NAME]",
        -      "remote": "test-schema-moved-[UNIQUE_NAME]"
        -    },
        -    "schema_id": {
        -      "action": "skip",
        -      "reason": "internal_id",
        -      "old": "[SCHEMA_ID]",
        -      "remote": "[SCHEMA_ID]"
        -    }
        -  }
        -}
        -
        -=== Deploy takes the renamed schema for the bundle's, and sends nothing to the other one
        -
        ->>> [CLI] bundle deploy
        -Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
        -Files: 1 uploaded, 0 deleted
        -Resources: 0 created, 0 changed, 0 deleted, 1 unchanged
        -
        ->>> 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]"
        -}
        -
        ->>> [CLI] schemas get main.test-schema-[UNIQUE_NAME]
        -{
        -  "full_name": "main.test-schema-[UNIQUE_NAME]",
        -  "schema_id": "[FOREIGN_SCHEMA_ID]"
        -}
        -
        -=== Destroy deletes the bundle's schema at its new name, not the other one
        -
        ->>> [CLI] bundle destroy --auto-approve
        -The following resources will be deleted:
        -  delete resources.schemas.schema1
        -
        -This action will result in the deletion of the following UC schemas. Any underlying data may be lost:
        -  delete resources.schemas.schema1
        -
        -All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default
        -
        -Destroy: 1 deleted
        -
        ->>> print_requests.py //unity-catalog
        -{
        -  "method": "DELETE",
        -  "path": "/api/2.1/unity-catalog/schemas/main.test-schema-moved-[UNIQUE_NAME]",
        -  "q": {
        -    "force": "true"
        -  }
        -}
        -
        ->>> musterr [CLI] schemas get main.test-schema-moved-[UNIQUE_NAME]
        -Error: Schema 'main.test-schema-moved-[UNIQUE_NAME]' does not exist.
        -
        -=== 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-xcx4qzx2bvhkxd5s7uxme5r6gy"
        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-xcx4qzx2bvhkxd5s7uxme5r6gy",
        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-xcx4qzx2bvhkxd5s7uxme5r6gy",
        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-xcx4qzx2bvhkxd5s7uxme5r6gy",
        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-xcx4qzx2bvhkxd5s7uxme5r6gy",
        LOG.oob_requests:   "body": {
        LOG.oob_requests:     "new_name": "test-schema-moved-xcx4qzx2bvhkxd5s7uxme5r6gy"
        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-xcx4qzx2bvhkxd5s7uxme5r6gy"
        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_nameDMS2960075958/002/output.txt
        @@ -18,10 +18,8 @@
         === 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.
        -
         {
        -  "action": "create",
        +  "action": "update",
           "new_state": {
             "value": {
               "catalog_name": "main",
        @@ -30,10 +27,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]"
             }
           }
         }
        @@ -42,109 +42,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
         
        -=== Point the config at the bundle's renamed schema: the plan finds it there by its schema_id
        -
        ->>> [CLI] bundle plan --output json
        -{
        -  "id": "main.test-schema-moved-[UNIQUE_NAME]",
        -  "action": "update_id",
        -  "state_only": true,
        -  "new_state": {
        -    "value": {
        -      "catalog_name": "main",
        -      "comment": "c1",
        -      "name": "test-schema-moved-[UNIQUE_NAME]"
        -    }
        -  },
        -  "changes": {
        -    "name": {
        -      "action": "skip",
        -      "reason": "remote_already_set",
        -      "old": "test-schema-[UNIQUE_NAME]",
        -      "new": "test-schema-moved-[UNIQUE_NAME]",
        -      "remote": "test-schema-moved-[UNIQUE_NAME]"
        -    },
        -    "schema_id": {
        -      "action": "skip",
        -      "reason": "internal_id",
        -      "old": "[SCHEMA_ID]",
        -      "remote": "[SCHEMA_ID]"
        -    }
        -  }
        -}
        -
        -=== Deploy takes the renamed schema for the bundle's, and sends nothing to the other one
        -
        ->>> [CLI] bundle deploy
        -Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
        -Files: 1 uploaded, 0 deleted
        -Resources: 0 created, 0 changed, 0 deleted, 1 unchanged
        -
        ->>> 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]"
        -}
        -
        ->>> [CLI] schemas get main.test-schema-[UNIQUE_NAME]
        -{
        -  "full_name": "main.test-schema-[UNIQUE_NAME]",
        -  "schema_id": "[FOREIGN_SCHEMA_ID]"
        -}
        -
        -=== Destroy deletes the bundle's schema at its new name, not the other one
        -
        ->>> [CLI] bundle destroy --auto-approve
        -The following resources will be deleted:
        -  delete resources.schemas.schema1
        -
        -This action will result in the deletion of the following UC schemas. Any underlying data may be lost:
        -  delete resources.schemas.schema1
        -
        -All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default
        -
        -Destroy: 1 deleted
        -
        ->>> print_requests.py //unity-catalog
        -{
        -  "method": "DELETE",
        -  "path": "/api/2.1/unity-catalog/schemas/main.test-schema-moved-[UNIQUE_NAME]",
        -  "q": {
        -    "force": "true"
        -  }
        -}
        -
        ->>> musterr [CLI] schemas get main.test-schema-moved-[UNIQUE_NAME]
        -Error: Schema 'main.test-schema-moved-[UNIQUE_NAME]' does not exist.
        -
        -=== 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-jvaoosbt2fedligd3omqjkjh4y"
        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-jvaoosbt2fedligd3omqjkjh4y",
        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-jvaoosbt2fedligd3omqjkjh4y",
        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-jvaoosbt2fedligd3omqjkjh4y",
        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-jvaoosbt2fedligd3omqjkjh4y",
        LOG.oob_requests:   "body": {
        LOG.oob_requests:     "new_name": "test-schema-moved-jvaoosbt2fedligd3omqjkjh4y"
        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-jvaoosbt2fedligd3omqjkjh4y"
        LOG.oob_requests:   }
        LOG.oob_requests: }
TestAccept/bundle/resources/schemas/foreign_at_recorded_name/DMS=true: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌

main (9a14ad6):

acceptance_test.go:1402: Diff:
        --- bundle/resources/schemas/foreign_at_recorded_name/output.txt
        +++ /tmp/TestAcceptbundleresourcesschemasforeign_at_recorded_nameDMS2359083593/002/output.txt
        @@ -18,10 +18,8 @@
         === 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.
        -
         {
        -  "action": "create",
        +  "action": "update",
           "new_state": {
             "value": {
               "catalog_name": "main",
        @@ -30,10 +27,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]"
             }
           }
         }
        @@ -42,109 +42,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
         
        -=== Point the config at the bundle's renamed schema: the plan finds it there by its schema_id
        -
        ->>> [CLI] bundle plan --output json
        -{
        -  "id": "main.test-schema-moved-[UNIQUE_NAME]",
        -  "action": "update_id",
        -  "state_only": true,
        -  "new_state": {
        -    "value": {
        -      "catalog_name": "main",
        -      "comment": "c1",
        -      "name": "test-schema-moved-[UNIQUE_NAME]"
        -    }
        -  },
        -  "changes": {
        -    "name": {
        -      "action": "skip",
        -      "reason": "remote_already_set",
        -      "old": "test-schema-[UNIQUE_NAME]",
        -      "new": "test-schema-moved-[UNIQUE_NAME]",
        -      "remote": "test-schema-moved-[UNIQUE_NAME]"
        -    },
        -    "schema_id": {
        -      "action": "skip",
        -      "reason": "internal_id",
        -      "old": "[SCHEMA_ID]",
        -      "remote": "[SCHEMA_ID]"
        -    }
        -  }
        -}
        -
        -=== Deploy takes the renamed schema for the bundle's, and sends nothing to the other one
        -
        ->>> [CLI] bundle deploy
        -Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
        -Files: 1 uploaded, 0 deleted
        -Resources: 0 created, 0 changed, 0 deleted, 1 unchanged
        -
        ->>> 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]"
        -}
        -
        ->>> [CLI] schemas get main.test-schema-[UNIQUE_NAME]
        -{
        -  "full_name": "main.test-schema-[UNIQUE_NAME]",
        -  "schema_id": "[FOREIGN_SCHEMA_ID]"
        -}
        -
        -=== Destroy deletes the bundle's schema at its new name, not the other one
        -
        ->>> [CLI] bundle destroy --auto-approve
        -The following resources will be deleted:
        -  delete resources.schemas.schema1
        -
        -This action will result in the deletion of the following UC schemas. Any underlying data may be lost:
        -  delete resources.schemas.schema1
        -
        -All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default
        -
        -Destroy: 1 deleted
        -
        ->>> print_requests.py //unity-catalog
        -{
        -  "method": "DELETE",
        -  "path": "/api/2.1/unity-catalog/schemas/main.test-schema-moved-[UNIQUE_NAME]",
        -  "q": {
        -    "force": "true"
        -  }
        -}
        -
        ->>> musterr [CLI] schemas get main.test-schema-moved-[UNIQUE_NAME]
        -Error: Schema 'main.test-schema-moved-[UNIQUE_NAME]' does not exist.
        -
        -=== 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-ogofftfr2vfjbajnrfmykrqwnu"
        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-ogofftfr2vfjbajnrfmykrqwnu",
        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-ogofftfr2vfjbajnrfmykrqwnu",
        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-ogofftfr2vfjbajnrfmykrqwnu",
        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-ogofftfr2vfjbajnrfmykrqwnu",
        LOG.oob_requests:   "body": {
        LOG.oob_requests:     "new_name": "test-schema-moved-ogofftfr2vfjbajnrfmykrqwnu"
        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-ogofftfr2vfjbajnrfmykrqwnu"
        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_nameDMS1262724849/002/output.txt
        @@ -18,10 +18,8 @@
         === 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.
        -
         {
        -  "action": "create",
        +  "action": "update",
           "new_state": {
             "value": {
               "catalog_name": "main",
        @@ -30,10 +27,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]"
             }
           }
         }
        @@ -42,109 +42,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
         
        -=== Point the config at the bundle's renamed schema: the plan finds it there by its schema_id
        -
        ->>> [CLI] bundle plan --output json
        -{
        -  "id": "main.test-schema-moved-[UNIQUE_NAME]",
        -  "action": "update_id",
        -  "state_only": true,
        -  "new_state": {
        -    "value": {
        -      "catalog_name": "main",
        -      "comment": "c1",
        -      "name": "test-schema-moved-[UNIQUE_NAME]"
        -    }
        -  },
        -  "changes": {
        -    "name": {
        -      "action": "skip",
        -      "reason": "remote_already_set",
        -      "old": "test-schema-[UNIQUE_NAME]",
        -      "new": "test-schema-moved-[UNIQUE_NAME]",
        -      "remote": "test-schema-moved-[UNIQUE_NAME]"
        -    },
        -    "schema_id": {
        -      "action": "skip",
        -      "reason": "internal_id",
        -      "old": "[SCHEMA_ID]",
        -      "remote": "[SCHEMA_ID]"
        -    }
        -  }
        -}
        -
        -=== Deploy takes the renamed schema for the bundle's, and sends nothing to the other one
        -
        ->>> [CLI] bundle deploy
        -Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
        -Files: 1 uploaded, 0 deleted
        -Resources: 0 created, 0 changed, 0 deleted, 1 unchanged
        -
        ->>> 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]"
        -}
        -
        ->>> [CLI] schemas get main.test-schema-[UNIQUE_NAME]
        -{
        -  "full_name": "main.test-schema-[UNIQUE_NAME]",
        -  "schema_id": "[FOREIGN_SCHEMA_ID]"
        -}
        -
        -=== Destroy deletes the bundle's schema at its new name, not the other one
        -
        ->>> [CLI] bundle destroy --auto-approve
        -The following resources will be deleted:
        -  delete resources.schemas.schema1
        -
        -This action will result in the deletion of the following UC schemas. Any underlying data may be lost:
        -  delete resources.schemas.schema1
        -
        -All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default
        -
        -Destroy: 1 deleted
        -
        ->>> print_requests.py //unity-catalog
        -{
        -  "method": "DELETE",
        -  "path": "/api/2.1/unity-catalog/schemas/main.test-schema-moved-[UNIQUE_NAME]",
        -  "q": {
        -    "force": "true"
        -  }
        -}
        -
        ->>> musterr [CLI] schemas get main.test-schema-moved-[UNIQUE_NAME]
        -Error: Schema 'main.test-schema-moved-[UNIQUE_NAME]' does not exist.
        -
        -=== 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-my3kay74ljbrzgad6kfhmrckae"
        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-my3kay74ljbrzgad6kfhmrckae",
        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-my3kay74ljbrzgad6kfhmrckae",
        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-my3kay74ljbrzgad6kfhmrckae",
        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-my3kay74ljbrzgad6kfhmrckae",
        LOG.oob_requests:   "body": {
        LOG.oob_requests:     "new_name": "test-schema-moved-my3kay74ljbrzgad6kfhmrckae"
        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-my3kay74ljbrzgad6kfhmrckae"
        LOG.oob_requests:   }
        LOG.oob_requests: }

4 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: efce9ca

Run: 46397755997

Env 🤯​MISS 💚​RECOVERED ✅​pass 🙈​skip Time
💚​ aws linux-2core-8gb 1 188 17 2:52
💚​ aws-windows-latest-4core-16gb 1 188 17 5:21
🤯​ azure linux-2core-8gb 1 1 184 17 3:11
🤯​ azure-windows-latest-4core-16gb 1 1 184 17 4:20
🤯​ gcp linux-2core-8gb 1 1 185 17 2:41
🤯​ gcp-windows-latest-4core-16gb 1 1 185 17 5:28
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 3 slowest tests (at least 2 minutes):
duration env testname
4:02 aws-windows-latest-4core-16gb TestAccept
3:12 gcp-windows-latest-4core-16gb TestAccept
3:06 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 added a commit that referenced this pull request Nov 26, 2026
…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>
denik added a commit that referenced this pull request Nov 26, 2026
…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>
@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

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

denik commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Addressed the review on c33cefa and the nit on ac738ad in one push, 12cd4fd82. Each thread has its own reply. Main changes:

  • The lookup under a renamed parent runs only for resources that live in a UC parent: those with parent_id_fields, plus features and feature specs through a new moves_with_parent config flag. A secret scope named like a schema is never re-targeted (schemas/rename_with_gone_scope_named_like_it).
  • A delete that depends on a with_parent child also waits for that child's parent, and blocks the parent's delete if it fails.
  • --select of a with_parent child without its parent is now an error. Before, it quietly brought in the parent's forced delete.

Each fix has a test that fails without it. An independent review of this batch found one more instance of the class: the first version of the scope fix dropped the lookup for features. That is fixed in the same push. The changed cloud tests passed on AWS locally.

The bot's question about plan_version is still open for an owner, in "Gaps and risks".

AI agent (opus5.5, isaac_claude)

@denik

denik commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

/review

@denik
denik requested a review from Sankalp-Mittal November 26, 2026 20:58

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

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

This PR makes the direct engine check a schema's or volume's recorded internal ID before it updates or deletes it. Destroy now finds the bundle's object after a rename out of band, and children of a moved parent are handled. The core identity check looks right, and the acceptance tests show the before and after clearly. Two gaps remain in the new with_parent handling: --select rejects a parent that the selection already pulls in, and the graph drops a child's ordering edges to resources outside its parent. There are also a plan-version gap and a few test-script rule nits.

Comment thread bundle/deployplan/plan.go Resolved
Comment thread bundle/direct/graph.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] 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.

@denik

denik commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

/review

@denik
denik requested a review from andrewnester November 26, 2026 23:00
denik and others added 22 commits November 30, 2026 10:03
…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>
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>
…t with_parent deletes with their parent

- Only resources with parent_id_fields or moves_with_parent (features, feature specs) are looked for under a renamed parent, so a secret scope named like a schema is never re-targeted.
- A delete that depends on a with_parent entry also waits for, and blocks, its parent's delete.
- --select of a with_parent entry without its parent is an error instead of pulling in a forced parent delete.
- One advice sentence for both "another object" warnings; comment fixes.
- Tests: shared helpers in acceptance/bundle/resources/script.prepare; fault.py instead of [[Server]] stubs.

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>
…n; its parent's delete waits for its dependencies

- FilterToSelected checks a with_parent entry's parent against the closure once the walk is done, so a parent pulled in as a dependent (a schema under a selected catalog) counts.
- makeGraph moves a with_parent entry's edges to nodes outside its parent onto the parent's delete, unless that would close a cycle (a sibling deleted before the parent).
- Tests: LOG.rename instead of /dev/null; a secret_scope_names helper.

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>
- 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>
…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>
…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>
In schemas/ and volumes/foreign_at_recorded_name, a new step points the config at the renamed object: the plan finds it there by its internal ID (update_id), deploy sends nothing to the other object, and destroy deletes the bundle's at its new name. Their Badness notes are dropped, since destroy no longer leaves anything behind in them; schemas/destroy_after_rename_out_of_band still records the leak.

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>
Its bucket URL differs per cloud (s3, gs, abfss), so volumes/foreign_at_recorded_name failed on Azure and GCP.

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>
schemas/destroy_with_other_at_recorded_name: while the config still names the recorded schema, destroy warns, sends no DELETE, drops the entry, and leaves both the other schema and the bundle's renamed one in place. The Badness note records the leak, which the follow-up fixes.

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_with_other_at_recorded_name TestAccept/bundle/resources/volumes/foreign_at_recorded_name

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

- The delete warning names the resource key once and says the bundle's renamed copy is left in place and must be deleted outside the bundle.
- otherInternalID's comment names both causes.
- replay_tfstate.py matches names lowercased on both sides, one lookup.
- Plainer changelog fragment.

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_with_other_at_recorded_name TestAccept/bundle/resources/volumes/foreign_at_recorded_name

Co-authored-by: Isaac <no-reply@databricks.com>
main removed the errcode helper (#7975). The EXIT-trap cleanup in schemas/destroy_with_other_at_recorded_name, schemas/recreated_at_recorded_name and volumes/foreign_at_recorded_name now uses `cmd > LOG.cleanup 2>&1 || true`, as .agents/rules/testing.md asks.

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_with_other_at_recorded_name TestAccept/bundle/resources/volumes/foreign_at_recorded_name

Co-authored-by: Isaac <no-reply@databricks.com>
@denik
denik force-pushed the denik/schema-volume-identity branch from 49cbb30 to efce9ca Compare November 30, 2026 10:11
@denik
denik requested a review from andrewnester November 30, 2026 10:34
denik added a commit that referenced this pull request Nov 30, 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.

Rebased on #8056 as of efce9ca: the warnings use #8056's wording, and destroy_with_other_at_recorded_name now shows destroy deleting the bundle's schema at its new name (its Badness note and destroy_after_rename_out_of_band's are removed). The cleanup in the restored tests uses `|| true`, as main no longer has errcode (#7975).

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 TestAccept/bundle/resources/schemas/destroy_with_other_at_recorded_name

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

This branch has not been deployed

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

Labels

DABs DABs related issues factory-generated

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants