10000 feat!: move workspace renames behind flag, disable by default by f0ssel · Pull Request #11189 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

feat!: move workspace renames behind flag, disable by default #11189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
Dec 15, 2023

Conversation

f0ssel
Copy link
Contributor
@f0ssel f0ssel commented Dec 13, 2023

Closes #10922

  • This allows renames to continue to function if the flag is enabled.
  • Disables the form field and conditionally the form fotter containing the cancel and submit button in the workspace settings when renames disabled and template policies disabled.
Screenshot 2023-12-15 at 9 41 49 AM image ima
10000
ge image

Considerations

  • I personally like showing disabled fields because it gives the user information despite not being able to take action as oppose to a page being missing entirely. I removed the form footer with the cancel and submit buttons, but if we want to remove the page entirely conditionally this will take a little more work because I need to move that logic up to have the sidebar behave correctly too.

@f0ssel f0ssel changed the title feat: Add flag to allow workspace renames feat: add flag to allow workspace renames Dec 13, 2023
@f0ssel f0ssel marked this pull request as ready for review December 13, 2023 20:19
@f0ssel
Copy link
Contributor Author
f0ssel commented Dec 13, 2023

Gonna request @ammario to ensure this is the spec you were thinking, @mafredri as well since you worked on the feature originally and may know blind spots I missed.

@f0ssel f0ssel requested review from mafredri and ammario December 13, 2023 20:22
Copy link
Member
ammario commented Dec 13, 2023

Will review shortly.

Copy link
Member
ammario commented Dec 13, 2023

Re the expiration going into the DB vs. hard-coded, I intentionally envisioned it as hard-coded so it can be easily changed or removed in response to user feedback.

<FormFooter
onCancel={onCancel}
isLoading={form.isSubmitting}
submitDisabled={!templatePoliciesEnabled && !workspace.allow_renames}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a general rule, whenever there's a disabled field in the frontend there must be some explanation about why that field is disabled and what (if anything) the user can do to enable it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we remove/hide this entire form if allow renames is false? This should only be disabled if allow renames = true and expired.

Otherwise users will be unhappy about seeing a feature that can't be enabled (after the date).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm good with removing the form entirely as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to keep the structure of the form, since it can optionally be expanded to include template policies if those are enabled. Also I don't love the idea of conditionally having items in a sidebar, which would be the case here if we removed it from the sidebar (because there's nothing to show).

When you mean remove the form entirely, do you mean just the form footer buttons, or actually the whole page? Example of the former.
Screenshot 2023-12-15 at 9 05 31 AM

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For comparison with the template cpolicies enabled:
image

Copy link
Contributor Author
@f0ssel f0ssel Dec 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like

const formEnabled = (templatePoliciesEnabled && !workspace.template_require_active_version)
    || workspace.allow_renames

@mafredri mafredri changed the title feat: add flag to allow workspace renames feat: move workspace renames behind flag, disable by default Dec 14, 2023
@mafredri mafredri changed the title feat: move workspace renames behind flag, disable by default feat!: move workspace renames behind flag, disable by default Dec 14, 2023
@github-actions github-actions bot added the release/breaking This label is applied to PRs to detect breaking changes as part of the release process label Dec 14, 2023
Copy link
Member
@mafredri mafredri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took the liberty of updating the title and marking this a breaking change, since it sounded too much like we're adding a new feature instead of removing one.

The breaking change will also help inform our users that this is going away in the future.

That said, I'm very conflicted about this PR for two reasons:

  1. We're removing a feature, the general rule is that once it's in you can't remove it because everybody is already relying on it. Do we have data to suggest nobody uses it?
  2. Timed expiry feels user-hostile, compared to deprecation and explicit removal

Generally when I use software I like the comfort of knowing that behaviors in my applications don't change when I don't update.

If it's a big problem that we forget to remove deprecations from the code-base, can't we make some changes and just lint it instead?

<FormFooter
onCancel={onCancel}
isLoading={form.isSubmitting}
submitDisabled={!templatePoliciesEnabled && !workspace.allow_renames}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we remove/hide this entire form if allow renames is false? This should only be disabled if allow renames = true and expired.

Otherwise users will be unhappy about seeing a feature that can't be enabled (after the date).

@f0ssel
Copy link
Contributor Author
f0ssel commented Dec 14, 2023

@mafredri I can agree with some of your points, I do think the timed expiration feels a little hostile because it is not in the usual upgrade path admins will be expecting.

Depends, do we want the feature to be disabled during runtime or only at start? There's a significant difference in user experience.

This is a good point and one I didn't fully consider. If we are only checking at start, the response could be different depending on when the instance started in an HA setting. Also if the app stays running without restart for a long time, it can go way past the deadline and continue allowing until it does restart.

Shouldn't we remove/hide this entire form if allow renames is false? This should only be disabled if allow renames = true and expired. Otherwise users will be unhappy about seeing a feature that can't be enabled (after the date).

I considered this but didn't want to bleed this logic into the upper components, and assumed we will add more settings in the future here so I think it's OK to have a disabled form that users can see. There are other tabs that should be viewed as well.

@ammario Because of the issue with both the golden files breaking CI if we auto-hide the flag at a set date + the odd startup behavior, I think the deadline behavior might not be the best experience for us and the customer. Do you want to continue with this behavior - do the auto-hide behavior (and opt to break CI in the future), revert this to a basic flag we remove later, or something else?

Copy link
Member
ammario commented Dec 14, 2023

I'm thinking the CI breaking at a certain date is a good failsafe. My p1 is solving for us keeping around deprecated options for too long, p3 is enforcing customers migrate at a date.

@mafredri
Copy link
Member

I'm thinking the CI breaking at a certain date is a good failsafe. My p1 is solving for us keeping around deprecated options for too long, p3 is enforcing customers migrate at a date.

How will we enforce that it remains a fail-safe? I see it as a very high risk of this getting in the way of multiple PRs at a certain date, I for one don't want to be dealing with sudden CI breakage.

Copy link
Member
@ammario ammario left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm good with removing the date stuff if you think its best

<FormFooter
onCancel={onCancel}
isLoading={form.isSubmitting}
submitDisabled={!templatePoliciesEnabled && !workspace.allow_renames}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm good with removing the form entirely as well.

@f0ssel f0ssel force-pushed the f0ssel/workspace-rename branch from 6286cf2 to db34075 Compare December 15, 2023 13:53
@f0ssel
Copy link
Contributor Author
f0ssel commented Dec 15, 2023

@ammario @mafredri I've removed the time based expiration and the form footers if all the fields are disabled, pictures are in the description, let me know if this is what you both had in mind. Thanks.

@f0ssel f0ssel requested review from ammario and mafredri December 15, 2023 14:37
Copy link
Member
@mafredri mafredri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BE LGTM 👍🏻, only thing that raised a flag for me was the 10000 removal of the form footer in some cases for the FE, but I'll leave that for FE people determine.

I'm still a bit disappointed we're removing the feature, but this approach is at least acceptable. 😄 Thanks for making the changes @f0ssel.

helperText={
!workspace.allow_renames &&
"Renaming your workspace can be destructive and has not been enabled for this deployment."
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have an alert below that relies on slightly different logic but has similar messaging. It would be nice to consolidate and just use helper text IMO. You could even conditionally change the color of the text so that it assumes a warning hue if workspace.allow_renames is true.
Screenshot 2023-12-15 at 11 17 40 AM

The class to target would be .MuiFormHelperText-root

@@ -54,16 +58,20 @@ export const WorkspaceSettingsForm: FC<{
<HorizontalForm onSubmit={form.handleSubmit} data-testid="form">
<FormSection
title="Workspace Name"
description="Update the name of your workspace."
description="The name of your workspace."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might keep the old language here. The user already knows this is an input. Also, the other field (and any other fields we add in the future) are going to use imperative descriptions.

@Kira-Pilot
Copy link
Member

Everything works as intended! From a FE perspective, I'm not wild about having a disabled form, but I think the design required here is outside of this ticket's scope. We should probably make a ticket for a more general redesign of these workspace forms. If a template doesn't have parameters and also doesn't have this flag enabled, we basically have two pages of empty space.

Also, could we please add 1) a storybook for the disabled input to WorkspaceSettingsPageView.stories.tsx and 2) a jest test to WorkspaceSettingsPage.test.tsx to test that workspace name input is disabled when that flag is off?

@f0ssel f0ssel dismissed ammario’s stale review December 15, 2023 18:36

Made requested changes

@f0ssel f0ssel merged commit 7924bb2 into main Dec 15, 2023
@f0ssel f0ssel deleted the f0ssel/workspace-rename branch December 15, 2023 18:38
@github-actions github-actions bot locked and limited conversation to collaborators Dec 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release/breaking This label is applied to PRs to detect breaking changes as part of the release process
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Workspace renames can break builds
4 participants
0