Skip to content

acc: cover field removals on postgres resources against the real API - #7805

Open
denik wants to merge 3 commits into
mainfrom
denik/postgres-removal-tests
Open

denik wants to merge 3 commits into
mainfrom
denik/postgres-removal-tests

Conversation

@denik

@denik denik commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Changes

New bundle tests that remove a field from each postgres resource and record the deploy, the PATCH, the read-back and the following plan: project custom_tags (shrink, then remove), default_endpoint_settings.pg_settings key, enable_pg_native_login; endpoint settings.pg_settings key, disabled; branch is_protected; role attributes.createdb, membership_roles.

New raw-API factcheck postgres_projects/factcheck/clear_field: for each resource, clears a field by masking it with the field omitted, by masking spec with it omitted, and by masking spec with the zero value sent.

The testserver is updated to match what the real API returned for these requests: a masked repeated field the body omits is cleared, a masked map the body omits is kept, update_mask=spec keeps an omitted is_protected / disabled / role attribute, role updates reject a masked scalar with no value, and project/endpoint status reflect custom_tags, pg_settings and enable_pg_native_login.

Why

To see what changes if postgres resources switch to update_mask=spec (#7806), we need a baseline of what removals do today on a real workspace. Today: removing a list entry, a whole list or a map key works; removing a bool fails with 400 (is in update_mask but not provided in request), recorded as Badness.

The factcheck is meant for the Lakebase team: an omitted scalar cannot be cleared under either mask, and under spec an omitted repeated field is kept for project custom_tags but cleared for role membership_roles.

Tests

All new tests were generated against an AWS workspace and pass locally against the testserver.

This pull request and its description were written by Isaac.

Bundle tests for removing a field from each postgres resource, plus a raw-API
factcheck showing how each Update API clears a field under a field mask and
under update_mask=spec. The testserver now matches what the real API did on
2026-11-19 for these requests.

Co-authored-by: Isaac <no-reply@databricks.com>
@denik
denik requested review from a team as code owners November 19, 2026 13:54
@github-actions github-actions Bot added DABs DABs related issues test-only-fix PRs that update failing of flaky tests without changing CLI code. labels Nov 19, 2026
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Regression test report ✅

Commit: 7b219313e | Workflow run

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

17 tests: regression=0 unreleased=0 coverage=17 failing=0
test branch main (3442593) latest (v1.28.0)
TestAccept/bundle/resources/postgres_branches/remove_is_protected/DMS= ✅ ✅ ✅
TestAccept/bundle/resources/postgres_branches/remove_is_protected/DMS=true ✅ ✅ ✅
TestAccept/bundle/resources/postgres_endpoints/remove_disabled/DMS= ✅ ✅ ✅
TestAccept/bundle/resources/postgres_endpoints/remove_disabled/DMS=true ✅ ✅ ✅
TestAccept/bundle/resources/postgres_endpoints/remove_pg_settings_key/DMS= ✅ ✅ ✅
TestAccept/bundle/resources/postgres_endpoints/remove_pg_settings_key/DMS=true ✅ ✅ ✅
TestAccept/bundle/resources/postgres_projects/factcheck/clear_field ✅ ✅ ✅
TestAccept/bundle/resources/postgres_projects/remove_custom_tags/DMS= ✅ ✅ ✅
TestAccept/bundle/resources/postgres_projects/remove_custom_tags/DMS=true ✅ ✅ ✅
TestAccept/bundle/resources/postgres_projects/remove_default_pg_settings_key/DMS= ✅ ✅ ✅
TestAccept/bundle/resources/postgres_projects/remove_default_pg_settings_key/DMS=true ✅ ✅ ✅
TestAccept/bundle/resources/postgres_projects/remove_enable_pg_native_login/DMS= ✅ ✅ ✅
TestAccept/bundle/resources/postgres_projects/remove_enable_pg_native_login/DMS=true ✅ ✅ ✅
TestAccept/bundle/resources/postgres_roles/remove_attribute/DMS= ✅ ✅ ✅
TestAccept/bundle/resources/postgres_roles/remove_attribute/DMS=true ✅ ✅ ✅
TestAccept/bundle/resources/postgres_roles/remove_membership_roles/DMS= ✅ ✅ ✅
TestAccept/bundle/resources/postgres_roles/remove_membership_roles/DMS=true ✅ ✅ ✅

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

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

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: 7b21931

Run: 46423699764

Env 🔄​flaky 💚​RECOVERED ✅​pass 🙈​skip Time
💚​ aws linux-2core-8gb 1 115 6 5:27
💚​ aws-windows-latest-4core-16gb 1 115 6 7:08
💚​ azure linux-2core-8gb 1 115 6 4:49
💚​ azure-windows-latest-4core-16gb 1 115 6 6:39
💚​ gcp linux-2core-8gb 1 115 6 4:50
🔄​ gcp-windows-latest-4core-16gb 3 113 6 7:55
Test Name aws linux-2core-8gb aws-windows-latest-4core-16gb azure linux-2core-8gb azure-windows-latest-4core-16gb gcp linux-2core-8gb gcp-windows-latest-4core-16gb
🔄​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 🔄​f
🔄​ TestAccept/bundle/resources/postgres_projects/remove_custom_tags ✅​p ✅​p ✅​p ✅​p ✅​p 🔄​f
🔄​ TestAccept/bundle/resources/postgres_projects/remove_custom_tags/DMS=true ✅​p ✅​p ✅​p ✅​p ✅​p 🔄​f
Top 2 slowest tests (at least 2 minutes):
duration env testname
3:11 aws-windows-latest-4core-16gb TestAccept
2:45 azure-windows-latest-4core-16gb TestAccept

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

func maskApplies(mask string, body map[string]any, path string) bool {
for entry := range strings.SplitSeq(mask, ",") {
entry = strings.TrimSpace(entry)
if entry != path && !strings.HasPrefix(path, entry+".") {

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] maskApplies never matches * or an empty mask, so an update_mask=* update with is_protected: true leaves branch status unchanged while echoedSpec merges it into spec. Treat * like spec, as maskSetsGroup does?


// Map fields under spec. One named in update_mask but absent from the body is accepted
// and keeps the stored map (probed against a real workspace on 2026-11-19).
var postgresMapMaskPaths = []string{"spec.default_endpoint_settings.pg_settings", "spec.settings.pg_settings"}

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] No golden sends a masked pg_settings with the map omitted, since both map tests keep one key, so this skip never runs. Can a test remove the last key, or clear_field record that case?

// 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),
// caller set (a field masked but absent from the body keeps its previous value, except
// a repeated field, which is cleared),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[AI Generated] nit: Under update_mask=spec an omitted repeated field is kept (clear_field/output.txt:22, via mergeSpecMap), so "except a repeated field, which is cleared" overstates it. Say "a repeated field the mask names"?

Calls that always fail use musterr, calls that succeed run bare, and
best-effort cleanup uses `|| true`.

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

This branch has not been deployed

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

Labels

DABs DABs related issues test-only-fix PRs that update failing of flaky tests without changing CLI code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants