Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.36k stars 2.79k forks source link

[HOLD for payment 2024-08-19] [$250] `Tag no longer valid` appears on optional multilevel tag after changing a required tag #46789

Closed m-natarajan closed 1 month ago

m-natarajan commented 1 month ago

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.15-6 Reproducible in staging?: y Reproducible in production?: y 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: @cead22 Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1722618234255979

Action Performed:

  1. Enable multiple levels of tag (oldDot)
  2. Import the tags from Implement violations for mutiple tag lists #37117 (oldDot)
  3. Mark the first two tags not required (oldDot)
  4. Submit expense > Enter amount > Enter merchant > Submit
  5. Open the expense preview
  6. Select a project from the project multi-tag

Expected Result:

Violation shouldn't show

Actual Result:

Tag no longer valid violation appears on optional multilevel tag after changing a required tag

Workaround:

unknown

Platforms:

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

Screenshots/Videos

https://github.com/user-attachments/assets/d9df1479-9b90-41a1-8c7c-2ac63ce62d8d

https://github.com/user-attachments/assets/7b66bae0-849f-41a2-a208-c4c4ab510539

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01b480770995fdef2d
  • Upwork Job ID: 1820487238490623314
  • Last Price Increase: 2024-08-05
  • Automatic offers:
    • ikevin127 | Reviewer | 103410889
    • nkdengineer | Contributor | 103410890
Issue OwnerCurrent Issue Owner: @OfstadC
melvin-bot[bot] commented 1 month ago

Triggered auto assignment to @OfstadC (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[bot] commented 1 month ago

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

melvin-bot[bot] commented 1 month ago

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

nkdengineer commented 1 month ago

Proposal

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

Tag no longer valid violation appears on optional multilevel tag after changing a required tag

What is the root cause of that problem?

The multi-level tag has the format A:B:C, when we only select C, the tag is stored in the transaction as ::C

https://github.com/Expensify/App/blob/0ee0fe34c5a3e0dae89fc88140025f0bc6d67276/src/libs/Violations/ViolationsUtils.ts#L84

Then the selectedTags here is ['', '', 'C']

https://github.com/Expensify/App/blob/0ee0fe34c5a3e0dae89fc88140025f0bc6d67276/src/libs/Violations/ViolationsUtils.ts#L84 That makes isTagInPolicy is false for the first selected tag then the violation is added and shown in the money request view https://github.com/Expensify/App/blob/0ee0fe34c5a3e0dae89fc88140025f0bc6d67276/src/libs/Violations/ViolationsUtils.ts#L115

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

If the selectedTag tag here is empty, we shouldn't add the violation since we passed the required tag check below and it can be empty

https://github.com/Expensify/App/blob/0ee0fe34c5a3e0dae89fc88140025f0bc6d67276/src/libs/Violations/ViolationsUtils.ts#L112

if (!isTagInPolicy && selectedTag) {

https://github.com/Expensify/App/blob/0ee0fe34c5a3e0dae89fc88140025f0bc6d67276/src/libs/Violations/ViolationsUtils.ts#L115

What alternative solutions did you explore? (Optional)

ikevin127 commented 1 month ago

@nkdengineer's proposal LGTM πŸš€ -> All points mentioned in the RCA check-out and the proposed solution fixes the issue accordingly, fulfilling the Expected result of the issue.

πŸŽ€πŸ‘€πŸŽ€Β C+ reviewed

melvin-bot[bot] commented 1 month ago

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

melvin-bot[bot] commented 1 month ago

πŸ“£ @ikevin127 πŸŽ‰ An offer has been automatically sent to your Upwork account for the Reviewer role πŸŽ‰ Thanks for contributing to the Expensify app!

Offer link Upwork job

melvin-bot[bot] commented 1 month ago

πŸ“£ @nkdengineer πŸŽ‰ 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 πŸ“–

melvin-bot[bot] commented 1 month ago

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

melvin-bot[bot] commented 1 month ago

The solution for this issue has been :rocket: deployed to production :rocket: in version 9.0.18-10 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-08-19. :confetti_ball:

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

melvin-bot[bot] commented 1 month ago

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:

ikevin127 commented 1 month ago

Regression Test Proposal

  1. OD: Enable multiple levels of tag on.
  2. OD: Import the tags from Implement violations for mutiple tag lists #37117 (comment).
  3. OD: Mark the first two tags not required.
  4. Submit expense > Enter amount > Enter merchant > Submit.
  5. Open the expense detail.
  6. Select a city from the required City multi-tag field.
  7. Verify that a violation doesn't show on any on the non-required fields (Category, State, Region) after changing the City.

Do we agree πŸ‘ or πŸ‘Ž.

cead22 commented 1 month ago

We have a pretty comprehensive list of tests for violations now, which should cover this, righ @isagoico ?

ikevin127 commented 1 month ago

cc @OfstadC

OfstadC commented 1 month ago

Payment Summary

@ikevin127 paid $250 via Upwork @nkdengineer paid $250 via Upwork

Sounds like we don't need regression testing here - so I'll close. But if that changes, feel free to tag me and i'll create an issue πŸ˜ƒ