Skip to content

Resolve client host and credentials from one source#191

Draft
parthban-db wants to merge 1 commit into
mainfrom
parthban-db/stack/bugbash-bug5-client-config
Draft

Resolve client host and credentials from one source#191
parthban-db wants to merge 1 commit into
mainfrom
parthban-db/stack/bugbash-bug5-client-config

Conversation

@parthban-db
Copy link
Copy Markdown
Contributor

@parthban-db parthban-db commented Jun 3, 2026

🥞 Stacked PR

Use this link to review incremental changes.


Summary

Generated clients now resolve their host and credentials from one source via the new resolveClientConfig, so the profile travels with the host and the two can no longer drift apart. new XxxClient({}) no longer throws Host is required. and can fall back to a profile.

Why

Client config previously flowed through two independent paths: the constructor hard-required options.host, while transport.ts called defaultCredentials() with no arguments and independently loaded the default profile. A client built for host A could therefore silently authenticate with a token resolved for host B. Routing both through a single resolved config keeps the host and credentials bound to the same profile.

What changed

  • Adds @databricks/sdk-core/config exporting resolveClientConfig, which normalizes host, workspaceId, accountId, and profile into one config (new ./config package export).
  • ClientOptions gains an optional profile.
  • defaultCredentials accepts a profileName (resolved on first use) and a host overlaid onto the resolved profile, so credentials authenticate against the profile and host the client resolved.
  • Regenerates every client.ts to call resolveClientConfig and drop the Host is required. throw, and every transport.ts to thread profileName/host into defaultCredentials.
  • Diverges from the Go SDK, which resolves the full Config lazily via EnsureResolved; the synchronous TS constructor keeps the caller-supplied host while threading the profile name to credentials.
  • Pairs with universe generator PR #2026019, which emits the updated client.ts/transport.ts templates.

Validated: build, typecheck, lint, and Vitest unit tests for the new config and default-credentials modules pass.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 3, 2026

Please ensure that the NEXT_CHANGELOG.md file is updated with any relevant changes.
If this is not necessary for your PR, please include the following in your PR description:
NO_CHANGELOG=true
and rerun the job.

Client configuration previously flowed through two independent paths. The generated constructor hard-required options.host (throwing "Host is required."), so new PostgresClient({}) could never fall back to a profile. Separately, when no credentials were passed, transport.ts called defaultCredentials() with no arguments and independently loaded the default profile. A client built for host A could therefore silently authenticate with a token resolved for host B.

This adds @databricks/sdk-core/config exporting resolveClientConfig, which normalizes caller options (host, workspaceId, accountId, profile) into one config whose profile travels with the host. ClientOptions gains an optional profile. defaultCredentials now accepts a profileName to resolve on first use and a host overlaid onto the resolved profile, so credentials authenticate against the same profile and host the client resolved. Every client.ts and transport.ts is regenerated to call resolveClientConfig; new XxxClient({}) no longer throws.

This regen pairs with the universe generator PR ("[SDK-JS] Generate clients that resolve host and credentials from one source") that emits the updated client.ts/transport.ts templates.

This diverges slightly from the Go SDK, which resolves the full Config lazily on the request path via EnsureResolved; the synchronous TS constructor keeps host caller-supplied while threading the profile name to credentials to keep them coupled.

Co-authored-by: Isaac
@parthban-db parthban-db force-pushed the parthban-db/stack/bugbash-bug5-client-config branch from 5207cf7 to 5fe52fa Compare June 4, 2026 13:04
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.

1 participant