Skip to content

fix MPP-4559: feat(masks): make free mask limit configurable per environment#6280

Open
groovecoder wants to merge 1 commit intomainfrom
update-mask-limit-mpp-4559
Open

fix MPP-4559: feat(masks): make free mask limit configurable per environment#6280
groovecoder wants to merge 1 commit intomainfrom
update-mask-limit-mpp-4559

Conversation

@groovecoder
Copy link
Member

This PR fixes MPP-4559.

How to test:

  1. Checkout this branch
  2. Set your MAX_NUM_FREE_ALIASES env var to a new number (e.g., 10)
  3. cd frontend && npm run build
  4. cd .. && python manage.py collectstatic
  5. python manage.py runserver
  6. Go to the dashboard as a free user and create the new max number of free aliases
    • When you create 1 less than the max, you should see the bottom-right upgrade notification
    • When you create the max number, you should see the top "hero" upgrade banner
  7. (Optional) Set your MAX_NUM_FREE_ALIASES env var to a new higher number (e.g., 15)
  8. Repeat steps 3-6 to check that the code works as expected with the new higher env var value
  • l10n changes have been submitted to the l10n repository, if any.
  • I've added or updated a unit test to test for potential regressions of this bug.
  • I've added or updated relevant docs in the docs/ directory.
  • All UI revisions follow the coding standards, and use Protocol / Nebula colors where applicable (see /frontend/src/styles/colors.scss).
  • Commits in this PR are minimal and have descriptive commit messages.

@groovecoder groovecoder force-pushed the update-mask-limit-mpp-4559 branch from 640e18f to f4430d2 Compare February 11, 2026 17:46
@groovecoder groovecoder changed the title feat(masks): make free mask limit configurable per environment fix MPP-4559: feat(masks): make free mask limit configurable per environment Feb 11, 2026
Copy link
Contributor

@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.

This may go beyond the scope of MPP-4559, which only covered updating the mask limit on the API side. This looks more like it is getting into the Relay Dashboard work, which would include e2e tests in MPP-4563.

Since this is mostly frontend code, I'm commenting rather than approving or requesting changes

emailSizeLimitNumber: 10,
emailSizeLimitUnit: "MB",
maxFreeAliases: 5,
maxFreeAliases: 50,
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm concerned this could ship the new mask limit when it goes to production. Is product OK with that, or did they want to coordinate across clients (Firefox integration, add-on)

Copy link
Collaborator

Choose a reason for hiding this comment

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

+1 this

Copy link
Collaborator

Choose a reason for hiding this comment

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

this work covers MPP-4570

Copy link
Member Author

Choose a reason for hiding this comment

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

I introduced a new waffle flag increased_free_mask_limit to control whether the app will use the MAX or INCREASED_MAX value.

// Note: Set to 5 for test performance. Production default is 50 (see runtimeData-default.ts),
// but tests use 5 to avoid creating 49 aliases to trigger limit-related UI.
MAX_NUM_FREE_ALIASES: 5,
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

this work covers MPP-4570

@vpremamozilla
Copy link
Collaborator

vpremamozilla commented Feb 11, 2026

ran unit test suite, looks like this PR also covers MPP-4571

const maxFreeAliases = runtimeData.MAX_NUM_FREE_ALIASES;
const showAtMaskCount = maxFreeAliases - 1;

if (
Copy link
Collaborator

Choose a reason for hiding this comment

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

this work covers MPP-4572

only question i have for product/UX - do we want this to pop up maybe for the 25 mask mark? or is waiting until 49 still an appropriate use for this component?

@vpremamozilla
Copy link
Collaborator

vpremamozilla commented Feb 11, 2026

Overall this looks good to me, it does cover several of the frontend tickets relating to the mask limit expansion initiative - MPP-4570, MPP-4571 and MPP-4572

only thing i would double check (and maybe this is something youve already considered looking at the PR)
what i observed is that there are TWO separate config systems:

  • Frontend config (getRuntimeConfig() from config.ts) – contains maxFreeAliases
  • Backend runtime data (from /runtime_data API) – contains feature flags, product IDs, etc., but NO mask limit

it looks like if its not set in Django, that you are using the setting in the frontend config.ts file, if thats intentional i'd say it looks good to me (and makes the most use of the backend api value)

@joeherm
Copy link
Collaborator

joeherm commented Feb 12, 2026

This looks good, but I'm a bit worried about this line in the add-on being hardcoded:
https://github.com/mozilla/fx-private-relay-add-on/blob/4e86761189aef430492c4f2d5b21bc660052ae87/src/js/background/background.js#L4

It would be good to get a timeline + sequence of the rollout strategy that takes into account the different Relay clients. If we change the frontend default from 50 to 5 as suggested by @jwhitlock and @vpremamozilla above, I'd still probably feel comfortable merging this down. We could then do follow on PRs for FF/add-on, and the webservices-infra ConfigMap updates.

@groovecoder groovecoder force-pushed the update-mask-limit-mpp-4559 branch from f4430d2 to 0b73e52 Compare February 12, 2026 21:16
…ronment

Backend exposes `MAX_NUM_FREE_ALIASES` via `runtime_data` endpoint.
Frontend fetches the value and falls back to hardcoded 5.
Components use runtime data instead of static config.

Waffle flag "increased_free_mask_limit" controls which limit applies.
Two environment variables set the values:
- MAX_NUM_FREE_ALIASES (default: 5)
- INCREASED_MAX_NUM_FREE_ALIASES (defaul: 50)

Dev and stage can now set higher limits without rebuilding frontend.
Single build works across all environments.
Each environment can run with MAX or INCREASED_MAX via waffle flag.
@groovecoder groovecoder force-pushed the update-mask-limit-mpp-4559 branch from 0b73e52 to 021e257 Compare February 12, 2026 21:20
@groovecoder
Copy link
Member Author

I introduced a new waffle flag increased_free_mask_limit to control whether the app will use the MAX or INCREASED_MAX value.

This way, we can merge this code, and set the env var and waffle flag in dev & stage servers:

  • Dev
    • INCREASED_MAX_NUM_FREE_ALIASES=50
    • increased_free_mask_limit flag = everyone
  • Stage
    • INCREASED_MAX_NUM_FREE_ALIASES=50
    • increased_free_mask_limit flag = everyone
  • Prod
    • INCREASED_MAX_NUM_FREE_ALIASES=50
    • increased_free_mask_limit flag = individual accounts & QA

For the add-on, here's a first draft PR to make it also pull from the runtime_data endpoint rather than hard-code: mozilla/fx-private-relay-add-on#563

Copy link
Collaborator

@joeherm joeherm left a comment

Choose a reason for hiding this comment

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

With the waffle-flag and add-on work this LGTM.

@groovecoder
Copy link
Member Author

@vpremamozilla, re:

only thing i would double check (and maybe this is something youve already considered looking at the PR)
what i observed is that there are TWO separate config systems:

Frontend config (getRuntimeConfig() from config.ts) – contains maxFreeAliases
Backend runtime data (from /runtime_data API) – contains feature flags, product IDs, etc., but NO mask limit

it looks like if its not set in Django, that you are using the setting in the frontend config.ts file, if thats intentional i'd say it looks good to me (and makes the most use of the backend api value)

Yes that's intentional. Your comment made me realize that getRuntimeConfig and runtimeData are two separate things and their conflicting names make things confusing. So I filed https://mozilla-hub.atlassian.net/browse/MPP-4578 and attached an implementation plan to clean that up in aother PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants