[$250] Tags - Missing tag violation for first expense is shown only after creating second expense
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:
- Go to https://staging.new.expensify.com/home
- Go to workspace settings -more features
- Enable Tags
- Create a manual expense entering merchant and category
- Go to tags page
- Add few tags
- Tap settings
- Enable members must tag all expenses
- Go to workspace chat
- Note in preview missing tag violation is not shown
- Open the expense and now tag required is not shown
- Go back to workspace chat
- Create a manual expense entering merchant
- Now note in preview missing tag violation is shown for both expenses
- 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
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 Owner
Current Issue Owner: @brunovjk
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.
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
i can't reproduce
I'm also having trouble recreating. Going to see if QA can retest
Request here β https://expensify.enterprise.slack.com/archives/C9YU7BX5M/p1762285757906329
Reproduce, MacOS Monterey / Chrome, Web v9.2.43-2
https://github.com/user-attachments/assets/42bec29a-00af-4b87-926a-2a63b2fd96d9
Job added to Upwork: https://www.upwork.com/jobs/~021986535910600778021
Triggered auto assignment to Contributor-plus team member for initial proposal review - @brunovjk (External)
Hey @brunovjk! We have a proposal here for you to review β thanks!
Great, reviewing ASAP
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.
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
OP Fixed by https://github.com/Expensify/App/pull/74389.
https://github.com/user-attachments/assets/2b6154b2-a430-49ca-99e8-9b79a4126b16
Asking for a retest here β https://expensify.enterprise.slack.com/archives/C9YU7BX5M/p1763407166759599
@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
Still reproducible. Awaiting proposals.
@Tony-MK I think this can be handled as part of follow up
@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!
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
Sorry if I misunderstood, but @situchan, will you be handling this issue? Thank you.
yes in https://github.com/Expensify/App/pull/75485
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
Not overdue, we are working on it
@brunovjk Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
Not overdue!
Not overdue!
@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!
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
@brunovjk Whoops! This issue is 2 days overdue. Let's get this updated quick!
Hey @brunovjk β just checking to see where we're at with this? Thanks!