From c4e19242169608947b74f7be517e461dbf7053c5 Mon Sep 17 00:00:00 2001 From: "denis.bilenko" Date: Thu, 19 Nov 2026 14:10:12 +0000 Subject: [PATCH] direct: use update_mask=spec for postgres projects, branches, endpoints, roles and databases Removing a scalar no longer fails with 400 but is silently ignored, and removing all project custom_tags, which worked with the field mask, is now silently ignored too. Badness is updated from runs against a real workspace on 2026-11-19. Co-authored-by: Isaac --- .../remove_is_protected/out.deploy.remove.txt | 11 ++------- .../out.plan.after_remove.json | 10 ++------ .../out.requests.remove.json | 2 +- .../remove_is_protected/test.toml | 9 +++---- .../update_expire_time/out.requests.json | 2 +- .../out.requests.restore.json | 2 +- .../update_protected/out.requests.update.json | 2 +- .../update_ttl/out.requests.json | 2 +- .../update/out.requests.restore.json | 2 +- .../update/out.requests.update.json | 2 +- .../add_settings/out.requests.json | 2 +- .../remove_disabled/out.deploy.remove.txt | 11 ++------- .../out.plan.after_remove.json | 10 ++------ .../remove_disabled/out.requests.remove.json | 2 +- .../remove_disabled/test.toml | 9 +++---- .../out.requests.remove.json | 2 +- .../remove_suspend_timeout/out.deploy.txt | 11 ++------- .../out.plan.drift.json | 10 ++------ .../remove_suspend_timeout/out.plan.drift.txt | 4 +--- .../remove_suspend_timeout/out.requests.json | 2 +- .../remove_suspend_timeout/output.txt | 2 +- .../remove_suspend_timeout/script | 10 +++----- .../remove_suspend_timeout/test.toml | 15 ++++++------ .../out.requests.restore.json | 2 +- .../out.requests.update.json | 2 +- .../update_pg_settings/out.requests.json | 2 +- .../update_suspend_timeout/out.requests.json | 2 +- .../out.deploy.txt | 11 ++------- .../add_default_endpoint_settings/script | 7 ++---- .../add_default_endpoint_settings/test.toml | 12 ++++------ .../remove_custom_tags/out.get.remove.json | 7 +++++- .../out.requests.remove.json | 2 +- .../out.requests.shrink.json | 2 +- .../remove_custom_tags/test.toml | 7 ++++++ .../out.requests.remove.json | 2 +- .../out.deploy.remove.txt | 11 ++------- .../out.plan.after_remove.json | 7 +----- .../out.requests.remove.json | 2 +- .../remove_enable_pg_native_login/test.toml | 9 +++---- .../remove_history_retention/out.deploy.txt | 11 ++------- .../out.plan.drift.json | 7 +----- .../out.plan.drift.txt | 4 +--- .../out.requests.json | 2 +- .../remove_history_retention/test.toml | 13 +++++----- .../out.requests.json | 2 +- .../out.requests.json | 2 +- .../out.requests.restore.json | 2 +- .../out.requests.update.json | 2 +- .../out.requests.json | 2 +- .../remove_attribute/out.deploy.remove.txt | 11 ++------- .../out.plan.after_remove.json | 7 +----- .../remove_attribute/out.requests.remove.json | 2 +- .../postgres_roles/remove_attribute/test.toml | 9 +++---- .../out.requests.remove.json | 2 +- .../update/out.requests.restore.json | 2 +- .../update/out.requests.update.json | 2 +- bundle/direct/dresources/postgres_branch.go | 12 ++++------ bundle/direct/dresources/postgres_database.go | 10 ++------ bundle/direct/dresources/postgres_endpoint.go | 17 ++----------- bundle/direct/dresources/postgres_project.go | 12 ++++------ bundle/direct/dresources/postgres_role.go | 9 ++----- bundle/direct/dresources/postgres_wait.go | 8 +++++++ libs/testserver/postgres_spec.go | 24 +++++++------------ libs/testserver/postgres_spec_test.go | 10 +++++++- 64 files changed, 150 insertions(+), 255 deletions(-) create mode 100644 acceptance/bundle/resources/postgres_projects/remove_custom_tags/test.toml diff --git a/acceptance/bundle/resources/postgres_branches/remove_is_protected/out.deploy.remove.txt b/acceptance/bundle/resources/postgres_branches/remove_is_protected/out.deploy.remove.txt index 2f95fba323e..61038611de4 100644 --- a/acceptance/bundle/resources/postgres_branches/remove_is_protected/out.deploy.remove.txt +++ b/acceptance/bundle/resources/postgres_branches/remove_is_protected/out.deploy.remove.txt @@ -1,11 +1,4 @@ Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/remove-is-protected-[UNIQUE_NAME]/default/files... -Error: cannot update resources.postgres_branches.main: updating id=projects/test-pg-proj-[UNIQUE_NAME]/branches/main: Field 'spec.is_protected' is in update_mask but not provided in request (400 INVALID_PARAMETER_VALUE) - -Endpoint: PATCH [DATABRICKS_URL]/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]/branches/main?update_mask=spec.is_protected -HTTP Status: 400 Bad Request -API error_code: INVALID_PARAMETER_VALUE -API message: Field 'spec.is_protected' is in update_mask but not provided in request - +Updated postgres_branches.main Files: 0 uploaded, 0 deleted - -Exit code: 1 +Resources: 0 created, 1 changed, 0 deleted, 1 unchanged diff --git a/acceptance/bundle/resources/postgres_branches/remove_is_protected/out.plan.after_remove.json b/acceptance/bundle/resources/postgres_branches/remove_is_protected/out.plan.after_remove.json index 591fb1bf72f..6d36d78db61 100644 --- a/acceptance/bundle/resources/postgres_branches/remove_is_protected/out.plan.after_remove.json +++ b/acceptance/bundle/resources/postgres_branches/remove_is_protected/out.plan.after_remove.json @@ -1,10 +1,4 @@ { - "action": "update", - "changes": { - "is_protected": { - "action": "update", - "old": true, - "remote": true - } - } + "action": "skip", + "changes": null } diff --git a/acceptance/bundle/resources/postgres_branches/remove_is_protected/out.requests.remove.json b/acceptance/bundle/resources/postgres_branches/remove_is_protected/out.requests.remove.json index caf851359d1..94f5ff6f288 100644 --- a/acceptance/bundle/resources/postgres_branches/remove_is_protected/out.requests.remove.json +++ b/acceptance/bundle/resources/postgres_branches/remove_is_protected/out.requests.remove.json @@ -2,7 +2,7 @@ "method": "PATCH", "path": "/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]/branches/main", "q": { - "update_mask": "spec.is_protected" + "update_mask": "spec" }, "body": { "spec": { diff --git a/acceptance/bundle/resources/postgres_branches/remove_is_protected/test.toml b/acceptance/bundle/resources/postgres_branches/remove_is_protected/test.toml index 1a4dd03a752..3179317aed2 100644 --- a/acceptance/bundle/resources/postgres_branches/remove_is_protected/test.toml +++ b/acceptance/bundle/resources/postgres_branches/remove_is_protected/test.toml @@ -1,4 +1,5 @@ -# Verified against a real workspace on 2026-11-19: the direct engine masks spec.is_protected and omits it from -# the body, and the API rejects a masked scalar with no value. The old value stays in state, so -# out.plan.after_remove.json shows the removal pending again and every later deploy fails the same way. -Badness = "Removing is_protected fails: the field is named in update_mask but omitted from the body, which the API rejects" +# Verified against a real workspace on 2026-11-19: the engine masks the whole spec and omits +# is_protected from the body. The API accepts it and keeps the stored value in status, but echoes +# back the spec as sent, so out.plan.after_remove.json shows no drift although out.get.remove.json still +# reports the old value. Before update_mask=spec this deploy failed with 400. +Badness = "Removing is_protected is silently ignored: the deploy succeeds and the plan shows no drift, but the resource keeps the old value" diff --git a/acceptance/bundle/resources/postgres_branches/update_expire_time/out.requests.json b/acceptance/bundle/resources/postgres_branches/update_expire_time/out.requests.json index 4d9bc1cbd89..7447a9ceb09 100644 --- a/acceptance/bundle/resources/postgres_branches/update_expire_time/out.requests.json +++ b/acceptance/bundle/resources/postgres_branches/update_expire_time/out.requests.json @@ -2,7 +2,7 @@ "method": "PATCH", "path": "/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]/branches/dev-branch", "q": { - "update_mask": "spec.expiration" + "update_mask": "spec" }, "body": { "spec": { diff --git a/acceptance/bundle/resources/postgres_branches/update_protected/out.requests.restore.json b/acceptance/bundle/resources/postgres_branches/update_protected/out.requests.restore.json index ea3e9b584ec..ad2c2886e81 100644 --- a/acceptance/bundle/resources/postgres_branches/update_protected/out.requests.restore.json +++ b/acceptance/bundle/resources/postgres_branches/update_protected/out.requests.restore.json @@ -14,7 +14,7 @@ "method": "PATCH", "path": "/api/2.0/postgres/[DEV_BRANCH_ID]", "q": { - "update_mask": "spec.is_protected" + "update_mask": "spec" }, "body": { "spec": { diff --git a/acceptance/bundle/resources/postgres_branches/update_protected/out.requests.update.json b/acceptance/bundle/resources/postgres_branches/update_protected/out.requests.update.json index d7260bafe65..3338d165a87 100644 --- a/acceptance/bundle/resources/postgres_branches/update_protected/out.requests.update.json +++ b/acceptance/bundle/resources/postgres_branches/update_protected/out.requests.update.json @@ -14,7 +14,7 @@ "method": "PATCH", "path": "/api/2.0/postgres/[DEV_BRANCH_ID]", "q": { - "update_mask": "spec.is_protected" + "update_mask": "spec" }, "body": { "spec": { diff --git a/acceptance/bundle/resources/postgres_branches/update_ttl/out.requests.json b/acceptance/bundle/resources/postgres_branches/update_ttl/out.requests.json index 433fadb089e..b26276e21ec 100644 --- a/acceptance/bundle/resources/postgres_branches/update_ttl/out.requests.json +++ b/acceptance/bundle/resources/postgres_branches/update_ttl/out.requests.json @@ -2,7 +2,7 @@ "method": "PATCH", "path": "/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]/branches/dev-branch", "q": { - "update_mask": "spec.expiration" + "update_mask": "spec" }, "body": { "spec": { diff --git a/acceptance/bundle/resources/postgres_databases/update/out.requests.restore.json b/acceptance/bundle/resources/postgres_databases/update/out.requests.restore.json index 05d035f3dc0..f1e6d68a372 100644 --- a/acceptance/bundle/resources/postgres_databases/update/out.requests.restore.json +++ b/acceptance/bundle/resources/postgres_databases/update/out.requests.restore.json @@ -30,7 +30,7 @@ "method": "PATCH", "path": "/api/2.0/postgres/[MY_DATABASE_ID]", "q": { - "update_mask": "spec.postgres_database" + "update_mask": "spec" }, "body": { "spec": { diff --git a/acceptance/bundle/resources/postgres_databases/update/out.requests.update.json b/acceptance/bundle/resources/postgres_databases/update/out.requests.update.json index 82d82c5a603..004096f197d 100644 --- a/acceptance/bundle/resources/postgres_databases/update/out.requests.update.json +++ b/acceptance/bundle/resources/postgres_databases/update/out.requests.update.json @@ -30,7 +30,7 @@ "method": "PATCH", "path": "/api/2.0/postgres/[MY_DATABASE_ID]", "q": { - "update_mask": "spec.postgres_database" + "update_mask": "spec" }, "body": { "spec": { diff --git a/acceptance/bundle/resources/postgres_endpoints/add_settings/out.requests.json b/acceptance/bundle/resources/postgres_endpoints/add_settings/out.requests.json index 0693bf14f3b..83ee8d77c19 100644 --- a/acceptance/bundle/resources/postgres_endpoints/add_settings/out.requests.json +++ b/acceptance/bundle/resources/postgres_endpoints/add_settings/out.requests.json @@ -2,7 +2,7 @@ "method": "PATCH", "path": "/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]/branches/main/endpoints/my-endpoint", "q": { - "update_mask": "spec.settings" + "update_mask": "spec" }, "body": { "spec": { diff --git a/acceptance/bundle/resources/postgres_endpoints/remove_disabled/out.deploy.remove.txt b/acceptance/bundle/resources/postgres_endpoints/remove_disabled/out.deploy.remove.txt index 32e0b51b6fb..057c3634e80 100644 --- a/acceptance/bundle/resources/postgres_endpoints/remove_disabled/out.deploy.remove.txt +++ b/acceptance/bundle/resources/postgres_endpoints/remove_disabled/out.deploy.remove.txt @@ -1,11 +1,4 @@ Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/remove-disabled-[UNIQUE_NAME]/default/files... -Error: cannot update resources.postgres_endpoints.my_endpoint: updating id=projects/test-pg-proj-[UNIQUE_NAME]/branches/main/endpoints/my-endpoint: Field 'spec.disabled' is in update_mask but not provided in request (400 INVALID_PARAMETER_VALUE) - -Endpoint: PATCH [DATABRICKS_URL]/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]/branches/main/endpoints/my-endpoint?update_mask=spec.disabled -HTTP Status: 400 Bad Request -API error_code: INVALID_PARAMETER_VALUE -API message: Field 'spec.disabled' is in update_mask but not provided in request - +Updated postgres_endpoints.my_endpoint Files: 0 uploaded, 0 deleted - -Exit code: 1 +Resources: 0 created, 1 changed, 0 deleted, 2 unchanged diff --git a/acceptance/bundle/resources/postgres_endpoints/remove_disabled/out.plan.after_remove.json b/acceptance/bundle/resources/postgres_endpoints/remove_disabled/out.plan.after_remove.json index a3b8a4be73c..6d36d78db61 100644 --- a/acceptance/bundle/resources/postgres_endpoints/remove_disabled/out.plan.after_remove.json +++ b/acceptance/bundle/resources/postgres_endpoints/remove_disabled/out.plan.after_remove.json @@ -1,10 +1,4 @@ { - "action": "update", - "changes": { - "disabled": { - "action": "update", - "old": true, - "remote": true - } - } + "action": "skip", + "changes": null } diff --git a/acceptance/bundle/resources/postgres_endpoints/remove_disabled/out.requests.remove.json b/acceptance/bundle/resources/postgres_endpoints/remove_disabled/out.requests.remove.json index 4da029e78eb..56e6de607c6 100644 --- a/acceptance/bundle/resources/postgres_endpoints/remove_disabled/out.requests.remove.json +++ b/acceptance/bundle/resources/postgres_endpoints/remove_disabled/out.requests.remove.json @@ -2,7 +2,7 @@ "method": "PATCH", "path": "/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]/branches/main/endpoints/my-endpoint", "q": { - "update_mask": "spec.disabled" + "update_mask": "spec" }, "body": { "spec": { diff --git a/acceptance/bundle/resources/postgres_endpoints/remove_disabled/test.toml b/acceptance/bundle/resources/postgres_endpoints/remove_disabled/test.toml index 0b54b7620da..3087243f7a5 100644 --- a/acceptance/bundle/resources/postgres_endpoints/remove_disabled/test.toml +++ b/acceptance/bundle/resources/postgres_endpoints/remove_disabled/test.toml @@ -1,4 +1,5 @@ -# Verified against a real workspace on 2026-11-19: the direct engine masks spec.disabled and omits it from -# the body, and the API rejects a masked scalar with no value. The old value stays in state, so -# out.plan.after_remove.json shows the removal pending again and every later deploy fails the same way. -Badness = "Removing disabled fails: the field is named in update_mask but omitted from the body, which the API rejects" +# Verified against a real workspace on 2026-11-19: the engine masks the whole spec and omits +# disabled from the body. The API accepts it and keeps the stored value in status, but echoes +# back the spec as sent, so out.plan.after_remove.json shows no drift although out.get.remove.json still +# reports the old value. Before update_mask=spec this deploy failed with 400. +Badness = "Removing disabled is silently ignored: the deploy succeeds and the plan shows no drift, but the resource keeps the old value" diff --git a/acceptance/bundle/resources/postgres_endpoints/remove_pg_settings_key/out.requests.remove.json b/acceptance/bundle/resources/postgres_endpoints/remove_pg_settings_key/out.requests.remove.json index c97e29d72e2..a237eb5e3b9 100644 --- a/acceptance/bundle/resources/postgres_endpoints/remove_pg_settings_key/out.requests.remove.json +++ b/acceptance/bundle/resources/postgres_endpoints/remove_pg_settings_key/out.requests.remove.json @@ -2,7 +2,7 @@ "method": "PATCH", "path": "/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]/branches/main/endpoints/my-endpoint", "q": { - "update_mask": "spec.settings.pg_settings" + "update_mask": "spec" }, "body": { "spec": { diff --git a/acceptance/bundle/resources/postgres_endpoints/remove_suspend_timeout/out.deploy.txt b/acceptance/bundle/resources/postgres_endpoints/remove_suspend_timeout/out.deploy.txt index 062615af571..c8d3feefbbf 100644 --- a/acceptance/bundle/resources/postgres_endpoints/remove_suspend_timeout/out.deploy.txt +++ b/acceptance/bundle/resources/postgres_endpoints/remove_suspend_timeout/out.deploy.txt @@ -1,11 +1,4 @@ Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/remove-postgres-endpoint-suspend-[UNIQUE_NAME]/default/files... -Error: cannot update resources.postgres_endpoints.my_endpoint: updating id=projects/test-pg-proj-[UNIQUE_NAME]/branches/main/endpoints/my-endpoint: Field 'spec.suspension' is in update_mask but not provided in request (400 INVALID_PARAMETER_VALUE) - -Endpoint: PATCH [DATABRICKS_URL]/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]/branches/main/endpoints/my-endpoint?update_mask=spec.suspension -HTTP Status: 400 Bad Request -API error_code: INVALID_PARAMETER_VALUE -API message: Field 'spec.suspension' is in update_mask but not provided in request - +Updated postgres_endpoints.my_endpoint Files: 0 uploaded, 0 deleted - -Exit code: 1 +Resources: 0 created, 1 changed, 0 deleted, 2 unchanged diff --git a/acceptance/bundle/resources/postgres_endpoints/remove_suspend_timeout/out.plan.drift.json b/acceptance/bundle/resources/postgres_endpoints/remove_suspend_timeout/out.plan.drift.json index f7478579457..6d36d78db61 100644 --- a/acceptance/bundle/resources/postgres_endpoints/remove_suspend_timeout/out.plan.drift.json +++ b/acceptance/bundle/resources/postgres_endpoints/remove_suspend_timeout/out.plan.drift.json @@ -1,10 +1,4 @@ { - "action": "update", - "changes": { - "suspend_timeout_duration": { - "action": "update", - "old": "300s", - "remote": "300s" - } - } + "action": "skip", + "changes": null } diff --git a/acceptance/bundle/resources/postgres_endpoints/remove_suspend_timeout/out.plan.drift.txt b/acceptance/bundle/resources/postgres_endpoints/remove_suspend_timeout/out.plan.drift.txt index 20dbae59085..0b1f3a9d31f 100644 --- a/acceptance/bundle/resources/postgres_endpoints/remove_suspend_timeout/out.plan.drift.txt +++ b/acceptance/bundle/resources/postgres_endpoints/remove_suspend_timeout/out.plan.drift.txt @@ -1,5 +1,3 @@ >>> [CLI] bundle plan -update postgres_endpoints.my_endpoint - -Plan: 0 to add, 1 to change, 0 to delete, 2 unchanged +Plan: 0 to add, 0 to change, 0 to delete, 3 unchanged diff --git a/acceptance/bundle/resources/postgres_endpoints/remove_suspend_timeout/out.requests.json b/acceptance/bundle/resources/postgres_endpoints/remove_suspend_timeout/out.requests.json index 56aefeeca6c..5444828667a 100644 --- a/acceptance/bundle/resources/postgres_endpoints/remove_suspend_timeout/out.requests.json +++ b/acceptance/bundle/resources/postgres_endpoints/remove_suspend_timeout/out.requests.json @@ -2,7 +2,7 @@ "method": "PATCH", "path": "/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]/branches/main/endpoints/my-endpoint", "q": { - "update_mask": "spec.suspension" + "update_mask": "spec" }, "body": { "spec": { diff --git a/acceptance/bundle/resources/postgres_endpoints/remove_suspend_timeout/output.txt b/acceptance/bundle/resources/postgres_endpoints/remove_suspend_timeout/output.txt index 59954a2cd43..e8ae21f5284 100644 --- a/acceptance/bundle/resources/postgres_endpoints/remove_suspend_timeout/output.txt +++ b/acceptance/bundle/resources/postgres_endpoints/remove_suspend_timeout/output.txt @@ -24,7 +24,7 @@ Resources: 3 created, 0 changed, 0 deleted, 0 unchanged } } -=== Remove suspend_timeout_duration: neither engine can apply it +=== Remove suspend_timeout_duration >>> update_file.py databricks.yml suspend_timeout_duration: 300s diff --git a/acceptance/bundle/resources/postgres_endpoints/remove_suspend_timeout/script b/acceptance/bundle/resources/postgres_endpoints/remove_suspend_timeout/script index ecd4e1c3db9..2e9283ff27d 100644 --- a/acceptance/bundle/resources/postgres_endpoints/remove_suspend_timeout/script +++ b/acceptance/bundle/resources/postgres_endpoints/remove_suspend_timeout/script @@ -13,13 +13,10 @@ trace $CLI bundle deploy rm -f "$OUT_REQUESTS" trace $CLI postgres get-endpoint "${endpoint_name}" | endpoint_fields -title "Remove suspend_timeout_duration: neither engine can apply it" +title "Remove suspend_timeout_duration" trace update_file.py databricks.yml " suspend_timeout_duration: 300s" "" -# Both engines plan the removal and neither applies it, but they fail differently, so the -# deploy and the drift it leaves stay in per-engine files. The direct engine masks -# spec.suspension with no member of that oneof in the body and the API rejects it; the -# Terraform provider masks the whole spec, which the API accepts and then ignores. See +# The removal is planned and the deploy succeeds, but the API keeps the old value. See # test.toml. trace $CLI bundle plan trace $CLI bundle plan -o json | nostamp | jq '.plan."resources.postgres_endpoints.my_endpoint" | {action, changes}' > out.plan.json @@ -28,8 +25,7 @@ errcode $CLI bundle deploy &> out.deploy.txt trace print_requests.py --del-body project_id,branch_id,endpoint_id --sort '//postgres' '^//workspace-files/' '^//workspace/' '^//telemetry-ext' '^//operations/' > out.requests.json # Read the endpoint back to see whether the removal reached it, then plan again to -# record the drift it leaves behind: direct still has the removal pending and will -# fail again on every deploy, terraform applied it and is clean. +# record the drift it leaves behind. trace $CLI postgres get-endpoint "${endpoint_name}" | endpoint_fields trace $CLI bundle plan &> out.plan.drift.txt trace $CLI bundle plan -o json | nostamp | jq '.plan."resources.postgres_endpoints.my_endpoint" | {action, changes}' > out.plan.drift.json diff --git a/acceptance/bundle/resources/postgres_endpoints/remove_suspend_timeout/test.toml b/acceptance/bundle/resources/postgres_endpoints/remove_suspend_timeout/test.toml index e9fdc923eed..4f367d61cb0 100644 --- a/acceptance/bundle/resources/postgres_endpoints/remove_suspend_timeout/test.toml +++ b/acceptance/bundle/resources/postgres_endpoints/remove_suspend_timeout/test.toml @@ -1,8 +1,7 @@ -# The mask is now correct: suspend_timeout_duration is masked under its oneof group name -# spec.suspension. The removal still cannot be applied, and that is a property of the API -# rather than of the mask: a masked field has to be populated in the request body, so -# dropping it from the bundle leaves nothing to send. Probed against a real workspace on -# 2026-08-31 -- an absent value and an explicit null are both answered with "is in -# update_mask but not provided in request". The only way to stop an endpoint suspending is -# to set the other member of the oneof, no_suspension: true. -Badness = "Removing suspend_timeout_duration cannot be applied: the API requires a masked field to be populated, so the removal fails on every deploy. Setting no_suspension: true instead is the supported way to express it" +# Verified against a real workspace on 2026-11-19: the engine masks the whole spec and omits +# suspend_timeout_duration from the body. The API accepts it and keeps 300s, but echoes back +# the spec as sent, so out.plan.drift.json shows no drift. Before update_mask=spec this +# deploy failed with 400 "Field 'spec.suspension' is in update_mask but not provided in +# request". The supported way to stop an endpoint suspending is to set the other member of +# the oneof, no_suspension: true. +Badness = "Removing suspend_timeout_duration is silently ignored: the deploy succeeds and the plan shows no drift, but the endpoint keeps the old timeout. Setting no_suspension: true instead is the supported way to express it" diff --git a/acceptance/bundle/resources/postgres_endpoints/update_autoscaling/out.requests.restore.json b/acceptance/bundle/resources/postgres_endpoints/update_autoscaling/out.requests.restore.json index fac7fa4601f..8e42f05e388 100644 --- a/acceptance/bundle/resources/postgres_endpoints/update_autoscaling/out.requests.restore.json +++ b/acceptance/bundle/resources/postgres_endpoints/update_autoscaling/out.requests.restore.json @@ -22,7 +22,7 @@ "method": "PATCH", "path": "/api/2.0/postgres/[MY_ENDPOINT_ID]", "q": { - "update_mask": "spec.autoscaling_limit_max_cu" + "update_mask": "spec" }, "body": { "spec": { diff --git a/acceptance/bundle/resources/postgres_endpoints/update_autoscaling/out.requests.update.json b/acceptance/bundle/resources/postgres_endpoints/update_autoscaling/out.requests.update.json index 7347d0a8c7f..2104dfb2b33 100644 --- a/acceptance/bundle/resources/postgres_endpoints/update_autoscaling/out.requests.update.json +++ b/acceptance/bundle/resources/postgres_endpoints/update_autoscaling/out.requests.update.json @@ -22,7 +22,7 @@ "method": "PATCH", "path": "/api/2.0/postgres/[MY_ENDPOINT_ID]", "q": { - "update_mask": "spec.autoscaling_limit_max_cu" + "update_mask": "spec" }, "body": { "spec": { diff --git a/acceptance/bundle/resources/postgres_endpoints/update_pg_settings/out.requests.json b/acceptance/bundle/resources/postgres_endpoints/update_pg_settings/out.requests.json index 8e87c6f1861..90bb6b85142 100644 --- a/acceptance/bundle/resources/postgres_endpoints/update_pg_settings/out.requests.json +++ b/acceptance/bundle/resources/postgres_endpoints/update_pg_settings/out.requests.json @@ -2,7 +2,7 @@ "method": "PATCH", "path": "/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]/branches/main/endpoints/my-endpoint", "q": { - "update_mask": "spec.settings.pg_settings" + "update_mask": "spec" }, "body": { "spec": { diff --git a/acceptance/bundle/resources/postgres_endpoints/update_suspend_timeout/out.requests.json b/acceptance/bundle/resources/postgres_endpoints/update_suspend_timeout/out.requests.json index 3acf526f897..bf4d245d2c4 100644 --- a/acceptance/bundle/resources/postgres_endpoints/update_suspend_timeout/out.requests.json +++ b/acceptance/bundle/resources/postgres_endpoints/update_suspend_timeout/out.requests.json @@ -2,7 +2,7 @@ "method": "PATCH", "path": "/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]/branches/main/endpoints/my-endpoint", "q": { - "update_mask": "spec.suspension" + "update_mask": "spec" }, "body": { "spec": { diff --git a/acceptance/bundle/resources/postgres_projects/add_default_endpoint_settings/out.deploy.txt b/acceptance/bundle/resources/postgres_projects/add_default_endpoint_settings/out.deploy.txt index e9fa2b4da16..fa179f237ca 100644 --- a/acceptance/bundle/resources/postgres_projects/add_default_endpoint_settings/out.deploy.txt +++ b/acceptance/bundle/resources/postgres_projects/add_default_endpoint_settings/out.deploy.txt @@ -1,11 +1,4 @@ Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle-[UNIQUE_NAME]/default/files... -Error: cannot update resources.postgres_projects.my_project: updating id=projects/test-pg-proj-[UNIQUE_NAME]: Field 'spec.default_endpoint_settings.suspension' is in update_mask but not provided in request (400 INVALID_PARAMETER_VALUE) - -Endpoint: PATCH [DATABRICKS_URL]/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]?update_mask=spec.default_endpoint_settings -HTTP Status: 400 Bad Request -API error_code: INVALID_PARAMETER_VALUE -API message: Field 'spec.default_endpoint_settings.suspension' is in update_mask but not provided in request - +Updated postgres_projects.my_project Files: 0 uploaded, 0 deleted - -Exit code: 1 +Resources: 0 created, 1 changed, 0 deleted, 0 unchanged diff --git a/acceptance/bundle/resources/postgres_projects/add_default_endpoint_settings/script b/acceptance/bundle/resources/postgres_projects/add_default_endpoint_settings/script index ff5a57ce67b..31151fd78d2 100644 --- a/acceptance/bundle/resources/postgres_projects/add_default_endpoint_settings/script +++ b/acceptance/bundle/resources/postgres_projects/add_default_endpoint_settings/script @@ -16,9 +16,6 @@ trace update_file.py databricks.yml "#TO_ADD: " "" # to its leaves. (The top-level plan verdict is 'update' on both engines.) $CLI bundle plan -o json | plan_filter.py > out.plan.json -# The consequence shows up at deploy time, which diverges by engine, so route it to -# per-engine files. Masking the whole message means the API requires the suspension -# oneof in the body (see dresources/util.go), so the direct deploy FAILS with a 400; -# terraform masks the leaf spec.default_endpoint_settings.autoscaling_limit_max_cu -# and succeeds. +# The engine masks the whole spec, so the block-level change does not reach the mask +# and the deploy succeeds. errcode $CLI bundle deploy > out.deploy.txt 2>&1 diff --git a/acceptance/bundle/resources/postgres_projects/add_default_endpoint_settings/test.toml b/acceptance/bundle/resources/postgres_projects/add_default_endpoint_settings/test.toml index 648bd82593e..2f0b95e37d7 100644 --- a/acceptance/bundle/resources/postgres_projects/add_default_endpoint_settings/test.toml +++ b/acceptance/bundle/resources/postgres_projects/add_default_endpoint_settings/test.toml @@ -1,8 +1,6 @@ RecordRequests = false -# Inherits Cloud = true from the parent. On a real workspace this validates that the -# API still rejects a message-level update_mask exactly as the testserver models it -# (libs/testserver/postgres.go, probed 2026-08-31): the direct deploy is expected to -# 400 there (tolerated by errcode), while terraform masks the leaf and succeeds. Runs -# on both engines; the divergent plan/deploy are routed to per-engine files. - -Badness = "On the direct engine, adding the whole default_endpoint_settings block produces update_mask=spec.default_endpoint_settings (the enclosing message) instead of the leaf spec.default_endpoint_settings.autoscaling_limit_max_cu, and the deploy FAILS with 400: 'Field spec.default_endpoint_settings.suspension is in update_mask but not provided in request'. Root cause: structdiff records one change at the block level instead of descending to leaves, so collectUpdatePathsWithPrefix masks the message. Terraform masks the leaf and succeeds." +# Inherits Cloud = true from the parent. Adding the whole default_endpoint_settings block +# records one change at the block level. With a field mask this masked the enclosing +# message and the API rejected it with 400 "Field 'spec.default_endpoint_settings.suspension' +# is in update_mask but not provided in request"; the whole-spec mask is accepted (verified +# against a real workspace on 2026-11-19). diff --git a/acceptance/bundle/resources/postgres_projects/remove_custom_tags/out.get.remove.json b/acceptance/bundle/resources/postgres_projects/remove_custom_tags/out.get.remove.json index 71f02695d0c..32a8bb67c36 100644 --- a/acceptance/bundle/resources/postgres_projects/remove_custom_tags/out.get.remove.json +++ b/acceptance/bundle/resources/postgres_projects/remove_custom_tags/out.get.remove.json @@ -1,3 +1,8 @@ { - "custom_tags": null + "custom_tags": [ + { + "key": "env", + "value": "test" + } + ] } diff --git a/acceptance/bundle/resources/postgres_projects/remove_custom_tags/out.requests.remove.json b/acceptance/bundle/resources/postgres_projects/remove_custom_tags/out.requests.remove.json index 0ca1a6b41c2..65dc93930cc 100644 --- a/acceptance/bundle/resources/postgres_projects/remove_custom_tags/out.requests.remove.json +++ b/acceptance/bundle/resources/postgres_projects/remove_custom_tags/out.requests.remove.json @@ -2,7 +2,7 @@ "method": "PATCH", "path": "/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]", "q": { - "update_mask": "spec.custom_tags" + "update_mask": "spec" }, "body": { "spec": { diff --git a/acceptance/bundle/resources/postgres_projects/remove_custom_tags/out.requests.shrink.json b/acceptance/bundle/resources/postgres_projects/remove_custom_tags/out.requests.shrink.json index d5f97053816..48cf7e77b4b 100644 --- a/acceptance/bundle/resources/postgres_projects/remove_custom_tags/out.requests.shrink.json +++ b/acceptance/bundle/resources/postgres_projects/remove_custom_tags/out.requests.shrink.json @@ -2,7 +2,7 @@ "method": "PATCH", "path": "/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]", "q": { - "update_mask": "spec.custom_tags" + "update_mask": "spec" }, "body": { "spec": { diff --git a/acceptance/bundle/resources/postgres_projects/remove_custom_tags/test.toml b/acceptance/bundle/resources/postgres_projects/remove_custom_tags/test.toml new file mode 100644 index 00000000000..8cb4d0d0ca7 --- /dev/null +++ b/acceptance/bundle/resources/postgres_projects/remove_custom_tags/test.toml @@ -0,0 +1,7 @@ +# Regression from update_mask=spec, verified against a real workspace on 2026-11-19. With a +# field mask, removing the last tag masks spec.custom_tags with no custom_tags in the body, +# which the API applies by clearing the tags. Under the whole-spec mask the API keeps the +# stored tags when the body omits them, and the SDK cannot send an empty list instead. It +# echoes back the spec as sent, so out.plan.after_remove.json shows no drift although +# out.get.remove.json still has the tag. See factcheck/clear_field. +Badness = "Removing all custom_tags is silently ignored: the deploy succeeds and the plan shows no drift, but the project keeps its tags. This worked before update_mask=spec" diff --git a/acceptance/bundle/resources/postgres_projects/remove_default_pg_settings_key/out.requests.remove.json b/acceptance/bundle/resources/postgres_projects/remove_default_pg_settings_key/out.requests.remove.json index bfafc1054bc..ccf0528c332 100644 --- a/acceptance/bundle/resources/postgres_projects/remove_default_pg_settings_key/out.requests.remove.json +++ b/acceptance/bundle/resources/postgres_projects/remove_default_pg_settings_key/out.requests.remove.json @@ -2,7 +2,7 @@ "method": "PATCH", "path": "/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]", "q": { - "update_mask": "spec.default_endpoint_settings.pg_settings" + "update_mask": "spec" }, "body": { "spec": { diff --git a/acceptance/bundle/resources/postgres_projects/remove_enable_pg_native_login/out.deploy.remove.txt b/acceptance/bundle/resources/postgres_projects/remove_enable_pg_native_login/out.deploy.remove.txt index b7645e47dfa..c87b52f7e7d 100644 --- a/acceptance/bundle/resources/postgres_projects/remove_enable_pg_native_login/out.deploy.remove.txt +++ b/acceptance/bundle/resources/postgres_projects/remove_enable_pg_native_login/out.deploy.remove.txt @@ -1,11 +1,4 @@ Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/remove-enable-pg-native-login-[UNIQUE_NAME]/default/files... -Error: cannot update resources.postgres_projects.my_project: updating id=projects/test-pg-proj-[UNIQUE_NAME]: Field 'spec.enable_pg_native_login' is in update_mask but not provided in request (400 INVALID_PARAMETER_VALUE) - -Endpoint: PATCH [DATABRICKS_URL]/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]?update_mask=spec.enable_pg_native_login -HTTP Status: 400 Bad Request -API error_code: INVALID_PARAMETER_VALUE -API message: Field 'spec.enable_pg_native_login' is in update_mask but not provided in request - +Updated postgres_projects.my_project Files: 0 uploaded, 0 deleted - -Exit code: 1 +Resources: 0 created, 1 changed, 0 deleted, 0 unchanged diff --git a/acceptance/bundle/resources/postgres_projects/remove_enable_pg_native_login/out.plan.after_remove.json b/acceptance/bundle/resources/postgres_projects/remove_enable_pg_native_login/out.plan.after_remove.json index 1e8a7b747f3..6cf4670fe06 100644 --- a/acceptance/bundle/resources/postgres_projects/remove_enable_pg_native_login/out.plan.after_remove.json +++ b/acceptance/bundle/resources/postgres_projects/remove_enable_pg_native_login/out.plan.after_remove.json @@ -1,11 +1,6 @@ { - "action": "update", + "action": "skip", "changes": { - "enable_pg_native_login": { - "action": "update", - "old": true, - "remote": true - }, "pg_version": { "action": "skip", "reason": "spec:input_only", diff --git a/acceptance/bundle/resources/postgres_projects/remove_enable_pg_native_login/out.requests.remove.json b/acceptance/bundle/resources/postgres_projects/remove_enable_pg_native_login/out.requests.remove.json index f70eb8d553a..22be71fcda7 100644 --- a/acceptance/bundle/resources/postgres_projects/remove_enable_pg_native_login/out.requests.remove.json +++ b/acceptance/bundle/resources/postgres_projects/remove_enable_pg_native_login/out.requests.remove.json @@ -2,7 +2,7 @@ "method": "PATCH", "path": "/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]", "q": { - "update_mask": "spec.enable_pg_native_login" + "update_mask": "spec" }, "body": { "spec": { diff --git a/acceptance/bundle/resources/postgres_projects/remove_enable_pg_native_login/test.toml b/acceptance/bundle/resources/postgres_projects/remove_enable_pg_native_login/test.toml index 681240a26e0..fe50ddd296c 100644 --- a/acceptance/bundle/resources/postgres_projects/remove_enable_pg_native_login/test.toml +++ b/acceptance/bundle/resources/postgres_projects/remove_enable_pg_native_login/test.toml @@ -1,4 +1,5 @@ -# Verified against a real workspace on 2026-11-19: the direct engine masks spec.enable_pg_native_login and omits it from -# the body, and the API rejects a masked scalar with no value. The old value stays in state, so -# out.plan.after_remove.json shows the removal pending again and every later deploy fails the same way. -Badness = "Removing enable_pg_native_login fails: the field is named in update_mask but omitted from the body, which the API rejects" +# Verified against a real workspace on 2026-11-19: the engine masks the whole spec and omits +# enable_pg_native_login from the body. The API accepts it and keeps the stored value in status, but echoes +# back the spec as sent, so out.plan.after_remove.json shows no drift although out.get.remove.json still +# reports the old value. Before update_mask=spec this deploy failed with 400. +Badness = "Removing enable_pg_native_login is silently ignored: the deploy succeeds and the plan shows no drift, but the resource keeps the old value" diff --git a/acceptance/bundle/resources/postgres_projects/remove_history_retention/out.deploy.txt b/acceptance/bundle/resources/postgres_projects/remove_history_retention/out.deploy.txt index 43f53f98801..971d9a7733c 100644 --- a/acceptance/bundle/resources/postgres_projects/remove_history_retention/out.deploy.txt +++ b/acceptance/bundle/resources/postgres_projects/remove_history_retention/out.deploy.txt @@ -1,11 +1,4 @@ Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/remove-postgres-project-retention-[UNIQUE_NAME]/default/files... -Error: cannot update resources.postgres_projects.my_project: updating id=projects/test-pg-proj-[UNIQUE_NAME]: Field 'spec.history_retention_duration' is in update_mask but not provided in request (400 INVALID_PARAMETER_VALUE) - -Endpoint: PATCH [DATABRICKS_URL]/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]?update_mask=spec.history_retention_duration -HTTP Status: 400 Bad Request -API error_code: INVALID_PARAMETER_VALUE -API message: Field 'spec.history_retention_duration' is in update_mask but not provided in request - +Updated postgres_projects.my_project Files: 0 uploaded, 0 deleted - -Exit code: 1 +Resources: 0 created, 1 changed, 0 deleted, 0 unchanged diff --git a/acceptance/bundle/resources/postgres_projects/remove_history_retention/out.plan.drift.json b/acceptance/bundle/resources/postgres_projects/remove_history_retention/out.plan.drift.json index 77bde21b0fc..6cf4670fe06 100644 --- a/acceptance/bundle/resources/postgres_projects/remove_history_retention/out.plan.drift.json +++ b/acceptance/bundle/resources/postgres_projects/remove_history_retention/out.plan.drift.json @@ -1,11 +1,6 @@ { - "action": "update", + "action": "skip", "changes": { - "history_retention_duration": { - "action": "update", - "old": "604800s", - "remote": "604800s" - }, "pg_version": { "action": "skip", "reason": "spec:input_only", diff --git a/acceptance/bundle/resources/postgres_projects/remove_history_retention/out.plan.drift.txt b/acceptance/bundle/resources/postgres_projects/remove_history_retention/out.plan.drift.txt index a622ace9faa..f88b3379f3c 100644 --- a/acceptance/bundle/resources/postgres_projects/remove_history_retention/out.plan.drift.txt +++ b/acceptance/bundle/resources/postgres_projects/remove_history_retention/out.plan.drift.txt @@ -1,5 +1,3 @@ >>> [CLI] bundle plan -update postgres_projects.my_project - -Plan: 0 to add, 1 to change, 0 to delete, 0 unchanged +Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged diff --git a/acceptance/bundle/resources/postgres_projects/remove_history_retention/out.requests.json b/acceptance/bundle/resources/postgres_projects/remove_history_retention/out.requests.json index 3db270dc252..1ec9b752f72 100644 --- a/acceptance/bundle/resources/postgres_projects/remove_history_retention/out.requests.json +++ b/acceptance/bundle/resources/postgres_projects/remove_history_retention/out.requests.json @@ -2,7 +2,7 @@ "method": "PATCH", "path": "/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]", "q": { - "update_mask": "spec.history_retention_duration" + "update_mask": "spec" }, "body": { "spec": { diff --git a/acceptance/bundle/resources/postgres_projects/remove_history_retention/test.toml b/acceptance/bundle/resources/postgres_projects/remove_history_retention/test.toml index efa6e2c01e2..505d896969a 100644 --- a/acceptance/bundle/resources/postgres_projects/remove_history_retention/test.toml +++ b/acceptance/bundle/resources/postgres_projects/remove_history_retention/test.toml @@ -1,7 +1,6 @@ -# Removing history_retention_duration is rejected. The engine names the field in -# update_mask and omits it from the body, and the API requires every masked field to -# carry a value: 400 "Field 'spec.history_retention_duration' is in update_mask but -# not provided in request" (verified against a real workspace on 2026-08-28). The old -# value therefore stays in state, so out.plan.drift.direct.json shows the same -# removal pending again, and every later deploy fails the same way. -Badness = "Removing history_retention_duration fails: the field is named in update_mask but omitted from the body, which the API rejects, so the removal can never be applied and every later deploy retries and fails" +# Verified against a real workspace on 2026-11-19: the engine masks the whole spec and omits +# history_retention_duration from the body. The API accepts it and keeps 604800s in status +# (out.project.txt), but echoes back the spec as sent, so out.plan.drift.json shows no drift. +# Before update_mask=spec this deploy failed with 400 "Field 'spec.history_retention_duration' +# is in update_mask but not provided in request". +Badness = "Removing history_retention_duration is silently ignored: the deploy succeeds and the plan shows no drift, but the project keeps the old retention" diff --git a/acceptance/bundle/resources/postgres_projects/update_default_endpoint_autoscaling/out.requests.json b/acceptance/bundle/resources/postgres_projects/update_default_endpoint_autoscaling/out.requests.json index 326ad9eea01..586e2a89427 100644 --- a/acceptance/bundle/resources/postgres_projects/update_default_endpoint_autoscaling/out.requests.json +++ b/acceptance/bundle/resources/postgres_projects/update_default_endpoint_autoscaling/out.requests.json @@ -2,7 +2,7 @@ "method": "PATCH", "path": "/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]", "q": { - "update_mask": "spec.default_endpoint_settings.autoscaling_limit_max_cu" + "update_mask": "spec" }, "body": { "spec": { diff --git a/acceptance/bundle/resources/postgres_projects/update_default_endpoint_suspend/out.requests.json b/acceptance/bundle/resources/postgres_projects/update_default_endpoint_suspend/out.requests.json index 3747f87142d..ba471363e27 100644 --- a/acceptance/bundle/resources/postgres_projects/update_default_endpoint_suspend/out.requests.json +++ b/acceptance/bundle/resources/postgres_projects/update_default_endpoint_suspend/out.requests.json @@ -2,7 +2,7 @@ "method": "PATCH", "path": "/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]", "q": { - "update_mask": "spec.default_endpoint_settings.suspension" + "update_mask": "spec" }, "body": { "spec": { diff --git a/acceptance/bundle/resources/postgres_projects/update_display_name/out.requests.restore.json b/acceptance/bundle/resources/postgres_projects/update_display_name/out.requests.restore.json index 42d5374db1d..3b9e502247a 100644 --- a/acceptance/bundle/resources/postgres_projects/update_display_name/out.requests.restore.json +++ b/acceptance/bundle/resources/postgres_projects/update_display_name/out.requests.restore.json @@ -6,7 +6,7 @@ "method": "PATCH", "path": "/api/2.0/postgres/[MY_PROJECT_ID]", "q": { - "update_mask": "spec.display_name" + "update_mask": "spec" }, "body": { "spec": { diff --git a/acceptance/bundle/resources/postgres_projects/update_display_name/out.requests.update.json b/acceptance/bundle/resources/postgres_projects/update_display_name/out.requests.update.json index fff4cdda46d..7eb28bb156f 100644 --- a/acceptance/bundle/resources/postgres_projects/update_display_name/out.requests.update.json +++ b/acceptance/bundle/resources/postgres_projects/update_display_name/out.requests.update.json @@ -6,7 +6,7 @@ "method": "PATCH", "path": "/api/2.0/postgres/[MY_PROJECT_ID]", "q": { - "update_mask": "spec.display_name" + "update_mask": "spec" }, "body": { "spec": { diff --git a/acceptance/bundle/resources/postgres_projects/update_history_retention/out.requests.json b/acceptance/bundle/resources/postgres_projects/update_history_retention/out.requests.json index 1b3837bd47f..e01d1f62fe0 100644 --- a/acceptance/bundle/resources/postgres_projects/update_history_retention/out.requests.json +++ b/acceptance/bundle/resources/postgres_projects/update_history_retention/out.requests.json @@ -2,7 +2,7 @@ "method": "PATCH", "path": "/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]", "q": { - "update_mask": "spec.history_retention_duration" + "update_mask": "spec" }, "body": { "spec": { diff --git a/acceptance/bundle/resources/postgres_roles/remove_attribute/out.deploy.remove.txt b/acceptance/bundle/resources/postgres_roles/remove_attribute/out.deploy.remove.txt index e03ecdb23ac..d87eb123a1c 100644 --- a/acceptance/bundle/resources/postgres_roles/remove_attribute/out.deploy.remove.txt +++ b/acceptance/bundle/resources/postgres_roles/remove_attribute/out.deploy.remove.txt @@ -1,11 +1,4 @@ Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/remove-attribute-[UNIQUE_NAME]/default/files... -Error: cannot update resources.postgres_roles.my_role: updating id=projects/test-pg-proj-[UNIQUE_NAME]/branches/main/roles/test-role: Field 'spec.attributes.createdb' is in update_mask but not provided in request (400 INVALID_PARAMETER_VALUE) - -Endpoint: PATCH [DATABRICKS_URL]/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]/branches/main/roles/test-role?update_mask=spec.attributes.createdb -HTTP Status: 400 Bad Request -API error_code: INVALID_PARAMETER_VALUE -API message: Field 'spec.attributes.createdb' is in update_mask but not provided in request - +Updated postgres_roles.my_role Files: 0 uploaded, 0 deleted - -Exit code: 1 +Resources: 0 created, 1 changed, 0 deleted, 2 unchanged diff --git a/acceptance/bundle/resources/postgres_roles/remove_attribute/out.plan.after_remove.json b/acceptance/bundle/resources/postgres_roles/remove_attribute/out.plan.after_remove.json index e01e151165d..84594a26765 100644 --- a/acceptance/bundle/resources/postgres_roles/remove_attribute/out.plan.after_remove.json +++ b/acceptance/bundle/resources/postgres_roles/remove_attribute/out.plan.after_remove.json @@ -1,11 +1,6 @@ { - "action": "update", + "action": "skip", "changes": { - "attributes.createdb": { - "action": "update", - "old": true, - "remote": true - }, "postgres_role": { "action": "skip", "reason": "spec:input_only", diff --git a/acceptance/bundle/resources/postgres_roles/remove_attribute/out.requests.remove.json b/acceptance/bundle/resources/postgres_roles/remove_attribute/out.requests.remove.json index 16a8571e1e0..bf7d7e9221c 100644 --- a/acceptance/bundle/resources/postgres_roles/remove_attribute/out.requests.remove.json +++ b/acceptance/bundle/resources/postgres_roles/remove_attribute/out.requests.remove.json @@ -2,7 +2,7 @@ "method": "PATCH", "path": "/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]/branches/main/roles/test-role", "q": { - "update_mask": "spec.attributes.createdb" + "update_mask": "spec" }, "body": { "spec": { diff --git a/acceptance/bundle/resources/postgres_roles/remove_attribute/test.toml b/acceptance/bundle/resources/postgres_roles/remove_attribute/test.toml index 35bc4860a12..23c7e9c5620 100644 --- a/acceptance/bundle/resources/postgres_roles/remove_attribute/test.toml +++ b/acceptance/bundle/resources/postgres_roles/remove_attribute/test.toml @@ -1,4 +1,5 @@ -# Verified against a real workspace on 2026-11-19: the direct engine masks spec.attributes.createdb and omits it from -# the body, and the API rejects a masked scalar with no value. The old value stays in state, so -# out.plan.after_remove.json shows the removal pending again and every later deploy fails the same way. -Badness = "Removing attributes.createdb fails: the field is named in update_mask but omitted from the body, which the API rejects" +# Verified against a real workspace on 2026-11-19: the engine masks the whole spec and omits +# attributes.createdb from the body. The API accepts it and keeps the stored value in status, but echoes +# back the spec as sent, so out.plan.after_remove.json shows no drift although out.get.remove.json still +# reports the old value. Before update_mask=spec this deploy failed with 400. +Badness = "Removing attributes.createdb is silently ignored: the deploy succeeds and the plan shows no drift, but the resource keeps the old value" diff --git a/acceptance/bundle/resources/postgres_roles/remove_membership_roles/out.requests.remove.json b/acceptance/bundle/resources/postgres_roles/remove_membership_roles/out.requests.remove.json index c7850b0604b..2bf1556e57f 100644 --- a/acceptance/bundle/resources/postgres_roles/remove_membership_roles/out.requests.remove.json +++ b/acceptance/bundle/resources/postgres_roles/remove_membership_roles/out.requests.remove.json @@ -2,7 +2,7 @@ "method": "PATCH", "path": "/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]/branches/main/roles/test-role", "q": { - "update_mask": "spec.membership_roles" + "update_mask": "spec" }, "body": { "spec": { diff --git a/acceptance/bundle/resources/postgres_roles/update/out.requests.restore.json b/acceptance/bundle/resources/postgres_roles/update/out.requests.restore.json index 198552d19ed..36884e60546 100644 --- a/acceptance/bundle/resources/postgres_roles/update/out.requests.restore.json +++ b/acceptance/bundle/resources/postgres_roles/update/out.requests.restore.json @@ -22,7 +22,7 @@ "method": "PATCH", "path": "/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]/branches/main/roles/test-role", "q": { - "update_mask": "spec.attributes.createdb" + "update_mask": "spec" }, "body": { "spec": { diff --git a/acceptance/bundle/resources/postgres_roles/update/out.requests.update.json b/acceptance/bundle/resources/postgres_roles/update/out.requests.update.json index cdf033ce54f..7dc00f4a0fa 100644 --- a/acceptance/bundle/resources/postgres_roles/update/out.requests.update.json +++ b/acceptance/bundle/resources/postgres_roles/update/out.requests.update.json @@ -22,7 +22,7 @@ "method": "PATCH", "path": "/api/2.0/postgres/projects/test-pg-proj-[UNIQUE_NAME]/branches/main/roles/test-role", "q": { - "update_mask": "spec.attributes.createdb" + "update_mask": "spec" }, "body": { "spec": { diff --git a/bundle/direct/dresources/postgres_branch.go b/bundle/direct/dresources/postgres_branch.go index babdf14a0b3..17c737b9bc6 100644 --- a/bundle/direct/dresources/postgres_branch.go +++ b/bundle/direct/dresources/postgres_branch.go @@ -260,16 +260,12 @@ var branchOneofGroups = map[string]string{ } func (r *ResourcePostgresBranch) DoUpdate(ctx context.Context, id string, config *PostgresBranchState, entry *PlanEntry) (*PostgresBranchRemote, error) { - // Build the mask from the plan's change list and prefix with "spec." (the - // API expects paths relative to Branch). The API rejects mask entries - // that aren't also populated in the request body, and a wildcard "*" - // expands to nested attributes the body would have to set too — so we - // can't use a static all-fields mask. The change list naturally tracks - // what the user actually set, so the body and mask stay consistent. + // The change list only decides whether there is anything to send: the request + // masks the whole spec (see postgresSpecUpdateMask). fieldPaths := collectUpdatePathsWithPrefix(entry.Changes, "spec.", branchOneofGroups) // purge_on_delete is an input-only flag consulted at delete time; it is - // not a spec field. Strip it from the mask so toggling it between deploys + // not a spec field. Ignore it so toggling it between deploys // becomes a state-only refresh (the framework saves newState when this // returns nil error). fieldPaths = slices.DeleteFunc(fieldPaths, func(p string) bool { @@ -295,7 +291,7 @@ func (r *ResourcePostgresBranch) DoUpdate(ctx context.Context, id string, config }, Name: id, UpdateMask: fieldmask.FieldMask{ - Paths: fieldPaths, + Paths: postgresSpecUpdateMask, }, }) if err != nil { diff --git a/bundle/direct/dresources/postgres_database.go b/bundle/direct/dresources/postgres_database.go index 034c7532eac..bbffa08ef48 100644 --- a/bundle/direct/dresources/postgres_database.go +++ b/bundle/direct/dresources/postgres_database.go @@ -130,13 +130,7 @@ func (r *ResourcePostgresDatabase) DoCreate(ctx context.Context, config *Postgre return remote.Name, remote, nil } -func (r *ResourcePostgresDatabase) DoUpdate(ctx context.Context, id string, config *PostgresDatabaseState, entry *PlanEntry) (*PostgresDatabaseRemote, error) { - // Build update mask from fields that have action="update" in the changes map. - // This excludes immutable fields and fields that haven't changed. - // Prefix with "spec." because the API expects paths relative to the Database object, - // not relative to our flattened state type. - fieldPaths := collectUpdatePathsWithPrefix(entry.Changes, "spec.", nil) - +func (r *ResourcePostgresDatabase) DoUpdate(ctx context.Context, id string, config *PostgresDatabaseState, _ *PlanEntry) (*PostgresDatabaseRemote, error) { waiter, err := r.client.Postgres.UpdateDatabase(ctx, postgres.UpdateDatabaseRequest{ Database: postgres.Database{ Spec: &config.DatabaseDatabaseSpec, @@ -152,7 +146,7 @@ func (r *ResourcePostgresDatabase) DoUpdate(ctx context.Context, id string, conf }, Name: id, UpdateMask: fieldmask.FieldMask{ - Paths: fieldPaths, + Paths: postgresSpecUpdateMask, }, }) if err != nil { diff --git a/bundle/direct/dresources/postgres_endpoint.go b/bundle/direct/dresources/postgres_endpoint.go index 188cb44c216..d88ae276584 100644 --- a/bundle/direct/dresources/postgres_endpoint.go +++ b/bundle/direct/dresources/postgres_endpoint.go @@ -176,20 +176,7 @@ func (r *ResourcePostgresEndpoint) DoCreate(ctx context.Context, config *Postgre return remote.Name, remote, nil } -// no_suspension and suspend_timeout_duration are two sides of one oneof, which the API -// accepts in update_mask only under the group name; see branchOneofGroups. -var endpointOneofGroups = map[string]string{ - "no_suspension": "suspension", - "suspend_timeout_duration": "suspension", -} - -func (r *ResourcePostgresEndpoint) DoUpdate(ctx context.Context, id string, config *PostgresEndpointState, entry *PlanEntry) (*PostgresEndpointRemote, error) { - // Build update mask from fields that have action="update" in the changes map. - // This excludes immutable fields and fields that haven't changed. - // Prefix with "spec." because the API expects paths relative to the Endpoint object, - // not relative to our flattened state type. - fieldPaths := collectUpdatePathsWithPrefix(entry.Changes, "spec.", endpointOneofGroups) - +func (r *ResourcePostgresEndpoint) DoUpdate(ctx context.Context, id string, config *PostgresEndpointState, _ *PlanEntry) (*PostgresEndpointRemote, error) { waiter, err := r.client.Postgres.UpdateEndpoint(ctx, postgres.UpdateEndpointRequest{ Endpoint: postgres.Endpoint{ Spec: &config.EndpointSpec, @@ -206,7 +193,7 @@ func (r *ResourcePostgresEndpoint) DoUpdate(ctx context.Context, id string, conf }, Name: id, UpdateMask: fieldmask.FieldMask{ - Paths: fieldPaths, + Paths: postgresSpecUpdateMask, }, }) if err != nil { diff --git a/bundle/direct/dresources/postgres_project.go b/bundle/direct/dresources/postgres_project.go index 8caf845b0e1..e4598e8863d 100644 --- a/bundle/direct/dresources/postgres_project.go +++ b/bundle/direct/dresources/postgres_project.go @@ -209,16 +209,12 @@ var projectOneofGroups = map[string]string{ } func (r *ResourcePostgresProject) DoUpdate(ctx context.Context, id string, config *PostgresProjectState, entry *PlanEntry) (*PostgresProjectRemote, error) { - // Build the mask from the plan's change list and prefix with "spec." (the - // API expects paths relative to Project). The API rejects mask entries - // that aren't also populated in the request body, and a wildcard "*" - // expands to nested attributes the body would have to set too — so we - // can't use a static all-fields mask. The change list naturally tracks - // what the user actually set, so the body and mask stay consistent. + // The change list only decides whether there is anything to send: the request + // masks the whole spec (see postgresSpecUpdateMask). fieldPaths := collectUpdatePathsWithPrefix(entry.Changes, "spec.", projectOneofGroups) // purge_on_delete is an input-only flag consulted at delete time; it is - // not a spec field. Strip it from the mask so toggling it between deploys + // not a spec field. Ignore it so toggling it between deploys // becomes a state-only refresh (the framework saves newState when this // returns nil error). fieldPaths = slices.DeleteFunc(fieldPaths, func(p string) bool { @@ -247,7 +243,7 @@ func (r *ResourcePostgresProject) DoUpdate(ctx context.Context, id string, confi }, Name: id, UpdateMask: fieldmask.FieldMask{ - Paths: fieldPaths, + Paths: postgresSpecUpdateMask, }, }) if err != nil { diff --git a/bundle/direct/dresources/postgres_role.go b/bundle/direct/dresources/postgres_role.go index 3e630fa95d7..a065c7821ae 100644 --- a/bundle/direct/dresources/postgres_role.go +++ b/bundle/direct/dresources/postgres_role.go @@ -200,12 +200,7 @@ func (r *ResourcePostgresRole) recoverFailedCreate(ctx context.Context, req post }, createErr) } -func (r *ResourcePostgresRole) DoUpdate(ctx context.Context, id string, config *PostgresRoleState, entry *PlanEntry) (*PostgresRoleRemote, error) { - // Build update mask from fields that have action="update" in the changes map. - // Prefix with "spec." because the API expects paths relative to the Role - // object, not relative to our flattened state type. - fieldPaths := collectUpdatePathsWithPrefix(entry.Changes, "spec.", nil) - +func (r *ResourcePostgresRole) DoUpdate(ctx context.Context, id string, config *PostgresRoleState, _ *PlanEntry) (*PostgresRoleRemote, error) { waiter, err := r.client.Postgres.UpdateRole(ctx, postgres.UpdateRoleRequest{ Name: id, Role: postgres.Role{ @@ -221,7 +216,7 @@ func (r *ResourcePostgresRole) DoUpdate(ctx context.Context, id string, config * ForceSendFields: nil, }, UpdateMask: fieldmask.FieldMask{ - Paths: fieldPaths, + Paths: postgresSpecUpdateMask, }, }) if err != nil { diff --git a/bundle/direct/dresources/postgres_wait.go b/bundle/direct/dresources/postgres_wait.go index c902356cabf..cadc2d02f77 100644 --- a/bundle/direct/dresources/postgres_wait.go +++ b/bundle/direct/dresources/postgres_wait.go @@ -7,6 +7,14 @@ import ( "github.com/databricks/databricks-sdk-go/experimental/api" ) +// postgresSpecUpdateMask masks the whole spec on update, with the full desired spec as +// the body. Probed against a real workspace on 2026-11-19, the API then applies what the +// body carries and keeps the stored value of most fields the body omits, so a field +// removed from the config usually keeps its last value. A field mask per changed path +// is rejected instead when that path's value is omitted ("is in update_mask but not +// provided in request"). +var postgresSpecUpdateMask = []string{"spec"} + // waitCreateOperation polls a postgres create operation, polling again when a poll fails with a // transient error (observed: 500 INTERNAL_ERROR and inactivity timeouts on GET .../operations/...). // The create request was already accepted, so polling again cannot create a second resource, diff --git a/libs/testserver/postgres_spec.go b/libs/testserver/postgres_spec.go index 7000bfcdad5..e7aa4ca354e 100644 --- a/libs/testserver/postgres_spec.go +++ b/libs/testserver/postgres_spec.go @@ -2,6 +2,7 @@ package testserver import ( "encoding/json" + "maps" "slices" "strings" ) @@ -10,8 +11,9 @@ import ( // update. Since 2026-11-12 the API returns spec as stored for projects, branches, // endpoints, databases and roles (catalogs, data APIs and synced tables were not // observed to change and still return status only): the fields the -// caller set (a field masked but absent from the body keeps its previous value, except -// a repeated field, which is cleared), +// caller set (under a field mask, a field masked but absent from the body keeps its +// previous value, except a repeated field, which is cleared; the whole-spec mask +// replaces the echoed spec with the body), // minus inputOnly fields that are consulted once and never echoed. Defaults the // backend materializes appear only in status, not in spec. // @@ -45,7 +47,10 @@ func echoedSpec[T any](stored *T, body []byte, mask string, oneofGroups map[stri for path := range strings.SplitSeq(mask, ",") { path = strings.TrimSpace(path) if path == "spec" || path == "*" { - mergeSpecMap(result, bodySpec) + // The whole-spec mask replaces the echoed spec with the body, even though the + // fields it omits keep their value in status (probed against a real workspace + // on 2026-11-19). + result = maps.Clone(bodySpec) continue } rel, ok := strings.CutPrefix(path, "spec.") @@ -128,19 +133,6 @@ func specPathParts(path string) []string { return strings.Split(strings.TrimPrefix(path, "spec."), ".") } -// mergeSpecMap deep-merges src into dst; keys absent from src keep their dst value. -func mergeSpecMap(dst, src map[string]any) { - for k, v := range src { - srcChild, srcIsMap := v.(map[string]any) - dstChild, dstIsMap := dst[k].(map[string]any) - if srcIsMap && dstIsMap { - mergeSpecMap(dstChild, srcChild) - continue - } - dst[k] = v - } -} - // specMapGet returns the value at parts in m, if present. func specMapGet(m map[string]any, parts []string) (any, bool) { var node any = m diff --git a/libs/testserver/postgres_spec_test.go b/libs/testserver/postgres_spec_test.go index 5262de35fe4..5a9134a4fce 100644 --- a/libs/testserver/postgres_spec_test.go +++ b/libs/testserver/postgres_spec_test.go @@ -31,11 +31,19 @@ func TestEchoedSpecUpdateOneofReplacesSibling(t *testing.T) { assert.True(t, spec.IsProtected, "fields outside the mask keep their stored value") } -func TestEchoedSpecUpdateMaskedButAbsentKeepsPrevious(t *testing.T) { +func TestEchoedSpecUpdateWholeSpecReplacesEcho(t *testing.T) { stored := echoedSpec[postgres.ProjectSpec](nil, []byte(`{"spec":{"display_name":"a","history_retention_duration":"604800s"}}`), "", projectOneofGroups) spec := echoedSpec(stored, []byte(`{"spec":{"display_name":"b"}}`), "spec", projectOneofGroups) require.NotNil(t, spec) assert.Equal(t, "b", spec.DisplayName) + assert.Nil(t, spec.HistoryRetentionDuration, "the echo drops a field the body omits, though status keeps it") +} + +func TestEchoedSpecUpdateMaskedButAbsentKeepsPrevious(t *testing.T) { + stored := echoedSpec[postgres.ProjectSpec](nil, []byte(`{"spec":{"display_name":"a","history_retention_duration":"604800s"}}`), "", projectOneofGroups) + spec := echoedSpec(stored, []byte(`{"spec":{"display_name":"b"}}`), "spec.display_name,spec.history_retention_duration", projectOneofGroups) + require.NotNil(t, spec) + assert.Equal(t, "b", spec.DisplayName) require.NotNil(t, spec.HistoryRetentionDuration) }