Skip to content

Exclude entitlements from CurrentWorkspaceID Me probe#1681

Merged
rauchy merged 3 commits into
mainfrom
omer-lachish_data/deco-26714-current-workspace-id-attributes
May 22, 2026
Merged

Exclude entitlements from CurrentWorkspaceID Me probe#1681
rauchy merged 3 commits into
mainfrom
omer-lachish_data/deco-26714-current-workspace-id-attributes

Conversation

@rauchy

@rauchy rauchy commented May 15, 2026

Copy link
Copy Markdown
Contributor

This PR makes WorkspaceClient.CurrentWorkspaceID ask the SCIM server to skip the entitlements attribute on the underlying Me call.

Why

CurrentWorkspaceID issues a GET /api/2.0/preview/scim/v2/Me request and reads the X-Databricks-Org-Id response header to identify the workspace. The body of the response is discarded.

By default, however, the SCIM server computes the User.Entitlements field for /Me responses - and that computation scans every entitlement grant in the workspace, regardless of which user is calling. On workspaces with a lot of accumulated grants, that's a meaningful amount of server work for a value the SDK never looks at.

This change passes ?excludedAttributes=entitlements on the request so the server can skip the scan entirely. The endpoint already honors that query parameter today.

What changed

One option appended to the existing Do call:

httpclient.WithRequestData(map[string]string{"excludedAttributes": "entitlements"})

And a doc-comment line on CurrentWorkspaceID explaining the why.

Tests

New TestCurrentWorkspaceIDExcludesEntitlements stands up an httptest server, captures r.URL.RawQuery, and asserts it's excludedAttributes=entitlements. The two existing TestCurrentWorkspaceID* tests in this file already match on r.URL.Path, so they still pass.

@rauchy rauchy temporarily deployed to test-trigger-is May 15, 2026 07:41 — with GitHub Actions Inactive
@rauchy rauchy temporarily deployed to test-trigger-is May 15, 2026 07:42 — with GitHub Actions Inactive
@rauchy rauchy temporarily deployed to test-trigger-is May 15, 2026 07:42 — with GitHub Actions Inactive
CurrentWorkspaceID issues `GET /api/2.0/preview/scim/v2/Me` to read the
X-Databricks-Org-Id response header. The Me endpoint computes
User.Entitlements by default - a scan whose cost scales with the total
number of entitlement grants in the workspace - and CurrentWorkspaceID
never reads the body at all. Ask the server to skip the attribute.
@rauchy rauchy force-pushed the omer-lachish_data/deco-26714-current-workspace-id-attributes branch from b048fe1 to 4bd5abc Compare May 15, 2026 07:46
@rauchy rauchy temporarily deployed to test-trigger-is May 15, 2026 07:46 — with GitHub Actions Inactive
@rauchy rauchy temporarily deployed to test-trigger-is May 15, 2026 07:46 — with GitHub Actions Inactive
@rauchy rauchy requested a deployment to test-trigger-is May 15, 2026 07:46 — with GitHub Actions Abandoned
@rauchy rauchy requested a review from Divyansh-db May 21, 2026 09:44
@rauchy rauchy temporarily deployed to test-trigger-is May 22, 2026 08:50 — with GitHub Actions Inactive
@rauchy rauchy temporarily deployed to test-trigger-is May 22, 2026 08:52 — with GitHub Actions Inactive
@rauchy rauchy temporarily deployed to test-trigger-is May 22, 2026 08:52 — with GitHub Actions Inactive
@rauchy rauchy temporarily deployed to test-trigger-is May 22, 2026 08:53 — with GitHub Actions Inactive
@github-actions

Copy link
Copy Markdown

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/sdk-go

Inputs:

  • PR number: 1681
  • Commit SHA: ce52818d422101f52078aa3e7df2201b1365d413

Checks will be approved automatically on success.

@rauchy rauchy temporarily deployed to test-trigger-is May 22, 2026 08:53 — with GitHub Actions Inactive
@rauchy rauchy temporarily deployed to test-trigger-is May 22, 2026 08:54 — with GitHub Actions Inactive
@rauchy rauchy added this pull request to the merge queue May 22, 2026
Merged via the queue into main with commit fb01984 May 22, 2026
14 checks passed
@rauchy rauchy deleted the omer-lachish_data/deco-26714-current-workspace-id-attributes branch May 22, 2026 11:07
deco-sdk-tagging Bot added a commit that referenced this pull request May 25, 2026
## Release v0.137.0

### New Features and Improvements

* Honor the Vercel `AI_AGENT=<name>` env var as a secondary fallback for
  AI agent detection in the User-Agent header (after the agents.md
  `AGENT=<name>` standard). Unrecognized fallback values now pass through
  the User-Agent sanitized and length-capped at 64 chars instead of being
  coerced to `agent/unknown`, so versioned variants such as
  `claude-code_2-1-141_agent` surface as-is.

### Internal Changes

* Pass `excludedAttributes=entitlements` on the SCIM `/Me` request made by `WorkspaceClient.CurrentWorkspaceID` ([#1681](#1681)).

  `CurrentWorkspaceID` only reads the `X-Databricks-Org-Id` response header and discards the body, so it has no use for the `User.Entitlements` field. Skipping that attribute avoids an expensive `getEffectivePermissions` scan on the SCIM backend, which has caused incidents on workspaces with large grant counts.

### API Changes
* Add `Revert` method for [w.Lakeview](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/dashboards#LakeviewAPI) workspace-level service.
* Add `ParentPath` field for [dashboards.GenieUpdateSpaceRequest](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/dashboards#GenieUpdateSpaceRequest).
* Add `ComputeMaxInstances` and `ComputeMinInstances` fields for [apps.App](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/apps#App).
* Add `ComputeMaxInstances` and `ComputeMinInstances` fields for [apps.AppUpdate](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/apps#AppUpdate).
* Add `CronScheduleTrigger`, `StreamingMode` and `TableTrigger` fields for [ml.MaterializedFeature](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/ml#MaterializedFeature).
* Add `SyncedTableId` field for [postgres.SyncedTableSyncedTableStatus](https://pkg.go.dev/github.com/databricks/databricks-sdk-go/service/postgres#SyncedTableSyncedTableStatus).
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