Skip to content

[HOLD for payment 2025-02-05] [$250] Expensify Card - App uses data from other workspace when assigning card in different workspace #55125

Closed

Description

@IuliiaHerets

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.84-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: Exp
Email or phone of affected tester (no customers): applausetester+110106kh@applause.expensifail.com
Issue reported by: Applause Internal Team
Device used: Mac 15.0 / Chrome
App Component: Workspace Settings

Action Performed:

Precondition:

  • Account has two workspaces.
  • Both workspaces have enabled Expensify Card.
  • Both workspaces have different members.
  1. Go to staging.new.expensify.com
  2. Go to workspace settings of the first workspace > Expensify Card.
  3. Click Issue card.
  4. Select the workspace member in the first step.
  5. Reach the confirmation page.
  6. Exit the flow by clicking outside RHP.
  7. Go to workspace settings of the second workspace > Expensify Card.
  8. Click Issue card.
  9. Click Issue card on confirmation page.
  10. Enter magic code.

Expected Result:

In Step 8, the card assignment flow should start from the beginning because it is a different workspace.

Actual Result:

In Step 8, the card assignment flow continues with data from the first workspace when admin assigns card on the second workspace.
Member from the first workspace appears on confirmation page.
When entering correct magic code, it shows error.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug6711875_1736607237655.20250111_224234.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021879481800916724750
  • Upwork Job ID: 1879481800916724750
  • Last Price Increase: 2025-01-15
  • Automatic offers:
    • brunovjk | Reviewer | 105728846
    • twilight2294 | Contributor | 105728851
Issue OwnerCurrent Issue Owner: @laurenreidexpensify

Activity

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

    @melvin-bot

    Triggered auto assignment to @laurenreidexpensify (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. twilight2294 commented on Jan 12, 2025

    @twilight2294
    Contributor

    Proposal

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

    App uses data from other workspace when assigning card in different workspace

    What is the root cause of that problem?

    We use ISSUE_NEW_EXPENSIFY_CARD to get the data for issue card flow, There is no way currently to know if the data is for that unique policy, This causes the data in ISSUE_NEW_EXPENSIFY_CARD to persist amongst all policies.

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

    We need to make ISSUE_NEW_EXPENSIFY_CARD a Onyx collection and then store the value for each Policy.

    First update the key here to:

        /** Stores the information about the state of issuing a new card */
        ISSUE_NEW_EXPENSIFY_CARD: 'issueNewExpensifyCard_',

    This will help us in storing the data for each unique policyID, Then remove the onyx assignment here and instead make it a collection:

    [ONYXKEYS.COLLECTION.ISSUE_NEW_EXPENSIFY_CARD]: OnyxTypes.IssueNewCard;

    Then we for all the places we access this data, we need to update it to store/clear that particular policyID 's card data.

    And for the original bug in the OP, we need to update the following code:

    const [issueNewCard] = useOnyx(ONYXKEYS.ISSUE_NEW_EXPENSIFY_CARD);
    const {currentStep} = issueNewCard ?? {};
    const policyID = policy?.id ?? '-1';
    const backTo = route?.params?.backTo;

    To access for unique policyID:

     const policyID = policy?.id ?? '-1'; 
     const [issueNewCard] = useOnyx(`${ONYXKEYS.COLLECTION.ISSUE_NEW_EXPENSIFY_CARD}${policyID}`);

    This is only a template implementation details will be done during PR phase. Note that we need to update the places where we used to store ISSUE_NEW_EXPENSIFY_CARD data and clear it as well.

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

    N/A but if we want we can write tests which clear the onyx data using clearIssueNewCardFlow and match if that policyID data is cleared

    What alternative solutions did you explore? (Optional)

  4. moved this to Bugs and Follow Up Issues in #expensify-bugson Jan 14, 2025
  5. twilight2294 commented on Jan 15, 2025

    @twilight2294
    Contributor

    @laurenreidexpensify can you make this one external please 😄

  6. melvin-bot commented on Jan 15, 2025

    @melvin-bot

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

  7. melvin-bot commented on Jan 15, 2025

    @melvin-bot
  8. changed the title [-]Expensify Card - App uses data from other workspace when assigning card in different workspace[/-] [+][$250] Expensify Card - App uses data from other workspace when assigning card in different workspace[/+] on Jan 15, 2025
  9. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jan 15, 2025
  10. 28 remaining items

  11. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on Jan 29, 2025
  12. changed the title [-][$250] Expensify Card - App uses data from other workspace when assigning card in different workspace[/-] [+][HOLD for payment 2025-02-05] [$250] Expensify Card - App uses data from other workspace when assigning card in different workspace[/+] on Jan 29, 2025
  13. melvin-bot commented on Jan 29, 2025

    @melvin-bot

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

  14. melvin-bot commented on Jan 29, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.90-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-02-05. 🎊

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

  15. melvin-bot commented on Jan 29, 2025

    @melvin-bot

    @brunovjk @laurenreidexpensify @brunovjk 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. brunovjk commented on Jan 31, 2025

    @brunovjk
    Contributor

    I will complete the checklist the day before payday :D

  17. brunovjk commented on Feb 4, 2025

    @brunovjk
    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: Applause Internal Team
    • [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: No PR directly created this bug.

    • [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:

    • [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.

    Regression Test Proposal

    Precondition:

    • Account has two workspaces.
    • Both workspaces have enabled Expensify Card.
    • Both workspaces have different members.

    Test:

    1. App > Go to workspace settings of the first workspace > Expensify Card.
    2. Click Issue card. > Select the workspace member in the first step > Reach the confirmation page.
    3. Exit the flow by clicking outside RHP.
    4. Go to workspace settings of the second workspace > Expensify Card.
    5. Click Issue card.
    6. Verify that: The card assignment flow should start from the beginning because it is a different workspace.

    Do we agree 👍 or 👎

  18. laurenreidexpensify commented on Feb 5, 2025

    @laurenreidexpensify
    Contributor

    Payment summary

  19. moved this from Bugs and Follow Up Issues to Done in #expensify-bugson Feb 5, 2025
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