Skip to content

Fix permissions: [] to add default IS_OWNER instead of being treated as absent - #6046

Open
denik wants to merge 3 commits into
mainfrom
denik/permissions-empty-list-fix
Open

Fix permissions: [] to add default IS_OWNER instead of being treated as absent#6046
denik wants to merge 3 commits into
mainfrom
denik/permissions-empty-list-fix

Conversation

@denik

@denik denik commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Why

An explicit permissions: [] on a resource was collapsed to nil by
ApplyBundlePermissions and then skipped by FixPermissions, so it never got
the default IS_OWNER for the current user — it behaved as if the block were
absent. The jobs/pipelines empty_list acceptance fixtures documented this as
a known bug.

Changes

Track whether the permissions key was present and only collapse to nil when
it was absent. An explicit empty list now survives as an empty sequence, so
FixPermissions adds IS_OWNER, matching both a non-empty list and Terraform.

Also handles the grants counterpart. Grants have no default owner, so
grants: [] grants nothing, but the direct engine used to create a grants
node and fire a no-op PATCH on first deploy while terraform emitted nothing.
Skip the node when the grants list is empty and absent from state; when it is
already in state the node is kept, so removing all grants with grants: []
still plans an update and emits the removal PATCH.

ApplyBundlePermissions collapsed an empty permissions slice to nil, which
FixPermissions then skipped (AsSequence fails on nil), so an explicit
permissions: [] never got the default IS_OWNER for the current user. It
was indistinguishable from omitting the block entirely.

Track whether the permissions key was present and only collapse to nil
when it was absent. An explicit empty list now survives as an empty
sequence, so FixPermissions adds IS_OWNER, matching both a non-empty list
and Terraform. The jobs/pipelines empty_list fixtures documented this as
a known bug; that comment is now resolved.

Co-authored-by: Isaac
@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Approval status: pending

/acceptance/bundle/ - needs approval

32 files changed
Suggested: @janniklasrose
Also eligible: @pietern, @shreyas-goenka, @andrewnester, @lennartkats-db, @anton-107

/bundle/ - needs approval

Files: bundle/config/mutator/resourcemutator/apply_bundle_permissions.go, bundle/direct/bundle_plan.go
Suggested: @janniklasrose
Also eligible: @pietern, @shreyas-goenka, @andrewnester, @lennartkats-db, @anton-107

General files (require maintainer)

Files: .nextchanges/bundles/grants-empty-list-noop.md, .nextchanges/bundles/permissions-empty-list.md
Based on git history:

  • @janniklasrose -- recent work in .nextchanges/bundles/, bundle/direct/, bundle/config/mutator/resourcemutator/

Any maintainer (@andrewnester, @anton-107, @pietern, @shreyas-goenka, @simonfaltum, @renaudhartert-db, @janniklasrose, @lennartkats-db) can approve all areas.
See OWNERS for ownership rules.

@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 652b793

Run: 30281684653

Env ❌​FAIL 🟨​KNOWN 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
❌​ aws linux 6 1 3 4 319 1061 7:54
❌​ aws windows 6 1 3 4 321 1059 12:12
💚​ azure linux 4 4 325 1060 6:05
❌​ azure windows 6 1 3 4 321 1058 8:15
💚​ gcp linux 1 5 324 1062 6:56
💚​ gcp windows 1 5 326 1060 8:34
14 interesting tests: 6 FAIL, 4 SKIP, 3 RECOVERED, 1 KNOWN
Test Name aws linux aws windows azure linux azure windows gcp linux gcp windows
🟨​ TestAccept 🟨​K 🟨​K 💚​R 🟨​K 💚​R 💚​R
❌​ TestAccept/bundle/deploy/mlops-stacks ❌​F ❌​F ✅​p ❌​F ✅​p ✅​p
❌​ TestAccept/bundle/deploy/mlops-stacks/DATABRICKS_BUNDLE_ENGINE=direct ❌​F ❌​F ✅​p ❌​F ✅​p ✅​p
❌​ TestAccept/bundle/deploy/mlops-stacks/DATABRICKS_BUNDLE_ENGINE=terraform ❌​F ❌​F ✅​p ❌​F ✅​p ✅​p
🙈​ TestAccept/bundle/invariant/no_drift 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
❌​ TestAccept/bundle/resources/grants/schemas/empty_list ❌​F ❌​F ✅​p ❌​F ✅​p ✅​p
❌​ TestAccept/bundle/resources/grants/schemas/empty_list/DATABRICKS_BUNDLE_ENGINE=direct ❌​F ❌​F ✅​p ❌​F ✅​p ✅​p
❌​ TestAccept/bundle/resources/grants/schemas/empty_list/DATABRICKS_BUNDLE_ENGINE=terraform ❌​F ❌​F ✅​p ❌​F ✅​p ✅​p
🙈​ TestAccept/bundle/resources/vector_search_endpoints/drift/recreated_same_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_indexes/recreate/embedding_dimension 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/ssh/connection 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
💚​ TestFetchRepositoryInfoAPI_FromRepo 💚​R 💚​R 💚​R 💚​R 🙈​S 🙈​S
💚​ TestFetchRepositoryInfoAPI_FromRepo/root 💚​R 💚​R 💚​R 💚​R
💚​ TestFetchRepositoryInfoAPI_FromRepo/subdir 💚​R 💚​R 💚​R 💚​R
Top 4 slowest tests (at least 2 minutes):
duration env testname
6:55 gcp windows TestAccept
2:48 gcp linux TestAccept
2:47 azure linux TestAccept
2:17 gcp linux TestAccept/bundle/resources/grants/schemas/empty_list/DATABRICKS_BUNDLE_ENGINE=terraform

denik added 2 commits July 24, 2026 17:43
Grants have no default owner (no FixPermissions analog), so grants: [] grants
nothing rather than injecting a principal, and validate shows [] vs null for
absent. The test also records a direct-vs-terraform divergence on create:
direct emits a no-op PATCH with an empty body, terraform emits no request.

Co-authored-by: Isaac
When a resource was created with grants: [] and no prior state, the direct
engine created a grants node and fired a PATCH with no changes, while
terraform emitted nothing. Skip the node in that case. The node is still
kept when it exists in state, so removing all grants with grants: [] still
plans an update and emits the removal PATCH.

Co-authored-by: Isaac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants