Skip to content

Stop rejecting unknown grant privileges in validate and PyDABs - #7315

Merged
janniklasrose merged 4 commits into
mainfrom
janniklasrose/stop-warning-and-erroring-on-grant-privilege-enum
Nov 3, 2026
Merged

janniklasrose merged 4 commits into
mainfrom
janniklasrose/stop-warning-and-erroring-on-grant-privilege-enum

Conversation

@janniklasrose

Copy link
Copy Markdown
Member

Changes

The platform accepts grant privileges that the SDK's catalog.Privilege enum does not yet list (e.g. CREATE_SECRET, see #6770). The enum values flow from the OpenAPI spec into the SDK and from there into two CLI consumers, both of which rejected platform-valid values:

  • bundle validate warned, and --strict errored, because the enum validation allowlist (bundle/internal/validation/generated/enum_fields.go) is reflected from the SDK's Values().
  • PyDABs generated a strict class Privilege(Enum) and _transform raised ValueError on unknown strings.

This PR relaxes both while keeping the enum (and completion) in the JSON schema and PyDABs:

  • bundle/internal/validation/enum.go: exclude catalog.Privilege from the generator, so no resources.*.grants[*].privileges[*] pattern is checked. Regenerated with ./task generate-validation; the diff is exactly the 10 privilege entries.
  • python/codegen/codegen/generated_enum.py: new OPEN_ENUMS = {"catalog.Privilege"}. Open enums are generated with a _missing_ hook that turns unknown strings into pseudo-members cached in _value2member_map_ (the stdlib Flag pattern, so identity/equality and from_dict → as_dict round-trips hold), and PrivilegeParam gains | str so the dict form type-checks for unknown values. main.py fails if an OPEN_ENUMS key is not a known schema. Regenerated with ./task pydabs-codegen; the diff is exactly the 10 */_models/privilege.py modules.

Deploy was never affected: catalog.Privilege is type Privilege string in Go, so unknown values already passed through both engines.

Why not wait for an SDK bump?

The allowlist is only as current as the SDK, which lags the platform by design. Privileges are an area where the platform adds values frequently, so an SDK bump fixes today's gap and reopens tomorrow's. Dropping the client-side check for this one field removes the recurring breakage; the general enum validation stays in place for everything else.

Tests

  • acceptance/bundle/validate/enum: added a schema grant with INVALID_PRIVILEGE; the regenerated output shows no warning for it while the other enum warnings still fire.
  • python/codegen/codegen_tests/test_generated_enum.py: open vs closed enum code generation.
  • python/databricks_tests/core/test_open_enum.py: known value, unknown value accepted, cached identity, non-string rejected, dict round-trip.
  • Full PyDABs suite (491 passed), pyright clean, Sphinx docs build with -W.

This pull request and its description were written by Isaac.

janniklasrose and others added 2 commits November 3, 2026 13:28
The platform accepts grant privileges that the SDK's catalog.Privilege
enum does not yet list (e.g. CREATE_SECRET, see #6770). Both consumers of
that enum rejected them:

- `bundle validate` warned, and `--strict` errored, because the enum
  validation allowlist is reflected from the SDK's Values().
- PyDABs generated a strict `Privilege(Enum)` and `_transform` raised
  ValueError on unknown strings.

Exclude catalog.Privilege from the validation generator so no
`grants[*].privileges[*]` pattern is checked, and generate Privilege as
an open enum in PyDABs: a `_missing_` hook turns unknown strings into
cached pseudo-members and `PrivilegeParam` gains `| str`. The JSON schema
keeps the enum, so completion is unchanged in both.

Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
@github-actions github-actions Bot added DABs DABs related issues PyDABs labels Nov 3, 2026
janniklasrose and others added 2 commits November 3, 2026 13:58
Move the schema grant in the enum acceptance test below the jobs so
output.txt no longer differs from main by line numbers only. Drop the
"platform adds privileges faster" wording from the changelog fragment and
the issue link from the PyDABs codegen comment.

Co-authored-by: Isaac <no-reply@databricks.com>
…nt-privilege-enum

Resolved bundle/internal/validation/generated/enum_fields.go by taking
main and re-running ./task generate-validation. Re-ran ./task
pydabs-codegen; it produced no further changes.

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

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Commit: 270275e2c | Workflow run

Regression test report

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

2 tests: regression=2 unreleased=0 coverage=0 failing=0

test branch main (c0e1859) latest (v1.23.0)
TestAccept/bundle/validate/enum/DMS= ✅ ❌ ❌
TestAccept/bundle/validate/enum/DMS=true ✅ ❌ ❌
TestAccept/bundle/validate/enum/DMS=: branch ✅ | main (c0e1859) ❌ | latest (v1.23.0) ❌

main (c0e1859):

acceptance_test.go:1342: Diff:
        --- bundle/validate/enum/output.txt
        +++ /tmp/TestAcceptbundlevalidateenumDMS=2882081111/002/output.txt
        @@ -16,6 +16,10 @@
           at resources.jobs.my_job_invalid.tasks[0].new_cluster.data_security_mode
           in databricks.yml:54:33
         
        +Warning: invalid value "INVALID_PRIVILEGE" for enum field. Valid values are [ACCESS ALL_PRIVILEGES APPLY_TAG BROWSE CREATE CREATE_CATALOG CREATE_CLEAN_ROOM CREATE_CONNECTION CREATE_EXTERNAL_LOCATION CREATE_EXTERNAL_TABLE CREATE_EXTERNAL_VOLUME CREATE_FEATURE CREATE_FOREIGN_CATALOG CREATE_FOREIGN_SECURABLE CREATE_FUNCTION CREATE_MANAGED_STORAGE CREATE_MATERIALIZED_VIEW CREATE_MODEL CREATE_PROVIDER CREATE_RECIPIENT CREATE_SCHEMA CREATE_SERVICE_CREDENTIAL CREATE_SHARE CREATE_STORAGE_CREDENTIAL CREATE_TABLE CREATE_VIEW CREATE_VOLUME EXECUTE EXECUTE_CLEAN_ROOM_TASK EXTERNAL_USE_LOCATION EXTERNAL_USE_SCHEMA MANAGE MANAGE_ALLOWLIST MODIFY MODIFY_CLEAN_ROOM READ_FEATURE READ_FILES READ_METADATA READ_PRIVATE_FILES READ_VOLUME REFRESH SELECT SET_SHARE_PERMISSION USAGE USE_CATALOG USE_CONNECTION USE_MARKETPLACE_ASSETS USE_PROVIDER USE_RECIPIENT USE_SCHEMA USE_SHARE WRITE_FILES WRITE_PRIVATE_FILES WRITE_VOLUME]
        +  at resources.schemas.my_schema.grants[0].privileges[0]
        +  in databricks.yml:70:15
        +
         Warning: invalid value "INVALID_SOURCE" for enum field. Valid values are [GIT WORKSPACE]
           at resources.jobs.my_job_invalid.tasks[0].notebook_task.source
           in databricks.yml:49:21
        @@ -34,4 +38,4 @@
           User: [USERNAME]
           Path: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default
         
        -Found 7 warnings
        +Found 8 warnings

latest (v1.23.0):

acceptance_test.go:1342: Diff:
        --- bundle/validate/enum/output.txt
        +++ /tmp/TestAcceptbundlevalidateenumDMS=2413694883/002/output.txt
        @@ -16,6 +16,10 @@
           at resources.jobs.my_job_invalid.tasks[0].new_cluster.data_security_mode
           in databricks.yml:54:33
         
        +Warning: invalid value "INVALID_PRIVILEGE" for enum field. Valid values are [ACCESS ALL_PRIVILEGES APPLY_TAG BROWSE CREATE CREATE_CATALOG CREATE_CLEAN_ROOM CREATE_CONNECTION CREATE_EXTERNAL_LOCATION CREATE_EXTERNAL_TABLE CREATE_EXTERNAL_VOLUME CREATE_FOREIGN_CATALOG CREATE_FOREIGN_SECURABLE CREATE_FUNCTION CREATE_MANAGED_STORAGE CREATE_MATERIALIZED_VIEW CREATE_MODEL CREATE_PROVIDER CREATE_RECIPIENT CREATE_SCHEMA CREATE_SERVICE_CREDENTIAL CREATE_SHARE CREATE_STORAGE_CREDENTIAL CREATE_TABLE CREATE_VIEW CREATE_VOLUME EXECUTE EXECUTE_CLEAN_ROOM_TASK EXTERNAL_USE_LOCATION EXTERNAL_USE_SCHEMA MANAGE MANAGE_ALLOWLIST MODIFY MODIFY_CLEAN_ROOM READ_FILES READ_METADATA READ_PRIVATE_FILES READ_VOLUME REFRESH SELECT SET_SHARE_PERMISSION USAGE USE_CATALOG USE_CONNECTION USE_MARKETPLACE_ASSETS USE_PROVIDER USE_RECIPIENT USE_SCHEMA USE_SHARE WRITE_FILES WRITE_PRIVATE_FILES WRITE_VOLUME]
        +  at resources.schemas.my_schema.grants[0].privileges[0]
        +  in databricks.yml:70:15
        +
         Warning: invalid value "INVALID_SOURCE" for enum field. Valid values are [GIT WORKSPACE]
           at resources.jobs.my_job_invalid.tasks[0].notebook_task.source
           in databricks.yml:49:21
        @@ -34,4 +38,4 @@
           User: [USERNAME]
           Path: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default
         
        -Found 7 warnings
        +Found 8 warnings
TestAccept/bundle/validate/enum/DMS=true: branch ✅ | main (c0e1859) ❌ | latest (v1.23.0) ❌

main (c0e1859):

acceptance_test.go:1342: Diff:
        --- bundle/validate/enum/output.txt
        +++ /tmp/TestAcceptbundlevalidateenumDMS=true1454202877/002/output.txt
        @@ -16,6 +16,10 @@
           at resources.jobs.my_job_invalid.tasks[0].new_cluster.data_security_mode
           in databricks.yml:54:33
         
        +Warning: invalid value "INVALID_PRIVILEGE" for enum field. Valid values are [ACCESS ALL_PRIVILEGES APPLY_TAG BROWSE CREATE CREATE_CATALOG CREATE_CLEAN_ROOM CREATE_CONNECTION CREATE_EXTERNAL_LOCATION CREATE_EXTERNAL_TABLE CREATE_EXTERNAL_VOLUME CREATE_FEATURE CREATE_FOREIGN_CATALOG CREATE_FOREIGN_SECURABLE CREATE_FUNCTION CREATE_MANAGED_STORAGE CREATE_MATERIALIZED_VIEW CREATE_MODEL CREATE_PROVIDER CREATE_RECIPIENT CREATE_SCHEMA CREATE_SERVICE_CREDENTIAL CREATE_SHARE CREATE_STORAGE_CREDENTIAL CREATE_TABLE CREATE_VIEW CREATE_VOLUME EXECUTE EXECUTE_CLEAN_ROOM_TASK EXTERNAL_USE_LOCATION EXTERNAL_USE_SCHEMA MANAGE MANAGE_ALLOWLIST MODIFY MODIFY_CLEAN_ROOM READ_FEATURE READ_FILES READ_METADATA READ_PRIVATE_FILES READ_VOLUME REFRESH SELECT SET_SHARE_PERMISSION USAGE USE_CATALOG USE_CONNECTION USE_MARKETPLACE_ASSETS USE_PROVIDER USE_RECIPIENT USE_SCHEMA USE_SHARE WRITE_FILES WRITE_PRIVATE_FILES WRITE_VOLUME]
        +  at resources.schemas.my_schema.grants[0].privileges[0]
        +  in databricks.yml:70:15
        +
         Warning: invalid value "INVALID_SOURCE" for enum field. Valid values are [GIT WORKSPACE]
           at resources.jobs.my_job_invalid.tasks[0].notebook_task.source
           in databricks.yml:49:21
        @@ -34,4 +38,4 @@
           User: [USERNAME]
           Path: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default
         
        -Found 7 warnings
        +Found 8 warnings
        
FAIL

latest (v1.23.0):

acceptance_test.go:1342: Diff:
        --- bundle/validate/enum/output.txt
        +++ /tmp/TestAcceptbundlevalidateenumDMS=true3388785167/002/output.txt
        @@ -16,6 +16,10 @@
           at resources.jobs.my_job_invalid.tasks[0].new_cluster.data_security_mode
           in databricks.yml:54:33
         
        +Warning: invalid value "INVALID_PRIVILEGE" for enum field. Valid values are [ACCESS ALL_PRIVILEGES APPLY_TAG BROWSE CREATE CREATE_CATALOG CREATE_CLEAN_ROOM CREATE_CONNECTION CREATE_EXTERNAL_LOCATION CREATE_EXTERNAL_TABLE CREATE_EXTERNAL_VOLUME CREATE_FOREIGN_CATALOG CREATE_FOREIGN_SECURABLE CREATE_FUNCTION CREATE_MANAGED_STORAGE CREATE_MATERIALIZED_VIEW CREATE_MODEL CREATE_PROVIDER CREATE_RECIPIENT CREATE_SCHEMA CREATE_SERVICE_CREDENTIAL CREATE_SHARE CREATE_STORAGE_CREDENTIAL CREATE_TABLE CREATE_VIEW CREATE_VOLUME EXECUTE EXECUTE_CLEAN_ROOM_TASK EXTERNAL_USE_LOCATION EXTERNAL_USE_SCHEMA MANAGE MANAGE_ALLOWLIST MODIFY MODIFY_CLEAN_ROOM READ_FILES READ_METADATA READ_PRIVATE_FILES READ_VOLUME REFRESH SELECT SET_SHARE_PERMISSION USAGE USE_CATALOG USE_CONNECTION USE_MARKETPLACE_ASSETS USE_PROVIDER USE_RECIPIENT USE_SCHEMA USE_SHARE WRITE_FILES WRITE_PRIVATE_FILES WRITE_VOLUME]
        +  at resources.schemas.my_schema.grants[0].privileges[0]
        +  in databricks.yml:70:15
        +
         Warning: invalid value "INVALID_SOURCE" for enum field. Valid values are [GIT WORKSPACE]
           at resources.jobs.my_job_invalid.tasks[0].notebook_task.source
           in databricks.yml:49:21
        @@ -34,4 +38,4 @@
           User: [USERNAME]
           Path: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default
         
        -Found 7 warnings
        +Found 8 warnings
        
FAIL

@eng-dev-ecosystem-bot

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 270275e

Run: 41652236148

Env 🔄​flaky ✅​pass 🙈​skip Time
✅​ aws linux-2core-8gb 271 16 10:44
✅​ aws-windows-latest-4core-16gb 273 14 5:53
🔄​ azure linux-2core-8gb 1 269 16 9:54
✅​ azure-windows-latest-4core-16gb 272 14 5:22
✅​ gcp linux-2core-8gb 271 16 9:54
✅​ gcp-windows-latest-4core-16gb 273 14 4:34
Test Name azure linux-2core-8gb
🔄​ TestSyncIncrementalSyncFileToPythonNotebook 🔄​f
Top 6 slowest tests (at least 2 minutes):
duration env testname
4:12 azure linux-2core-8gb TestAccept
4:08 aws linux-2core-8gb TestAccept
4:08 gcp linux-2core-8gb TestAccept
3:04 gcp-windows-latest-4core-16gb TestFilerWorkspaceFilesExtensionsReadDir
2:53 aws-windows-latest-4core-16gb TestFilerWorkspaceFilesExtensionsReadDir
2:09 gcp linux-2core-8gb TestImportDirWithOverwriteFlag

@janniklasrose
janniklasrose marked this pull request as ready for review November 3, 2026 14:37
@janniklasrose
janniklasrose requested review from a team as code owners November 3, 2026 14:37
@janniklasrose
janniklasrose added this pull request to the merge queue Nov 3, 2026
Merged via the queue into main with commit a11ca9f Nov 3, 2026
32 checks passed
@janniklasrose
janniklasrose deleted the janniklasrose/stop-warning-and-erroring-on-grant-privilege-enum branch November 3, 2026 15:43
deco-sdk-tagging Bot added a commit that referenced this pull request Nov 4, 2026
## Release v1.24.0

### Notable Changes

 * A variable used as the value of a secret is now sensitive: referencing it from any other field, such as a job parameter or a secret's `comment`, is an error because the value would be used in plain text. Mark other secret-holding variables with `sensitive: true` to get the same protection. ([#7288](#7288))

### CLI

 * Fix `databricks auth login` and `databricks configure` overwriting the parent profile's host and token when saving a profile with a dotted name such as `team.prod` next to an existing `[team]`. ([#7266](#7266))
 * `databricks auth login` and `databricks auth token` now reject the name of an existing profile after "Create a new profile" instead of logging in to that profile. ([#7196](#7196))
 * `databricks auth login` and `databricks auth token` now reject a host that is not a URL with a hostname, such as `/`, `?o=123` or `https://`, instead of falling back to `DATABRICKS_HOST` or failing later. An empty host after "Enter a host URL manually" in the login profile picker no longer starts discovery login. ([#7195](#7195))
 * Prompts that validate their input, such as the `databricks configure` host prompt, no longer open with a red cross before anything is typed. ([#7314](#7314))
 * `databricks ssh connect` now documents `--environment-version` for choosing the serverless environment version, starts a separate default-named server for each version, and rejects the flag together with `--cluster`. Default connection names also include the environment version in their hash, so the default name when `--environment-version` is not specified changes with this release. Configuration associated with the old connection name (secret scope, SSH keys and known hosts in your local `.databricks` folder) will no longer be used and can be safely removed. ([#7310](#7310))

### AI Runtime

 * Show workspace-supported accelerator types in `databricks air run -h config.compute.accelerator_type`. ([#7275](#7275))
 * `air list` now reports `No active runs found.` for an empty active-only result. ([#7276](#7276))
 * Stop printing a retry notice on every `air run --watch`; retries are still reported when they happen. ([#7270](#7270))

### Bundles

 * Fix `bundle plan` reporting an update to an app's `config.env` values on every run, which also redeployed the app on every `bundle deploy`. The Apps API returns environment variable names only, so `value` and `value_from` are no longer compared against the remote deployment. ([#7326](#7326))
 * Add the `data_quality_monitors` resource for data quality monitors on Unity Catalog schemas and tables (direct engine only). ([#7094](#7094))
 * `bundle deploy` now asks for confirmation before recreating or deleting a Feature View, and `bundle deploy` and `bundle destroy` warn that FeatureSpecs using a Feature View are not checked. ([#7164](#7164))
 * Accept grant `privileges` values that the SDK enum does not list yet: `bundle validate` no longer warns (or errors under `--strict`) on them, and the PyDABs `Privilege` enum accepts unknown strings instead of raising. The JSON schema and PyDABs still advertise the known values for completion. ([#7315](#7315))
 * Add the `materialization_sets` resource, which materializes Feature Store Feature Views to offline and online stores. ([#7164](#7164))
 * Detect notebooks with the same rule as the workspace: a `.py`, `.sql`, `.scala` or `.r` file is a notebook when its first line contains `Databricks notebook source`, for example after a byte order mark. Previously such a file was tracked as a plain file, so removing it locally left the remote notebook behind. ([#7290](#7290))
 * Add `sensitive: true` for bundle variables. A variable used as the value of a secret is sensitive by default. `bundle validate -o json` redacts only sensitive variables instead of every string variable, and a sensitive variable can only be referenced from a sensitive resource field (such as a secret's `value`) or from another sensitive variable. ([#7288](#7288))

### Dependency Updates

 * Bump dependencies with known vulnerabilities. ([#7305](#7305))
 * Bump dependencies with known vulnerabilities. ([#7327](#7327))
 * Update the Go SDK to [v0.191.1](https://github.com/databricks/databricks-sdk-go/releases/tag/v0.191.1). ([#7277](#7277))
 * Update the Go SDK to [v0.193.0](https://github.com/databricks/databricks-sdk-go/releases/tag/v0.193.0). ([#7303](#7303))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DABs DABs related issues PyDABs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants