Skip to content

Commit b02315d

Browse files
authored
Patch CLI incompatible onboarding path (#2992)
1 parent 6fc9267 commit b02315d

File tree

16 files changed

+90
-36
lines changed

16 files changed

+90
-36
lines changed

extension/src/cli/dvc/constants.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
import { join } from 'path'
22

3-
export const MIN_CLI_VERSION = '2.30.0'
4-
export const LATEST_TESTED_CLI_VERSION = '2.38.0'
5-
export const MAX_CLI_VERSION = '3'
6-
73
export const UNEXPECTED_ERROR_CODE = 255
84

95
export const TEMP_PLOTS_DIR = join('.dvc', 'tmp', 'plots')

extension/src/cli/dvc/contract.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import { Plot } from '../../plots/webview/contract'
22

3+
export const MIN_CLI_VERSION = '2.30.0'
4+
export const LATEST_TESTED_CLI_VERSION = '2.38.0'
5+
export const MAX_CLI_VERSION = '3'
6+
37
type ErrorContents = { type: string; msg: string }
48

59
export type DvcError = { error: ErrorContents }

extension/src/cli/dvc/discovery.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {
22
LATEST_TESTED_CLI_VERSION,
33
MAX_CLI_VERSION,
44
MIN_CLI_VERSION
5-
} from './constants'
5+
} from './contract'
66
import { CliCompatible, isVersionCompatible } from './version'
77
import { IExtension } from '../../interfaces'
88
import { Toast } from '../../vscode/toast'

extension/src/cli/dvc/version.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import {
44
ParsedSemver,
55
CliCompatible
66
} from './version'
7-
import { MIN_CLI_VERSION, LATEST_TESTED_CLI_VERSION } from './constants'
7+
import { MIN_CLI_VERSION, LATEST_TESTED_CLI_VERSION } from './contract'
88

9-
jest.mock('./constants', () => ({
10-
...jest.requireActual('./constants'),
9+
jest.mock('./contract', () => ({
10+
...jest.requireActual('./contract'),
1111
LATEST_TESTED_CLI_VERSION: '2.11.1',
1212
MIN_CLI_VERSION: '2.9.4'
1313
}))

extension/src/cli/dvc/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {
22
MAX_CLI_VERSION,
33
LATEST_TESTED_CLI_VERSION,
44
MIN_CLI_VERSION
5-
} from './constants'
5+
} from './contract'
66

77
export enum CliCompatible {
88
NO_BEHIND_MIN_VERSION = 'no-behind-min-version',

extension/src/extension.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ export class Extension extends Disposable implements IExtension {
170170
this.resourceLocator.dvcIcon,
171171
() => this.initProject(),
172172
() => this.showExperiments(this.dvcRoots[0]),
173-
() => this.getAvailable(),
173+
() => this.getCliCompatible(),
174174
() => this.hasRoots(),
175175
() => this.experiments.getHasData()
176176
)
@@ -544,6 +544,10 @@ export class Extension extends Disposable implements IExtension {
544544
)
545545
}
546546

547+
private getCliCompatible() {
548+
return this.cliCompatible
549+
}
550+
547551
private changeSetupStep() {
548552
this.setup.sendDataToWebview()
549553
}

extension/src/setup.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
LATEST_TESTED_CLI_VERSION,
2424
MAX_CLI_VERSION,
2525
MIN_CLI_VERSION
26-
} from './cli/dvc/constants'
26+
} from './cli/dvc/contract'
2727
import { extractSemver, ParsedSemver } from './cli/dvc/version'
2828
import { delay } from './util/time'
2929
import { Title } from './vscode/title'

extension/src/setup/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export class Setup extends BaseRepository<TSetupData> {
1515

1616
private webviewMessages: WebviewMessages
1717
private showExperiments: () => void
18-
private getCliAccessible: () => boolean
18+
private getCliCompatible: () => boolean | undefined
1919
private getHasRoots: () => boolean
2020
private getHasData: () => boolean | undefined
2121

@@ -24,7 +24,7 @@ export class Setup extends BaseRepository<TSetupData> {
2424
webviewIcon: Resource,
2525
initProject: () => void,
2626
showExperiments: () => void,
27-
getCliAccessible: () => boolean,
27+
getCliCompatible: () => boolean | undefined,
2828
getHasRoots: () => boolean,
2929
getHasData: () => boolean | undefined
3030
) {
@@ -36,7 +36,7 @@ export class Setup extends BaseRepository<TSetupData> {
3636
this.sendDataToWebview()
3737
}
3838
this.showExperiments = showExperiments
39-
this.getCliAccessible = getCliAccessible
39+
this.getCliCompatible = getCliCompatible
4040
this.getHasRoots = getHasRoots
4141
this.getHasData = getHasData
4242
}
@@ -50,13 +50,13 @@ export class Setup extends BaseRepository<TSetupData> {
5050
}
5151

5252
public async sendDataToWebview() {
53-
const cliAccessible = this.getCliAccessible()
53+
const cliCompatible = this.getCliCompatible()
5454
const projectInitialized = this.getHasRoots()
5555
const hasData = this.getHasData()
5656

5757
if (
5858
this.webview?.isVisible &&
59-
cliAccessible &&
59+
cliCompatible &&
6060
projectInitialized &&
6161
hasData
6262
) {
@@ -68,7 +68,7 @@ export class Setup extends BaseRepository<TSetupData> {
6868
const pythonBinPath = await findPythonBinForInstall()
6969

7070
this.webviewMessages.sendWebviewMessage(
71-
cliAccessible,
71+
cliCompatible,
7272
projectInitialized,
7373
isPythonExtensionInstalled(),
7474
getBinDisplayText(pythonBinPath),

extension/src/setup/webview/contract.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export type SetupData = {
2-
cliAccessible: boolean
2+
cliCompatible: boolean | undefined
33
hasData: boolean | undefined
44
isPythonExtensionInstalled: boolean
55
projectInitialized: boolean

extension/src/setup/webview/messages.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ export class WebviewMessages {
2525
}
2626

2727
public sendWebviewMessage(
28-
cliAccessible: boolean,
28+
cliCompatible: boolean | undefined,
2929
projectInitialized: boolean,
3030
isPythonExtensionInstalled: boolean,
3131
pythonBinPath: string | undefined,
3232
hasData: boolean | undefined
3333
) {
3434
this.getWebview()?.show({
35-
cliAccessible,
35+
cliCompatible,
3636
hasData,
3737
isPythonExtensionInstalled,
3838
projectInitialized,

0 commit comments

Comments
 (0)