You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[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
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor
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:
Go to staging.new.expensify.com
Create a workspace
Go to workspace settings > More features
Enable Workflows
Go to Workflows
Enable Add approvals
Click Add approval workflow
Click Upgrade
Note that "Delay submissions" toggle is enabled
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 evidenceBug6692325_1734016783320.bandicam_2024-12-12_23-14-16-190.mp4
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.
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:
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;
}
if (PolicyUtils.isInstantSubmitEnabled(policy)) {
Policy.setWorkspaceAutoReportingFrequency(policy.id, CONST.POLICY.AUTO_REPORTING_FREQUENCIES.MANUAL);
}
Policy.upgradeToCorporate(policy.id, feature?.name);
};
POCScreen.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?
Scenario 1: If canPerformUpgrade is false, ensure no actions are performed.
Scenario 2: If isInstantSubmitEnabled(policy) returns true, verify setWorkspaceAutoReportingFrequency is called with CONST.POLICY.AUTO_REPORTING_FREQUENCIES.MANUAL.
Scenario 3: If isInstantSubmitEnabled(policy) returns false, ensure setWorkspaceAutoReportingFrequency is not called.
Scenario 4: If feature is undefined, check that Policy.upgradeToCorporate is called with undefined for the feature name.
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.
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
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
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:
@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]
[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.
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor
Activity
melvin-bot commentedon Dec 12, 2024
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.github-actions commentedon Dec 12, 2024
madisonruth1992 Your proposal will be dismissed because you did not follow the proposal template.
FitseTLT commentedon Dec 12, 2024
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
autoReportingFrequencyis not instantApp/src/pages/workspace/workflows/WorkspaceWorkflowsPage.tsx
Line 156 in 50c1db8
and in this case we are setting it to immediate optimistically on upgrade to corporate
App/src/libs/actions/Policy/Policy.ts
Line 3386 in 50c1db8
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
App/src/libs/actions/Policy/Policy.ts
Lines 3384 to 3387 in 50c1db8
also we don't need
App/src/libs/actions/Policy/Policy.ts
Lines 3416 to 3417 in 50c1db8
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
We can add a test for
upgradeToCorporateto assert that it doesn't alterautoReportingFrequencyto immediate when it was instant.What alternative solutions did you explore? (Optional)
huult commentedon Dec 13, 2024
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 updateautoReportingFrequencytoCONST.POLICY.AUTO_REPORTING_FREQUENCIES.IMMEDIATEand enableautoReporting. As a result, the button delay submission is enabled.App/src/libs/actions/Policy/Policy.ts
Lines 3401 to 3407 in 815b4ed
App/src/pages/workspace/workflows/WorkspaceWorkflowsPage.tsx
Line 155 in d03d4b4
After that, when we click
Got it, thanks, it triggers theOpenPolicyWorkflowsPagecall. The API responds withautoReportingFrequencyset toinstant. 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
autoReportingFrequencytoCONST.POLICY.AUTO_REPORTING_FREQUENCIES.IMMEDIATEinupgradeToCorporate, but the backend did not update the database. As a result,OpenPolicyWorkflowsPagestill 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_FREQUENCYto setautoReportingFrequencytoCONST.POLICY.AUTO_REPORTING_FREQUENCIES.IMMEDIATE, something like this:We removed that logic from the
optimisticData.App/src/libs/actions/Policy/Policy.ts
Lines 3401 to 3407 in 815b4ed
And when we
upgradeToCorporate, we check if the policy is instant submit enabled, then callsetWorkspaceAutoReportingFrequencywith thefrequencyset toCONST.POLICY.AUTO_REPORTING_FREQUENCIES.MANUALApp/src/pages/workspace/upgrade/WorkspaceUpgradePage.tsx
Lines 92 to 98 in 8bbeaef
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?
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.
melvin-bot commentedon Dec 16, 2024
@CortneyOfstad Whoops! This issue is 2 days overdue. Let's get this updated quick!
CortneyOfstad commentedon Dec 17, 2024
Was able to recreate, so going to get eyes on this!
[-]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[/+]melvin-bot commentedon Dec 17, 2024
Job added to Upwork: https://www.upwork.com/jobs/~021869129717738672469
36 remaining items
[-][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[/+]melvin-bot commentedon Jan 14, 2025
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:
melvin-bot commentedon Jan 14, 2025
@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]
fedirjh commentedon Jan 17, 2025
BugZero Checklist:
Bug classification
Source of bug:
Where bug was reported:
Who reported the bug:
[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 👎
melvin-bot commentedon Jan 20, 2025
@robertjchen, @CortneyOfstad, @fedirjh, @FitseTLT Whoops! This issue is 2 days overdue. Let's get this updated quick!
melvin-bot commentedon Jan 22, 2025
@robertjchen, @CortneyOfstad, @fedirjh, @FitseTLT Eep! 4 days overdue now. Issues have feelings too...
CortneyOfstad commentedon Jan 22, 2025
Payment Summary
@FitseTLT — paid $250 via Upwork
@fedirjh — to be paid $250 via NewDot
Regression Test
Not needed based on checklist here
garrettmknight commentedon Jan 29, 2025
$250 approved for @fedirjh