From 546a8931aa40220a35c02642e8a34145b6257726 Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Thu, 19 Jan 2023 22:32:59 -0600 Subject: [PATCH] chore: move vscode local out of experiments (#5773) We've been dogfooding the VS Code extension for a while, and it seems stable enough that it's overall positive to release! --- coderd/apidoc/docs.go | 11 +---------- coderd/apidoc/swagger.json | 7 +------ coderd/experiments_test.go | 1 - codersdk/experiments.go | 9 +++------ docs/api/general.md | 14 ++++---------- docs/api/schemas.md | 14 -------------- scripts/apitypings/main.go | 7 ++++++- site/src/api/typesGenerated.ts | 4 ++-- .../src/pages/WorkspacePage/WorkspaceReadyPage.tsx | 7 ++----- site/src/testHelpers/entities.ts | 2 +- 10 files changed, 20 insertions(+), 56 deletions(-) diff --git a/coderd/apidoc/docs.go b/coderd/apidoc/docs.go index faf82ac0b1..1ec2452a6d 100644 --- a/coderd/apidoc/docs.go +++ b/coderd/apidoc/docs.go @@ -408,7 +408,7 @@ const docTemplate = `{ "schema": { "type": "array", "items": { - "$ref": "#/definitions/codersdk.Experiment" + "type": "string" } } } @@ -6119,15 +6119,6 @@ const docTemplate = `{ } } }, - "codersdk.Experiment": { - "type": "string", - "enum": [ - "vscode_local" - ], - "x-enum-varnames": [ - "ExperimentVSCodeLocal" - ] - }, "codersdk.Feature": { "type": "object", "properties": { diff --git a/coderd/apidoc/swagger.json b/coderd/apidoc/swagger.json index 66d3e3cac2..33dfd90093 100644 --- a/coderd/apidoc/swagger.json +++ b/coderd/apidoc/swagger.json @@ -346,7 +346,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/definitions/codersdk.Experiment" + "type": "string" } } } @@ -5464,11 +5464,6 @@ } } }, - "codersdk.Experiment": { - "type": "string", - "enum": ["vscode_local"], - "x-enum-varnames": ["ExperimentVSCodeLocal"] - }, "codersdk.Feature": { "type": "object", "properties": { diff --git a/coderd/experiments_test.go b/coderd/experiments_test.go index 7a9da53707..4b5ddfcfdb 100644 --- a/coderd/experiments_test.go +++ b/coderd/experiments_test.go @@ -29,7 +29,6 @@ func Test_Experiments(t *testing.T) { require.NoError(t, err) require.NotNil(t, experiments) require.Empty(t, experiments) - require.False(t, experiments.Enabled(codersdk.ExperimentVSCodeLocal)) require.False(t, experiments.Enabled("foo")) }) diff --git a/codersdk/experiments.go b/codersdk/experiments.go index 0d6f1b78f5..ecd963ef90 100644 --- a/codersdk/experiments.go +++ b/codersdk/experiments.go @@ -9,9 +9,8 @@ import ( type Experiment string const ( - // ExperimentVSCodeLocal enables a workspace button to launch VSCode - // and connect using the local VSCode extension. - ExperimentVSCodeLocal Experiment = "vscode_local" +// Add new experiments here! +// ExperimentExample Experiment = "example" ) var ( @@ -19,9 +18,7 @@ var ( // users to opt-in to via --experimental='*'. // Experiments that are not ready for consumption by all users should // not be included here and will be essentially hidden. - ExperimentsAll = Experiments{ - ExperimentVSCodeLocal, - } + ExperimentsAll = Experiments{} ) // Experiments is a list of experiments that are enabled for the deployment. diff --git a/docs/api/general.md b/docs/api/general.md index 102c31395c..58ac05f3fd 100644 --- a/docs/api/general.md +++ b/docs/api/general.md @@ -1072,23 +1072,17 @@ curl -X GET http://coder-server:8080/api/v2/experiments \ > 200 Response ```json -["vscode_local"] +["string"] ``` ### Responses -| Status | Meaning | Description | Schema | -| ------ | ------------------------------------------------------- | ----------- | ------------------------------------------------------------- | -| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | array of [codersdk.Experiment](schemas.md#codersdkexperiment) | +| Status | Meaning | Description | Schema | +| ------ | ------------------------------------------------------- | ----------- | --------------- | +| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | array of string |

Response Schema

-Status Code **200** - -| Name | Type | Required | Restrictions | Description | -| -------------- | ----- | -------- | ------------ | ----------- | -| `[array item]` | array | false | | | - To perform this operation, you must be authenticated. [Learn more](authentication.md). ## Update check diff --git a/docs/api/schemas.md b/docs/api/schemas.md index 68de4258f6..d242e8bd22 100644 --- a/docs/api/schemas.md +++ b/docs/api/schemas.md @@ -2427,20 +2427,6 @@ CreateParameterRequest is a structure used to create a new parameter value for a | `trial` | boolean | false | | | | `warnings` | array of string | false | | | -## codersdk.Experiment - -```json -"vscode_local" -``` - -### Properties - -#### Enumerated Values - -| Value | -| -------------- | -| `vscode_local` | - ## codersdk.Feature ```json diff --git a/scripts/apitypings/main.go b/scripts/apitypings/main.go index 765c8dd510..96b4398d0f 100644 --- a/scripts/apitypings/main.go +++ b/scripts/apitypings/main.go @@ -223,8 +223,13 @@ func (g *Generator) generateAll() (*TypescriptTypes, error) { sort.Strings(values) var s strings.Builder _, _ = s.WriteString(g.posLine(v)) + joined := strings.Join(values, " | ") + if joined == "" { + // It's possible an enum has no values. + joined = "never" + } _, _ = s.WriteString(fmt.Sprintf("export type %s = %s\n", - name, strings.Join(values, " | "), + name, joined, )) var pluralName string diff --git a/site/src/api/typesGenerated.ts b/site/src/api/typesGenerated.ts index 9c81a6f96a..26bf9a9de4 100644 --- a/site/src/api/typesGenerated.ts +++ b/site/src/api/typesGenerated.ts @@ -1092,8 +1092,8 @@ export const Entitlements: Entitlement[] = [ ] // From codersdk/experiments.go -export type Experiment = "vscode_local" -export const Experiments: Experiment[] = ["vscode_local"] +export type Experiment = never +export const Experiments: Experiment[] = [] // From codersdk/features.go export type FeatureName = diff --git a/site/src/pages/WorkspacePage/WorkspaceReadyPage.tsx b/site/src/pages/WorkspacePage/WorkspaceReadyPage.tsx index d81c969440..ecec679938 100644 --- a/site/src/pages/WorkspacePage/WorkspaceReadyPage.tsx +++ b/site/src/pages/WorkspacePage/WorkspaceReadyPage.tsx @@ -40,7 +40,7 @@ export const WorkspaceReadyPage = ({ const [_, bannerSend] = useActor( workspaceState.children["scheduleBannerMachine"], ) - const { buildInfo, experiments } = useDashboard() + const { buildInfo } = useDashboard() const featureVisibility = useFeatureVisibility() const { workspace, @@ -115,10 +115,7 @@ export const WorkspaceReadyPage = ({ builds={builds} canUpdateWorkspace={canUpdateWorkspace} hideSSHButton={featureVisibility["browser_only"]} - hideVSCodeDesktopButton={ - !experiments.includes("vscode_local") || - featureVisibility["browser_only"] - } + hideVSCodeDesktopButton={featureVisibility["browser_only"]} workspaceErrors={{ [WorkspaceErrors.GET_RESOURCES_ERROR]: refreshWorkspaceWarning, [WorkspaceErrors.GET_BUILDS_ERROR]: getBuildsError, diff --git a/site/src/testHelpers/entities.ts b/site/src/testHelpers/entities.ts index 02efc7aca6..b588d51314 100644 --- a/site/src/testHelpers/entities.ts +++ b/site/src/testHelpers/entities.ts @@ -982,7 +982,7 @@ export const MockEntitlementsWithAuditLog: TypesGen.Entitlements = { }), } -export const MockExperiments: TypesGen.Experiment[] = ["vscode_local"] +export const MockExperiments: TypesGen.Experiment[] = [] export const MockAuditLog: TypesGen.AuditLog = { id: "fbd2116a-8961-4954-87ae-e4575bd29ce0",