Skip to content
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

[HOLD for payment 2024-12-19] [$250] Missing validate code sent when adding copilot #53177

Open
1 of 8 tasks
m-natarajan opened this issue Nov 26, 2024 · 22 comments
Open
1 of 8 tasks
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 Overdue

Comments

@m-natarajan
Copy link

m-natarajan commented Nov 26, 2024

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.0.67-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: @dukenv0307
Slack conversation (hyperlinked to channel name): ts_external_expensify_bugs

Action Performed:

  1. Go to Settings page -> Security page
  2. Click Add Copilot button
  3. Complete the flow
  4. In the final step observe the request validate code modal

Expected Result:

'Code requested. Please check your device.' is displayed

Actual Result:

'Code requested. Please check your device.' isn't displayed

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
bug-resize.mp4
Recording.805.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021862155129202940736
  • Upwork Job ID: 1862155129202940736
  • Last Price Increase: 2024-11-28
  • Automatic offers:
    • layacat | Contributor | 105162375
Issue OwnerCurrent Issue Owner: @muttmuure
@m-natarajan m-natarajan added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Nov 26, 2024
Copy link

melvin-bot bot commented Nov 26, 2024

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

@nkdengineer
Copy link
Contributor

Proposal

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

Missing validate code sent when adding copilot

What is the root cause of that problem?

In DelegateMagicCodeModal component, we are setting hasMagicCodeBeenSent based on currentDelegate

But when API ResendValidateCode is called, currentDelegate isn't updated

hasMagicCodeBeenSent={!!currentDelegate?.validateCodeSent}

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

We should update hasMagicCodeBeenSent based on ONYXKEYS.VALIDATE_ACTION_CODE as we did with other validated code modal

    const [validateCodeAction] = useOnyx(ONYXKEYS.VALIDATE_ACTION_CODE);
    ....
    hasMagicCodeBeenSent={!!validateCodeAction?.validateCodeSent}

We can similarly check the places where ValidateCodeActionModal component is used

What alternative solutions did you explore? (Optional)

NA

@layacat
Copy link
Contributor

layacat commented Nov 26, 2024

Proposal

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

Missing validate code sent when adding copilot

What is the root cause of that problem?

We're using this line to display the code sent message:

hasMagicCodeBeenSent={!!currentDelegate?.validateCodeSent}

But currentDelegate doesn't have that property, in the other hand, we don't add that param while adding delegate. That's the RCA.

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

The first part, we should use validateCodeAction (we used it almost everywhere):

// introduce new varibale
const [validateCodeAction] = useOnyx(ONYXKEYS.VALIDATE_ACTION_CODE);

// and update the hasMagicCodeBeenSent props:

hasMagicCodeBeenSent={validateCodeAction?. validateCodeSent}

But if we only update hasMagicCodeBeenSent props by usingvalidateCodeAction?. validateCodeSent, we will never received magic code again in other flows, because the validateCodeSent was not reset. Because of that, we need the second part, we should reset the value of validateCodeAction?. validateCodeSent after adding delete (it can be failed or successful) in our optimistic data of addDelegate function:

// Update the optimistic data of addDelegate function:
        const optimisticResetActionCode = {
            onyxMethod: Onyx.METHOD.MERGE,
            key: ONYXKEYS.VALIDATE_ACTION_CODE,
            value: {
                validateCodeSent: null,
            },
        };
        successData.push(optimisticResetActionCode);
        failureData.push(optimisticResetActionCode);

What alternative solutions did you explore? (Optional)

N/A
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.

@muttmuure muttmuure added the External Added to denote the issue can be worked on by a contributor label Nov 28, 2024
@melvin-bot melvin-bot bot changed the title Missing validate code sent when adding copilot [$250] Missing validate code sent when adding copilot Nov 28, 2024
Copy link

melvin-bot bot commented Nov 28, 2024

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Nov 28, 2024
Copy link

melvin-bot bot commented Nov 28, 2024

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

Copy link

melvin-bot bot commented Dec 2, 2024

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

@melvin-bot melvin-bot bot added the Overdue label Dec 2, 2024
@fedirjh
Copy link
Contributor

fedirjh commented Dec 2, 2024

Thanks everyone for the proposals.

@layacat's proposal looks good to me. We should reset the validateCodeAction when we verify the delegate.

🎀 👀 🎀 C+ reviewed

@melvin-bot melvin-bot bot removed the Overdue label Dec 2, 2024
Copy link

melvin-bot bot commented Dec 2, 2024

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

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Dec 2, 2024
Copy link

melvin-bot bot commented Dec 2, 2024

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

@nkdengineer
Copy link
Contributor

But if we only update hasMagicCodeBeenSent props by usingvalidateCodeAction?. validateCodeSent, we will never received magic code again in other flows, because the validateCodeSent was not reset

@fedirjh this point is wrong, we still received magic code again in other flows

we should reset the value of validateCodeAction?. validateCodeSent after adding delete (it can be failed or successful) in our optimistic data of addDelegate function:

If we do this then we have to do it with all the places where ValidateCodeActionModal is used in our app

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Dec 3, 2024
@nkdengineer
Copy link
Contributor

@fedirjh could you please check this comment

@layacat
Copy link
Contributor

layacat commented Dec 4, 2024

If we don't reset validateCodeSent then this will happen:

delegate.mov

Cause we had an early return here:

if (!firstRenderRef.current || !isVisible || hasMagicCodeBeenSent) {
return;
}

@nkdengineer
Copy link
Contributor

@layacat if this happens, we should fix all places right?

@layacat
Copy link
Contributor

layacat commented Dec 5, 2024

Mostly. Yes, I think so.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Dec 12, 2024
@melvin-bot melvin-bot bot changed the title [$250] Missing validate code sent when adding copilot [HOLD for payment 2024-12-19] [$250] Missing validate code sent when adding copilot Dec 12, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Dec 12, 2024
Copy link

melvin-bot bot commented Dec 12, 2024

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

Copy link

melvin-bot bot commented Dec 12, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.74-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 2024-12-19. 🎊

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

Copy link

melvin-bot bot commented Dec 12, 2024

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

@muttmuure
Copy link
Contributor

Not overdue

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels Dec 18, 2024
@fedirjh
Copy link
Contributor

fedirjh commented Dec 22, 2024

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: feat: add timer on validate code action modal #51663 (comment)

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

Test:

  1. Go to Settings page -> Security page
  2. Click Add Copilot button
  3. Complete the flow
  4. In the final step observe the request validate code modal
  5. Verify validate code sent message is displayed

Do we agree 👍 or 👎

Copy link

melvin-bot bot commented Dec 23, 2024

@thienlnam, @fedirjh, @muttmuure, @layacat Huh... This is 4 days overdue. Who can take care of this?

@thienlnam
Copy link
Contributor

Pending payment

Copy link

melvin-bot bot commented Dec 25, 2024

@thienlnam, @fedirjh, @muttmuure, @layacat Still overdue 6 days?! Let's take care of this!

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 Overdue
Projects
None yet
Development

No branches or pull requests

6 participants