Skip to content

fix: tag Control-tier upgrade features with requiredPlan for Submit workspaces - #100082

Merged
grgia merged 2 commits into
Expensify:mainfrom
neerajbachani:fix/93096-control-tier-required-plan
Sep 18, 2026
Merged

grgia merged 2 commits into
Expensify:mainfrom
neerajbachani:fix/93096-control-tier-required-plan

Conversation

@neerajbachani

@neerajbachani neerajbachani commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Add requiredPlan: CORPORATE to Control-gated UPGRADE_FEATURE_INTRO_MAPPING entries that were still defaulting Submit upgrades to Collect (report fields, prevent-members-changing-title, GL/tax codes, multi-level tags, approvals).

Derive the Submit upgrade target from the raw mapping lookup by alias so filtered entries like policyPreventMemberChangingTitle upgrade correctly.

$ #93096

Explanation of Change

Control-tier toggles gate on !isControlPolicy(policy), but Submit workspaces upgrading through WorkspaceUpgradePage defaulted to Collect (TEAM) whenever UPGRADE_FEATURE_INTRO_MAPPING had no requiredPlan. After the first upgrade the workspace was still not Control, so disable → re-enable re-opened the Upgrade RHP (issue #93096).

Product confirmed Submit → Report fields should upgrade to Control, stay Control after disable, and not re-prompt on re-enable.

This PR:

  1. Adds requiredPlan: this.POLICY.TYPE.CORPORATE to all remaining Control-gated mapping entries (reportFields, policyPreventMemberChangingTitle, multiApprovalLevels, glCodes, glAndPayrollCodes, taxCodes, multiLevelTags, approvals).
  2. Derives the Submit upgrade target from the raw mapping lookup by alias in WorkspaceUpgradePage, so filtered entries like policyPreventMemberChangingTitle (excluded from intro UI) still upgrade to Control.

Collect-tier Submit features (travelSubmit, payments, etc.) are unchanged and still default to TEAM.

Fixed Issues

$ #93096
PROPOSAL: #93096 (comment)

Tests

Precondition: Expensifail account with submit2026 beta, Submit workspace.

  1. Go to Workspace settings → Reports.
  2. Enable Report fields → confirm Control upgrade RHP → tap Upgrade → workspace becomes Control.
  3. Disable Report fields → workspace stays Control.
  4. Re-enable Report fields → toggles on without Upgrade RHP.
  5. On a fresh Submit workspace, enable Prevent members from changing custom names first → upgrade → disable → re-enable → no Upgrade loop.
  6. On Submit workspace with tags, enable GL codes → upgrade → disable → re-enable → no Upgrade loop.
  7. More Features → enable Travel on Submit workspace → still upgrades to Collect (regression check).
  • Verify that no errors appear in the JS console

Offline tests

Same as Tests — the upgrade target is computed locally from the feature mapping, so the correct plan is chosen offline. The upgrade completes once back online.

QA Steps

Precondition: Expensifail account, Submit workspace on staging.

  1. Go to staging.new.expensify.com → Workspace settings → Reports.
  2. Enable Report fields → tap Upgrade on Control upgrade RHP.
  3. Verify workspace upgrades to Control.
  4. Disable, then re-enable Report fields → verify Upgrade RHP does not reappear.
  5. Repeat steps 2–4 for Prevent members from changing custom names on the same page.
  6. On Submit workspace with tags enabled, repeat disable/re-enable for GL codes.
  • 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 shown in the product 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
Screen.Recording.2026-09-04.at.12.28.33.AM.online-video-cutter.com.mp4
Android: mWeb Chrome
Record_2026-09-04-11-14-33.online-video-cutter.com.mp4
iOS: Native
Simulator.Screen.Recording.-.iPhone.17.Pro.-.2026-09-04.at.00.23.35.online-video-cutter.com.mp4
iOS: mWeb Safari
Screen.Recording.2026-09-04.at.11.40.39.AM.mov
MacOS: Chrome / Safari
Screen.Recording.2026-08-03.at.1.00.36.PM.online-video-cutter.com.mp4

…orkspaces

Add requiredPlan: CORPORATE to Control-gated UPGRADE_FEATURE_INTRO_MAPPING
entries that were still defaulting Submit upgrades to Collect (report fields,
prevent-members-changing-title, GL/tax codes, multi-level tags, approvals).

Derive the Submit upgrade target from the raw mapping lookup by alias so
filtered entries like policyPreventMemberChangingTitle upgrade correctly.

Fixes Expensify#93096
@neerajbachani
neerajbachani requested review from a team as code owners September 1, 2026 21:35
@melvin-bot
melvin-bot Bot requested review from dylanexpensify and thelullabyy and removed request for a team September 1, 2026 21:35
@melvin-bot

melvin-bot Bot commented Sep 1, 2026

Copy link
Copy Markdown

@thelullabyy Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot
melvin-bot Bot removed the request for review from a team September 1, 2026 21:35
dylanexpensify
dylanexpensify previously approved these changes Sep 3, 2026

@dylanexpensify dylanexpensify left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

good from a product perspective 👍

@thelullabyy

thelullabyy commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible 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 checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (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 verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • 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 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.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this 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.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
Screen.Recording.2026-09-06.at.21.33.31.mov
Android: mWeb Chrome
Screen.Recording.2026-09-06.at.21.29.07.mov
iOS: HybridApp
Screen.Recording.2026-09-06.at.21.01.05.mov
iOS: mWeb Safari
Screen.Recording.2026-09-06.at.20.54.12.mov
MacOS: Chrome / Safari
Screen.Recording.2026-09-06.at.20.51.43.mov

Comment thread src/CONST/index.ts
alias: 'policy-prevent-member-changing-title',
name: undefined,
icon: undefined,
requiredPlan: this.POLICY.TYPE.CORPORATE,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do we need add requiredPlan for others? Isn't the issue only about report fields @neerajbachani

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@thelullabyy the issue repro is Report fields, but the root cause is the same across Control-gated features on Submit:

  • Toggle gates on !isControlPolicy
  • Submit upgrade defaults to Collect when there's no requiredPlan
  • After upgrade, isControlPolicy is still false → disable/re-enable loops

That's exactly what #92872 fixed for rules-approval features; Report fields and others were just never tagged.

Why not only reportFields?

  1. Same page, same bug - "Prevent members from changing custom names" uses the same gate and the same mapping pattern (policyPreventMemberChangingTitle). I repro'd the loop there too when testing lorretheboy's one-line fix (only reportFields gets requiredPlan).

  2. Same pattern elsewhere - I also hit it on GL codes / tags on Submit (#93096 comment). Melvin flagged the same list on #92864.

  3. Matches the approved approach - Product confirmed Submit → Report fields should land on Control (#93096 comment). Tagging requiredPlan: CORPORATE on Control-gated entries is the same pattern as Upgrade Submit workspaces to the plan tier required by the unlocked feature #92872, just completing what that PR scoped down for the deploy blocker.

  4. policyPreventMemberChangingTitle needs the alias lookup fix anyway - it's filtered out of feature on the upgrade page, so adding requiredPlan there only works with the WorkspaceUpgradePage change.

The goal is to fix this pattern across the codebase so we don't keep filing duplicate issues for the same root cause

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@thelullabyy Here are videos that might make it clearer.

The members toggle (policyPreventMemberChangingTitle) — same loop if we only add requiredPlan on reportFields:

Screen.Recording.2026-08-11.at.4.14.33.PM.online-video-cutter.com.mp4

Same pattern on tags / GL codes — disable → re-enable on Submit loops again:

Screen.Recording.2026-08-18.at.7.33.06.PM.mov

A reportFields-only change doesn’t cover the members toggle on the same page, that’s why policyPreventMemberChangingTitle is in this PR too.

@thelullabyy thelullabyy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@melvin-bot
melvin-bot Bot requested a review from grgia September 6, 2026 13:34
await waitForBatchedUpdates();
});

it('should upgrade a Submit workspace to Corporate when unlocking Report fields', async () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

NAB. should we add the same test for policyPreventMemberChangingTitle.alias? the two new cases pass without the upgradeFeatureByAlias change, so nothing catches a refactor back to reading requiredPlan off feature

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@grgia Added the test for policyPreventMemberChangingTitle.alias

…e alias

Add a WorkspaceUpgradeTest case for the filtered alias path so refactors
that read requiredPlan from feature instead of upgradeFeatureByAlias fail CI.

Also add upgrade-button testID to GenericFeaturesView for test parity with
UpgradeIntroView.
@neerajbachani

Copy link
Copy Markdown
Contributor Author

@grgia Friendly bump on this one :)

@neerajbachani

Copy link
Copy Markdown
Contributor Author

@grgia Friendly bump, thanks!!

@neerajbachani

Copy link
Copy Markdown
Contributor Author

@grgia now that the PR is approved, is there anything left to get this merged?

@grgia
grgia merged commit ea3f7d7 into Expensify:main Sep 18, 2026
37 of 39 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🚧 grgia has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/grgia in version: 9.4.90-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@MelvinBot

Copy link
Copy Markdown
Contributor

Yes — help site changes were required. Draft PR: Docs updates for E/A#100082 Submit workspace upgrade plan per feature

Why: this PR makes the upgrade target deterministic for free Submit workspaces — turning on a Control-only feature now upgrades straight to Control instead of Collect, and the workspace keeps that plan if the feature is turned off again. Two articles under docs/articles contradicted or omitted that.

What changed in the docs PR

File Change
docs/articles/new-expensify/getting-started/Submit-Workspace.md The upgrade section listed only two paths (switching Plan type in Overview, an approver clicking Approve) and never mentioned upgrading by turning on a feature. Added that path plus a new section naming which plan each feature upgrades to, and that the plan sticks after you turn the feature back off.
docs/articles/new-expensify/workspaces/Enable-Report-Fields.md Steps pointed at More features > Report Fields, which no longer exists — the Report fields toggle lives on the workspace Reports page. Fixed navigation in all three sections and documented the upgrade prompt, including the direct-to-Control upgrade for Submit workspaces.
How I verified the labels and the plan split

Labels were taken from src/languages/en.ts on main (the source of the rendered strings), not paraphrased: Reports (common.reports), Report fields (workspace.common.reportFields), Prevent members from changing custom report titles, GL codes, GL & Payroll codes, Tax codes, Multi-level tags, Multiple approval levels, Prevent self-approvals, Per diem, Rules, Upgrade (common.upgrade).

The Control vs Collect split in the new section comes from requiredPlan in UPGRADE_FEATURE_INTRO_MAPPING after your change — entries with requiredPlan: CORPORATE are documented as upgrading to Control, and the entries with no requiredPlan (categories, travelSubmit, companyCardSubmit, approvalSubmit, payments) as upgrading to Collect.

Navigation was confirmed in code, not assumed: src/pages/workspace/getWorkspaceMenuItems.ts:221 adds the Reports item, and src/pages/workspace/reports/WorkspaceReportsPage.tsx:186 renders the Report fields section there. The More features page has no report fields toggle.

Written against docs/HELPSITE_NAMING_CONVENTIONS.md, docs/HELP_AUTHORING_GUIDELINES.md, and docs/TEMPLATE.md: one # title per article, task-based ## headings, bolded sentence-case UI labels, relative links with descriptive anchor text, and no links inside numbered steps.

Two things to flag:

  • I could not add you as an assignee on the docs PR — GitHub rejects it because your permission on Expensify/App is read. The label HelpDot is applied, the PR is a draft, and you're tagged in the body. Someone with write access can assign you if you want it on your list.
  • Enable-Report-Fields.md still uses three # headings and the prose casing "Report Fields" rather than the UI's "Report fields". Fixing that means restructuring the whole article, which is unrelated to this behavior change, so I left it out and noted it in the docs PR.

@neerajbachani, please review the linked help site PR and confirm it reflects the current behavior. Then mark the linked help site PR Ready for review

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/lakchote in version: 9.4.90-2 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

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.

6 participants