App icon indicating copy to clipboard operation
App copied to clipboard

[$250] Tags - Missing tag violation for first expense is shown only after creating second expense

Open jponikarchuk opened this issue 2 months ago β€’ 44 comments

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: V9.2.43-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack: Exploratory Email or phone of affected tester (no customers): Slottwo1 [email protected] Issue reported by: Applause Internal Team Device used: Redminote 10s android 13 App Component: Money Requests

Action Performed:

  1. Go to https://staging.new.expensify.com/home
  2. Go to workspace settings -more features
  3. Enable Tags
  4. Create a manual expense entering merchant and category
  5. Go to tags page
  6. Add few tags
  7. Tap settings
  8. Enable members must tag all expenses
  9. Go to workspace chat
  10. Note in preview missing tag violation is not shown
  11. Open the expense and now tag required is not shown
  12. Go back to workspace chat
  13. Create a manual expense entering merchant
  14. Now note in preview missing tag violation is shown for both expenses
  15. Open the expense report and details page and note violation is now shown for both expenses

Expected Result:

Missing tag violation for first expense must be shown after changing settings members must tag all expenses.

Actual Result:

Missing tag violation for first expense is shown only after creating second expense.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

https://github.com/user-attachments/assets/76b083f9-3431-40dc-b8b2-64b7ebba7602

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021986535910600778021
  • Upwork Job ID: 1986535910600778021
  • Last Price Increase: 2025-12-25
Issue OwnerCurrent Issue Owner: @brunovjk

jponikarchuk avatar Nov 04 '25 04:11 jponikarchuk

Triggered auto assignment to @CortneyOfstad (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] avatar Nov 04 '25 04:11 melvin-bot[bot]

Proposal

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

Tags - Missing tag violation for first expense is shown only after creating second expense

What is the root cause of that problem?

When the user enables "members must tag all expenses" setting, we only updates the policy setting but does not recalculate violations for existing transactions

https://github.com/Expensify/App/blob/28ede48c8c98b9b6deba2aa5d2d55fecaa4c4c6d/src/libs/actions/Policy/Tag.ts#L917-L986

Unlike the setWorkspaceRequiresCategory function which properly calls pushTransactionViolationsOnyxData to recalculate violations for all existing transactions when the category requirement setting changes

https://github.com/Expensify/App/blob/28ede48c8c98b9b6deba2aa5d2d55fecaa4c4c6d/src/libs/actions/Policy/Category.ts#L892-L953

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

We need to add the violation recalculation logic to the setPolicyRequiresTag, following the same pattern used in setWorkspaceRequiresCategory

function setPolicyRequiresTag(
    policyID: string,
    requiresTag: boolean,
    policyCategories: PolicyCategories = {},
    allTransactionViolations: OnyxCollection<TransactionViolations> = {},
) {
    ...
    onyxData.optimisticData?.push(getUpdatedTagsData(requiresTag));
    onyxData.failureData?.push(getUpdatedTagsData(!requiresTag));
    onyxData.successData?.push(getUpdatedTagsData(requiresTag));

    pushTransactionViolationsOnyxData(onyxData, policyID, policyTags, policyCategories, allTransactionViolations, {
        requiresTag,
    });

https://github.com/Expensify/App/blob/28ede48c8c98b9b6deba2aa5d2d55fecaa4c4c6d/src/libs/actions/Policy/Tag.ts#L917-L986

Then update the function call to pass the additional parameters

    const [policyCategories] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${policyID}`, {canBeMissing: true});
    const [allTransactionViolations] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS);
    const updateWorkspaceRequiresTag = useCallback(
        (value: boolean) => {
            setPolicyRequiresTag(policyID, value, policyCategories, allTransactionViolations);
        },
        [policyID, policyCategories, allTransactionViolations],
    );

https://github.com/Expensify/App/blob/28ede48c8c98b9b6deba2aa5d2d55fecaa4c4c6d/src/pages/workspace/tags/WorkspaceTagsSettingsPage.tsx#L63-L68

What alternative solutions did you explore? (Optional)

None

nyomanjyotisa avatar Nov 04 '25 04:11 nyomanjyotisa

i can't reproduce

daledah avatar Nov 04 '25 07:11 daledah

I'm also having trouble recreating. Going to see if QA can retest

CortneyOfstad avatar Nov 04 '25 19:11 CortneyOfstad

Request here β€” https://expensify.enterprise.slack.com/archives/C9YU7BX5M/p1762285757906329

CortneyOfstad avatar Nov 04 '25 19:11 CortneyOfstad

Reproduce, MacOS Monterey / Chrome, Web v9.2.43-2

https://github.com/user-attachments/assets/42bec29a-00af-4b87-926a-2a63b2fd96d9

m-natarajan avatar Nov 04 '25 20:11 m-natarajan

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

melvin-bot[bot] avatar Nov 06 '25 20:11 melvin-bot[bot]

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

melvin-bot[bot] avatar Nov 06 '25 20:11 melvin-bot[bot]

Hey @brunovjk! We have a proposal here for you to review – thanks!

CortneyOfstad avatar Nov 06 '25 20:11 CortneyOfstad

Great, reviewing ASAP

brunovjk avatar Nov 06 '25 21:11 brunovjk

Thanks for the proposal @nyomanjyotisa and sorry for the delay. It makes sense to me but after testing it seems incomplete:

https://github.com/user-attachments/assets/d1e7e2e7-a9aa-47c1-abed-4d03ff61e5eb

After marking it as required and returning to the workspace chat, we saw that the violation appears as "Review" on the button, and when entering the Expense Preview we also see the violation in the Tag field. However, both the violation title in the Expense Preview and the red dot in the LHN only appear after entering and exiting the Expense Preview. Where else do you think it might be inconsistent? Thank you.

brunovjk avatar Nov 12 '25 14:11 brunovjk

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

melvin-bot[bot] avatar Nov 13 '25 16:11 melvin-bot[bot]

OP Fixed by https://github.com/Expensify/App/pull/74389.

https://github.com/user-attachments/assets/2b6154b2-a430-49ca-99e8-9b79a4126b16

Tony-MK avatar Nov 14 '25 19:11 Tony-MK

Asking for a retest here β€” https://expensify.enterprise.slack.com/archives/C9YU7BX5M/p1763407166759599

CortneyOfstad avatar Nov 17 '25 19:11 CortneyOfstad

@CortneyOfstad QA team still can reproduced this issue on Web and mWeb, build v9.2.59-3

https://github.com/user-attachments/assets/a61e3415-ffea-4c72-bab9-ad6c399610dd

https://github.com/user-attachments/assets/e53d1b09-1dd1-4b04-84d3-a393c08a5052

IuliiaHerets avatar Nov 17 '25 20:11 IuliiaHerets

Still reproducible. Awaiting proposals.

brunovjk avatar Nov 17 '25 22:11 brunovjk

@Tony-MK I think this can be handled as part of follow up

situchan avatar Nov 18 '25 02:11 situchan

@CortneyOfstad @brunovjk this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

melvin-bot[bot] avatar Nov 18 '25 22:11 melvin-bot[bot]

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

melvin-bot[bot] avatar Nov 20 '25 16:11 melvin-bot[bot]

Sorry if I misunderstood, but @situchan, will you be handling this issue? Thank you.

brunovjk avatar Nov 24 '25 20:11 brunovjk

yes in https://github.com/Expensify/App/pull/75485

situchan avatar Nov 24 '25 20:11 situchan

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

melvin-bot[bot] avatar Nov 27 '25 16:11 melvin-bot[bot]

Not overdue, we are working on it

brunovjk avatar Nov 27 '25 18:11 brunovjk

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

melvin-bot[bot] avatar Dec 01 '25 00:12 melvin-bot[bot]

Not overdue!

CortneyOfstad avatar Dec 01 '25 19:12 CortneyOfstad

Not overdue!

brunovjk avatar Dec 01 '25 19:12 brunovjk

@CortneyOfstad @brunovjk this issue is now 4 weeks old, please consider:

  • Finding a contributor to fix the bug
  • Closing the issue if BZ has been unable to add the issue to a VIP or Wave project
  • If you have any questions, don't hesitate to start a discussion in #expensify-open-source

Thanks!

melvin-bot[bot] avatar Dec 02 '25 22:12 melvin-bot[bot]

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

melvin-bot[bot] avatar Dec 04 '25 16:12 melvin-bot[bot]

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

melvin-bot[bot] avatar Dec 04 '25 23:12 melvin-bot[bot]

Hey @brunovjk – just checking to see where we're at with this? Thanks!

CortneyOfstad avatar Dec 05 '25 15:12 CortneyOfstad