Skip to content

[Due for payment 2025-05-20] [$150] Expensify Card - Limit input page shows error after incorrect magic code is entered #61051

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
6 of 8 tasks
mitarachim opened this issue Apr 29, 2025 · 33 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

@mitarachim
Copy link

mitarachim commented Apr 29, 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: 9.1.33-3
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: No, reproducible on hybrid only
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): [email protected]
Issue reported by: Applause Internal Team
Device used: Mac 15.3 / Chrome
App Component: Workspace Settings

Action Performed:

Precondition:

  • Workspace has enabled Expensify Card feature and has set up bank account.
  1. Go to staging.new.expensify.com
  2. Go to workspace settings > Expensify Card.
  3. Click Issue card.
  4. Fill in the details and reach the confirmation page.
  5. On confirmation page, enter incorrect magic code.
  6. Now enter the correct magic code.
  7. Click Issue card.
  8. Select any member.
  9. Select any card type > Next.
  10. Select Limit type > Next.

Expected Result:

Limit input page will not show error.

Actual Result:

Limit input page shows error - You must be a domain admin to create the virtual card.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug6816046_1745907880813.20250429_141825.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021917579859517676775
  • Upwork Job ID: 1917579859517676775
  • Last Price Increase: 2025-05-01
  • Automatic offers:
    • mkzie2 | Contributor | 107140179
Issue OwnerCurrent Issue Owner: @
Issue OwnerCurrent Issue Owner: @joekaufmanexpensify
@mitarachim mitarachim added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 labels Apr 29, 2025
Copy link

melvin-bot bot commented Apr 29, 2025

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

@Themoonalsofall
Copy link
Contributor

Themoonalsofall commented Apr 29, 2025

🚨 Edited by proposal-police: This proposal was edited at 2025-04-29 11:13:50 UTC.

Proposal

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

Expensify Card - Limit input page shows error after incorrect magic code is entered

What is the root cause of that problem?

After entering the wrong magic code, the error is saved in the key issueNewExpensifyCard and we don't clear error in issueNewExpensifyCard after creating a new issue card

const successData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.ISSUE_NEW_EXPENSIFY_CARD}${policyID}`,
value: {
isLoading: false,
isSuccessful: true,
},
},
];

We don't add policyID as param in this command

API.write(WRITE_COMMANDS.RESEND_VALIDATE_CODE, null, {optimisticData, successData, failureData});

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

  1. Add a new policyID param for requestValidateCodeAction function

  2. Add policyID as a param and we also need to update type of WRITE_COMMANDS.RESEND_VALIDATE_CODE

API.write(WRITE_COMMANDS.RESEND_VALIDATE_CODE, null, {optimisticData, successData, failureData});

    API.write(WRITE_COMMANDS.RESEND_VALIDATE_CODE, {policyID}, {optimisticData, successData, failureData})
  1. Passing policyID in ConfirmationStep

sendValidateCode={requestValidateCodeAction}

    sendValidateCode={() => requestValidateCodeAction(policyID)}

Note: We can check for similar errors with pages where we use ValidateCodeActionModal

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


None

What alternative solutions did you explore? (Optional)

@mkzie2
Copy link
Contributor

mkzie2 commented Apr 29, 2025

🚨 Edited by proposal-police: This proposal was edited at 2025-05-01 16:28:53 UTC.

Proposal

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

Limit input page shows error - You must be a domain admin to create the virtual card.

What is the root cause of that problem?

We already have logics to clear error here

clearError={() => clearIssueNewCardError(policyID)}

function clearIssueNewCardError(policyID: string | undefined) {
Onyx.merge(`${ONYXKEYS.COLLECTION.ISSUE_NEW_EXPENSIFY_CARD}${policyID}`, {errors: null});
}

However, when validating with incorrect magic code, We don’t send policyID together with CreateAdminIssuedVirtualCard, so BE send error in issueNewExpensifyCard with no policyID

Image

So we're not clearing the correct Onyx entry and the error persists.

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

  1. BE should return error in correct Onyx entry
  2. To fix this in FE, create a new Onyx key for issueNewExpensifyCard, then we should update clearIssueNewCardError to clear error in issueNewExpensifyCard as well

function clearIssueNewCardError(policyID: string | undefined) {
Onyx.merge(`${ONYXKEYS.COLLECTION.ISSUE_NEW_EXPENSIFY_CARD}${policyID}`, {errors: null});
}

function clearIssueNewCardError(policyID: string | undefined) {
    Onyx.merge(`${ONYXKEYS.COLLECTION.ISSUE_NEW_EXPENSIFY_CARD}${policyID}`, {errors: null});
    Onyx.merge(‘issueNewExpensifyCard’, {errors: null});
}

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

I don't think we need one, because it's error when sending API.

What alternative solutions did you explore? (Optional)

We should pass policyID to CreateAdminIssuedVirtualCard parameters

const parameters = {
assigneeEmail,
limit,
limitType,
cardTitle,
validateCode,
domainAccountID,
};

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.

@joekaufmanexpensify
Copy link
Contributor

Reproduced. The error clears if you proceed past it, so it's no major impact. But it's confusing so feels worth cleaning it up.

@joekaufmanexpensify joekaufmanexpensify added the External Added to denote the issue can be worked on by a contributor label Apr 30, 2025
Copy link

melvin-bot bot commented Apr 30, 2025

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

@melvin-bot melvin-bot bot changed the title Expensify Card - Limit input page shows error after incorrect magic code is entered [$250] Expensify Card - Limit input page shows error after incorrect magic code is entered Apr 30, 2025
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Apr 30, 2025
Copy link

melvin-bot bot commented Apr 30, 2025

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

@dukenv0307
Copy link
Contributor

I'm not sure why BE returns the error for issueNewExpensifyCard, it should return the error for issueNewExpensifyCard_policyID, so I think the best way is to fix it on BE side. If there's a reason to return this key, we can go with @mkzie2's proposal to clear the error in clearIssueNewCardError

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Apr 30, 2025

Triggered auto assignment to @blimpich, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@blimpich
Copy link
Contributor

@dukenv0307 so to be clear, we could fix this either in the BE or FE, but we should probably fix it in the backend?

Looks like we basically had this exact same issue a couple months ago: #56363

@blimpich
Copy link
Contributor

cc: @lakchote I think this PR should've fixed this issue right?

@lakchote
Copy link
Contributor

lakchote commented May 1, 2025

However, when validating with incorrect magic code, BE send error in issueNewExpensifyCard with no policyID

That's expected as the frontend doesn't provide a policyID to the API command, as such we can't key the error by the policy ID:

Image

The fix needs to be frontend related.

cc @blimpich

@mkzie2
Copy link
Contributor

mkzie2 commented May 1, 2025

That's expected as the frontend doesn't provide a policyID to the API command, as such we can't key the error by the policy ID:

Updated proposal

@Themoonalsofall
Copy link
Contributor

thanks @lakchote, i updated the proposal

@dukenv0307
Copy link
Contributor

Thank you @lakchote, let's go with @mkzie2's proposal, it works well

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented May 1, 2025

Current assignee @blimpich is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

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

melvin-bot bot commented May 1, 2025

📣 @mkzie2 🎉 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 📖

@blimpich blimpich changed the title [$250] Expensify Card - Limit input page shows error after incorrect magic code is entered [$150] Expensify Card - Limit input page shows error after incorrect magic code is entered May 1, 2025
Copy link

melvin-bot bot commented May 1, 2025

Upwork job price has been updated to $150

@blimpich
Copy link
Contributor

blimpich commented May 1, 2025

Reducing price because Lucien basically solved this for us and the fix is just a simple parameter change.

@joekaufmanexpensify
Copy link
Contributor

@mkzie2 is there an ETA for a PR?

@mkzie2
Copy link
Contributor

mkzie2 commented May 2, 2025

PR will be up in several hours.

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels May 3, 2025
@joekaufmanexpensify
Copy link
Contributor

PR in review

@joekaufmanexpensify
Copy link
Contributor

PR on staging

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels May 13, 2025
@melvin-bot melvin-bot bot changed the title [$150] Expensify Card - Limit input page shows error after incorrect magic code is entered [Due for payment 2025-05-20] [$150] Expensify Card - Limit input page shows error after incorrect magic code is entered May 13, 2025
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label May 13, 2025
Copy link

melvin-bot bot commented May 13, 2025

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

Copy link

melvin-bot bot commented May 13, 2025

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

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

Copy link

melvin-bot bot commented May 13, 2025

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

@dukenv0307
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
  • 2b. Reported on staging (deploy blocker)
  • 2c. 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/59996/files#r2089426301

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

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

Test:

  • Precondition: Workspace has enabled Expensify Card feature and has set up bank account.
  1. Go to workspace settings > Expensify Card.
  2. Click Issue card.
  3. Select Virtual card type
  4. Fill in the details and reach the confirmation page.
  5. On confirmation page, enter incorrect magic code.
  6. Now enter the correct magic code.
  7. Click Issue card.
  8. Select any member.
  9. Select Virtual card type > Next.
  10. Select Limit type > Next.
  11. Verify that: Limit input page will not show error.

Do we agree 👍 or 👎

@joekaufmanexpensify
Copy link
Contributor

Will handle next steps today so we're prepped to pay tomorrow

@joekaufmanexpensify
Copy link
Contributor

This is a pretty niche bug. Only applicable if you're issuing multiple cards in short succession and incorrectly enter magic code when issuing the first one. I don't think we need to have QA test this flow in every test run as it is not likely to be something commonly done by actual users. Going to skip the test for now.

@joekaufmanexpensify
Copy link
Contributor

All set to pay tomorrow! We need to pay:

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels May 20, 2025
@joekaufmanexpensify
Copy link
Contributor

@mkzie2 $150 sent and contract ended!

@joekaufmanexpensify
Copy link
Contributor

Upwork job closed.

@joekaufmanexpensify
Copy link
Contributor

@dukenv0307 Please request payment at your earliest convenience. Closing as this is otherwise all set!

@JmillsExpensify
Copy link

$150 approved for @dukenv0307

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
Development

No branches or pull requests

8 participants