Skip to content

Add beta override switches to the Test Tool menu - #99444

Draft
arekm213 wants to merge 2 commits into
Expensify:mainfrom
arekm213:arekm213/feat/98409-beta-overrides
Draft

Add beta override switches to the Test Tool menu#99444
arekm213 wants to merge 2 commits into
Expensify:mainfrom
arekm213:arekm213/feat/98409-beta-overrides

Conversation

@arekm213

@arekm213 arekm213 commented Aug 25, 2026

Copy link
Copy Markdown

Explanation of Change

Betas can only be flipped locally today by editing Onyx by hand in the console (Onyx.merge('betas', [...betas, 'submit2026'])), which is easy to get wrong and gets wiped on the next reconnect.

This adds a Beta overrides row to the Test Tool menu that opens a modal listing every beta in CONST.BETAS with a switch each, so a beta can be turned on or off on the current device without touching the console. The row renders from TestToolMenu, so it is available both in the hidden Test Tools modal and inline on Settings > Troubleshoot.

Behavior:

  • Toggling a beta pins it to that value. Toggling back does not remove the override, it pins the opposite value, and pinned rows show an Overridden badge.
  • Reset all overrides clears them all and returns every beta to the value the account has on the backend.
  • Overrides survive sign out, the sign in redirect, delegate switching and clearOnyxAndResetApp, so a testing setup is not lost by logging out.
  • Overrides never apply in production builds, and the row is hidden there (the Test Tools modal is reachable in production).

Implementation notes:

  • New ONYXKEYS.BETAS_OVERRIDE key (Partial<Record<Beta, boolean>>) rather than writing into BETAS, because the server re-pushes BETAS on every OpenApp/ReconnectApp and would wipe anything stored there.
  • The merge point is Permissions.isBetaEnabled, which takes the overrides as a new optional parameter defaulting to a module level value. That keeps the non-render callers (actions, utils, navigation guards) that receive betas as a parameter honest without each of them subscribing to the key. Components get reactivity through usePermissions, which passes the value in from a new BetasOverrideContext. This mirrors how ONYXKEYS.BETAS itself is already read: through BetasContext for components and through Onyx.connectWithoutView in ViolationsUtils and TransactionInlineEdit for non-React code. See Onyx Data Management.
  • TestToolsModalNavigator now skips its ESCAPE shortcut while modal.willAlertModalBecomeVisible is true, so on web Escape closes the overrides modal instead of closing both it and the Test Tools modal.
  • The all beta is excluded from the list, since it is a blanket switch rather than an individual feature.

Known limitation, happy to address if reviewers prefer: QuickCreationActionsBar and TravelMenuItem call Permissions.isBetaEnabled directly rather than through usePermissions, so they read the correct value but do not re-render on an override change until something else re-renders them.

Proposed by @JakubKorytko.

Fixed Issues

$ #98409
PROPOSAL:

Tests

  1. Sign in.
  2. Open the hidden Test Tool menu (iOS/Android App and mWeb: tap the screen with 4 fingers; Web: open /test-tools or press Cmd/Ctrl+D). Alternatively go to Settings > Troubleshoot.
  3. Tap View on the Beta overrides row and verify the modal opens on top of the Test Tools modal, with the list of betas and a switch on each row.
  4. Toggle defaultRooms on. Verify the switch flips and an Overridden badge appears next to the name.
  5. Close the modal and verify the feature behind that beta is now available (with defaultRooms on, #admins and #announce rooms appear in the LHN).
  6. Reopen the modal and toggle defaultRooms back off. Verify the badge stays, since the override is now pinned to false rather than removed, and verify the rooms disappear again.
  7. Refresh or restart the app and verify the override is still applied.
  8. Sign out and sign back in. Verify the override is still applied.
  9. Tap Reset all overrides and verify every badge disappears and each beta returns to the value the account has on the backend.
  10. Web only: with the overrides modal open, press Escape. Verify it closes only the overrides modal and the Test Tools modal stays open, and that pressing Escape again closes the Test Tools modal.
  • Verify that no errors appear in the JS console

Offline tests

N/A. Overrides are stored locally in Onyx and only affect frontend checks, so behavior is identical offline. Note that force enabling a beta the account does not have on the backend can still fail at the request level once online, which the modal calls out in its description.

QA Steps

Same as Tests.

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android.mov
Android: mWeb Chrome
chromeMobile.mov
iOS: Native
iOS.mov
iOS: mWeb Safari
safariMobile.mov
MacOS: Chrome / Safari
chrome.mov

@melvin-bot

melvin-bot Bot commented Aug 25, 2026

Copy link
Copy Markdown

Hey, I noticed you changed src/languages/en.ts in a PR from a fork. For security reasons, translations are not generated automatically for PRs from forks.

If you want to automatically generate translations for other locales, an Expensify employee will have to:

  1. Look at the code and make sure there are no malicious changes.
  2. Run the Generate static translations GitHub workflow. If you have write access and the K2 extension, you can simply click: [this button]

Alternatively, if you are an external contributor, you can run the translation script locally with your own OpenAI API key. To learn more, try running:

npx bun ./scripts/generateTranslations.ts --help

Typically, you'd want to translate only what you changed by running npx bun ./scripts/generateTranslations.ts --compare-ref main

@codecov

codecov Bot commented Aug 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.

Files with missing lines Coverage Δ
src/ONYXKEYS.ts 100.00% <ø> (ø)
src/components/OnyxListItemProvider.tsx 100.00% <100.00%> (ø)
src/hooks/usePermissions.ts 100.00% <100.00%> (ø)
src/libs/ExportOnyxState/common.ts 80.95% <ø> (ø)
src/libs/Permissions.ts 100.00% <100.00%> (ø)
src/libs/actions/App.ts 60.62% <ø> (ø)
src/libs/actions/Delegate.ts 30.81% <ø> (ø)
src/libs/actions/Session/index.ts 58.57% <ø> (-0.61%) ⬇️
src/libs/actions/SignInRedirect.ts 81.81% <100.00%> (+0.33%) ⬆️
src/components/TestToolMenu.tsx 89.36% <60.00%> (-3.50%) ⬇️
... and 3 more
... and 183 files with indirect coverage changes

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.

1 participant