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

[$250] [HOLD for payment 2024-04-05] [Simplified Collect][Taxes] - App crashes when opening Foreign currency default row after deleting the selected tax #38931

Closed
6 tasks done
izarutskaya opened this issue Mar 25, 2024 · 29 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Engineering Weekly KSv2

Comments

@izarutskaya
Copy link

izarutskaya commented Mar 25, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Found when executing PR : #38208

Version Number: 1.4.56-2
Reproducible in staging?: Y
Reproducible in production?: N
Logs: https://stackoverflow.com/c/expensify/questions/4856
Issue reported by: Applause-Internal team

Action Performed:

Precondition:

  • User is admin of Collect workspace.
  • There are a few tax rates in the Collect workspace.
  1. Go to staging.new.expensify.com.
  2. Go to Profile > Workspaces > Collect workspace.
  3. Go to Taxes.
  4. Click Settings > Foreign currency default > Select any tax rate.
  5. Delete the tax rate selected in Step 4.
  6. Click Settings > Foreign currency default.

Expected Result:

App does not crash.

Actual Result:

App crashes.

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6425851_1711367608184.20240325_194849.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @alexpensify
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01e292bf5e67d0c666
  • Upwork Job ID: 1776020973492867072
  • Last Price Increase: 2024-04-04
@izarutskaya izarutskaya added DeployBlockerCash This issue or pull request should block deployment Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Mar 25, 2024
Copy link

melvin-bot bot commented Mar 25, 2024

Triggered auto assignment to @alexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

Copy link
Contributor

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

Copy link

melvin-bot bot commented Mar 25, 2024

Triggered auto assignment to @nkuoch (Engineering), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

@izarutskaya
Copy link
Author

@alexpensify I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors.

We think that this bug might be related to #wave-control.

@mountiny
Copy link
Contributor

Happy to take over since its related to simplified collect

@ArekChr is going to look into this one

@mountiny mountiny assigned mountiny and unassigned nkuoch Mar 25, 2024
@ArekChr
Copy link
Contributor

ArekChr commented Mar 25, 2024

Sure, happy to handle this issue!

@kosmydel
Copy link
Contributor

Hey, if needed we can check this issue as I with @filip-solecki was responsible for the Taxes feature. Just let me know, if we should investigate it.

@shahinyan11
Copy link
Contributor

shahinyan11 commented Mar 25, 2024

Proposal

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

Taxes - App crashes when opening Foreign currency default row after deleting the selected tax

What is the root cause of that problem?

The Onyx data is not updated correct

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

Add the foreignTaxDefault, pendingFields and errorFields keys to the onyxData object here, as done in the setWorkspaceCurrencyDefault function

const onyxData: OnyxData = {
        optimisticData: [
            {
                onyxMethod: Onyx.METHOD.MERGE,
                key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`,
                value: {
                    taxRates: {
                        foreignTaxDefault: policy?.taxRates?.defaultExternalID,
                        pendingFields: {foreignTaxDefault: CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE},
                        errorFields: null,
                        taxes: taxesToDelete.reduce<TaxRateDeleteMap>((acc, taxID) => {
                            acc[taxID] = {pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE, errors: null};
                            return acc;
                        }, {}),
                    },
                },
            },
        ],
        successData: [
            {
                onyxMethod: Onyx.METHOD.MERGE,
                key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`,
                value: {
                    taxRates: {
                        pendingFields: {foreignTaxDefault: null},
                        errorFields: null,
                        taxes: taxesToDelete.reduce<TaxRateDeleteMap>((acc, taxID) => {
                            acc[taxID] = null;
                            return acc;
                        }, {}),
                    },
                },
            },
        ],
        failureData: [
            {
                onyxMethod: Onyx.METHOD.MERGE,
                key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`,
                value: {
                    taxRates: {
                        foreignTaxDefault: policy?.taxRates?.defaultExternalID,
                        pendingFields: {foreignTaxDefault: null},
                        errorFields: {foreignTaxDefault: ErrorUtils.getMicroSecondOnyxError('common.genericErrorMessage')},
                        taxes: taxesToDelete.reduce<TaxRateDeleteMap>((acc, taxID) => {
                            acc[taxID] = {
                                pendingAction: null,
                                errors: ErrorUtils.getMicroSecondOnyxError('workspace.taxes.errors.deleteFailureMessage'),
                            };
                            return acc;
                        }, {}),
                    },
                },
            },
        ],
    };

What alternative solutions did you explore? (Optional)

@luacmartins luacmartins self-assigned this Mar 25, 2024
@luacmartins luacmartins changed the title Taxes - App crashes when opening Foreign currency default row after deleting the selected tax [Simplified Collect][Taxes] - App crashes when opening Foreign currency default row after deleting the selected tax Mar 25, 2024
@luacmartins
Copy link
Contributor

@ArekChr @filip-solecki are either of you available to investigate this one?

@filip-solecki
Copy link
Contributor

Sure, I can check it!

@luacmartins
Copy link
Contributor

Thanks! I think the solution involves:

  1. Check if the taxes being deleted include the foreign tax default
  2. If it does, we need to update the foreign tax default to the workspace default one
  3. Update the pending action only for the foreign tax default field. The error will be shown on the deleted tax already, so no need to duplicate it here too

@luacmartins
Copy link
Contributor

luacmartins commented Mar 25, 2024

I'm gonna demote this from being a blocker since customers don't have access to this yet, but we should definitely fix it asap.

@luacmartins luacmartins added Daily KSv2 and removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 labels Mar 25, 2024
@filip-solecki
Copy link
Contributor

@luacmartins You're right. What we have to do is just check if tax we want to remove is marked as Foreign tax default if yes we have to update it at the same time. In the Old Dot we have rule that the first tax from the list became Foreign tax default so do we want to keep it or do we want to use Workspace default tax?

@shahinyan11
Copy link
Contributor

Doesn't anyone have any feedback on my proposal ?

@melvin-bot melvin-bot bot added the Weekly KSv2 label Mar 25, 2024
@Ollyws
Copy link
Contributor

Ollyws commented Mar 25, 2024

Can I get assigned here for the C+ review? Thanks.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Mar 29, 2024
@melvin-bot melvin-bot bot changed the title [Simplified Collect][Taxes] - App crashes when opening Foreign currency default row after deleting the selected tax [HOLD for payment 2024-04-05] [Simplified Collect][Taxes] - App crashes when opening Foreign currency default row after deleting the selected tax Mar 29, 2024
Copy link

melvin-bot bot commented Mar 29, 2024

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Mar 29, 2024
Copy link

melvin-bot bot commented Mar 29, 2024

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

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

  • @Ollyws requires payment (Needs manual offer from BZ)
  • @filip-solecki does not require payment (Contractor)

Copy link

melvin-bot bot commented Mar 29, 2024

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@Ollyws] The PR that introduced the bug has been identified. Link to the PR:
  • [@Ollyws] 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:
  • [@Ollyws] A discussion in #expensify-bugs 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:
  • [@Ollyws] Determine if we should create a regression test for this bug.
  • [@Ollyws] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@alexpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@mountiny
Copy link
Contributor

$250 to @Ollyws

@alexpensify alexpensify added the External Added to denote the issue can be worked on by a contributor label Apr 4, 2024
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2024-04-05] [Simplified Collect][Taxes] - App crashes when opening Foreign currency default row after deleting the selected tax [$250] [HOLD for payment 2024-04-05] [Simplified Collect][Taxes] - App crashes when opening Foreign currency default row after deleting the selected tax Apr 4, 2024
Copy link

melvin-bot bot commented Apr 4, 2024

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

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

melvin-bot bot commented Apr 4, 2024

Current assignee @Ollyws is eligible for the External assigner, not assigning anyone new.

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels Apr 4, 2024
@alexpensify alexpensify added Weekly KSv2 and removed External Added to denote the issue can be worked on by a contributor Daily KSv2 Help Wanted Apply this label when an issue is open to proposals by contributors Overdue labels Apr 4, 2024
@alexpensify
Copy link
Contributor

@Ollyws - please apply to the job here:

https://www.upwork.com/jobs/~01e292bf5e67d0c666

Tomorrow, I can complete the payment process. Thanks!

@alexpensify
Copy link
Contributor

@Ollyws - I sent an offer via Upwork, please accept and I can continue the payment process. Thanks!

@Ollyws
Copy link
Contributor

Ollyws commented Apr 5, 2024

Accepted, thanks.

@alexpensify
Copy link
Contributor

alexpensify commented Apr 5, 2024

Payouts due:

Upwork job is here.


Closing, the payment process is complete in Upwork.

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. Engineering Weekly KSv2
Projects
No open projects
Archived in project
Development

No branches or pull requests

10 participants