Skip to content

[Due for payment 2025-03-17] [$250][Not here][Offline] Not Found page shows up when enabling Company Cards on offline #57119

Closed

Description

@m-natarajan

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.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:

  1. Create a workspace.
  2. Switch “Force offline” on from Cmd + D menu.
  3. Go to workspace settings > More features > enable Company Cards.
  4. Disable “Company Cards”.
  5. Enable "Company Cards" again.
  6. Navigate to the "Company Cards" page.
  7. 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 evidence
Screen.Recording.2025-02-19.at.6.49.28.PM.mov
Recording.998.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021892309795912003900
  • Upwork Job ID: 1892309795912003900
  • Last Price Increase: 2025-02-19
  • Automatic offers:
    • suneox | Reviewer | 106279830
    • nkdengineer | Contributor | 106279832

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Feb 19, 2025
  2. melvin-bot commented on Feb 19, 2025

    @melvin-bot

    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.

  3. Christinadobrzyn commented on Feb 19, 2025

    @Christinadobrzyn
    Contributor

    I'm not able to reproduce this - asking QA to test. https://expensify.slack.com/archives/C9YU7BX5M/p1739993078008289

  4. kavimuru commented on Feb 19, 2025

    @kavimuru

    Still reproducible

    Recording.38.mp4
  5. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Feb 19, 2025
  6. 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
  7. melvin-bot commented on Feb 19, 2025

    @melvin-bot
  8. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Feb 19, 2025
  9. melvin-bot commented on Feb 19, 2025

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @suneox (External)

  10. nkdengineer commented on Feb 20, 2025

    @nkdengineer
    Contributor

    🚨 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.

    ongoingRequest = persistedRequests.shift() ?? null;

    After the API is complete, we call endPersistedRequestAndRemoveFromQueue to remove the API from the queue

    endPersistedRequestAndRemoveFromQueue(requestToProcess);

    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.

    const index = requests.findIndex((persistedRequest) => isEqual(persistedRequest, requestToRemove));

    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

    1. Don't use shift method here and replace it with at(0)
    ongoingRequest = persistedRequests.at(0) ?? null;
    

    ongoingRequest = persistedRequests.shift() ?? null;

    1. Remove the logic filter out the removed request in endRequestAndRemoveFromQueue and only update ongoing request to null in onyx

    const requests = [...persistedRequests];
    const index = requests.findIndex((persistedRequest) => isEqual(persistedRequest, requestToRemove));
    if (index !== -1) {
    requests.splice(index, 1);
    }

    1. 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.

  11. Christinadobrzyn commented on Feb 20, 2025

    @Christinadobrzyn
    Contributor

    Awesome, @suneox can you take a peek at @nkdengineer's proposal to see if it will work?

  12. 22 remaining items

  13. 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
  14. melvin-bot commented on Mar 10, 2025

    @melvin-bot

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

  15. melvin-bot commented on Mar 10, 2025

    @melvin-bot

    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:

  16. melvin-bot commented on Mar 10, 2025

    @melvin-bot

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

  17. suneox commented on Mar 16, 2025

    @suneox
    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: 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:

    1. Create a workspace.
    2. Switch “Force offline” on from Cmd + D menu.
    3. Go to workspace settings > More features > enable Company Cards.
    4. Disable “Company Cards”.
    5. Enable "Company Cards" again.
    6. Navigate to the "Company Cards" page.
    7. Go online from the Cmd + D menu.

    Do we agree 👍 or 👎

  18. nkdengineer commented on Mar 16, 2025

    @nkdengineer
    Contributor

    @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.

  19. Christinadobrzyn commented on Mar 18, 2025

    @Christinadobrzyn
    Contributor

    Thanks for reaching out about that @nkdengineer - I'll check in with Rory on this!

  20. roryabraham commented on Mar 19, 2025

    @roryabraham
    Contributor

    👍🏼 to the $500 bounty amount for this issue

  21. Christinadobrzyn commented on Mar 20, 2025

    @Christinadobrzyn
    Contributor

    Awesome! Payment summary is here - #57119 (comment)

    Closing!

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

Metadata

Metadata

Labels

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

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions