Skip to content

refactor(cli): route doctor's SDK access through the shared workspace-client facade - #531

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

refactor(cli): route doctor's SDK access through the shared workspace-client facade#531
MarioCadenas merged 3 commits into
mainfrom
feat/doctor-workspace-client

Conversation

@MarioCadenas

Copy link
Copy Markdown
Collaborator

Follows the workspace-client relocation (in the base feat/registry-cli): the SDK facade now lives in packages/shared/src/workspace-client, reachable from both appkit and the CLI in shared. This routes the doctor command's SDK access through it, removing the dynamic-import workaround it needed when shared was SDK-free.

Changes

  • doctor/databricks-client.ts: getServiceClient now uses createWorkspaceClient({profile}).toLegacyWorkspaceClient(); getProfileHost uses the facade's re-exported loadConfigFile. Drops both biome-ignore lint/style/noRestrictedImports suppressions and the await import("@databricks/sdk-experimental") dance.
  • workspace-client facade: adds loadConfigFile to the re-exports (legacy.ts + index.ts).
  • packages/appkit/package.json: removes the now-unused direct @databricks/sdk-experimental dependency. appkit no longer imports the SDK directly (all access is via shared/workspace-client); it still ships to consumers because dist-appkit.ts merges shared's deps into the published tarball.

Notes

  • SdkNotInstalledError is kept exported (no longer thrown — shared now hard-depends on the SDK) so checks.ts's SDK_NOT_INSTALLED diagnostic branch and the existing tests keep compiling. That branch is now effectively dead; removing it is a deliberate separate cleanup.
  • The Lakebase probe (getLakebasePool) keeps its dynamic @databricks/appkit import — that's an optional peer shared doesn't depend on, unchanged.

Verification

  • shared + appkit typecheck clean
  • 128 doctor tests pass
  • biome clean (no more suppressions)

Based on feat/registry-cli; will retarget to main once that merges.

This pull request and its description were written by Isaac.


This PR was created with GitHub MCP.

@MarioCadenas
MarioCadenas requested a review from a team as a code owner August 11, 2026 17:46
@MarioCadenas
MarioCadenas requested review from ditadi and removed request for a team August 11, 2026 17:46
@MarioCadenas
MarioCadenas force-pushed the feat/doctor-workspace-client branch from 2a673ed to 0a07567 Compare August 13, 2026 15:15
@MarioCadenas
MarioCadenas changed the base branch from feat/registry-cli to feat/workspace-client-shared August 13, 2026 15:20
@MarioCadenas
MarioCadenas force-pushed the feat/doctor-workspace-client branch from 0a07567 to 4b7d53d Compare August 13, 2026 17:52
Base automatically changed from feat/workspace-client-shared to main August 14, 2026 07:36
…-client facade

Now that the SDK facade lives in packages/shared/src/workspace-client, the doctor
command reaches the SDK through it instead of a dynamic import + noRestrictedImports
suppression:

- getServiceClient uses createWorkspaceClient({profile}).toLegacyWorkspaceClient()
- getProfileHost uses the facade's re-exported loadConfigFile
- drops both `biome-ignore` suppressions and the dynamic import(...) dance
- adds loadConfigFile to the facade's re-exports

SdkNotInstalledError is kept exported (no longer thrown — shared now hard-depends
on the SDK) so the SDK_NOT_INSTALLED diagnostic branch and tests keep compiling.
The Lakebase probe keeps its dynamic @databricks/appkit import (optional peer).

Also removes @databricks/sdk-experimental from packages/appkit/package.json: with
the facade moved to shared, appkit no longer imports the SDK directly. It still
ships to consumers via shared's deps (dist-appkit.ts merges them into the tarball).

Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
@MarioCadenas
MarioCadenas force-pushed the feat/doctor-workspace-client branch from 4b7d53d to b660293 Compare August 14, 2026 07:39
@github-actions

Copy link
Copy Markdown
Contributor

📦 Bundle size report

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

@databricks/appkit

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

dist raw gzip
JS (runtime) 869 KB (-553 B) 303 KB (-89 B)
Type declarations 315 KB (+379 B) 109 KB (+221 B)
Source maps 1.7 MB (+326 B) 566 KB (+137 B)
Other 11 KB 3.7 KB
Total 2.9 MB (+152 B) 982 KB (+269 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 (+18 B) 2.5 KB 91 KB (+18 B) external 288 KB (+48 B)
./beta 49 KB (+7 B) 456 B (-2 B) 49 KB (+5 B) external 143 KB (+48 B)
./type-generator 21 KB (+41 B) 0 B 21 KB (+41 B) external 61 KB (+48 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 434 B
./beta client-options.js initial 219 B
./beta supervisor-api.js lazy 192 B
./beta databricks.js lazy 141 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

@MarioCadenas
MarioCadenas enabled auto-merge (squash) August 14, 2026 07:42
@MarioCadenas
MarioCadenas disabled auto-merge August 14, 2026 07:46
The doctor command now reaches the SDK through the shared workspace-client
facade, so shared's compiled CLI imports ../../../workspace-client/{factory,legacy}.js.
dist-appkit copied shared's dist/cli into the tarball but not dist/workspace-client,
so any appkit CLI invocation (e.g. the generate-types postinstall, which loads all
commands) crashed with ERR_MODULE_NOT_FOUND. Copy dist/workspace-client alongside
the other CLI leaf modules so those relative imports resolve.

Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
@github-actions

github-actions Bot commented Aug 14, 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 31782698860 -R databricks/appkit -n appkit-template-0.60.0-pr.3f21656-feat-doctor-workspace-client-531 -D appkit-pr-531 \
  && unzip -o "appkit-pr-531/appkit-template-0.60.0-pr.3f21656-feat-doctor-workspace-client-531.zip" -d "appkit-pr-531" \
  && databricks apps init --template "appkit-pr-531"

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 doctor routing re-exports loadConfigFile from legacy.ts's SDK destructure;
add it to legacy.test.ts's vi.mock so module load doesn't throw "No loadConfigFile
export is defined on the mock".

Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
@MarioCadenas
MarioCadenas merged commit 1683368 into main Aug 14, 2026
10 checks passed
@MarioCadenas
MarioCadenas deleted the feat/doctor-workspace-client branch August 14, 2026 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants