Skip to content

refactor(shared): relocate the Databricks SDK facade to shared - #534

Merged
MarioCadenas merged 3 commits into
mainfrom
feat/workspace-client-shared
Aug 14, 2026
Merged

refactor(shared): relocate the Databricks SDK facade to shared#534
MarioCadenas merged 3 commits into
mainfrom
feat/workspace-client-shared

Conversation

@MarioCadenas

Copy link
Copy Markdown
Collaborator

What

Moves the workspace-client facade from packages/appkit/src/workspace-client to packages/shared/src/workspace-client, so both appkit and the CLI (which lives in shared) reach @databricks/sdk-experimental through one sanctioned import site.

Why

Split out of the registry-CLI branch (feat/registry-cli) so this broadly-reaching relocation — it touches appkit's ~47 SDK-facade importers — can be reviewed and merged on its own, ahead of the feature work that depends on it.

Changes

  • shared/src/workspace-client/* — the facade (moved; git shows renames).
  • appkit/src/workspace-client/index.ts — now a thin re-export from shared/workspace-client; the 6 facade files are gone. Its importers are unchanged.
  • biome.jsonnoRestrictedImports SDK allow-list repointed to the new location.
  • shared/package.json — adds @databricks/sdk-experimental + a ./workspace-client export (tsdown entry added so it's emitted independently).
  • appkit/package.json — drops the now-unused direct SDK dep.
  • Adds a profile option to WorkspaceClientOptions.

Pure relocation — no behavior change beyond the additive profile option.

Verification

  • shared + appkit typecheck clean
  • workspace-client tests pass (5)
  • appkit build clean (attw + publint: no issues)
  • biome clean; pnpm install --frozen-lockfile matches

Move the workspace-client facade from packages/appkit/src/workspace-client
to packages/shared/src/workspace-client so both appkit and the CLI (which
lives in shared) reach the SDK through one sanctioned import site.

- appkit's workspace-client becomes a thin re-export from
  shared/workspace-client; its ~47 importers are unchanged.
- biome noRestrictedImports allow-list repoints to the new location.
- shared gains the @databricks/sdk-experimental dep and a ./workspace-client
  export (tsdown entry added so it's emitted independently); appkit drops the
  now-unused direct SDK dep.
- Adds a `profile` option to WorkspaceClientOptions.

Pure relocation — no behavior change beyond the additive `profile` option.
Extracted from the registry-CLI work so it can land on its own.

Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
@MarioCadenas
MarioCadenas requested a review from a team as a code owner August 13, 2026 14:54
@MarioCadenas
MarioCadenas requested a review from ditadi August 13, 2026 14:54
@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

📦 Bundle size report

Compared against bundle-size-baseline.json (main).

@databricks/appkit

npm tarball (packed): 840 KB (+161 B) — gzipped download (dist + bin; excludes release-only docs/NOTICE).

dist raw gzip
JS (runtime) 869 KB (-569 B) 303 KB (-98 B)
Type declarations 315 KB (+379 B) 109 KB (+221 B)
Source maps 1.7 MB (+303 B) 566 KB (+121 B)
Other 11 KB 3.7 KB
Total 2.9 MB (+113 B) 982 KB (+244 B)
Per-entry composition (own code — deps external (as shipped))
Entry Initial (gz) Lazy (gz) Total (gz) node_modules (min) Own code (min)
. 88 KB (+8 B) 2.5 KB 91 KB (+8 B) external 288 KB (+30 B)
./beta 49 KB (-2 B) 459 B (+1 B) 49 KB (-1 B) external 143 KB (+31 B)
./type-generator 21 KB (+33 B) 0 B 21 KB (+33 B) external 61 KB (+30 B)

Chunks:

Entry Chunk Load Size (gz)
. index.js initial 84 KB
. utils.js initial 4.0 KB
. remote-tunnel-manager.js lazy 2.5 KB
./beta beta.js initial 33 KB
./beta stream-manager.js initial 5.8 KB
./beta wide-event-emitter.js initial 3.2 KB
./beta databricks.js initial 3.0 KB
./beta configuration.js initial 2.1 KB
./beta service-context.js initial 1.3 KB
./beta client.js initial 425 B
./beta client-options.js initial 219 B
./beta supervisor-api.js lazy 194 B
./beta databricks.js lazy 142 B
./beta index.js lazy 123 B
./type-generator index.js initial 21 KB

@databricks/appkit-ui

npm tarball (packed): 342 KB (+351 B) — gzipped download (dist + bin; excludes release-only docs/NOTICE).

dist raw gzip
JS (runtime) 390 KB 130 KB
Type declarations 228 KB (+412 B) 83 KB (+360 B)
Source maps 753 KB 248 KB
CSS 16 KB 3.3 KB
Total 1.4 MB (+412 B) 465 KB (+360 B)
Per-entry composition (consumer bundle — deps bundled, peerDeps external)
Entry Initial (gz) Lazy (gz) Total (gz) node_modules (min) Own code (min)
./js 5.3 KB 49 KB 55 KB 208 KB 14 KB
./js/beta 20 B 0 B 20 B 0 B 0 B
./react 432 KB 49 KB 480 KB 1.3 MB 175 KB
./react/beta 1.0 KB 0 B 1.0 KB 0 B 1.9 KB

Chunks:

Entry Chunk Load Size (gz)
./js index.js initial 5.2 KB
./js chunk initial 120 B
./js apache-arrow lazy 49 KB
./js/beta beta.js initial 20 B
./react index.js initial 430 KB
./react tslib initial 2.1 KB
./react apache-arrow lazy 49 KB
./react/beta beta.js initial 1.0 KB

@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

🤖 AppKit PR bot

🔬 Run evals

Start an eval for this PR from the evals-monitor app: Go to Evals Monitor →

📦 Try this PR's app template

Scaffolds a new app from this PR's SDK build. Run it in any folder (requires the GitHub CLI — gh auth login — and the Databricks CLI):

gh run download 31722181182 -R databricks/appkit -n appkit-template-0.60.0-pr.cfecf1c-feat-workspace-client-shared-534 -D appkit-pr-534 \
  && unzip -o "appkit-pr-534/appkit-template-0.60.0-pr.cfecf1c-feat-workspace-client-shared-534.zip" -d "appkit-pr-534" \
  && databricks apps init --template "appkit-pr-534"

The template pins @databricks/appkit and @databricks/appkit-ui to tarballs built from this branch, so the scaffolded app runs against this PR's code.

The workspace-client facade re-exported runtime values from the
`shared/workspace-client` subpath. tsdown resolves that subpath export to
shared's built dist and, under unbundle, leaves it as a bare
`shared/workspace-client` import; dist-appkit then drops the `shared`
dependency, so the published tarball fails with ERR_MODULE_NOT_FOUND at
`appkit generate-types`.

Route the values through the `shared` root instead (the import style the
bundler inlines). Only values move to the root — the SDK `sql` type would
collide with the `sql` query helper from ./sql, so workspace-client types
stay on the subpath (type-only, no runtime cost).

Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
Routing the workspace-client values through the `shared` root pulls
@databricks/sdk-experimental (a Node-only SDK) into shared's export graph,
so the docs' webpack client build failed trying to bundle fs/crypto/stream/etc.
appkit is a Node package and the docs only reference its API — they never run
the SDK in the browser — so stub every Node builtin via resolve.fallback and
strip the node: scheme prefix. fallback only triggers on unresolvable modules,
so the Node-target server bundle is unaffected.

Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
@MarioCadenas
MarioCadenas merged commit a20b992 into main Aug 14, 2026
10 checks passed
@MarioCadenas
MarioCadenas deleted the feat/workspace-client-shared branch August 14, 2026 07:36
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