Repository navigation
Description
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: v9.4.9-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: #93271
Email or phone of affected tester (no customers): N/A
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: Windows 11 / Chrome, iPhone 13 / iOS 26.5, Samsung Galaxy A52 / Android 14
App Component: Search
Action Performed:
Preconditions:
- Logged in to any account that has at least one workspace (it's recommended to use a new account to prevent Concierge categorizing expense from past activities)
Steps:
- In workspace settings, navigate to Category settings and toggle off "member must categorize all expenses"
- Create an expense to the workspace without category
- Navigate to Spend and observe the just created expense row (take a note that has no violation here)
- Navigate back to workspace setting, navigate to Category settings and toggle on "member must categorize all expenses"
- Navigate back to Spend and observe the just created expense row for several moment
- Click the expense row and close the RHP
Expected Result:
Without opening the expense row, the expense row's indicator should updates live after changing a workspace rule
Actual Result:
Without opening the expense row, the expense row's indicator doesn't updates live after changing a workspace rule. User needs to open the expense row to make the violation updated
Workaround:
Unknown
Platforms:
- Android: App
- Android: mWeb Chrome
- iOS: App
- iOS: mWeb Safari
- iOS: mWeb Chrome
- Windows: Chrome
- MacOS: Chrome Safari
Screenshots/Videos
Bug7182966_1781657567131.categories_violation.mp4
Applause Internal Information
Exported by: Rizky Gunawan
Bug ID: 7182966
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022067133051768071784
- Upwork Job ID: 2067133051768071784
- Last Price Increase: 2026-06-24
Issue Owner
Current Issue Owner: @mallenexpensifyMetadata
Metadata
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
applause-bot commentedon Jun 17, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/1f8e55d2b9d8d3f0cd4a76287ac087079d9ae8f9425c4e6f603098898055e933
MelvinBot commentedon Jun 17, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
In the Search ("Spend") view, toggling a workspace category rule ("members must categorize all expenses") does not update an existing expense row's violation (RBR) indicator live. The user has to open the expense (which fires
OpenReport) before the missing-category violation appears on the row.What is the root cause of that problem?
The Search transaction row reads its violation indicator from the live
TRANSACTION_VIOLATIONSOnyx collection (it deliberately bypasses the search snapshot), atTransactionListItem/index.tsx:105.The row does not re-derive most violations itself — it only re-syncs the attendees rule on the client via
syncMissingAttendeesViolationatTransactionListItem/index.tsx:146-157(note the in-code comment: "can be removed later when BE handles this"). There is no equivalent client-side re-derivation for themissingCategoryrule.So when
requiresCategoryis toggled on, the row already has the live policy value (requiresCategory: true) and the live transaction (no category), but it has no mechanism to compute themissingCategoryviolation from them. It depends on a freshTRANSACTION_VIOLATIONSentry being pushed. The optimistic recompute that exists (setWorkspaceRequiresCategory→pushTransactionViolationsOnyxData) does not reliably refresh the row, so the indicator stays stale until the user opens the expense andOpenReportreturns refreshed violations.Supporting evidence
TransactionListItem/index.tsx:105(originalUseOnyx(TRANSACTION_VIOLATIONS...), with the comment at lines 7-9 explaining it reads real-time Onyx, not the snapshot).policyForViolations = parentPolicy ?? snapshotPolicyatindex.tsx:136, whereparentPolicyis read live.syncMissingAttendeesViolationatAttendeeUtils.ts:114.missingCategoryis added byViolationsUtils.getViolationsOnyxDatawhenrequiresCategory && !category, but that path runs in the policy-action optimistic push, not on the row.OpenReport, whose response merges refreshedtransactionViolations— which is why the workaround (open the row) works.What changes do you think we should make in order to solve the problem?
Mirror the existing attendees pattern for the category rule:
syncMissingCategoryViolationhelper (alongsidesyncMissingAttendeesViolation) that, given the current violations list, re-derives whether amissingCategoryviolation should be present using the live policyrequiresCategoryflag, the live transactioncategory, andpolicyCategories— adding it when the rule is on and no (valid/required) category is set, and removing it otherwise.TransactionListItem/index.tsximmediately after the attendees sync, feeding itpolicyForViolations.requiresCategory,transaction?.category, andpolicyCategories(all already read live in that component).Because the row already subscribes live to the policy and transaction, the indicator will update immediately when the rule toggles, with no dependency on a backend/optimistic push reaching that specific transaction. Reuse the existing
missingCategorylogic inViolationsUtilsrather than duplicating the rule.What alternative solutions did you explore?
setWorkspaceRequiresCategory— this could help, but it's bounded by which reports/transactionsusePolicyDatahas loaded and is harder to make robust than a per-row re-derivation that uses data the row already has live. The attendees precedent shows the row-level sync is the established approach here.Note: I could not reproduce this end-to-end in a running app, so the recommended fix is based on code analysis (confidence: medium-high). I recommend verifying with the repro steps before sizing.
Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/93770)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
lorretheboy commentedon Jun 17, 2026
Proposal
What is the root cause of that problem?
The Spend/Search expense row only re-derives one violation type live —
missingAttendees. When the workspace "members must categorize all expenses" rule (requiresCategory) flips, the row's category indicator is never recomputed.In
ExpenseReportListItem, the only render-time violation sync that runs is for attendees, even though it fetches the live policy and categories and the comment claims it makes violations "show immediately when category settings change":App/src/components/Search/SearchList/ListItem/ExpenseReportListItem.tsx
Lines 149 to 176 in 257cd2d
The dot indicator is then driven by:
App/src/components/Search/SearchList/ListItem/ExpenseReportListItem.tsx
Line 315 in 257cd2d
So
hasAnyVisibleViolations= precomputedreportItem.hasVisibleViolations(from the search snapshot, which still has nomissingCategorybecause the expense had none when listed) OR the attendees-only live sync. Nothing recomputesmissingCategoryfrom the liverequiresCategoryvalue. The live policy and categories the row already loads go unused for this case:App/src/components/Search/SearchList/ListItem/ExpenseReportListItem.tsx
Lines 90 to 93 in 257cd2d
Opening the expense calls OpenReport, which returns the backend-recomputed violations and writes them to the live
TRANSACTION_VIOLATIONScollection — that's why the workaround of opening the row makes the dot appear.What changes do you think we should make in order to solve the problem?
Mirror the attendees handling for category violations in the same row. Using the already-fetched
parentPolicy(requiresCategory) andpolicyCategories, compute a render-timehasSyncedMissingCategoryViolationper transaction and OR it intohasAnyVisibleViolations. The exact add/remove logic already exists and should be reused so both paths stay consistent:App/src/libs/Violations/ViolationsUtils.ts
Lines 445 to 448 in 257cd2d
Concretely: factor the
missingCategory/categoryOutOfPolicydecision inViolationsUtilsinto a small helper (likesyncMissingAttendeesViolation) and call it in the row'suseMemonext to the attendees sync, keyed offpolicyForViolations.requiresCategory,policyCategories, and each transaction'scategory. This makes the dot react the moment the rule is toggled, without opening the expense.What alternative solutions did you explore? (Optional)
Make the optimistic recompute reach Search-listed transactions.
pushTransactionViolationsOnyxDataonly iterates transactions present inpolicyData.transactionsAndViolationsand bails when that set is empty, so transactions surfaced only via the search snapshot get no optimisticmissingCategorywrite:App/src/libs/ReportUtils.ts
Lines 2032 to 2046 in 257cd2d
Extending it to also cover the affected search transactions would fix it at the write layer, but the render-time sync is the lighter, more localized change and matches the pattern the row already uses for attendees.
mukhrr commentedon Jun 17, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-06-17 06:32:51 UTC.
Proposal
What is the root cause of that problem?
This is a Search snapshot vs live transaction-violation sync gap.
When the category rule is toggled, we do call
pushTransactionViolationsOnyxData():App/src/libs/actions/Policy/Category.ts
Lines 1239 to 1288 in 7af4b0e
But that optimistic recompute only reaches transactions present in
policyData.transactionsAndViolations:App/src/libs/ReportUtils.ts
Lines 2032 to 2046 in 7af4b0e
policyData.transactionsAndViolationscomes fromuseAllReportsTransactionsAndViolations(), not from the current Search snapshot:App/src/hooks/usePolicyData/index.ts
Lines 17 to 47 in 7af4b0e
So if the expense is visible in Spend from Search data, but its report transactions are not hydrated in
useAllReportsTransactionsAndViolations, the rule toggle does not write a newmissingCategoryviolation.History supports this RCA. PR #93271 moved Search away from screen-level live violation merging:
#93271
Then this commit added a scoped live-violation selector for unhydrated report rows:
cfbe176
That fix helps when
TRANSACTION_VIOLATIONSalready contains the updated violation. It does not help here because the optimistic write is skipped beforemissingCategoryis ever added.A similar render-time sync already exists for
missingAttendees:App/src/components/Search/SearchList/ListItem/TransactionListItem/index.tsx
Lines 136 to 156 in 7af4b0e
The report row has an attendee-only fallback, but not a category fallback:
App/src/components/Search/SearchList/ListItem/ExpenseReportListItem.tsx
Lines 149 to 176 in 7af4b0e
App/src/components/Search/SearchList/ListItem/ExpenseReportListItem.tsx
Lines 310 to 315 in 7af4b0e
What changes do you think we should make in order to solve the problem?
Add a small Search row-level derivation for
missingCategory, using the existing category violation rules, but only for display. Do not write to Onyx from render.Preview:
For report rows, include the same derived category state in the indicator calculation:
To avoid regressions:
missingCategory.missingCategorywhenrequiresCategorybecomes false.requiresCategoryon and off while the row is rendered from Search snapshot data.What alternative solutions did you explore? (Optional)
Make the optimistic recompute reach Search-listed transactions.
pushTransactionViolationsOnyxDataonly sees transactions present inpolicyData.transactionsAndViolationsand bails when that set is empty, so transactions shown only via the Search snapshot get no optimisticmissingCategorywrite:App/src/libs/ReportUtils.ts
Lines 2032 to 2046 in 7af4b0e
Extending it to also cover Search snapshot transactions would fix this at the write layer, but the render-time derivation is safer because it follows the existing Search live-data pattern and avoids coupling policy actions to Search cache state.
ahmdshrif commentedon Jun 17, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
On the Spends view, a row's violation indicator (RBR) is computed once from the search snapshot. When you change a workspace rule so that a transaction gains or loses a violation, the row's indicator does not update dynamically — you have to reload/re-run the search to see it.
What is the root cause of that problem?
PR #93271 ("Search live-merge: remove policies/violations from getSections") removed the screen-level live merge of
policiesandallTransactionViolationsfrom the Search component and fromgetSections, so sections are now derived purely from the static snapshot:App/src/components/Search/index.tsx
Lines 341 to 344 in 257cd2d
The intent was to recompute the badge per-row from live Onyx instead. But that live-merge was only added to
ExpenseReportListItem, not toTransactionGroupListItem(the grouped Spends rows). There, both the violations and the policy used to build the indicator come exclusively fromtransactionsSnapshot.data, with no liveuseOnyxsubscription:App/src/components/Search/SearchList/ListItem/TransactionGroupListItem.tsx
Lines 497 to 526 in 257cd2d
Because
groupViolationsandpolicyare read from the frozen snapshot, a live rule/violation change never triggers a recompute offilteredViolations, so the indicator passed at line 588 is stale.What changes do you think we should make in order to solve the problem?
Give
TransactionGroupListItemthe same live mergeExpenseReportListItemreceived: subscribe to live transaction violations scoped to the snapshot transaction IDs (and live policy), and prefer them over the snapshot values when buildingfilteredViolations.This mirrors the existing pattern in
ExpenseReportListItem(transactionViolationsByIDsSelector). Regression check: ensure the badge still renders correctly before live violations hydrate (fall back to snapshot), so rows that were never opened this session still show the snapshot indicator initially.melvin-bot commentedon Jun 17, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @jayeshmangwani (
External)David-2002065 commentedon Jun 17, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
In Search (Spend), an expense row's violation indicator doesn't update live after toggling the workspace "Members must categorize all expenses" rule — the user has to open the expense to make the missing-category violation appear.
What is the root cause of that problem?
PR #93271 removed the screen-level violation merge from
getSectionsand made each Search row reflect violations from live Onyx data instead. In the transaction row, the displayed violations are built purely from what's already in the liveTRANSACTION_VIOLATIONScollection for that transaction:App/src/components/Search/SearchList/ListItem/TransactionListItem/index.tsx
Line 102 in 257cd2d
App/src/components/Search/SearchList/ListItem/TransactionListItem/index.tsx
Lines 136 to 156 in 257cd2d
The row recomputes the
missingAttendeesviolation at render time from current policy/category settings viasyncMissingAttendeesViolation, but there is no equivalent render-time recompute formissingCategory/categoryOutOfPolicy. So the row can only show a category violation if one is already present inTRANSACTION_VIOLATIONS.The only thing that writes that optimistic
missingCategoryviolation when the rule is toggled issetWorkspaceRequiresCategory→pushTransactionViolationsOnyxData:App/src/libs/actions/Policy/Category.ts
Line 1288 in 257cd2d
and that recompute is scoped to the policy's transactions collected by
usePolicyData, which only includes reports whosepolicyIDmatches the policy:App/src/hooks/usePolicyData/index.ts
Lines 22 to 37 in 257cd2d
A just-created, not-yet-submitted expense isn't on a policy-linked expense report, so it's skipped and no optimistic
missingCategoryis written. Combined with the row having no render-time category recompute, the indicator stays stale until the user opens the expense — which triggers a backend recompute (OpenReport) that finally writes the violation. The same dependency on the pushed violation exists for the report-group badge, which is why opening the row is the only thing that fixes it.What changes do you think we should make in order to solve the problem?
Mirror the existing
missingAttendeesrender-time pattern for category violations, so the Search row derivesmissingCategory/categoryOutOfPolicyfrom the live policy + categories at render time (the samerequiresCategory/category logic already inViolationsUtils.getViolationsOnyxData):App/src/libs/Violations/ViolationsUtils.ts
Lines 419 to 447 in 257cd2d
Concretely, after building
onyxViolations, run a category-sync step (analogous tosyncMissingAttendeesViolation) using the livepolicyForViolations.requiresCategory,policyCategories, and the transaction's category beforemergeProhibitedViolations:We should apply the same render-time category sync in
ExpenseReportListItem(which already does the attendees sync at):App/src/components/Search/SearchList/ListItem/ExpenseReportListItem.tsx
Lines 153 to 178 in 257cd2d
so the report-group badge updates too.
Alternatively, fix it at the source: broaden the optimistic recompute so
setWorkspaceRequiresCategory/pushTransactionViolationsOnyxDatacovers all of the policy's transactions (including unreported/just-created ones), so themissingCategoryviolation is written toTRANSACTION_VIOLATIONSfor every affected expense and the existing per-row live subscriptions pick it up. The render-time sync is preferred because it's self-correcting and matches how attendees already work; we can pick the exact approach in the PR phase.What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
Toggling "Members must categorize all expenses" on/off should update an uncategorized expense row's violation indicator in Search live (without opening the row), and the indicator should clear when a valid category is added or the rule is turned off. Cover both the transaction row and the report-group badge.
What alternative solutions did you explore? (Optional)
Re-introduce a screen-level live violation merge in
getSections(what #93271 removed) — rejected because it re-fires every visible row on any change and reverses the performance win that PR intended; the per-row render-time sync keeps that benefit while closing the category gap.[-]Spends - Changing the workspace rule doesn't update the row's indicator dynamically[/-][+][$250] Spends - Changing the workspace rule doesn't update the row's indicator dynamically[/+]neerajbachani commentedon Jun 17, 2026
proposal
84 remaining items
melvin-bot commentedon Jul 16, 2026
Payment Summary
Upwork Job
BugZero Checklist (@mallenexpensify)
jayeshmangwani commentedon Jul 17, 2026
BugZero Checklist:
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to the comment on the PR: This is a niche edge case that we hadn't considered, and it may have existed for quite some time. I don't think it's coming from a single PR.
Link to the comment on the Issue: This is a niche edge case that we hadn't considered, and it may have existed for quite some time. I don't think it's coming from a single PR.
[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.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue: https://github.com/Expensify/Expensify/issues/662091
Regression Test Proposal
Test:
Do we agree 👍 or 👎
Zapier Logs
Run ID: 00040eee-eb84-ab3e-4ba6-500fe3669c74jayeshmangwani commentedon Jul 17, 2026
@mallenexpensify , here's what happened while fixing this issue. The breakdown below should help with the payment summary:
mallenexpensify commentedon Jul 21, 2026
Payment Summary
Contributor: @nkdengineer paid $250 via Newdot
Contributor+: @jayeshmangwani due $125 via NewDot
How/why is @mukhrr assigned here too, I see comments from ya. Are you due payment? If so, provide details and reasoning. Thx
mukhrr commentedon Jul 21, 2026
@mallenexpensify I thought @jayeshmangwani well explained here
So this issue is fixed by the PR I took care of. thanks!
mallenexpensify commentedon Jul 21, 2026
@mukhrr I see 4 issues linked in the OP of the PR.
I'm assuming the PR only needs to be paid once, is one issue better to pay on than another?
mukhrr commentedon Jul 21, 2026
Hmmm @mallenexpensify we decided to implement these all in a PR as they seemed relative.
So you would like to close this as-is and suggest to have one PR for one issue in the future?
mallenexpensify commentedon Jul 22, 2026
@mukhrr going to address in this issue
quinthar commentedon Jul 31, 2026
Approved $125 to @jayeshmangwani
twisterdotcom commentedon Aug 18, 2026
$250 approved for @nkdengineer in Report ID: R00HUzY8dIps.
Zapier Logs
Run ID: 00040eee-e4b1-a761-ae75-c9529d518484SO: https://stackoverflowteams.com/c/expensify/questions/7582