Skip to content
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

Remove unused feature flags #2136

Merged
merged 4 commits into from
Jun 29, 2022
Merged

Remove unused feature flags #2136

merged 4 commits into from
Jun 29, 2022

Conversation

Vinnl
Copy link
Collaborator

@Vinnl Vinnl commented Jun 28, 2022

New feature description

This removes "old" feature flags, to be replaced by Waffle-based ones.

Note that this does enable the hitherto gated feature
generateCustomAliasSubdomain (a popover when clicking your
subdomain explaining how to create a custom mask).
I'll also ask Tony and Eduardo to confirm that this is OK. (Edit: confirmed!)

Additionally, it makes the interview recruitment banner gated by the new-style
feature flags, which doesn't have a flag for that feature yet. That
means it will in effect be disabled for now - I'm verifying that this is OK.
If not, I'll have to learn how to add it. (Edit: also verified that that's OK!)

Screenshot (if applicable)

Not applicable.

How to test

Nothing should have changed, other than that this popup is now present, and the CSAT survey is restored:

image

Checklist

  • l10n changes have been submitted to the l10n repository, if any.
  • All acceptance criteria are met.
  • I've added or updated relevant docs in the docs/ directory.
  • All UI revisions follow the coding standards, and use Protocol tokens where applicable (see /frontend/src/styles/tokens.scss).
  • Commits in this PR are minimal and have descriptive commit messages.

@Vinnl Vinnl added 🛑 Do Not Merge Do not merge this PR, even if approved. Review: XS Code review time: up to 30min labels Jun 28, 2022
@Vinnl Vinnl self-assigned this Jun 28, 2022
@@ -70,14 +70,12 @@ def valid_available_subdomain(subdomain, *args, **kwargs):


def default_server_storage():
return datetime.now(timezone.utc) > settings.PREMIUM_RELEASE_DATE
return True
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I kept this since a migration (specifically 0029_profile_add_deleted_metric_and_changeserver_storage_default.py for the emails app) pointed to this function as the one to generate a default value. Not sure if there's a better way to do that.

Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: Add a comment like "This historical function is referenced in migration 0029_profile_add_deleted_metric_and_changeserver_storage_default"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good idea: a12cf6b

@@ -67,15 +67,6 @@ environment variables to the outside world. You can extend this endpoint in
using the `useRuntimeData` hook; you can find this in
`/frontend/src/hooks/api/runtimeData.ts`.

## Add a feature flag
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

IIRC Se Yeon is writing docs on how feature flagging with Waffle will be done, so I didn't include replacement docs for this.

@@ -4,7 +4,7 @@ export type RuntimeDataWithWaffle = RuntimeData & {
WAFFLE_FLAGS: RuntimeData["WAFFLE_FLAGS"];
};

export function flagIsActive(
export function isFlagActive(
Copy link
Collaborator Author

@Vinnl Vinnl Jun 28, 2022

Choose a reason for hiding this comment

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

I renamed this to be aligned with other function names (i.e. start with a verb, is if it returns a boolean) because I couldn't find this function at first, but since we don't have an explicit guideline for that anyway, I'm happy to drop this commit.

Copy link
Contributor

Choose a reason for hiding this comment

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

Personally, this makes sense to me. +1 from me.

@Vinnl Vinnl removed the 🛑 Do Not Merge Do not merge this PR, even if approved. label Jun 28, 2022
Copy link
Member

@jwhitlock jwhitlock left a comment

Choose a reason for hiding this comment

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

Thanks @Vinnl! I love cleaning up old code!

I've got some suggestions, and we need the migration for the updated model.

@@ -70,14 +70,12 @@ def valid_available_subdomain(subdomain, *args, **kwargs):


def default_server_storage():
return datetime.now(timezone.utc) > settings.PREMIUM_RELEASE_DATE
return True
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: Add a comment like "This historical function is referenced in migration 0029_profile_add_deleted_metric_and_changeserver_storage_default"

@@ -102,7 +100,7 @@ class Profile(models.Model):
db_index=True,
validators=[valid_available_subdomain],
)
server_storage = models.BooleanField(default=default_server_storage)
server_storage = models.BooleanField(default=True)
Copy link
Member

Choose a reason for hiding this comment

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

This will require a migration, please run ./manage.py makemigrations; black . and add the new / changed files

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh, thanks, I did not know that! a1cd4e6

emails/models.py Outdated
@@ -303,7 +301,7 @@ def emails_replied(self):
@property
def joined_before_premium_release(self):
date_created = self.user.date_joined
return date_created < settings.PREMIUM_RELEASE_DATE
return date_created < datetime.fromisoformat('2021-10-22 17:00:00+00:00')
Copy link
Member

Choose a reason for hiding this comment

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

Was this the actual premium release date? I wouldn't mind getting that correct, although it may screw up tests.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I believe so, since that was the value of this var in .env-dist: https://github.com/mozilla/fx-private-relay/pull/2136/files#diff-9b75aa53740e3b569fdd203e0b882eaadadc8c03b5c840e648f37a5b2ca7b622L36

There were a couple of tests that overrode the env var to make sure they preceded or followed the given date, but I went over the (non-removed) ones and verified that the dates were still correct relative to this static date.

@netlify
Copy link

netlify bot commented Jun 28, 2022

Deploy Preview for fx-relay-demo canceled.

Name Link
🔨 Latest commit 56d945f
🔍 Latest deploy log https://app.netlify.com/sites/fx-relay-demo/deploys/62bb8bc6ef3f510008f38790

@Vinnl Vinnl force-pushed the remove-unused-feature-flags branch from a12cf6b to 56d945f Compare June 28, 2022 23:16
@Vinnl Vinnl requested a review from jwhitlock June 28, 2022 23:16
Copy link
Contributor

@lloan lloan left a comment

Choose a reason for hiding this comment

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

LGTM.

I reviewed the React items. Leaving the Python code up to BE team.

Copy link
Member

@jwhitlock jwhitlock left a comment

Choose a reason for hiding this comment

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

Thanks @Vinnl, looks good to me!

Vinnl added 4 commits June 29, 2022 23:28
We're replacing them with a more sophisticated mechanism that does
not require recompiling the front-end, and allows gradually
enabling features for specific groups of users.

Note that this does enable the hitherto gated feature
`generateCustomAliasSubdomain` (a popover when clicking your
subdomain explaining how to create a custom mask). Additionally, it
makes the interview recruitment banner gated by the new-style
feature flags, which doesn't have a flag for that feature yet. That
means it will in effect be disabled for now.
This makes it consistent with other functions in that it starts
with a verb, and specifically with `is` because it returns a
boolean.
@Vinnl Vinnl force-pushed the remove-unused-feature-flags branch from 56d945f to 2807c8f Compare June 29, 2022 21:29
@Vinnl Vinnl merged commit b3c2a40 into main Jun 29, 2022
@Vinnl Vinnl deleted the remove-unused-feature-flags branch June 29, 2022 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Review: XS Code review time: up to 30min
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants