Skip to content

[HOLD for payment 2025-01-21] [HOLD for payment 2025-01-18] [$250] Workflows -"Delay submissions" is auto-enabled after upgrading workspace and then auto-disabled #54040

Closed

Description

@lanitochka17

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.0.75-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Email or phone of affected tester (no customers): applausetester+kh03120001@applause.expensifail.com
**Issue reported by:**Applause - Internal Team
**Component ** Workspace Settings

Action Performed:

  1. Go to staging.new.expensify.com
  2. Create a workspace
  3. Go to workspace settings > More features
  4. Enable Workflows
  5. Go to Workflows
  6. Enable Add approvals
  7. Click Add approval workflow
  8. Click Upgrade
  9. Note that "Delay submissions" toggle is enabled
  10. Close the upgrade successful RHP

Expected Result:

"Delay submissions" toggle should not change when upgrading workspace to Control and closing upgrade successful RHP

Actual Result:

"Delay submissions" toggle is enabled after upgrading workspace to Control, and disabled after closing upgrade successful RHP

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
Bug6692325_1734016783320.bandicam_2024-12-12_23-14-16-190.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021869129717738672469
  • Upwork Job ID: 1869129717738672469
  • Last Price Increase: 2024-12-24
  • Automatic offers:
    • FitseTLT | Contributor | 105541961
Issue OwnerCurrent Issue Owner: @CortneyOfstad

Activity

  1. added
    Daily
    Bug
    on Dec 12, 2024
  2. melvin-bot commented on Dec 12, 2024

    @melvin-bot

    Triggered auto assignment to @CortneyOfstad (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  3. github-actions commented on Dec 12, 2024

    @github-actions
    Contributor

    madisonruth1992 Your proposal will be dismissed because you did not follow the proposal template.

  4. FitseTLT commented on Dec 12, 2024

    @FitseTLT
    Contributor

    Edited by proposal-police: This proposal was edited at 2024-12-12 16:04:47 UTC.

    Proposal

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

    Workflows -"Delay submissions" is auto-enabled after upgrading workspace and then auto-disabled

    What is the root cause of that problem?

    We always turn on the toggle when the autoReportingFrequency is not instant

    isActive: (policy?.autoReportingFrequency !== CONST.POLICY.AUTO_REPORTING_FREQUENCIES.INSTANT && !hasDelayedSubmissionError) ?? false,

    and in this case we are setting it to immediate optimistically on upgrade to corporate
    autoReportingFrequency: CONST.POLICY.AUTO_REPORTING_FREQUENCIES.IMMEDIATE,

    it will be disabled again when the policy is fetched from BE on dismiss modal

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

    We leave it to instant same as the BE returns, so remove

    ...(PolicyUtils.isInstantSubmitEnabled(policy) && {
    autoReporting: true,
    autoReportingFrequency: CONST.POLICY.AUTO_REPORTING_FREQUENCIES.IMMEDIATE,
    }),

    also we don't need
    autoReporting: policy?.autoReporting ?? null,
    autoReportingFrequency: policy?.autoReportingFrequency ?? null,

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    We can add a test for upgradeToCorporate to assert that it doesn't alter autoReportingFrequency to immediate when it was instant.

    What alternative solutions did you explore? (Optional)

  5. huult commented on Dec 13, 2024

    @huult
    Contributor

    Proposal

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

    "Delay submissions" is auto-enabled after upgrading workspace and then auto-disabled

    What is the root cause of that problem?

    When we upgradeToCorporate, we check if the policy is instant submit enabled. If yes, we automatically update autoReportingFrequency to CONST.POLICY.AUTO_REPORTING_FREQUENCIES.IMMEDIATE and enable autoReporting. As a result, the button delay submission is enabled.

    ...(PolicyUtils.isInstantSubmitEnabled(policy) && {
    autoReporting: true,
    autoReportingFrequency: CONST.POLICY.AUTO_REPORTING_FREQUENCIES.IMMEDIATE,
    }),
    harvesting: {
    enabled: false,
    },

    isActive: (policy?.autoReportingFrequency !== CONST.POLICY.AUTO_REPORTING_FREQUENCIES.INSTANT && !hasDelayedSubmissionError) ?? false,

    After that, when we click Got it, thanks, it triggers the OpenPolicyWorkflowsPage call. The API responds with autoReportingFrequency set to instant. For this reason, the button delay submission is disabled.

    Screen.Recording.2024-12-13.at.12.20.38.mov

    The reason is that we set autoReportingFrequency to CONST.POLICY.AUTO_REPORTING_FREQUENCIES.IMMEDIATE in upgradeToCorporate, but the backend did not update the database. As a result, OpenPolicyWorkflowsPage still responds with the old value, causing this issue to occur.

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

    To resolve this issue, we should use SET_WORKSPACE_AUTO_REPORTING_FREQUENCY to set autoReportingFrequency to CONST.POLICY.AUTO_REPORTING_FREQUENCIES.IMMEDIATE, something like this:

    We removed that logic from the optimisticData.

    ...(PolicyUtils.isInstantSubmitEnabled(policy) && {
    autoReporting: true,
    autoReportingFrequency: CONST.POLICY.AUTO_REPORTING_FREQUENCIES.IMMEDIATE,
    }),
    harvesting: {
    enabled: false,
    },

    And when we upgradeToCorporate, we check if the policy is instant submit enabled, then call setWorkspaceAutoReportingFrequency with the frequency set to CONST.POLICY.AUTO_REPORTING_FREQUENCIES.MANUAL

    const upgradeToCorporate = () => {
    if (!canPerformUpgrade) {
    return;
    }
    Policy.upgradeToCorporate(policy.id, feature?.name);
    };

    to

        const upgradeToCorporate = () => {
            if (!canPerformUpgrade) {
                return;
            }
    
            if (PolicyUtils.isInstantSubmitEnabled(policy)) {
                Policy.setWorkspaceAutoReportingFrequency(policy.id, CONST.POLICY.AUTO_REPORTING_FREQUENCIES.MANUAL);
            }
    
            Policy.upgradeToCorporate(policy.id, feature?.name);
        };
    POC
    Screen.Recording.2024-12-13.at.12.43.48.mov

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    1. Scenario 1: If canPerformUpgrade is false, ensure no actions are performed.
    2. Scenario 2: If isInstantSubmitEnabled(policy) returns true, verify setWorkspaceAutoReportingFrequency is called with CONST.POLICY.AUTO_REPORTING_FREQUENCIES.MANUAL.
    3. Scenario 3: If isInstantSubmitEnabled(policy) returns false, ensure setWorkspaceAutoReportingFrequency is not called.
    4. Scenario 4: If feature is undefined, check that Policy.upgradeToCorporate is called with undefined for the feature name.
    5. Scenario 5: If canPerformUpgrade is true and isInstantSubmitEnabled(policy) returns true, ensure both setWorkspaceAutoReportingFrequency and upgradeToCorporate are called.

    What alternative solutions did you explore? (Optional)

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  6. melvin-bot commented on Dec 16, 2024

    @melvin-bot

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

  7. CortneyOfstad commented on Dec 17, 2024

    @CortneyOfstad
    Contributor

    Was able to recreate, so going to get eyes on this!

  8. added
    External
    on Dec 17, 2024
  9. changed the title [-]Workflows -"Delay submissions" is auto-enabled after upgrading workspace and then auto-disabled[/-] [+][$250] Workflows -"Delay submissions" is auto-enabled after upgrading workspace and then auto-disabled[/+] on Dec 17, 2024
  10. melvin-bot commented on Dec 17, 2024

    @melvin-bot
  11. 36 remaining items

  12. added
    Weekly
    and removed
    Weekly
    on Jan 14, 2025
  13. changed the title [-][HOLD for payment 2025-01-18] [$250] Workflows -"Delay submissions" is auto-enabled after upgrading workspace and then auto-disabled[/-] [+][HOLD for payment 2025-01-21] [HOLD for payment 2025-01-18] [$250] Workflows -"Delay submissions" is auto-enabled after upgrading workspace and then auto-disabled[/+] on Jan 14, 2025
  14. melvin-bot commented on Jan 14, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.84-7 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 2025-01-21. 🎊

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

  15. melvin-bot commented on Jan 14, 2025

    @melvin-bot

    @fedirjh @CortneyOfstad @fedirjh 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]

  16. added
    Daily
    and removed
    Weekly
    on Jan 17, 2025
  17. fedirjh commented on Jan 17, 2025

    @fedirjh
    Contributor

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
    • 2b. Reported on staging (eg. found during regression or PR testing)
    • 2d. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to comment: Add workspace upgrade flow #43822 (comment)

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion: N/A

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    I don't think we should require a regression test for this case, it doesn’t affect the UX.

    Regression Test Proposal Template
    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue:

    Regression Test Proposal

    Precondition:

    Test:

    Do we agree 👍 or 👎

  18. melvin-bot commented on Jan 20, 2025

    @melvin-bot

    @robertjchen, @CortneyOfstad, @fedirjh, @FitseTLT Whoops! This issue is 2 days overdue. Let's get this updated quick!

  19. melvin-bot commented on Jan 22, 2025

    @melvin-bot

    @robertjchen, @CortneyOfstad, @fedirjh, @FitseTLT Eep! 4 days overdue now. Issues have feelings too...

  20. CortneyOfstad commented on Jan 22, 2025

    @CortneyOfstad
    Contributor

    Payment Summary

    @FitseTLT — paid $250 via Upwork
    @fedirjh — to be paid $250 via NewDot

    Regression Test

    Not needed based on checklist here

  21. garrettmknight commented on Jan 29, 2025

    @garrettmknight
    Contributor

    $250 approved for @fedirjh

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

Metadata

Metadata

Labels

Awaiting PaymentBugDailyExternal

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions