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

[Due for payment 2025-02-19] [$250] Copilot - No countdown and code requested message on magic code page when changing access level #55718

Closed
6 of 8 tasks
vincdargento opened this issue Jan 24, 2025 · 31 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

@vincdargento
Copy link

vincdargento commented Jan 24, 2025

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.89-2
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Email or phone of affected tester (no customers): applausetester+100106kh@applause.expensifail.com
Issue reported by: Applause Internal Team
Device used: Mac 15.0 / Chrome
App Component: User Settings

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to Account settings > Security.
  3. Click Add copilot.
  4. Select a user, select access level and proceed to confirmation page.
  5. Click Add copilot.
  6. On magic code page, there is a countdown and "Code requested. Please check your device." message.
  7. Enter correct magic code.
  8. Click on the same member under "These members can access your account".
  9. Click Change access level.
  10. Select a different access level.

Expected Result:

On magic code page when changing access level for existing copilot, it should display a countdown and "Code requested. Please check your device." message.

Actual Result:

On magic code page when changing access level for existing copilot, it does not display a countdown and "Code requested. Please check your device." message, which is not consistent with the magic code page in Step 6.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

bug.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021884532777502086335
  • Upwork Job ID: 1884532777502086335
  • Last Price Increase: 2025-01-29
  • Automatic offers:
    • cretadn22 | Contributor | 105926705
Issue OwnerCurrent Issue Owner: @garrettmknight
@vincdargento vincdargento added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 labels Jan 24, 2025
Copy link

melvin-bot bot commented Jan 24, 2025

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

@etCoderDysto
Copy link
Contributor

etCoderDysto commented Jan 24, 2025

🚨 Edited by proposal-police: This proposal was edited at 2025-01-24 13:48:38 UTC.

Proposal

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

Copilot - No countdown and code requested message on magic code page when changing access level

What is the root cause of that problem?

We have not implemented the timer feature in BaseValidateCodeForm.tsx as we are doing here

/>
<OfflineWithFeedback errorRowStyles={[styles.mt2]}>
<View style={[styles.mt2, styles.dFlex, styles.flexColumn, styles.alignItemsStart]}>
<PressableWithFeedback

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

  1. Create a state to store time and set it to 30 second
    const [timeRemaining, setTimeRemaining] = useState(CONST.REQUEST_CODE_DELAY as number);
  2. Countdown the timer using setTimeOut
    useEffect(() => {
    if (timeRemaining > 0) {
    timerRef.current = setTimeout(() => {
    setTimeRemaining(timeRemaining - 1);
    }, 1000);
    }
    return () => {
    clearTimeout(timerRef.current);
    };
    }, [timeRemaining]);
  3. Show timer when time > 0 and user is not offline (shouldShowTimer)
    const shouldShowTimer = timeRemaining > 0 && !isOffline;
  4. Show resend link when shouldShowTimer is false

{shouldShowTimer && (
<Text style={[styles.mt5]}>
{translate('validateCodeForm.requestNewCode')}

  1. We should reset the timer when requesting a new magic code
setTimeRemaining(CONST.REQUEST_CODE_DELAY);

const resendValidateCode = () => {
if (!login) {
return;
}
Delegate.requestValidationCode();

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

N/A as it is a UI change

What alternative solutions did you explore? (Optional)

We can create hook that returns remainingTime and a function that resets the timer following the same logic as the existing timer implementation.

const {remainingTime, resetTimer} = useRequestTimeout(); 

And use remainingTime to decide if should display timer, and call resetTimer when requesting a new code to reset the time.

Tests

  • remainingTime should be 30 sec when calling the hook
  • remainingTime should be 0 after 30 second
  • remaingTime should be 30 sec when resetTimer is called

@cretadn22
Copy link
Contributor

cretadn22 commented Jan 24, 2025

🚨 Edited by proposal-police: This proposal was edited at 2025-01-24 17:25:44 UTC.

Proposal

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

There’s no countdown and "Code Requested" message displayed on the Magic Code page when changing the access level.

What is the root cause of that problem?

In UpdateDelegateMagicCodePage Component

function UpdateDelegateMagicCodePage({route}: UpdateDelegateMagicCodePageProps) {

We are using an independent ValidateCodeForm (src/pages/settings/Security/AddDelegate/UpdateDelegateRole/ValidateCodeForm/index.tsx), but the code to display the countdown timer has not been implemented

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

Note: In all other instances, we consistently use the ValidateCodeActionModal.

Therefore, I suggest that in the UpdateDelegateMagicCodePage component, we also use ValidateCodeActionModal, as we’ve done in other places like DelegateMagicCodeModal, etc.

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

I believe this section is unnecessary

What alternative solutions did you explore? (Optional)

No

Copy link
Contributor

⚠️ @cretadn22 Thanks for your proposal. Please update it to follow the proposal template, as proposals are only reviewed if they follow that format (note the mandatory sections).

@melvin-bot melvin-bot bot added the Overdue label Jan 27, 2025
Copy link

melvin-bot bot commented Jan 28, 2025

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

@JmillsExpensify JmillsExpensify moved this to Bugs and Follow Up Issues in [#whatsnext] #expense Jan 29, 2025
@JmillsExpensify JmillsExpensify added the External Added to denote the issue can be worked on by a contributor label Jan 29, 2025
@melvin-bot melvin-bot bot changed the title Copilot - No countdown and code requested message on magic code page when changing access level [$250] Copilot - No countdown and code requested message on magic code page when changing access level Jan 29, 2025
Copy link

melvin-bot bot commented Jan 29, 2025

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jan 29, 2025
@JmillsExpensify
Copy link

Opened up to the community.

Copy link

melvin-bot bot commented Jan 29, 2025

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

@melvin-bot melvin-bot bot removed the Overdue label Jan 29, 2025
@jayeshmangwani
Copy link
Contributor

Thank you for the proposals above.
I agree with @cretadn22 's Proposal to use the ValidateCodeActionModal for consistency with other pages that use a timer for the magic code.
Let's go with their proposal.

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Jan 30, 2025

Triggered auto assignment to @aldo-expensify, 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 Jan 30, 2025
Copy link

melvin-bot bot commented Jan 30, 2025

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

Copy link

melvin-bot bot commented Feb 3, 2025

@JmillsExpensify, @jayeshmangwani, @aldo-expensify, @cretadn22 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 Feb 3, 2025
@jayeshmangwani
Copy link
Contributor

We're waiting on @cretadn22 to raise the PR.

@melvin-bot melvin-bot bot removed the Overdue label Feb 3, 2025
@cretadn22
Copy link
Contributor

I'm currently working on this

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Daily KSv2 labels Feb 4, 2025
@cretadn22
Copy link
Contributor

@jayeshmangwani Take a look at this video. When an incorrect magic code is entered, the optimistic value updates initially, but once the backend returns a failure, the old value is reverted, causing a flickering effect. Since updating the delegate role requires a correct code that can only be verified by the backend, we shouldn't use optimistic data for this action. Instead, we could consider displaying a loading spinner while waiting for the API response. This might be out of scope for now, but it would be a valuable improvement.

Screen.Recording.2025-02-04.at.11.52.10.mov

@jayeshmangwani
Copy link
Contributor

Thanks for the input, @cretadn22 , I checked a few cases where we use the magic input, and it flickers in the current production version. So, I think we can include this change in this PR to improve the visual effect.

@dylanexpensify
Copy link
Contributor

@cretadn22 @jayeshmangwani agree with adding that in scope if easy. @cretadn22 when can we expect PR for review?

@cretadn22
Copy link
Contributor

Almost done, @jayeshmangwani Please start reviewing. On the other way, I will update this additional point later today

@cretadn22
Copy link
Contributor

I get this error because of many API calls. It block me from completing this PR

Image

@cretadn22
Copy link
Contributor

cretadn22 commented Feb 5, 2025

@jayeshmangwani All code changes are complete. Please proceed with the review. I will run another test and upload videos once the API is working again.

@jayeshmangwani
Copy link
Contributor

@cretadn22 Maybe you can try with a new account, or you could wait an hour before calling this API again.

@jayeshmangwani
Copy link
Contributor

Please proceed with the review

Yes sure, I'll review PR

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Feb 12, 2025
@melvin-bot melvin-bot bot changed the title [$250] Copilot - No countdown and code requested message on magic code page when changing access level [Due for payment 2025-02-19] [$250] Copilot - No countdown and code requested message on magic code page when changing access level Feb 12, 2025
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Feb 12, 2025
Copy link

melvin-bot bot commented Feb 12, 2025

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

Copy link

melvin-bot bot commented Feb 12, 2025

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

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

Copy link

melvin-bot bot commented Feb 12, 2025

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

@jayeshmangwani
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: N/A

  • [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: I don't think this is a regression; rather, it's a design improvement to make it consistent with other Magic code pages.

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

  1. Go to Account settings > Security.
  2. Click Add Copilot.
  3. Select a user, choose an access level, and proceed to the confirmation page.
  4. Click Add Copilot again.
  5. Enter the correct magic code.
  6. Click on the same member under "These members can access your account."
  7. Click Change access level.
  8. Select a different access level.
  9. Verify that, on the magic code page, when changing the access level for an existing Copilot, a countdown and the message Code requested. Please check your device should be displayed.

Do we agree 👍 or 👎

@garrettmknight
Copy link
Contributor

Taking over for payment - just waiting till Weds.

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Feb 19, 2025
@garrettmknight
Copy link
Contributor

Payment Summary:

@garrettmknight
Copy link
Contributor

@jayeshmangwani request whenever you're ready.

@github-project-automation github-project-automation bot moved this from Bugs and Follow Up Issues to Done in [#whatsnext] #expense Feb 19, 2025
@JmillsExpensify
Copy link

Payment Summary:

Contributor: @cretadn22 $250 via Upwork
Contirbutor+: @jayeshmangwani $250 via NewDot

@garrettmknight
Copy link
Contributor

$250 approved for @jayeshmangwani

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

8 participants