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
[Due for payment 2025-03-17] [$250][Not here][Offline] Not Found page shows up when enabling Company Cards on offline #57119
Version Number: 9.1.1-0 Reproducible in staging?: Y Reproducible in production?: Y If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by:@c3024 Slack conversation (hyperlinked to channel name): #Expensify bugs
Action Performed:
Create a workspace.
Switch “Force offline” on from Cmd + D menu.
Go to workspace settings > More features > enable Company Cards.
Disable “Company Cards”.
Enable "Company Cards" again.
Navigate to the "Company Cards" page.
Go online from the Cmd + D menu.
Expected Result:
The Company Cards page should continue showing up as it was before.
Actual Result:
The Company Cards page changes to Not Found page.
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 evidenceScreen.Recording.2025-02-19.at.6.49.28.PM.movRecording.998.mp4
changed the title [-]Not Found page shows up when enabling Company Cards on offline[/-][+][$250] Not Found page shows up when enabling Company Cards on offline[/+]on Feb 19, 2025
🚨 Edited by proposal-police: This proposal was edited at 2025-02-20 05:58:39 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
What is the root cause of that problem?
When offline we have three requests in the network queue [API1, API2, API3] if we enable -> disable -> enable a feature. The API1 and API3 are the same.
When we get a request to process here by processNextPersistedRequest function, we use shift function that also change the current array and now the persistedRequests is API2, API3 after the first API is called.
Because the API1 and API3 are the same and the API1 is removed from processNextPersistedRequest function above, the first index is the index of the API3 then it's removed here and now the persistedRequests has only API2.
So we only called two EnablePolicyCompanyCards APIs, the first is to enable this feature, and the second is to disable this feature so the not found page appears because this feature is disabled.
What changes do you think we should make in order to solve the problem?
This starts happening after this PR. We have some options to fix it
Don't use shift method here and replace it with at(0)
For each request, we can add a unique field like created time or random number so if it's removed from the queue, other requests will not be removed unexpectedly
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
Update test for PersistedRequests with the case three APIs above and verify that all of them are processed
What alternative solutions did you explore? (Optional)
We can add checkAndFixConflictingRequest to the enable feature API to remove the APIs if we have another one. For example, when we call enable company card API with enable is true, we will check if in the persistedRequests exists another enable company card API with enable is false (Of course we need to check the policy param is the same) or vice versa, we will remove both of them.
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 [-][$250][Not here][Offline] Not Found page shows up when enabling Company Cards on offline[/-][+][Due for payment 2025-03-17] [$250][Not here][Offline] Not Found page shows up when enabling Company Cards on offline[/+]on Mar 10, 2025
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.10-6 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@suneox@Christinadobrzyn@suneox 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.
@roryabraham Since the issue is expanded to improve for all enabled feature APIs and we fix the core logic, I think the price can be increased to $500 (2 based issues). Let me know if we have another thought.
Activity
melvin-bot commentedon Feb 19, 2025
Triggered auto assignment to @Christinadobrzyn (
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.Christinadobrzyn commentedon Feb 19, 2025
I'm not able to reproduce this - asking QA to test. https://expensify.slack.com/archives/C9YU7BX5M/p1739993078008289
kavimuru commentedon Feb 19, 2025
Still reproducible
Recording.38.mp4
[-]Not Found page shows up when enabling Company Cards on offline[/-][+][$250] Not Found page shows up when enabling Company Cards on offline[/+]melvin-bot commentedon Feb 19, 2025
Job added to Upwork: https://www.upwork.com/jobs/~021892309795912003900
melvin-bot commentedon Feb 19, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @suneox (
External)nkdengineer commentedon Feb 20, 2025
🚨 Edited by proposal-police: This proposal was edited at 2025-02-20 05:58:39 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
What is the root cause of that problem?
When offline we have three requests in the network queue
[API1, API2, API3]if weenable->disable->enablea feature. TheAPI1andAPI3are the same.When we get a request to process here by
processNextPersistedRequestfunction, we useshiftfunction that also change the current array and now thepersistedRequestsisAPI2, API3after the first API is called.App/src/libs/actions/PersistedRequests.ts
Line 122 in bf23769
After the API is complete, we call
endPersistedRequestAndRemoveFromQueueto remove the API from the queueApp/src/libs/Network/SequentialQueue.ts
Line 110 in bf23769
Because the API1 and API3 are the same and the
API1is removed fromprocessNextPersistedRequestfunction above, the first index is the index of theAPI3then it's removed here and now thepersistedRequestshas onlyAPI2.App/src/libs/actions/PersistedRequests.ts
Line 64 in bf23769
So we only called two
EnablePolicyCompanyCardsAPIs, the first is to enable this feature, and the second is to disable this feature so the not found page appears because this feature is disabled.What changes do you think we should make in order to solve the problem?
This starts happening after this PR. We have some options to fix it
shiftmethod here and replace it withat(0)App/src/libs/actions/PersistedRequests.ts
Line 122 in bf23769
endRequestAndRemoveFromQueueand only update ongoing request to null in onyxApp/src/libs/actions/PersistedRequests.ts
Lines 63 to 68 in bf23769
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
Update test for
PersistedRequestswith the case three APIs above and verify that all of them are processedWhat alternative solutions did you explore? (Optional)
We can add
checkAndFixConflictingRequestto the enable feature API to remove the APIs if we have another one. For example, when we call enable company card API withenableistrue, we will check if in thepersistedRequestsexists another enable company card API withenableisfalse(Of course we need to check the policy param is the same) or vice versa, we will remove both of them.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.
Christinadobrzyn commentedon Feb 20, 2025
Awesome, @suneox can you take a peek at @nkdengineer's proposal to see if it will work?
22 remaining items
[-][$250][Not here][Offline] Not Found page shows up when enabling Company Cards on offline[/-][+][Due for payment 2025-03-17] [$250][Not here][Offline] Not Found page shows up when enabling Company Cards on offline[/+]melvin-bot commentedon Mar 10, 2025
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Mar 10, 2025
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.10-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 2025-03-17. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Mar 10, 2025
@suneox @Christinadobrzyn @suneox 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]
suneox commentedon Mar 16, 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: https://github.com/Expensify/App/pull/47913/files#r1997638162
[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.
https://github.com/Expensify/Expensify/issues/482216
Regression Test Proposal
Precondition:
Test:
Do we agree 👍 or 👎
nkdengineer commentedon Mar 16, 2025
@roryabraham Since the issue is expanded to improve for all enabled feature APIs and we fix the core logic, I think the price can be increased to $500 (2 based issues). Let me know if we have another thought.
Christinadobrzyn commentedon Mar 18, 2025
Thanks for reaching out about that @nkdengineer - I'll check in with Rory on this!
roryabraham commentedon Mar 19, 2025
👍🏼 to the $500 bounty amount for this issue
Christinadobrzyn commentedon Mar 20, 2025
Awesome! Payment summary is here - #57119 (comment)
Closing!