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..17acea1c8 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) + * 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}. ` +