Skip to content

Commit eb4826a

Browse files
authored
chore: remove workspace_actions experiment (#10030)
1 parent 3c87c4d commit eb4826a

22 files changed

+35
-130
lines changed

cli/templatecreate.go

-10
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,6 @@ func (r *RootCmd) templateCreate() *clibase.Cmd {
4747
),
4848
Handler: func(inv *clibase.Invocation) error {
4949
if failureTTL != 0 || inactivityTTL != 0 || maxTTL != 0 {
50-
// This call can be removed when workspace_actions is no longer experimental
51-
experiments, exErr := client.Experiments(inv.Context())
52-
if exErr != nil {
53-
return xerrors.Errorf("get experiments: %w", exErr)
54-
}
55-
56-
if !experiments.Enabled(codersdk.ExperimentWorkspaceActions) {
57-
return xerrors.Errorf("--failure-ttl and --inactivityTTL are experimental features. Use the workspace_actions CODER_EXPERIMENTS flag to set these configuration values.")
58-
}
59-
6050
entitlements, err := client.Entitlements(inv.Context())
6151
var sdkErr *codersdk.Error
6252
if xerrors.As(err, &sdkErr) && sdkErr.StatusCode() == http.StatusNotFound {

cli/templateedit.go

-12
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,6 @@ func (r *RootCmd) templateEdit() *clibase.Cmd {
4141
),
4242
Short: "Edit the metadata of a template by name.",
4343
Handler: func(inv *clibase.Invocation) error {
44-
// This clause can be removed when workspace_actions is no longer experimental
45-
if failureTTL != 0 || inactivityTTL != 0 {
46-
experiments, exErr := client.Experiments(inv.Context())
47-
if exErr != nil {
48-
return xerrors.Errorf("get experiments: %w", exErr)
49-
}
50-
51-
if !experiments.Enabled(codersdk.ExperimentWorkspaceActions) {
52-
return xerrors.Errorf("--failure-ttl and --inactivityTTL are experimental features. Use the workspace_actions CODER_EXPERIMENTS flag to set these configuration values.")
53-
}
54-
}
55-
5644
unsetAutostopRequirementDaysOfWeek := len(autostopRequirementDaysOfWeek) == 1 && autostopRequirementDaysOfWeek[0] == "none"
5745
requiresEntitlement := (len(autostopRequirementDaysOfWeek) > 0 && !unsetAutostopRequirementDaysOfWeek) ||
5846
autostopRequirementWeeks > 0 ||

coderd/apidoc/docs.go

-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

codersdk/deployment.go

-3
Original file line numberDiff line numberDiff line change
@@ -1958,9 +1958,6 @@ const (
19581958
// feature is not yet complete in functionality.
19591959
ExperimentMoons Experiment = "moons"
19601960

1961-
// https://github.com/coder/coder/milestone/19
1962-
ExperimentWorkspaceActions Experiment = "workspace_actions"
1963-
19641961
// ExperimentTailnetPGCoordinator enables the PGCoord in favor of the pubsub-
19651962
// only Coordinator
19661963
ExperimentTailnetPGCoordinator Experiment = "tailnet_pg_coordinator"

docs/api/schemas.md

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

site/src/api/typesGenerated.ts

+1-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

site/src/components/Dashboard/DashboardProvider.tsx

-10
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,3 @@ export const useDashboard = (): DashboardProviderValue => {
110110

111111
return context;
112112
};
113-
114-
export const useIsWorkspaceActionsEnabled = (): boolean => {
115-
const { entitlements, experiments } = useDashboard();
116-
const allowAdvancedScheduling =
117-
entitlements.features["advanced_template_scheduling"].enabled;
118-
// This check can be removed when https://github.com/coder/coder/milestone/19
119-
// is merged up
120-
const allowWorkspaceActions = experiments.includes("workspace_actions");
121-
return allowWorkspaceActions && allowAdvancedScheduling;
122-
};

site/src/components/WorkspaceDeletion/DormantDeletionStat.tsx

+2-11
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,11 @@ interface DormantDeletionStatProps {
1414
export const DormantDeletionStat: FC<DormantDeletionStatProps> = ({
1515
workspace,
1616
}) => {
17-
const { entitlements, experiments } = useDashboard();
17+
const { entitlements } = useDashboard();
1818
const allowAdvancedScheduling =
1919
entitlements.features["advanced_template_scheduling"].enabled;
20-
// This check can be removed when https://github.com/coder/coder/milestone/19
21-
// is merged up
22-
const allowWorkspaceActions = experiments.includes("workspace_actions");
2320

24-
if (
25-
!displayDormantDeletion(
26-
workspace,
27-
allowAdvancedScheduling,
28-
allowWorkspaceActions,
29-
)
30-
) {
21+
if (!displayDormantDeletion(workspace, allowAdvancedScheduling)) {
3122
return null;
3223
}
3324

site/src/components/WorkspaceDeletion/DormantDeletionText.tsx

+2-11
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,11 @@ export const DormantDeletionText = ({
99
}: {
1010
workspace: Workspace;
1111
}): JSX.Element | null => {
12-
const { entitlements, experiments } = useDashboard();
12+
const { entitlements } = useDashboard();
1313
const allowAdvancedScheduling =
1414
entitlements.features["advanced_template_scheduling"].enabled;
15-
// This check can be removed when https://github.com/coder/coder/milestone/19
16-
// is merged up
17-
const allowWorkspaceActions = experiments.includes("workspace_actions");
1815

19-
if (
20-
!displayDormantDeletion(
21-
workspace,
22-
allowAdvancedScheduling,
23-
allowWorkspaceActions,
24-
)
25-
) {
16+
if (!displayDormantDeletion(workspace, allowAdvancedScheduling)) {
2617
return null;
2718
}
2819
return <StyledSpan role="status">Impending deletion</StyledSpan>;

site/src/components/WorkspaceDeletion/DormantWorkspaceBanner.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Workspace } from "api/typesGenerated";
2-
import { useIsWorkspaceActionsEnabled } from "components/Dashboard/DashboardProvider";
2+
import { useDashboard } from "components/Dashboard/DashboardProvider";
33
import { Alert } from "components/Alert/Alert";
44
import { formatDistanceToNow } from "date-fns";
55
import Link from "@mui/material/Link";
@@ -21,7 +21,9 @@ export const DormantWorkspaceBanner = ({
2121
shouldRedisplayBanner: boolean;
2222
count?: Count;
2323
}): JSX.Element | null => {
24-
const experimentEnabled = useIsWorkspaceActionsEnabled();
24+
const { entitlements } = useDashboard();
25+
const schedulingEnabled =
26+
entitlements.features["advanced_template_scheduling"].enabled;
2527

2628
if (!workspaces) {
2729
return null;
@@ -37,7 +39,7 @@ export const DormantWorkspaceBanner = ({
3739

3840
if (
3941
// Only show this if the experiment is included.
40-
!experimentEnabled ||
42+
!schedulingEnabled ||
4143
!hasDormantWorkspaces ||
4244
// Banners should be redisplayed after dismissal when additional workspaces are newly scheduled for deletion
4345
!shouldRedisplayBanner

site/src/components/WorkspaceDeletion/utils.test.ts

+8-22
Original file line numberDiff line numberDiff line change
@@ -4,53 +4,39 @@ import { displayDormantDeletion } from "./utils";
44

55
describe("displayDormantDeletion", () => {
66
const today = new Date();
7-
it.each<[string, boolean, boolean, boolean]>([
7+
it.each<[string, boolean, boolean]>([
88
[
99
new Date(new Date().setDate(today.getDate() + 15)).toISOString(),
1010
true,
11-
true,
1211
false,
1312
], // today + 15 days out
1413
[
1514
new Date(new Date().setDate(today.getDate() + 14)).toISOString(),
1615
true,
1716
true,
18-
true,
1917
], // today + 14
2018
[
2119
new Date(new Date().setDate(today.getDate() + 13)).toISOString(),
2220
true,
2321
true,
24-
true,
2522
], // today + 13
2623
[
2724
new Date(new Date().setDate(today.getDate() + 1)).toISOString(),
2825
true,
2926
true,
30-
true,
3127
], // today + 1
32-
[new Date().toISOString(), true, true, true], // today + 0
33-
[new Date().toISOString(), false, true, false], // Advanced Scheduling off
34-
[new Date().toISOString(), true, false, false], // Workspace Actions off
28+
[new Date().toISOString(), true, true], // today + 0
29+
[new Date().toISOString(), false, false], // Advanced Scheduling off
3530
])(
36-
`deleting_at=%p, allowAdvancedScheduling=%p, AllowWorkspaceActions=%p, shouldDisplay=%p`,
37-
(
38-
deleting_at,
39-
allowAdvancedScheduling,
40-
allowWorkspaceActions,
41-
shouldDisplay,
42-
) => {
31+
`deleting_at=%p, allowAdvancedScheduling=%p, shouldDisplay=%p`,
32+
(deleting_at, allowAdvancedScheduling, shouldDisplay) => {
4333
const workspace: TypesGen.Workspace = {
4434
...Mocks.MockWorkspace,
4535
deleting_at,
4636
};
47-
expect(
48-
displayDormantDeletion(
49-
workspace,
50-
allowAdvancedScheduling,
51-
allowWorkspaceActions,
52-
),
53-
).toBe(shouldDisplay);
37+
expect(displayDormantDeletion(workspace, allowAdvancedScheduling)).toBe(
38+
shouldDisplay,
39+
);
5440
},
5541
);
5642
});

site/src/components/WorkspaceDeletion/utils.ts

+1-6
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,9 @@ const IMPENDING_DELETION_DISPLAY_THRESHOLD = 14; // 14 days
1414
export const displayDormantDeletion = (
1515
workspace: Workspace,
1616
allowAdvancedScheduling: boolean,
17-
allowWorkspaceActions: boolean,
1817
) => {
1918
const today = new Date();
20-
if (
21-
!workspace.deleting_at ||
22-
!allowAdvancedScheduling ||
23-
!allowWorkspaceActions
24-
) {
19+
if (!workspace.deleting_at || !allowAdvancedScheduling) {
2520
return false;
2621
}
2722
return (

site/src/pages/DeploySettingsPage/GeneralSettingsPage/GeneralSettingsPageView.stories.tsx

+1-7
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,7 @@ const meta: Meta<typeof GeneralSettingsPageView> = {
3030
description:
3131
"Enable one or more experiments. These are not ready for production. Separate multiple experiments with commas, or enter '*' to opt-in to all available experiments.",
3232
flag: "experiments",
33-
value: [
34-
"*",
35-
"moons",
36-
"workspace_actions",
37-
"single_tailnet",
38-
"deployment_health_page",
39-
],
33+
value: ["*", "moons", "single_tailnet", "deployment_health_page"],
4034
flag_shorthand: "",
4135
hidden: false,
4236
},

site/src/pages/TemplateSettingsPage/TemplateSchedulePage/TemplateScheduleForm.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ export interface TemplateScheduleForm {
5050
isSubmitting: boolean;
5151
error?: unknown;
5252
allowAdvancedScheduling: boolean;
53-
allowWorkspaceActions: boolean;
5453
allowAutostopRequirement: boolean;
5554
// Helpful to show field errors on Storybook
5655
initialTouched?: FormikTouched<UpdateTemplateMeta>;
@@ -62,7 +61,6 @@ export const TemplateScheduleForm: FC<TemplateScheduleForm> = ({
6261
onCancel,
6362
error,
6463
allowAdvancedScheduling,
65-
allowWorkspaceActions,
6664
allowAutostopRequirement,
6765
isSubmitting,
6866
initialTouched,
@@ -459,7 +457,7 @@ export const TemplateScheduleForm: FC<TemplateScheduleForm> = ({
459457
</Stack>
460458
</Stack>
461459
</FormSection>
462-
{allowAdvancedScheduling && allowWorkspaceActions && (
460+
{allowAdvancedScheduling && (
463461
<>
464462
<FormSection
465463
title="Failure Cleanup"

site/src/pages/TemplateSettingsPage/TemplateSchedulePage/TemplateSchedulePage.test.tsx

-3
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,6 @@ describe("TemplateSchedulePage", () => {
123123
jest
124124
.spyOn(API, "getEntitlements")
125125
.mockResolvedValue(MockEntitlementsWithScheduling);
126-
127-
// remove when https://github.com/coder/coder/milestone/19 is completed.
128-
jest.spyOn(API, "getExperiments").mockResolvedValue(["workspace_actions"]);
129126
});
130127

131128
it("Calls the API when user fills in and submits a form", async () => {

site/src/pages/TemplateSettingsPage/TemplateSchedulePage/TemplateSchedulePage.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,11 @@ const TemplateSchedulePage: FC = () => {
1818
const queryClient = useQueryClient();
1919
const orgId = useOrganizationId();
2020
const { template } = useTemplateSettings();
21-
const { entitlements, experiments } = useDashboard();
21+
const { entitlements } = useDashboard();
2222
const allowAdvancedScheduling =
2323
entitlements.features["advanced_template_scheduling"].enabled;
2424
// This check can be removed when https://github.com/coder/coder/milestone/19
2525
// is merged up
26-
const allowWorkspaceActions = experiments.includes("workspace_actions");
2726
const allowAutostopRequirement =
2827
entitlements.features["template_autostop_requirement"].enabled;
2928
const { clearLocal } = useLocalStorage();
@@ -54,7 +53,6 @@ const TemplateSchedulePage: FC = () => {
5453
</Helmet>
5554
<TemplateSchedulePageView
5655
allowAdvancedScheduling={allowAdvancedScheduling}
57-
allowWorkspaceActions={allowWorkspaceActions}
5856
allowAutostopRequirement={allowAutostopRequirement}
5957
isSubmitting={isSubmitting}
6058
template={template}

site/src/pages/TemplateSettingsPage/TemplateSchedulePage/TemplateSchedulePageView.stories.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ type Story = StoryObj<typeof TemplateSchedulePageView>;
3131

3232
const defaultArgs = {
3333
allowAdvancedScheduling: true,
34-
allowWorkspaceActions: true,
3534
template: MockTemplate,
3635
onSubmit: action("onSubmit"),
3736
onCancel: action("cancel"),

site/src/pages/TemplateSettingsPage/TemplateSchedulePage/TemplateSchedulePageView.tsx

-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export interface TemplateSchedulePageViewProps {
1414
typeof TemplateScheduleForm
1515
>["initialTouched"];
1616
allowAdvancedScheduling: boolean;
17-
allowWorkspaceActions: boolean;
1817
allowAutostopRequirement: boolean;
1918
}
2019

@@ -24,7 +23,6 @@ export const TemplateSchedulePageView: FC<TemplateSchedulePageViewProps> = ({
2423
onSubmit,
2524
isSubmitting,
2625
allowAdvancedScheduling,
27-
allowWorkspaceActions,
2826
allowAutostopRequirement,
2927
submitError,
3028
initialTouched,
@@ -39,7 +37,6 @@ export const TemplateSchedulePageView: FC<TemplateSchedulePageViewProps> = ({
3937

4038
<TemplateScheduleForm
4139
allowAdvancedScheduling={allowAdvancedScheduling}
42-
allowWorkspaceActions={allowWorkspaceActions}
4340
allowAutostopRequirement={allowAutostopRequirement}
4441
initialTouched={initialTouched}
4542
isSubmitting={isSubmitting}

0 commit comments

Comments
 (0)