Skip to content

direct: don't warn when a retried delete finds the resource gone - #8046

Open
denik wants to merge 6 commits into
mainfrom
direct-silent-gone-after-retry
Open

denik wants to merge 6 commits into
mainfrom
direct-silent-gone-after-retry

Conversation

@denik

@denik denik commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Changes

Since #7708, the direct engine retries a delete on transient errors. The SDK also retries 503 and some 504s on its own. When the first attempt is applied but its response is lost, the retry fails on the missing resource. A NotFound already counts as success. UC secrets sometimes answer with a different error, though, and Delete/Recreate then fall back to reading the resource (added in #6061). The read confirmed the secret was gone, but the engine still printed a warning:

Warn: destroying resources.secrets.secret1: Treating resources.secrets.secret1 id=test_catalog_renamed_[UNIQUE_NAME].myschema2.mysecret as already deleted despite delete error: Path resolution failed for the following paths:
 - Segment 'SECRET/mysecret' not found in path index 0

This message is now logged at debug level. The resource is gone, so there is nothing for the user to act on (.agents/rules/style-guide-go.md: "diagnostics a user can't act on go to debug"). The same reasoning as #7926 for Files API deletes applies here.

Judgment calls:

  • The level is debug in every case, not only after our own retry. A retry inside the SDK happens within one DoDelete call, so the engine can't tell it apart from a single attempt. A version that counted only libs/retry attempts still warned on an applied 503.
  • The same holds when the resource is gone for another reason (deleted out of band, or an app in DELETING, the case behind direct: tolerate DELETING apps at apply-time delete #6061). The outcome is the same: the delete counts as done.
  • The 403 branch ("Ignoring permission error ...") is unchanged and still warns, because there the resource isn't confirmed gone.

Why

An output mismatch on a transient backend 500: bundle destroy printed a warning for a delete that succeeded.

Dashboard:

Tests

  • New acceptance test bundle/resources/secrets/delete_transient_500, with two phases:

    • a rename that recreates the secret;
    • a destroy.

    In each phase the first DELETE is applied and all three attempts answer 500. Both commands succeed without the warning. The recorded requests show the GET that confirms the secret is gone after the last DELETE. Without the fix, both phases print the warning.

  • Unit tests in bundle/direct/apply_test.go use a fake resource whose delete returns 500 and then 400, or a single 400, and whose read returns 404. They cover Delete and Recreate. Without the fix, all three cases fail.

  • Local acceptance tests for secrets, apps and postgres_projects pass. No golden contains the warning.

  • secrets/parent_rename and secrets/basic pass on AWS.

AI agent (opus5.5, isaac_claude)

This pull request and its description were written by Isaac.

gcp: TestAccept/bundle/resources/secrets/parent_rename

Co-authored-by: Isaac <no-reply@databricks.com>
@github-actions github-actions Bot added the DABs DABs related issues label Nov 26, 2026
denik and others added 2 commits November 26, 2026 03:32
gcp: TestAccept/bundle/resources/secrets/parent_rename

Co-authored-by: Isaac <no-reply@databricks.com>
gcp: TestAccept/bundle/resources/secrets/parent_rename

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

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Regression test report ✅

Commit: 32db94210 | Workflow run

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

6 tests: regression=2 unreleased=4 coverage=0 failing=0
test branch main (5b9a0b6) latest (v1.28.0)
TestAccept/bundle/resources/secrets/delete_transient_500/DMS= ✅ ❌ ❌
TestAccept/bundle/resources/secrets/delete_transient_500/DMS=true ✅ ❌ ❌
TestAccept/bundle/resources/secrets/parent_rename/DMS=/READPLAN= ✅ ✅ ❌
TestAccept/bundle/resources/secrets/parent_rename/DMS=/READPLAN=1 ✅ ✅ ❌
TestAccept/bundle/resources/secrets/parent_rename/DMS=true/READPLAN= ✅ ✅ ❌
TestAccept/bundle/resources/secrets/parent_rename/DMS=true/READPLAN=1 ✅ ✅ ❌
TestAccept/bundle/resources/secrets/delete_transient_500/DMS=: branch ✅ | main (5b9a0b6) ❌ | latest (v1.28.0) ❌

main (5b9a0b6):

acceptance_test.go:1402: Diff:
        --- bundle/resources/secrets/delete_transient_500/output.txt
        +++ /tmp/TestAcceptbundleresourcessecretsdelete_transient_500DMS=3971523700/002/output.txt
        @@ -11,6 +11,7 @@
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
         Warn: deploying resources.secrets.secret1: retrying after 500 Internal Server Error from DELETE /api/2.1/unity-catalog/secrets/main.default.test_secret
         Warn: deploying resources.secrets.secret1: retrying after 500 Internal Server Error from DELETE /api/2.1/unity-catalog/secrets/main.default.test_secret
        +Warn: deploying resources.secrets.secret1: Treating resources.secrets.secret1 id=main.default.test_secret as already deleted despite delete error: Fault injected by test.
         Recreated secrets.secret1
         Files: 1 uploaded, 0 deleted
         Resources: 1 created, 0 changed, 1 deleted, 0 unchanged
        @@ -34,6 +35,7 @@
         
         Warn: destroying resources.secrets.secret1: retrying after 500 Internal Server Error from DELETE /api/2.1/unity-catalog/secrets/main.default.test_secret2
         Warn: destroying resources.secrets.secret1: retrying after 500 Internal Server Error from DELETE /api/2.1/unity-catalog/secrets/main.default.test_secret2
        +Warn: destroying resources.secrets.secret1: Treating resources.secrets.secret1 id=main.default.test_secret2 as already deleted despite delete error: Fault injected by test.
         Destroy: 1 deleted
         
         >>> print_requests.py --get --summary //unity-catalog/secrets

latest (v1.28.0): same output as main (5b9a0b6)

TestAccept/bundle/resources/secrets/delete_transient_500/DMS=true: branch ✅ | main (5b9a0b6) ❌ | latest (v1.28.0) ❌

main (5b9a0b6):

acceptance_test.go:1402: Diff:
        --- bundle/resources/secrets/delete_transient_500/output.txt
        +++ /tmp/TestAcceptbundleresourcessecretsdelete_transient_500DMS=tru393854722/002/output.txt
        @@ -11,6 +11,7 @@
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
         Warn: deploying resources.secrets.secret1: retrying after 500 Internal Server Error from DELETE /api/2.1/unity-catalog/secrets/main.default.test_secret
         Warn: deploying resources.secrets.secret1: retrying after 500 Internal Server Error from DELETE /api/2.1/unity-catalog/secrets/main.default.test_secret
        +Warn: deploying resources.secrets.secret1: Treating resources.secrets.secret1 id=main.default.test_secret as already deleted despite delete error: Fault injected by test.
         Recreated secrets.secret1
         Files: 1 uploaded, 0 deleted
         Resources: 1 created, 0 changed, 1 deleted, 0 unchanged
        @@ -34,6 +35,7 @@
         
         Warn: destroying resources.secrets.secret1: retrying after 500 Internal Server Error from DELETE /api/2.1/unity-catalog/secrets/main.default.test_secret2
         Warn: destroying resources.secrets.secret1: retrying after 500 Internal Server Error from DELETE /api/2.1/unity-catalog/secrets/main.default.test_secret2
        +Warn: destroying resources.secrets.secret1: Treating resources.secrets.secret1 id=main.default.test_secret2 as already deleted despite delete error: Fault injected by test.
         Destroy: 1 deleted
         
         >>> print_requests.py --get --summary //unity-catalog/secrets

latest (v1.28.0): same output as main (5b9a0b6)

TestAccept/bundle/resources/secrets/parent_rename/DMS=/READPLAN=: branch ✅ | main (5b9a0b6) ✅ | latest (v1.28.0) ❌

latest (v1.28.0):

acceptance_test.go:1402: Diff:
        --- bundle/resources/secrets/parent_rename/output.txt
        +++ /tmp/TestAcceptbundleresourcessecretsparent_renameDMS=READPLAN=1575992330/002/output.txt
        @@ -93,6 +93,7 @@
             }
           },
           "resources.secrets.secret1": {
        +    "id": "test_catalog_[UNIQUE_NAME].myschema2.mysecret",
             "depends_on": [
               {
                 "node": "resources.catalogs.catalog1",
        @@ -103,8 +104,7 @@
                 "label": "${resources.schemas.schema1.name}"
               }
             ],
        -    "action": "update_id",
        -    "state_only": true,
        +    "action": "recreate",
             "new_state": {
               "value": {
                 "catalog_name": "test_catalog_[UNIQUE_NAME]",
        @@ -160,8 +160,8 @@
                 "remote": "[USERNAME]"
               },
               "schema_name": {
        -        "action": "update_id",
        -        "reason": "parent_renamed",
        +        "action": "recreate",
        +        "reason": "spec:immutable",
                 "old": "myschema",
                 "new": "myschema2",
                 "remote": "myschema"
        @@ -184,9 +184,10 @@
         
         >>> [CLI] bundle deploy
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
        +Recreated secrets.secret1
         Updated schemas.schema1
         Files: 1 uploaded, 0 deleted
        -Resources: 0 created, 1 changed, 0 deleted, 2 unchanged
        +Resources: 1 created, 1 changed, 1 deleted, 1 unchanged
         
         >>> print_requests.py //unity-catalog
         {
        @@ -198,12 +197,27 @@
             "new_name": "myschema2"
           }
         }
        +{
        +  "method": "DELETE",
        +  "path": "/api/2.1/unity-catalog/secrets/test_catalog_[UNIQUE_NAME].myschema2.mysecret"
        +}
        +{
        +  "method": "POST",
        +  "path": "/api/2.1/unity-catalog/secrets",
        +  "body": {
        +    "catalog_name": "test_catalog_[UNIQUE_NAME]",
        +    "comment": "c1",
        +    "name": "mysecret",
        +    "schema_name": "myschema2",
        +    "value": "secret-value"
        +  }
        +}
         
         >>> [CLI] secrets-uc get-secret test_catalog_[UNIQUE_NAME].myschema2.mysecret
         {
           "full_name": "test_catalog_[UNIQUE_NAME].myschema2.mysecret",
           "comment": "c1",
        -  "create_time": "[SECRET_CREATE_TIME]"
        +  "create_time": "[TIMESTAMP]"
         }
         
         === Rename the catalog and change the secret's comment: the update reaches the secret at its new path
        @@ -291,6 +300,7 @@
             }
           },
           "resources.secrets.secret1": {
        +    "id": "test_catalog_renamed_[UNIQUE_NAME].myschema2.mysecret",
             "depends_on": [
               {
                 "node": "resources.catalogs.catalog1",
        @@ -301,7 +311,7 @@
                 "label": "${resources.schemas.schema1.name}"
               }
             ],
        -    "action": "update_id",
        +    "action": "recreate",
             "new_state": {
               "value": {
                 "catalog_name": "test_catalog_renamed_[UNIQUE_NAME]",
        @@ -314,7 +324,7 @@
             "remote_state": {
               "catalog_name": "test_catalog_[UNIQUE_NAME]",
               "comment": "c1",
        -      "create_time": "[SECRET_CREATE_TIME]",
        +      "create_time": "[TIMESTAMP]",
               "created_by": "[USERNAME]",
               "effective_owner": "[USERNAME]",
               "effective_value": "[redacted]",
        @@ -322,13 +332,13 @@
               "name": "mysecret",
               "owner": "[USERNAME]",
               "schema_name": "myschema2",
        -      "update_time": "[SECRET_CREATE_TIME]",
        +      "update_time": "[TIMESTAMP]",
               "value": "[redacted]"
             },
             "changes": {
               "catalog_name": {
        -        "action": "update_id",
        -        "reason": "parent_renamed",
        +        "action": "recreate",
        +        "reason": "spec:immutable",
                 "old": "test_catalog_[UNIQUE_NAME]",
                 "new": "test_catalog_renamed_[UNIQUE_NAME]",
                 "remote": "test_catalog_[UNIQUE_NAME]"
        @@ -342,7 +348,7 @@
               "create_time": {
                 "action": "skip",
                 "reason": "spec:output_only",
        -        "remote": "[SECRET_CREATE_TIME]"
        +        "remote": "[TIMESTAMP]"
               },
               "created_by": {
                 "action": "skip",
        @@ -372,7 +378,7 @@
               "update_time": {
                 "action": "skip",
                 "reason": "spec:output_only",
        -        "remote": "[SECRET_CREATE_TIME]"
        +        "remote": "[TIMESTAMP]"
               },
               "value": {
                 "action": "skip",
        @@ -387,10 +393,10 @@
         
         >>> [CLI] bundle deploy
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
        +Recreated secrets.secret1
         Updated catalogs.catalog1
        -Updated secrets.secret1
         Files: 1 uploaded, 0 deleted
        -Resources: 0 created, 2 changed, 0 deleted, 1 unchanged
        +Resources: 1 created, 1 changed, 1 deleted, 1 unchanged
         
         >>> print_requests.py //unity-catalog
         {
        @@ -403,11 +407,12 @@
           }
         }
         {
        -  "method": "PATCH",
        -  "path": "/api/2.1/unity-catalog/secrets/test_catalog_renamed_[UNIQUE_NAME].myschema2.mysecret",
        -  "q": {
        -    "update_mask": "*"
        -  },
        +  "method": "DELETE",
        +  "path": "/api/2.1/unity-catalog/secrets/test_catalog_renamed_[UNIQUE_NAME].myschema2.mysecret"
        +}
        +{
        +  "method": "POST",
        +  "path": "/api/2.1/unity-catalog/secrets",
           "body": {
             "catalog_name": "test_catalog_renamed_[UNIQUE_NAME]",
             "comment": "c2",
        @@ -421,7 +426,7 @@
         {
           "full_name": "test_catalog_renamed_[UNIQUE_NAME].myschema2.mysecret",
           "comment": "c2",
        -  "create_time": "[SECRET_CREATE_TIME]"
        +  "create_time": "[TIMESTAMP]"
         }
         
         === The state tracks the new path and the plan is a no-op
        
    acceptance_test.go:1180: 
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/secrets/test_catalog_renamed_2tmcb2nkrvc5pk26i7p62wco24.myschema2.mysecret"
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/test_catalog_renamed_2tmcb2nkrvc5pk26i7p62wco24.myschema2",
        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/catalogs/test_catalog_renamed_2tmcb2nkrvc5pk26i7p62wco24",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
        LOG.destroy_requests: }
TestAccept/bundle/resources/secrets/parent_rename/DMS=/READPLAN=1: branch ✅ | main (5b9a0b6) ✅ | latest (v1.28.0) ❌

latest (v1.28.0):

acceptance_test.go:1402: Diff:
        --- bundle/resources/secrets/parent_rename/output.txt
        +++ /tmp/TestAcceptbundleresourcessecretsparent_renameDMS=READPLAN=514741931/002/output.txt
        @@ -93,6 +93,7 @@
             }
           },
           "resources.secrets.secret1": {
        +    "id": "test_catalog_[UNIQUE_NAME].myschema2.mysecret",
             "depends_on": [
               {
                 "node": "resources.catalogs.catalog1",
        @@ -103,8 +104,7 @@
                 "label": "${resources.schemas.schema1.name}"
               }
             ],
        -    "action": "update_id",
        -    "state_only": true,
        +    "action": "recreate",
             "new_state": {
               "value": {
                 "catalog_name": "test_catalog_[UNIQUE_NAME]",
        @@ -160,8 +160,8 @@
                 "remote": "[USERNAME]"
               },
               "schema_name": {
        -        "action": "update_id",
        -        "reason": "parent_renamed",
        +        "action": "recreate",
        +        "reason": "spec:immutable",
                 "old": "myschema",
                 "new": "myschema2",
                 "remote": "myschema"
        @@ -184,9 +184,10 @@
         
         >>> [CLI] bundle deploy
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
        +Recreated secrets.secret1
         Updated schemas.schema1
         Files: 1 uploaded, 0 deleted
        -Resources: 0 created, 1 changed, 0 deleted, 2 unchanged
        +Resources: 1 created, 1 changed, 1 deleted, 1 unchanged
         
         >>> print_requests.py //unity-catalog
         {
        @@ -198,12 +197,27 @@
             "new_name": "myschema2"
           }
         }
        +{
        +  "method": "DELETE",
        +  "path": "/api/2.1/unity-catalog/secrets/test_catalog_[UNIQUE_NAME].myschema2.mysecret"
        +}
        +{
        +  "method": "POST",
        +  "path": "/api/2.1/unity-catalog/secrets",
        +  "body": {
        +    "catalog_name": "test_catalog_[UNIQUE_NAME]",
        +    "comment": "c1",
        +    "name": "mysecret",
        +    "schema_name": "myschema2",
        +    "value": "secret-value"
        +  }
        +}
         
         >>> [CLI] secrets-uc get-secret test_catalog_[UNIQUE_NAME].myschema2.mysecret
         {
           "full_name": "test_catalog_[UNIQUE_NAME].myschema2.mysecret",
           "comment": "c1",
        -  "create_time": "[SECRET_CREATE_TIME]"
        +  "create_time": "[TIMESTAMP]"
         }
         
         === Rename the catalog and change the secret's comment: the update reaches the secret at its new path
        @@ -291,6 +300,7 @@
             }
           },
           "resources.secrets.secret1": {
        +    "id": "test_catalog_renamed_[UNIQUE_NAME].myschema2.mysecret",
             "depends_on": [
               {
                 "node": "resources.catalogs.catalog1",
        @@ -301,7 +311,7 @@
                 "label": "${resources.schemas.schema1.name}"
               }
             ],
        -    "action": "update_id",
        +    "action": "recreate",
             "new_state": {
               "value": {
                 "catalog_name": "test_catalog_renamed_[UNIQUE_NAME]",
        @@ -314,7 +324,7 @@
             "remote_state": {
               "catalog_name": "test_catalog_[UNIQUE_NAME]",
               "comment": "c1",
        -      "create_time": "[SECRET_CREATE_TIME]",
        +      "create_time": "[TIMESTAMP]",
               "created_by": "[USERNAME]",
               "effective_owner": "[USERNAME]",
               "effective_value": "[redacted]",
        @@ -322,13 +332,13 @@
               "name": "mysecret",
               "owner": "[USERNAME]",
               "schema_name": "myschema2",
        -      "update_time": "[SECRET_CREATE_TIME]",
        +      "update_time": "[TIMESTAMP]",
               "value": "[redacted]"
             },
             "changes": {
               "catalog_name": {
        -        "action": "update_id",
        -        "reason": "parent_renamed",
        +        "action": "recreate",
        +        "reason": "spec:immutable",
                 "old": "test_catalog_[UNIQUE_NAME]",
                 "new": "test_catalog_renamed_[UNIQUE_NAME]",
                 "remote": "test_catalog_[UNIQUE_NAME]"
        @@ -342,7 +348,7 @@
               "create_time": {
                 "action": "skip",
                 "reason": "spec:output_only",
        -        "remote": "[SECRET_CREATE_TIME]"
        +        "remote": "[TIMESTAMP]"
               },
               "created_by": {
                 "action": "skip",
        @@ -372,7 +378,7 @@
               "update_time": {
                 "action": "skip",
                 "reason": "spec:output_only",
        -        "remote": "[SECRET_CREATE_TIME]"
        +        "remote": "[TIMESTAMP]"
               },
               "value": {
                 "action": "skip",
        @@ -387,10 +393,10 @@
         
         >>> [CLI] bundle deploy
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
        +Recreated secrets.secret1
         Updated catalogs.catalog1
        -Updated secrets.secret1
         Files: 1 uploaded, 0 deleted
        -Resources: 0 created, 2 changed, 0 deleted, 1 unchanged
        +Resources: 1 created, 1 changed, 1 deleted, 1 unchanged
         
         >>> print_requests.py //unity-catalog
         {
        @@ -403,11 +407,12 @@
           }
         }
         {
        -  "method": "PATCH",
        -  "path": "/api/2.1/unity-catalog/secrets/test_catalog_renamed_[UNIQUE_NAME].myschema2.mysecret",
        -  "q": {
        -    "update_mask": "*"
        -  },
        +  "method": "DELETE",
        +  "path": "/api/2.1/unity-catalog/secrets/test_catalog_renamed_[UNIQUE_NAME].myschema2.mysecret"
        +}
        +{
        +  "method": "POST",
        +  "path": "/api/2.1/unity-catalog/secrets",
           "body": {
             "catalog_name": "test_catalog_renamed_[UNIQUE_NAME]",
             "comment": "c2",
        @@ -421,7 +426,7 @@
         {
           "full_name": "test_catalog_renamed_[UNIQUE_NAME].myschema2.mysecret",
           "comment": "c2",
        -  "create_time": "[SECRET_CREATE_TIME]"
        +  "create_time": "[TIMESTAMP]"
         }
         
         === The state tracks the new path and the plan is a no-op
        
    acceptance_test.go:1180: 
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/secrets/test_catalog_renamed_4q7w75pxoncdllaq6h7j6x3af4.myschema2.mysecret"
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/test_catalog_renamed_4q7w75pxoncdllaq6h7j6x3af4.myschema2",
        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/catalogs/test_catalog_renamed_4q7w75pxoncdllaq6h7j6x3af4",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
        LOG.destroy_requests: }
TestAccept/bundle/resources/secrets/parent_rename/DMS=true/READPLAN=: branch ✅ | main (5b9a0b6) ✅ | latest (v1.28.0) ❌

latest (v1.28.0):

acceptance_test.go:1402: Diff:
        --- bundle/resources/secrets/parent_rename/output.txt
        +++ /tmp/TestAcceptbundleresourcessecretsparent_renameDMS=trueREADP611240143/002/output.txt
        @@ -93,6 +93,7 @@
             }
           },
           "resources.secrets.secret1": {
        +    "id": "test_catalog_[UNIQUE_NAME].myschema2.mysecret",
             "depends_on": [
               {
                 "node": "resources.catalogs.catalog1",
        @@ -103,8 +104,7 @@
                 "label": "${resources.schemas.schema1.name}"
               }
             ],
        -    "action": "update_id",
        -    "state_only": true,
        +    "action": "recreate",
             "new_state": {
               "value": {
                 "catalog_name": "test_catalog_[UNIQUE_NAME]",
        @@ -160,8 +160,8 @@
                 "remote": "[USERNAME]"
               },
               "schema_name": {
        -        "action": "update_id",
        -        "reason": "parent_renamed",
        +        "action": "recreate",
        +        "reason": "spec:immutable",
                 "old": "myschema",
                 "new": "myschema2",
                 "remote": "myschema"
        @@ -184,9 +184,10 @@
         
         >>> [CLI] bundle deploy
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
        +Recreated secrets.secret1
         Updated schemas.schema1
         Files: 1 uploaded, 0 deleted
        -Resources: 0 created, 1 changed, 0 deleted, 2 unchanged
        +Resources: 1 created, 1 changed, 1 deleted, 1 unchanged
         
         >>> print_requests.py //unity-catalog
         {
        @@ -198,12 +197,27 @@
             "new_name": "myschema2"
           }
         }
        +{
        +  "method": "DELETE",
        +  "path": "/api/2.1/unity-catalog/secrets/test_catalog_[UNIQUE_NAME].myschema2.mysecret"
        +}
        +{
        +  "method": "POST",
        +  "path": "/api/2.1/unity-catalog/secrets",
        +  "body": {
        +    "catalog_name": "test_catalog_[UNIQUE_NAME]",
        +    "comment": "c1",
        +    "name": "mysecret",
        +    "schema_name": "myschema2",
        +    "value": "secret-value"
        +  }
        +}
         
         >>> [CLI] secrets-uc get-secret test_catalog_[UNIQUE_NAME].myschema2.mysecret
         {
           "full_name": "test_catalog_[UNIQUE_NAME].myschema2.mysecret",
           "comment": "c1",
        -  "create_time": "[SECRET_CREATE_TIME]"
        +  "create_time": "[TIMESTAMP]"
         }
         
         === Rename the catalog and change the secret's comment: the update reaches the secret at its new path
        @@ -291,6 +300,7 @@
             }
           },
           "resources.secrets.secret1": {
        +    "id": "test_catalog_renamed_[UNIQUE_NAME].myschema2.mysecret",
             "depends_on": [
               {
                 "node": "resources.catalogs.catalog1",
        @@ -301,7 +311,7 @@
                 "label": "${resources.schemas.schema1.name}"
               }
             ],
        -    "action": "update_id",
        +    "action": "recreate",
             "new_state": {
               "value": {
                 "catalog_name": "test_catalog_renamed_[UNIQUE_NAME]",
        @@ -314,7 +324,7 @@
             "remote_state": {
               "catalog_name": "test_catalog_[UNIQUE_NAME]",
               "comment": "c1",
        -      "create_time": "[SECRET_CREATE_TIME]",
        +      "create_time": "[TIMESTAMP]",
               "created_by": "[USERNAME]",
               "effective_owner": "[USERNAME]",
               "effective_value": "[redacted]",
        @@ -322,13 +332,13 @@
               "name": "mysecret",
               "owner": "[USERNAME]",
               "schema_name": "myschema2",
        -      "update_time": "[SECRET_CREATE_TIME]",
        +      "update_time": "[TIMESTAMP]",
               "value": "[redacted]"
             },
             "changes": {
               "catalog_name": {
        -        "action": "update_id",
        -        "reason": "parent_renamed",
        +        "action": "recreate",
        +        "reason": "spec:immutable",
                 "old": "test_catalog_[UNIQUE_NAME]",
                 "new": "test_catalog_renamed_[UNIQUE_NAME]",
                 "remote": "test_catalog_[UNIQUE_NAME]"
        @@ -342,7 +348,7 @@
               "create_time": {
                 "action": "skip",
                 "reason": "spec:output_only",
        -        "remote": "[SECRET_CREATE_TIME]"
        +        "remote": "[TIMESTAMP]"
               },
               "created_by": {
                 "action": "skip",
        @@ -372,7 +378,7 @@
               "update_time": {
                 "action": "skip",
                 "reason": "spec:output_only",
        -        "remote": "[SECRET_CREATE_TIME]"
        +        "remote": "[TIMESTAMP]"
               },
               "value": {
                 "action": "skip",
        @@ -387,10 +393,10 @@
         
         >>> [CLI] bundle deploy
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
        +Recreated secrets.secret1
         Updated catalogs.catalog1
        -Updated secrets.secret1
         Files: 1 uploaded, 0 deleted
        -Resources: 0 created, 2 changed, 0 deleted, 1 unchanged
        +Resources: 1 created, 1 changed, 1 deleted, 1 unchanged
         
         >>> print_requests.py //unity-catalog
         {
        @@ -403,11 +407,12 @@
           }
         }
         {
        -  "method": "PATCH",
        -  "path": "/api/2.1/unity-catalog/secrets/test_catalog_renamed_[UNIQUE_NAME].myschema2.mysecret",
        -  "q": {
        -    "update_mask": "*"
        -  },
        +  "method": "DELETE",
        +  "path": "/api/2.1/unity-catalog/secrets/test_catalog_renamed_[UNIQUE_NAME].myschema2.mysecret"
        +}
        +{
        +  "method": "POST",
        +  "path": "/api/2.1/unity-catalog/secrets",
           "body": {
             "catalog_name": "test_catalog_renamed_[UNIQUE_NAME]",
             "comment": "c2",
        @@ -421,7 +426,7 @@
         {
           "full_name": "test_catalog_renamed_[UNIQUE_NAME].myschema2.mysecret",
           "comment": "c2",
        -  "create_time": "[SECRET_CREATE_TIME]"
        +  "create_time": "[TIMESTAMP]"
         }
         
         === The state tracks the new path and the plan is a no-op
        
    acceptance_test.go:1180: 
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/secrets/test_catalog_renamed_dplfztgl6bge3h3hlkda56hb7u.myschema2.mysecret"
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/test_catalog_renamed_dplfztgl6bge3h3hlkda56hb7u.myschema2",
        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/catalogs/test_catalog_renamed_dplfztgl6bge3h3hlkda56hb7u",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
        LOG.destroy_requests: }
TestAccept/bundle/resources/secrets/parent_rename/DMS=true/READPLAN=1: branch ✅ | main (5b9a0b6) ✅ | latest (v1.28.0) ❌

latest (v1.28.0):

acceptance_test.go:1402: Diff:
        --- bundle/resources/secrets/parent_rename/output.txt
        +++ /tmp/TestAcceptbundleresourcessecretsparent_renameDMS=trueREADP1494407942/002/output.txt
        @@ -93,6 +93,7 @@
             }
           },
           "resources.secrets.secret1": {
        +    "id": "test_catalog_[UNIQUE_NAME].myschema2.mysecret",
             "depends_on": [
               {
                 "node": "resources.catalogs.catalog1",
        @@ -103,8 +104,7 @@
                 "label": "${resources.schemas.schema1.name}"
               }
             ],
        -    "action": "update_id",
        -    "state_only": true,
        +    "action": "recreate",
             "new_state": {
               "value": {
                 "catalog_name": "test_catalog_[UNIQUE_NAME]",
        @@ -160,8 +160,8 @@
                 "remote": "[USERNAME]"
               },
               "schema_name": {
        -        "action": "update_id",
        -        "reason": "parent_renamed",
        +        "action": "recreate",
        +        "reason": "spec:immutable",
                 "old": "myschema",
                 "new": "myschema2",
                 "remote": "myschema"
        @@ -184,9 +184,10 @@
         
         >>> [CLI] bundle deploy
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
        +Recreated secrets.secret1
         Updated schemas.schema1
         Files: 1 uploaded, 0 deleted
        -Resources: 0 created, 1 changed, 0 deleted, 2 unchanged
        +Resources: 1 created, 1 changed, 1 deleted, 1 unchanged
         
         >>> print_requests.py //unity-catalog
         {
        @@ -198,12 +197,27 @@
             "new_name": "myschema2"
           }
         }
        +{
        +  "method": "DELETE",
        +  "path": "/api/2.1/unity-catalog/secrets/test_catalog_[UNIQUE_NAME].myschema2.mysecret"
        +}
        +{
        +  "method": "POST",
        +  "path": "/api/2.1/unity-catalog/secrets",
        +  "body": {
        +    "catalog_name": "test_catalog_[UNIQUE_NAME]",
        +    "comment": "c1",
        +    "name": "mysecret",
        +    "schema_name": "myschema2",
        +    "value": "secret-value"
        +  }
        +}
         
         >>> [CLI] secrets-uc get-secret test_catalog_[UNIQUE_NAME].myschema2.mysecret
         {
           "full_name": "test_catalog_[UNIQUE_NAME].myschema2.mysecret",
           "comment": "c1",
        -  "create_time": "[SECRET_CREATE_TIME]"
        +  "create_time": "[TIMESTAMP]"
         }
         
         === Rename the catalog and change the secret's comment: the update reaches the secret at its new path
        @@ -291,6 +300,7 @@
             }
           },
           "resources.secrets.secret1": {
        +    "id": "test_catalog_renamed_[UNIQUE_NAME].myschema2.mysecret",
             "depends_on": [
               {
                 "node": "resources.catalogs.catalog1",
        @@ -301,7 +311,7 @@
                 "label": "${resources.schemas.schema1.name}"
               }
             ],
        -    "action": "update_id",
        +    "action": "recreate",
             "new_state": {
               "value": {
                 "catalog_name": "test_catalog_renamed_[UNIQUE_NAME]",
        @@ -314,7 +324,7 @@
             "remote_state": {
               "catalog_name": "test_catalog_[UNIQUE_NAME]",
               "comment": "c1",
        -      "create_time": "[SECRET_CREATE_TIME]",
        +      "create_time": "[TIMESTAMP]",
               "created_by": "[USERNAME]",
               "effective_owner": "[USERNAME]",
               "effective_value": "[redacted]",
        @@ -322,13 +332,13 @@
               "name": "mysecret",
               "owner": "[USERNAME]",
               "schema_name": "myschema2",
        -      "update_time": "[SECRET_CREATE_TIME]",
        +      "update_time": "[TIMESTAMP]",
               "value": "[redacted]"
             },
             "changes": {
               "catalog_name": {
        -        "action": "update_id",
        -        "reason": "parent_renamed",
        +        "action": "recreate",
        +        "reason": "spec:immutable",
                 "old": "test_catalog_[UNIQUE_NAME]",
                 "new": "test_catalog_renamed_[UNIQUE_NAME]",
                 "remote": "test_catalog_[UNIQUE_NAME]"
        @@ -342,7 +348,7 @@
               "create_time": {
                 "action": "skip",
                 "reason": "spec:output_only",
        -        "remote": "[SECRET_CREATE_TIME]"
        +        "remote": "[TIMESTAMP]"
               },
               "created_by": {
                 "action": "skip",
        @@ -372,7 +378,7 @@
               "update_time": {
                 "action": "skip",
                 "reason": "spec:output_only",
        -        "remote": "[SECRET_CREATE_TIME]"
        +        "remote": "[TIMESTAMP]"
               },
               "value": {
                 "action": "skip",
        @@ -387,10 +393,10 @@
         
         >>> [CLI] bundle deploy
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files...
        +Recreated secrets.secret1
         Updated catalogs.catalog1
        -Updated secrets.secret1
         Files: 1 uploaded, 0 deleted
        -Resources: 0 created, 2 changed, 0 deleted, 1 unchanged
        +Resources: 1 created, 1 changed, 1 deleted, 1 unchanged
         
         >>> print_requests.py //unity-catalog
         {
        @@ -403,11 +407,12 @@
           }
         }
         {
        -  "method": "PATCH",
        -  "path": "/api/2.1/unity-catalog/secrets/test_catalog_renamed_[UNIQUE_NAME].myschema2.mysecret",
        -  "q": {
        -    "update_mask": "*"
        -  },
        +  "method": "DELETE",
        +  "path": "/api/2.1/unity-catalog/secrets/test_catalog_renamed_[UNIQUE_NAME].myschema2.mysecret"
        +}
        +{
        +  "method": "POST",
        +  "path": "/api/2.1/unity-catalog/secrets",
           "body": {
             "catalog_name": "test_catalog_renamed_[UNIQUE_NAME]",
             "comment": "c2",
        @@ -421,7 +426,7 @@
         {
           "full_name": "test_catalog_renamed_[UNIQUE_NAME].myschema2.mysecret",
           "comment": "c2",
        -  "create_time": "[SECRET_CREATE_TIME]"
        +  "create_time": "[TIMESTAMP]"
         }
         
         === The state tracks the new path and the plan is a no-op
        
    acceptance_test.go:1180: 
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/secrets/test_catalog_renamed_lahfg6zm3bfphdpdgppmvtvkui.myschema2.mysecret"
        LOG.destroy_requests: }
        LOG.destroy_requests: {
        LOG.destroy_requests:   "method": "DELETE",
        LOG.destroy_requests:   "path": "/api/2.1/unity-catalog/schemas/test_catalog_renamed_lahfg6zm3bfphdpdgppmvtvkui.myschema2",
        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/catalogs/test_catalog_renamed_lahfg6zm3bfphdpdgppmvtvkui",
        LOG.destroy_requests:   "q": {
        LOG.destroy_requests:     "force": "true"
        LOG.destroy_requests:   }
        LOG.destroy_requests: }
FAIL

denik and others added 2 commits November 26, 2026 03:46
…ments

gcp: TestAccept/bundle/resources/secrets/parent_rename

Co-authored-by: Isaac <no-reply@databricks.com>
The SDK retries 503 and some 504s inside one DoDelete call, so counting
our own attempts missed the same case. The user can't act on a resource
that is already gone, so the message is a debug one in every case.

gcp: TestAccept/bundle/resources/secrets/parent_rename

Co-authored-by: Isaac <no-reply@databricks.com>
@eng-dev-ecosystem-bot

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

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: 32db942

Run: 45759126715

Env 🤯​MISS ✅​pass 🙈​skip Time
🤯​ aws linux-2core-8gb 1 280 20 3:49
🤯​ aws-windows-latest-4core-16gb 1 282 18 4:10
🤯​ azure linux-2core-8gb 1 279 20 3:49
🤯​ azure-windows-latest-4core-16gb 1 281 18 3:54
✅​ gcp linux-2core-8gb 285 20 3:57
✅​ gcp-windows-latest-4core-16gb 287 18 4:13
Test Name aws linux-2core-8gb aws-windows-latest-4core-16gb azure linux-2core-8gb azure-windows-latest-4core-16gb
🤯​ TestAccept/bundle/resources/secrets/parent_rename 🤯​M 🤯​M 🤯​M 🤯​M
Top 3 slowest tests (at least 2 minutes):
duration env testname
4:08 aws-windows-latest-4core-16gb TestAccept
3:52 azure-windows-latest-4core-16gb TestAccept
3:37 gcp-windows-latest-4core-16gb TestAccept

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

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

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

This PR moves the "Treating ... as already deleted despite delete error" message in the direct engine's Delete and Recreate from warn to debug level, and adds an acceptance test and unit tests for it. The change itself is small and does what the description says. Two follow-ups: the new doc comment and changelog say a read confirmed the resource is gone, which isn't true for the IsGone path, and two of the three new unit test cases repeat what the new acceptance test already covers.

Comment thread bundle/direct/apply_test.go Resolved
Comment thread bundle/direct/apply.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.

No issues found.

… the acceptance test covers

gcp: TestAccept/bundle/resources/secrets/parent_rename

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

@Sankalp-Mittal Sankalp-Mittal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[AI Generated] 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.

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