Skip to content

[Due for payment 2025-05-20] [$250] Expense - "Category no longer valid" briefly seen when submitting track expense to new WS. #61153

Closed

Description

@mitarachim

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.1.38-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
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): ibellicotest+635@gmail.com
Issue reported by: Applause Internal Team
Device used: Motorola MotoG60 - Android 12 - Chrome / Windows 10 - Chrome
App Component: Money Requests

Action Performed:

  1. Open the staging.new.expensify.com website.
  2. Tap on FAB and select "Create Expense"
  3. Tap on "Manual"
  4. Complete the creation flow and submit the expense to Self DM.
  5. Tap on "Share with my accountant" on system message below expense report.
  6. Tap on "New Workspace"
  7. Add a merchant and a category and submit the expense.
  8. Dismiss RHP.
  9. Open the just created expense report.
  10. Note that a "Category no longer valid" erorr message can be seen briefly on category field.

Expected Result:

No error message should be displayed on category field after submitting a track expense to a new workspace with a valid category.

Actual Result:

"Category no longer valid" error message can be seen briefly on category field, after submitting a track expense to a new workspace and opening the report.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Image

Bug6817341_1745994713543.Valid.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021917621735274303658
  • Upwork Job ID: 1917621735274303658
  • Last Price Increase: 2025-04-30
  • Automatic offers:
    • nkdengineer | Contributor | 107158236
Issue OwnerCurrent Issue Owner: @lschurr

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Apr 30, 2025
  2. melvin-bot commented on Apr 30, 2025

    @melvin-bot

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

  3. nkdengineer commented on Apr 30, 2025

    @nkdengineer
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2025-04-30 07:57:49 UTC.

    Proposal

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

    "Category no longer valid" error message can be seen briefly on category field, after submitting a track expense to a new workspace and opening the report.

    What is the root cause of that problem?

    In this case, we're creating the new expense report along with new policy. And we create the policyDraft and policyCategoryDraft to show in IOURequestStepConfirmation

    const [policyDraft] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_DRAFTS}${getIOURequestPolicyID(transaction, reportDraft)}`, {canBeMissing: true});
    const [policyReal] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${getIOURequestPolicyID(transaction, reportReal)}`, {canBeMissing: true});
    const [policyCategoriesReal] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${getIOURequestPolicyID(transaction, reportReal)}`, {canBeMissing: true});
    const [policyCategoriesDraft] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${getIOURequestPolicyID(transaction, reportDraft)}`, {canBeMissing: true});

    For the policyCategoriesDraft we're getting it from policyCategories_draftPolicyID, but the policy category draft is stored in
    policyCategoriesDraft_draftPolicyID, that causes policyCategoriesDraft empty so we build the violation optimistically if we can't find the category

    After Be returns data, we'll use the real policy and category so the violation disappears

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

    we should change this line:

    const [policyCategoriesDraft] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${getIOURequestPolicyID(transaction, reportDraft)}`, {canBeMissing: true});

    to

        const [policyCategoriesDraft] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_CATEGORIES_DRAFT}${getIOURequestPolicyID(transaction, reportDraft)}`, {canBeMissing: true});
    

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

    We can render the IOURequestStepConfirmation with mocked data then make sure after creating track expense, there's no violation for category

    What alternative solutions did you explore? (Optional)

    None

    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.

  4. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Apr 30, 2025
  5. changed the title [-]Expense - "Category no longer valid" briefly seen when submitting track expense to new WS.[/-] [+][$250] Expense - "Category no longer valid" briefly seen when submitting track expense to new WS.[/+] on Apr 30, 2025
  6. melvin-bot commented on Apr 30, 2025

    @melvin-bot
  7. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Apr 30, 2025
  8. melvin-bot commented on Apr 30, 2025

    @melvin-bot

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

  9. hungvu193 commented on May 1, 2025

    @hungvu193
    Contributor

    I'll review in the morning

  10. hungvu193 commented on May 2, 2025

    @hungvu193
    Contributor

    @nkdengineer 's proposal here has the correct RCA and straightforward solution! LGTM

    🎀 👀 🎀 C+ reviewed

  11. melvin-bot commented on May 2, 2025

    @melvin-bot

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

  12. 6 remaining items

  13. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on May 13, 2025
  14. changed the title [-][$250] Expense - "Category no longer valid" briefly seen when submitting track expense to new WS.[/-] [+][Due for payment 2025-05-20] [$250] Expense - "Category no longer valid" briefly seen when submitting track expense to new WS.[/+] on May 13, 2025
  15. melvin-bot commented on May 13, 2025

    @melvin-bot

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

  16. melvin-bot commented on May 13, 2025

    @melvin-bot

    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:

  17. melvin-bot commented on May 13, 2025

    @melvin-bot

    @hungvu193 @lschurr @hungvu193 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]

  18. lschurr commented on May 19, 2025

    @lschurr
    Contributor

    @hungvu193 could you work on the checklist for this one?

  19. lschurr commented on May 20, 2025

    @lschurr
    Contributor

    Payment summary:

  20. hungvu193 commented on May 21, 2025

    @hungvu193
    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: There are so many overlapping changes. Unfortunately I couldn't find the offending PR. The original code (policy draft) was added almost 2 years ago.

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

    Regression Test Proposal

    Test:

    1. Open the staging.new.expensify.com website.
    2. Tap on FAB and select "Create Expense"
    3. Tap on "Manual"
    4. Complete the creation flow and submit the expense to Self DM.
    5. Tap on "Share with my accountant" on system message below expense report.
    6. Tap on "New Workspace"
    7. Add a merchant and a category and submit the expense.
    8. Dismiss RHP.
    9. Open the just created expense report.
    10. Verify there is no error under category field.

    Do we agree 👍 or 👎

  21. garrettmknight commented on Jun 3, 2025

    @garrettmknight
    Contributor

    $250 approved for @hungvu193

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions