Skip to content

[Due for payment 2026-06-17] [$250] Upgrade opens after upgrading Submit WS via Prevent self-approvals, disabling & reenabling it #92864

Closed

Description

@applause-bot

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.4.0-0
Reproducible in staging?: Yes
Reproducible in production?: N/A - new feature, doesn't exist in prod
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #91258
Email or phone of affected tester (no customers): applausetester+ssndjois2jd1@applause.expensifail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.5 / Chrome
App Component: Workspace Settings

Action Performed:

Precondition:

  • Log in with Expensifail account.
  • Create a Submit workspace on OD.
  1. Go to staging.new.expensify.com
  2. Go to workspace settings > Workflows.
  3. Enable Prevent self-approvals.
  4. Click Upgrade.
  5. Close the RHP.
  6. Disable and enable Prevent self-approvals.

Expected Result:

Upgrade page will not open after upgrading workspace via Prevent self-approvals, disabling and reenabling it.

Actual Result:

Upgrade page opens after upgrading workspace via Prevent self-approvals, disabling and reenabling it.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome Safari

Screenshots/Videos

Bug7173662_1780766173454.24.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Julia Ponikarchuk
Bug ID: 7173662

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @hungvu193

Activity

  1. applause-bot commented on Jun 6, 2026

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:
    https://platform.applause.com/services/links/v1/external/64deb3495d471e76616d60c2a855e5802951fbaced82ba146649a5a92f1dd18c

  2. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jun 6, 2026
  3. melvin-bot commented on Jun 6, 2026

    @melvin-bot

    @iwiznia recently merged #91258, but they are OOO right now, so I'll auto-assign someone else.

  4. melvin-bot commented on Jun 6, 2026

    @melvin-bot

    Triggered auto assignment to @JS00001 (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

  5. melvin-bot commented on Jun 6, 2026

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  6. github-actions commented on Jun 6, 2026

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  7. MelvinBot commented on Jun 6, 2026

    @MelvinBot
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    After upgrading a Submit workspace by enabling Prevent self-approvals, disabling and re-enabling that toggle re-opens the Upgrade page, even though the workspace was already upgraded.

    What is the root cause of that problem?

    The Prevent self-approvals toggle is a Control-tier rule. Its onToggle opens the Upgrade page whenever the policy is not a Control policy:

    ExpenseReportRulesSection.tsx:56-62 — if (isEnabled && !isControlPolicy(policy)) { Navigation.navigate(...WORKSPACE_UPGRADE...preventSelfApproval...) }

    When a Submit workspace upgrades through this flow, onUpgradeToCorporate only upgrades to Corporate (Control) for a hard-coded list of feature ids — otherwise it upgrades to Team (Collect):

    WorkspaceUpgradePage.tsx:174-181

    const isCorporateUpgrade =
        feature?.id === CONST.UPGRADE_FEATURE_INTRO_MAPPING.perDiem.id ||
        feature?.id === CONST.UPGRADE_FEATURE_INTRO_MAPPING.rules.id ||
        feature?.id === CONST.UPGRADE_FEATURE_INTRO_MAPPING.hr.id;
    const targetType = isCorporateUpgrade ? CONST.POLICY.TYPE.CORPORATE : CONST.POLICY.TYPE.TEAM;
    upgradeSubmit(policy, targetType, ...);

    preventSelfApproval (and the sibling rules-approval features autoApproveCompliantReports, autoPayApprovedReports) are not in that list, so the workspace is upgraded to Collect/Team, not Control. isControlPolicy(policy) is therefore still false afterward, so re-enabling the toggle re-triggers the Upgrade navigation. This is a regression from #91258.

    What changes do you think we should make in order to solve the problem?

    Add the three Control-tier rules-approval feature ids to the isCorporateUpgrade check in WorkspaceUpgradePage.tsx so the Submit→upgrade path targets CORPORATE for them:

    const isCorporateUpgrade =
        feature?.id === CONST.UPGRADE_FEATURE_INTRO_MAPPING.perDiem.id ||
        feature?.id === CONST.UPGRADE_FEATURE_INTRO_MAPPING.rules.id ||
        feature?.id === CONST.UPGRADE_FEATURE_INTRO_MAPPING.hr.id ||
        feature?.id === CONST.UPGRADE_FEATURE_INTRO_MAPPING.preventSelfApproval.id ||
        feature?.id === CONST.UPGRADE_FEATURE_INTRO_MAPPING.autoApproveCompliantReports.id ||
        feature?.id === CONST.UPGRADE_FEATURE_INTRO_MAPPING.autoPayApprovedReports.id;

    This matches the toggles' own !isControlPolicy(policy) gating, so once upgraded the workspace is Control and the toggle no longer re-opens the Upgrade page. The same fix resolves the identical latent bug for Auto-approve compliant reports and Auto-pay approved reports, which share the gate at ExpenseReportRulesSection.tsx:80 and :128.

    Alternative considered

    Relaxing the toggle gate from !isControlPolicy(policy) to !isPaidGroupPolicy(policy) would also stop the re-prompt, but that would incorrectly make these Control-only rules available on Collect workspaces (and would diverge from the rules feature, which already upgrades to Corporate). Aligning the upgrade target with the existing Control requirement is the correct scope.


    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/92864) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.

  8. hungvu193 commented on Jun 7, 2026

    @hungvu193
    Contributor

    Taking a look 👀

  9. hungvu193 commented on Jun 7, 2026

    @hungvu193
    Contributor

    @MelvinBot Good point in this proposal, let's check if there is any other feature that we also need to add in isCorporateUpgrade check.

  10. MelvinBot commented on Jun 7, 2026

    @MelvinBot
    Contributor

    Good call — there are more. The defect applies to every Control-tier feature whose toggle gates on !isControlPolicy(policy). Since the Submit→upgrade path defaults to TEAM (Collect) for anything not in the allowlist, any such feature stays !isControlPolicy after "upgrading" and re-loops.

    Feature ids missing from isCorporateUpgrade

    All verified to navigate to the upgrade page guarded by !isControlPolicy(policy):

    Feature id Entry point
    multiApprovalLevels DynamicReportChangeApproverPage.tsx:70, SearchChangeApproverPage.tsx:146
    auditor ImportedMembersPage.tsx:103
    reportFields WorkspaceReportsPage.tsx:313 (+ QBO/Xero report-field mapping pages, same id via getFeatureNameAlias)
    glAndPayrollCodes CategorySettingsPage.tsx:308
    glCodes TagSettingsPage.tsx:106
    taxCodes WorkspaceEditTaxPage.tsx:168
    multiLevelTags ImportTagsOptionsPage.tsx:279
    policyPreventMemberChangingTitle WorkspaceReportsPage.tsx:266 — ⚠️ special, see below

    approvals also gates on Control, but the Submit path short-circuits to approvalSubmit before reaching it (WorkspaceWorkflowsPage.tsx:269), so it's safe to omit today (optional, for future-proofing).

    The Collect-tier features that correctly stay on TEAM are the ones in SUBMIT_FEATURE_IDS (companyCardSubmit, travelSubmit, approvalSubmit, roles, payments, accounting, expensifyCard, invoicing) — leave those as-is.

    ⚠️ Two gotchas

    1. policyPreventMemberChangingTitle can't be fixed by the feature?.id check alone — WorkspaceUpgradePage.tsx:99 deliberately filters this id out, so feature is undefined here. The target-type decision must also key off featureNameAlias.
    2. Separate (different) bug — feature is undefined, not in scope here but worth a follow-up: when a Submit owner picks the Control plan directly, no featureName is passed, so it falls into the undefined branch and upgrades to TEAM instead of Corporate — DynamicWorkspaceOverviewPlanTypePage.tsx:101 and SubscriptionPlanCardActionButton.tsx:86.

    Recommendation: derive the tier instead of growing the allowlist

    Needing 7+ new entries (and a special-case) is a sign the allowlist model is fragile — every future Control feature has to remember to amend onUpgradeToCorporate or silently reintroduce this loop. The guard dichotomy is clean across the whole codebase (Control features → !isControlPolicy; Collect/Submit features → SUBMIT_FEATURE_IDS/tryNavigateToSubmitWorkspaceUpgrade), and there's currently no tier metadata on the mapping entries.

    Cleaner fix: add a requiredPlan: 'collect' | 'control' field to each UPGRADE_FEATURE_INTRO_MAPPING entry and derive targetType from it:

    const targetType = feature?.requiredPlan === CONST.POLICY.TYPE.CORPORATE ? CONST.POLICY.TYPE.CORPORATE : CONST.POLICY.TYPE.TEAM;

    This makes the allowlist a one-liner, co-locates the tier with the feature definition, and handles policyPreventMemberChangingTitle naturally (read requiredPlan off the raw mapping even though feature is filtered for the intro UI).

    Reachability caveat

    reportFields, glCodes, glAndPayrollCodes, taxCodes, and multiLevelTags each require a prerequisite feature (accounting connection / tags / taxes / categories) to be enabled first, so I couldn't fully confirm a raw Submit workspace reaches every one without first upgrading via another path. They still all share the defect and should be covered. multiApprovalLevels, auditor, reportFields-toggle, and policyPreventMemberChangingTitle are directly reachable from a Submit workspace. A VictoriaLogs query for upgrade-page navigations from type === 'submit' policies grouped by featureName would confirm real-world impact per feature.


    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/92864) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.

  11. 17 remaining items

  12. iwiznia commented on Jun 8, 2026

    @iwiznia
    Contributor

    Not a blocker since this is under beta

  13. removed their assignment
    on Jun 8, 2026
  14. changed the title [-][$250] Upgrade opens after upgrading Submit WS via Prevent self-approvals, disabling & reenabling it[/-] [+][Due for payment 2026-06-17] [$250] Upgrade opens after upgrading Submit WS via Prevent self-approvals, disabling & reenabling it[/+] on Jun 10, 2026
  15. melvin-bot commented on Jun 10, 2026

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  16. melvin-bot commented on Jun 10, 2026

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.1-6 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2026-06-17. 🎊

    For reference, here are some details about the assignees on this issue:

    • @hungvu193 requires payment through NewDot Manual Requests
  17. melvin-bot commented on Jun 10, 2026

    @melvin-bot

    @hungvu193 The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]. If no checklist is needed for this issue, you can click: [no checklist button]

  18. melvin-bot commented on Jun 11, 2026

    @melvin-bot

    @hungvu193 Whoops! This issue is 2 days overdue. Let's get this updated quick!

  19. melvin-bot commented on Jun 15, 2026

    @melvin-bot

    @hungvu193 Still overdue 6 days?! Let's take care of this!

  20. hungvu193 commented on Jun 17, 2026

    @hungvu193
    Contributor

    We can close

  21. neerajbachani commented on Aug 11, 2026

    @neerajbachani
    Contributor

    @hungvu193 You worked on the requiredPlan change in #92872,

    quick question.

    Melvin's audit on #92864 also called out reportFields as having the same bug, but it didn't get requiredPlan in that PR. Was that on purpose? Is Report Fields meant to stay Collect-tier on Submit workspaces?

    Trying to figure out if #93096 should add requiredPlan: CORPORATE on the mapping, or fix the Reports page navigation instead. Any context would help, thanks!

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2Engineering

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions