From f396f77eaec187a1a66bc3e31580bfc654f76cd2 Mon Sep 17 00:00:00 2001 From: "@rugpanov" Date: Thu, 30 Jul 2026 18:15:02 +0200 Subject: [PATCH 1/2] feat(python-setup): rename result `target` field to `compute` *Why:* The `setup-local --output json` result key is being renamed `target` -> `compute` in the CLI (databricks/cli#6100, DECO-27794) so the result vocabulary matches the invocation-side field the extension already adopted (`SetupLocalInvocation.compute`, #2039). The extension parses the CLI result with a bare structural cast, so the TypeScript field name must equal the JSON key the CLI emits. This lands the extension half of that coordinated rename; the CLI half (#6100) merges first so the golden fixtures stay verbatim-from-golden. *What:* - `PythonSetupTargetInfo` -> `PythonSetupComputeInfo`; `PythonSetupResult.target?` -> `compute?` (inner fields `source`/`clusterId`/`serverlessVersion`/`envKey` unchanged -- only the outer key renames, matching #6100's result.go diff). - Drop the placeholder TODO on the field; replace with a doc comment pointing at the CLI wire key. - Fixtures (`setupLocalResults.ts`): 3x `target:` -> `compute:`. - Consumers: `isLocalEnvironmentReady` / `saveState` (orchestrator) and `errorMessages.ts` (`r.compute?.envKey`) + their tests. - `E_NO_TARGET` / `ERROR_NO_TARGET` (error-code names) deliberately NOT renamed -- they mirror the stable wire error-code string, which #6100 keeps. *Verification:* - `yarn build` (compile-coupling of fixtures to the type is the contract proof), `yarn test:lint`, `yarn test:unit` (415 passing) all green. Co-authored-by: Isaac --- .../PythonSetupEnvironmentSetup.test.ts | 6 +++--- .../controllers/PythonSetupEnvironmentSetup.ts | 6 +++--- .../python-setup/models/PythonSetupResult.test.ts | 4 ++-- .../src/python-setup/models/PythonSetupResult.ts | 14 ++++++++------ .../models/fixtures/setupLocalResults.ts | 6 +++--- .../src/python-setup/utils/errorMessages.test.ts | 4 ++-- .../src/python-setup/utils/errorMessages.ts | 2 +- 7 files changed, 22 insertions(+), 20 deletions(-) diff --git a/packages/databricks-vscode/src/python-setup/controllers/PythonSetupEnvironmentSetup.test.ts b/packages/databricks-vscode/src/python-setup/controllers/PythonSetupEnvironmentSetup.test.ts index 528859bc1..84edadefc 100644 --- a/packages/databricks-vscode/src/python-setup/controllers/PythonSetupEnvironmentSetup.test.ts +++ b/packages/databricks-vscode/src/python-setup/controllers/PythonSetupEnvironmentSetup.test.ts @@ -121,7 +121,7 @@ describe("PythonSetupEnvironmentSetup.setup", () => { expect(adopted).to.deep.equal([SUCCESS_REAL_RUN.venvPath]); expect(saved).to.deep.equal([ { - envKey: SUCCESS_REAL_RUN.target!.envKey, + envKey: SUCCESS_REAL_RUN.compute!.envKey, pythonVersion: SUCCESS_REAL_RUN.resolved!.pythonVersion, }, ]); @@ -248,12 +248,12 @@ describe("PythonSetupEnvironmentSetup.setup", () => { const shownErrors: string[] = []; const adopted: string[] = []; const saved: unknown[] = []; - // ok:true with a venvPath but no target/resolved: we could adopt an + // ok:true with a venvPath but no compute/resolved: we could adopt an // interpreter, but drift detection would have no baseline to persist — // so this is treated as a failure rather than a hollow "ready". const withoutBaseline: PythonSetupResult = { ...SUCCESS_REAL_RUN, - target: undefined, + compute: undefined, resolved: undefined, }; const setup = new PythonSetupEnvironmentSetup( diff --git a/packages/databricks-vscode/src/python-setup/controllers/PythonSetupEnvironmentSetup.ts b/packages/databricks-vscode/src/python-setup/controllers/PythonSetupEnvironmentSetup.ts index 5c373b58c..4a01c9dc6 100644 --- a/packages/databricks-vscode/src/python-setup/controllers/PythonSetupEnvironmentSetup.ts +++ b/packages/databricks-vscode/src/python-setup/controllers/PythonSetupEnvironmentSetup.ts @@ -31,7 +31,7 @@ export interface PythonSetupPersistedState { } type ReadyLocalEnvironmentResult = PythonSetupResult & - Required>; + Required>; function isLocalEnvironmentReady( r: PythonSetupResult @@ -39,7 +39,7 @@ function isLocalEnvironmentReady( return ( isPythonSetupSuccess(r) && r.venvPath !== undefined && - r.target !== undefined && + r.compute !== undefined && r.resolved !== undefined ); } @@ -197,7 +197,7 @@ export class PythonSetupEnvironmentSetup implements Disposable { } this.deps.saveState({ - envKey: result.target.envKey, + envKey: result.compute.envKey, pythonVersion: result.resolved.pythonVersion, }); diff --git a/packages/databricks-vscode/src/python-setup/models/PythonSetupResult.test.ts b/packages/databricks-vscode/src/python-setup/models/PythonSetupResult.test.ts index d746a01f1..2215827ca 100644 --- a/packages/databricks-vscode/src/python-setup/models/PythonSetupResult.test.ts +++ b/packages/databricks-vscode/src/python-setup/models/PythonSetupResult.test.ts @@ -24,8 +24,8 @@ describe("parsePythonSetupResult", () => { expect(r.schemaVersion).to.equal(1); expect(r.mode).to.equal("default"); expect(r.dryRun).to.equal(true); - expect(r.target?.serverlessVersion).to.equal("v4"); - expect(r.target?.envKey).to.equal("serverless/serverless-v4"); + expect(r.compute?.serverlessVersion).to.equal("v4"); + expect(r.compute?.envKey).to.equal("serverless/serverless-v4"); expect(r.resolved?.pythonVersion).to.equal("3.12"); expect(r.resolved?.dbconnectVersion).to.equal("17.2.0"); expect(r.error).to.equal(null); diff --git a/packages/databricks-vscode/src/python-setup/models/PythonSetupResult.ts b/packages/databricks-vscode/src/python-setup/models/PythonSetupResult.ts index 2cdde4a0c..1363be1dd 100644 --- a/packages/databricks-vscode/src/python-setup/models/PythonSetupResult.ts +++ b/packages/databricks-vscode/src/python-setup/models/PythonSetupResult.ts @@ -47,7 +47,7 @@ export type PythonSetupErrorCode = | "E_PROVISION" | "E_VALIDATE"; -export interface PythonSetupTargetInfo { +export interface PythonSetupComputeInfo { source: string; clusterId?: string; serverlessVersion?: string; @@ -97,11 +97,13 @@ export interface PythonSetupResult { ok: boolean; mode: PythonSetupMode; dryRun: boolean; - // TODO: rename to `compute` (+ PythonSetupTargetInfo -> PythonSetupComputeInfo) - // to match SetupLocalInvocation.compute. This field mirrors the CLI's wire - // key `target`, so the rename must land in the CLI's --output json first - // (with a schemaVersion bump), then here. - target?: PythonSetupTargetInfo; + /** + * The resolved compute the environment was provisioned against. Mirrors the + * CLI's `compute` result key (renamed from `target` in databricks/cli#6100, + * DECO-27794) so the structural cast in {@link parsePythonSetupResult} keeps + * matching the wire shape. + */ + compute?: PythonSetupComputeInfo; resolved?: PythonSetupResolvedInfo; greenfield: boolean; plan?: PythonSetupPlan; diff --git a/packages/databricks-vscode/src/python-setup/models/fixtures/setupLocalResults.ts b/packages/databricks-vscode/src/python-setup/models/fixtures/setupLocalResults.ts index 5bc46fc6f..2265696f7 100644 --- a/packages/databricks-vscode/src/python-setup/models/fixtures/setupLocalResults.ts +++ b/packages/databricks-vscode/src/python-setup/models/fixtures/setupLocalResults.ts @@ -31,7 +31,7 @@ export const SUCCESS_DEFAULT: PythonSetupResult = { ok: true, mode: "default", dryRun: true, - target: { + compute: { source: "serverless", serverlessVersion: "v4", envKey: "serverless/serverless-v4", @@ -67,7 +67,7 @@ export const SUCCESS_CONSTRAINTS_ONLY: PythonSetupResult = { ok: true, mode: "constraints-only", dryRun: true, - target: { + compute: { source: "serverless", serverlessVersion: "v4", envKey: "serverless/serverless-v4", @@ -164,7 +164,7 @@ export const SUCCESS_REAL_RUN: PythonSetupResult = { ok: true, mode: "default", dryRun: false, - target: { + compute: { source: "serverless", serverlessVersion: "v4", envKey: "serverless/serverless-v4", diff --git a/packages/databricks-vscode/src/python-setup/utils/errorMessages.test.ts b/packages/databricks-vscode/src/python-setup/utils/errorMessages.test.ts index 2a1c34117..0e455cf3a 100644 --- a/packages/databricks-vscode/src/python-setup/utils/errorMessages.test.ts +++ b/packages/databricks-vscode/src/python-setup/utils/errorMessages.test.ts @@ -47,14 +47,14 @@ describe("getPythonSetupErrorMessage", () => { const r = failure( "E_ENV_UNSUPPORTED", {failurePhase: "fetch"}, - {target: {source: "cluster", envKey: "dbr/15.4.x-scala2.12"}} + {compute: {source: "cluster", envKey: "dbr/15.4.x-scala2.12"}} ); const msg = getPythonSetupErrorMessage(r); expect(msg).to.contain("dbr/15.4.x-scala2.12"); expect(msg).to.match(/lts|latest/i); }); - it("maps E_ENV_UNSUPPORTED without a target gracefully", () => { + it("maps E_ENV_UNSUPPORTED without a compute gracefully", () => { const msg = getPythonSetupErrorMessage(failure("E_ENV_UNSUPPORTED")); expect(msg).to.match(/no matched environment/i); expect(msg).to.not.contain("undefined"); diff --git a/packages/databricks-vscode/src/python-setup/utils/errorMessages.ts b/packages/databricks-vscode/src/python-setup/utils/errorMessages.ts index 1e987fe87..4d82949af 100644 --- a/packages/databricks-vscode/src/python-setup/utils/errorMessages.ts +++ b/packages/databricks-vscode/src/python-setup/utils/errorMessages.ts @@ -35,7 +35,7 @@ const BASE_MESSAGE: Record< E_RESOLVE: () => "Could not resolve the selected compute. Check the cluster/serverless selection and try again.", E_ENV_UNSUPPORTED: (r) => { - const key = r.target?.envKey; + const key = r.compute?.envKey; const which = key ? `for ${key}` : "for the selected compute"; return ( `No matched environment ${which}. ` + From 70370e9d9192e4047f1295173b00c28f85ed6d87 Mon Sep 17 00:00:00 2001 From: "@rugpanov" Date: Mon, 3 Aug 2026 13:56:48 +0200 Subject: [PATCH 2/2] docs: drop internal tracker ref from PythonSetupResult comment *Why* The `compute` field doc comment referenced an internal-only JIRA ticket (DECO-27794), which must not appear in this public repo. *What* Remove the DECO-27794 mention from the comment; keep the public databricks/cli#6100 cross-reference that explains the `target` -> `compute` rename. *Verification* Comment-only change (no behavior). `git grep -niE 'DECO-[0-9]+'` over the PR's changed files now returns nothing. Co-authored-by: Isaac --- .../src/python-setup/models/PythonSetupResult.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/databricks-vscode/src/python-setup/models/PythonSetupResult.ts b/packages/databricks-vscode/src/python-setup/models/PythonSetupResult.ts index 1363be1dd..17acea1c8 100644 --- a/packages/databricks-vscode/src/python-setup/models/PythonSetupResult.ts +++ b/packages/databricks-vscode/src/python-setup/models/PythonSetupResult.ts @@ -99,9 +99,9 @@ export interface PythonSetupResult { dryRun: boolean; /** * The resolved compute the environment was provisioned against. Mirrors the - * CLI's `compute` result key (renamed from `target` in databricks/cli#6100, - * DECO-27794) so the structural cast in {@link parsePythonSetupResult} keeps - * matching the wire shape. + * CLI's `compute` result key (renamed from `target` in databricks/cli#6100) + * so the structural cast in {@link parsePythonSetupResult} keeps matching the + * wire shape. */ compute?: PythonSetupComputeInfo; resolved?: PythonSetupResolvedInfo;