Skip to content

[Due for payment 2025-04-23] [$250] Cards - Trying to assign same assigned cards to admin on different workspace showing card list #58949

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
4 of 8 tasks
jponikarchuk opened this issue Mar 22, 2025 · 42 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@jponikarchuk
Copy link

jponikarchuk commented Mar 22, 2025

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: V9.1.17-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Yes, reproducible on both
If this was caught during regression testing, add the test name, ID and link from TestRail: N
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause Internal Team
Device used: Redminote 10s android 13
App Component: Money Requests

Action Performed:

Pre-condition: create 2 workspace with american express direct feed card added

  1. Go to https://staging.new.expensify.com/home
  2. Go to workspace settings > company card
  3. In american express direct feed, tap assign card
  4. Note 2 cards are available to assign
  5. Assign 2 cards selecting default user (admin)
  6. Try to assign the card third time
  7. Note no active cards available displayed
  8. Now open the second workspace > company card
  9. In american express direct feed, tap assign card
  10. Try to assign 2 available card displayed to default selected user (admin)

Note : use only default user admin to reproduce the issue

Expected Result:

In the different workspace, when trying to assign same cards to same user (admin), it must show no active cards available.

Actual Result:

"Card already assigned to member on different feed" error is shown when trying to assign same assigned cards to the same user(admin) on different workspace.

Trying to assign the same assigned cards to the same user(admin) on different workspace, is showing cards list instead of showing "no active cards available"

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug6778913_1742633263304.Screenrecorder-2025-03-22-13-53-34-588.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @mallenexpensify
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021907042981915797896
  • Upwork Job ID: 1907042981915797896
  • Last Price Increase: 2025-04-08
  • Automatic offers:
    • ikevin127 | Contributor | 106843865
    • allgandalf | Contributor | 106871818
@jponikarchuk jponikarchuk added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 labels Mar 22, 2025
Copy link

melvin-bot bot commented Mar 22, 2025

Triggered auto assignment to @mallenexpensify (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.

@samranahm
Copy link
Contributor

@jponikarchuk It looks like the linked video might not be the correct one. Could you please double-check and update it. Thanks!

@jponikarchuk
Copy link
Author

jponikarchuk commented Mar 22, 2025

@samranahm the video is updated, sorry.

@layacat
Copy link
Contributor

layacat commented Mar 23, 2025

Proposal

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

Cards - Trying to assign same assigned cards to admin on different workspace showing card list

What is the root cause of that problem?

We only the filtered if the current card feed had assigned card and removed it from the current card, but with different workspaces and the same card, this logic will not work.

return Object.fromEntries(Object.entries(customFeedCardsToAssign ?? {}).filter(([cardNumber]) => !assignedCards.includes(cardNumber)));

From the above function we also knew that a assigned card meant, that card has a name (cardName):

const assignedCards = Object.values(cards).map((card) => card.cardName);

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

We should filter out all the assigned card from different workspaces, once a card get assigned to another person, we shouldn't display them on your card selection screen:

  1. Create a function to get all the assigned card of your workspaces, the below is the pseudocode, we can improve it later:
function getAllAssignedCards(allCards: any): string[] {
    const cardNames: string[] = [];

    // Loop through all keys in the object
    for (let key in allCards) {
        // Check if the value is an object and contains a `cardName` property
        if (typeof allCards[key] === 'object') {
            // Iterate over the sub-keys to find the `cardName`
            for (let subKey in allCards[key]) {
                if (allCards[key][subKey]?.cardName) {
                    cardNames.push(allCards[key][subKey].cardName);
                }
            }
        }
    }

    return cardNames;
}
  1. Update the logic of getFilteredCardList function to use the all assigned cards instead:
const assignedCards = getAllAssignedCards(allCards);

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

I don't think we can write test for this situation.

What alternative solutions did you explore? (Optional)

N/A

@melvin-bot melvin-bot bot added the Overdue label Mar 24, 2025
@mallenexpensify mallenexpensify added the Needs Reproduction Reproducible steps needed label Mar 26, 2025
@MelvinBot
Copy link

This has been labelled "Needs Reproduction". Follow the steps here: https://stackoverflowteams.com/c/expensify/questions/16989

@mallenexpensify
Copy link
Contributor

Added Needs Reproduction to see if a C+ can reproduce, if so I'll assign to them then make it External. If not, I'll attempt reproduction.

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Mar 26, 2025
@mallenexpensify mallenexpensify removed their assignment Mar 28, 2025
@melvin-bot melvin-bot bot removed the Overdue label Mar 28, 2025
@mallenexpensify mallenexpensify added Overdue Bug Something is broken. Auto assigns a BugZero manager. and removed Bug Something is broken. Auto assigns a BugZero manager. labels Mar 28, 2025
Copy link

melvin-bot bot commented Mar 28, 2025

Triggered auto assignment to @sonialiap (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.

@melvin-bot melvin-bot bot removed the Overdue label Mar 28, 2025
@mallenexpensify
Copy link
Contributor

@sonialiap I'm going to be OOO and offline for two weeks so I'm reassigning, will pick back up upon my return, thx (sorry I didn't get time to try to reproduce)

@mallenexpensify mallenexpensify self-assigned this Mar 28, 2025
@melvin-bot melvin-bot bot added the Overdue label Mar 31, 2025
Copy link

melvin-bot bot commented Apr 1, 2025

@sonialiap Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@sonialiap sonialiap added External Added to denote the issue can be worked on by a contributor and removed Needs Reproduction Reproducible steps needed labels Apr 1, 2025
@melvin-bot melvin-bot bot changed the title Cards - Trying to assign same assigned cards to admin on different workspace showing card list [$250] Cards - Trying to assign same assigned cards to admin on different workspace showing card list Apr 1, 2025
Copy link

melvin-bot bot commented Apr 1, 2025

Job added to Upwork: https://www.upwork.com/jobs/~021907042981915797896

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Apr 1, 2025
@allgandalf
Copy link
Contributor

👋 I reviewed the linked PR, @sonialiap @thienlnam can you assign me for payment here please

Copy link

melvin-bot bot commented Apr 10, 2025

📣 @allgandalf 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@mallenexpensify
Copy link
Contributor

Looks like we have a regression from the PR

@sonialiap thanks for keeping 👀 on, I unassigned ya.

@ikevin127
Copy link
Contributor

ikevin127 commented Apr 14, 2025

@mallenexpensify Hi, mind sharing the regression issue so I can take a look ?

We had 2 potential regressions but they were both dismantled, 1 as AMEX account locked (not related to PR changes) and 1 closed as not a bug (behaviour already existed before PR).

@mallenexpensify
Copy link
Contributor

@ikevin127 I was just working off the comment in the PR that said it caused a regression.
When it comes time to pay, if you don't think regressions were caused, please post reasoning and we'll @thienlnam 👍 and then I'll pay. Thx

@ikevin127
Copy link
Contributor

Got it, here's what happened with both regressions posted after PR was merged, and why both were closed as non-regressions:

To recap, the first one wasn't related to Expensify app so we closed as solved (after AMEX API cooldown everything worked as expected), and the second one was present on staging before, therefore @thienlnam decided to close as not a bug.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Apr 16, 2025
@melvin-bot melvin-bot bot changed the title [$250] Cards - Trying to assign same assigned cards to admin on different workspace showing card list [Due for payment 2025-04-23] [$250] Cards - Trying to assign same assigned cards to admin on different workspace showing card list Apr 16, 2025
Copy link

melvin-bot bot commented Apr 16, 2025

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Apr 16, 2025
Copy link

melvin-bot bot commented Apr 16, 2025

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.28-15-staging 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-04-23. 🎊

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

Copy link

melvin-bot bot commented Apr 16, 2025

@ikevin127 / @allgandalf @mallenexpensify @ikevin127 / @allgandalf 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]

@allgandalf
Copy link
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: 47a9f12#r155637100

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

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

  • N/A

Test:

  1. Go to workspace settings > Company cards.

  2. Add cards > add American Express > Personal Cards direct feed and assign card.

  3. Assign 2 cards selecting default user (admin).

  4. Try to assign a card a third time.
    Verify that the "no active cards on this feed" screen is displayed.

  5. Now open the second workspace settings > Company cards and repeat step 2.

Verify that trying to assign any of the already assigned cards will display the "no active cards on this feed" screen.

Do we agree 👍 or 👎

@mallenexpensify
Copy link
Contributor

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Apr 23, 2025
@ikevin127
Copy link
Contributor

cc @mallenexpensify for payments visibility

@allgandalf
Copy link
Contributor

@mallenexpensify

Image

@melvin-bot melvin-bot bot added the Overdue label Apr 28, 2025
Copy link

melvin-bot bot commented Apr 28, 2025

@mallenexpensify Eep! 4 days overdue now. Issues have feelings too...

@mallenexpensify
Copy link
Contributor

Sorry gents, was traveling. There's a bug with Upwork and I can't pay right now, addressed internally to see if we can find a workaround. will check back later today or tomorrow,

@melvin-bot melvin-bot bot removed the Overdue label Apr 28, 2025
@mallenexpensify
Copy link
Contributor

Contributor: @allgandalf paid $250 via Upwork
Contributor+: @ikevin127 paid $250 via Upwork.

Test case created

Thx!

@github-project-automation github-project-automation bot moved this from Bugs and Follow Up Issues to Done in #expensify-bugs Apr 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
Status: Done
Development

No branches or pull requests

10 participants