You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2026-09-15] After an expense with a “Company card purchases required” violation is submitted, the Fix / To-do action continues to be displayed for the expense. #99793
Version Number: Reproducible in staging?: Needs Reproduction (Reproduction blocked) Reproducible in production?: Needs Reproduction If this was caught during regression testing, add the test name, ID and link from BrowserStack: Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by:@AndrewGable Slack conversation (hyperlinked to channel name): #Expensify Bugs
Action Performed:
Create an expense that triggers the “Company card purchases required” violation.
Submit the expense/report containing the violation.
After the submission is completed, open the expense or relevant task/violation section.
Observe the Fix / To-do action.
Expected Result:
Once the expense has been submitted, the Fix / To-do action should no longer be displayed if the “Company card purchases required” violation can no longer be resolved by the user.
(Not sure about the expected result here)
Actual Result:
The Fix / To-do action remains visible after the expense has been submitted, even though the user appears unable to resolve the “Company card purchases required” violation.
Workaround:
Unknown
Platforms:
Select the officially supported platforms where the issue was reproduced:
Reproduced on web (dev NewDot). Enabled Require company cards for all purchases on a Control workspace, created a cash expense, submitted the report. The violation, the red brick road, the orange Fix pill and the Inbox To-dos entry all persist after submission, and nothing the submitter can click resolves them.
What is the root cause of that problem?
companyCardRequired was added as a display-only violation and was never given a visibility rule, so it is shown to everyone in every report state.
All violation surfaces funnel through shouldShowViolation(), which carries per-violation "can this user act on it?" branches for autoReportedRejectedExpense, overAutoApprovalLimit, rter, receiptNotSmartScanned, missingAttendees and missingCategory. companyCardRequired has no branch, so it falls through to return true at line 2135.
The only report-state filter on the brick-road path is isOpenOrProcessingReport, and processing is exactly the submitted state — so submitting does not clear it. Worse, submitting is what creates the Fix pill: reportAttributes.ts:599-613 only sets ACTION_BADGE.FIX once the green Submit action is gone.
The submitter genuinely cannot fix it: the violation is mapped to the 'none' field (useViolations.ts:71) so it has no editable row, it renders as a non-interactive message (MoneyRequestView.tsx:1662-1668), it is not dismissible, and it has no Mark as cash / Mark as resolved / Review path. Only a workspace admin can clear it, by disabling the rule.
What changes do you think we should make in order to solve the problem?
Add a COMPANY_CARD_REQUIRED branch to shouldShowViolation() that returns false for the submitter once the report is no longer open, and keeps returning true for admins and approvers, who can act on it. This mirrors the existing receiptNotSmartScanned branch.
One change fixes every surface, because useTransactionViolations filters through the same function: the RHP message, the LHN brick road and Fix badge, the Inbox To-dos count, and the Search red row.
Add a unit test asserting the violation is hidden from the submitter on a SUBMITTED report and still visible to an admin.
Alternatives considered and reproduction evidence
Alternatives:
Add it to excludedNoticeNamesForLHN — does not work. That list only applies to notice-type violations; this is a hard violation, and it would leave the RHP message and the Search row untouched.
Suppress the Fix badge generically for any violation the current user cannot act on — the right long-term shape, but there is no "is this actionable" concept today, so it is a much larger change with wide blast radius.
Hide the message entirely post-submit for everyone — loses the explanation the approver needs.
How it was introduced:#76728 (merged 2025-12-15) added the constant, the workspace rule and the message. It touched no visibility, brick-road or action-badge code, and the PR's own test plan states the only way the violation clears is an admin disabling the rule.
Note on the message text: the violation is generated server-side; the App only reads it. The fix above is entirely client-side, so no cross-repo change is needed.
Evidence (4)
Draft expense showing Company card purchases required violation pre-submit
Report still showing the violation after submission (status Outstanding)
Inbox To-dos tab still listing the submitted report with a Fix action
Clicking Fix opens the same report chat with no resolution UI
💡 Suggested AI code review rule
This looks like a recurring, mechanically detectable pattern, so it may be worth a coding-standards rule. Proposed for Expensify/App:
Rule:CONSISTENCY-19 Give every new violation an explicit visibility rule
Condition: when a PR adds a name to CONST.VIOLATIONS without adding a matching branch to shouldShowViolation(), flag it and ask the author to state who should see it and in which report states.
Why: unhandled names fall through to return true, so the violation drives the red brick road, the Fix action badge and the Inbox To-dos count for users who cannot resolve it — exactly this issue.
Search pattern: diff adds a line matching ^\+\s+[A-Z_]+: ' inside the VIOLATIONS object in src/CONST/index.ts, and src/libs/TransactionUtils/index.ts has no added violationName === CONST.VIOLATIONS.<NEW_NAME> branch.
If it's worth adding, a maintainer can open it as a draft PR in Expensify/App's coding-standards skill.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/99793) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
Here's the diff for the proposal, plus how I tested it.
The fix
One branch in shouldShowViolation(). Every surface (RHP message, LHN brick road + Fix pill, Inbox To-dos, Search row) funnels through it, so this one change covers them all.
diff --git a/src/libs/TransactionUtils/index.ts b/src/libs/TransactionUtils/index.ts--- a/src/libs/TransactionUtils/index.ts+++ b/src/libs/TransactionUtils/index.ts@@ -2124,6 +2124,12 @@ function shouldShowViolation(
return isPolicyMember && !isSubmitter && !isReportOpen;
}
+ if (violationName === CONST.VIOLATIONS.COMPANY_CARD_REQUIRED) {+ // Once the report leaves the open state the submitter can no longer resolve this violation from the report, so we stop surfacing+ // an unactionable Fix action to them. Everyone else reviewing the report (admins, approvers) still needs to see why it is flagged.+ return !isSubmitter || isReportOpen;+ }+
if (violationName === CONST.VIOLATIONS.MISSING_ATTENDEES) {
return isAttendeeTrackingEnabledForPolicy(policy);
}
I deliberately did not add an admin/approver carve-out for the submitter. A submitter who also happens to be the workspace admin still can't clear it from the report — they clear it in workspace rules — so keeping the unactionable Fix pill for them would just reproduce the bug in the most common test setup (one account owning the workspace).
Unit tests (tests/unit/TransactionUtilsTest.ts, inside the existing describe('shouldShowViolation'))
@@ describe('shouldShowViolation', () => {
expect(TransactionUtils.shouldShowViolation(iouReport, policy, CONST.VIOLATIONS.OVER_AUTO_APPROVAL_LIMIT, CURRENT_USER_EMAIL, CURRENT_USER_ID)).toBe(true);
});
++ it('should return true for company card required violation when the report is still open', () => {+ const iouReport: Report = {+ ...createRandomReport(0, undefined),+ type: CONST.REPORT.TYPE.EXPENSE,+ statusNum: CONST.REPORT.STATUS_NUM.OPEN,+ stateNum: CONST.REPORT.STATE_NUM.OPEN,+ ownerAccountID: CURRENT_USER_ID,+ managerID: SECOND_USER_ID,+ };++ const policy: Policy = {+ ...createRandomPolicy(0, CONST.POLICY.TYPE.CORPORATE),+ role: CONST.POLICY.ROLE.USER,+ };++ expect(TransactionUtils.shouldShowViolation(iouReport, policy, CONST.VIOLATIONS.COMPANY_CARD_REQUIRED, CURRENT_USER_EMAIL, CURRENT_USER_ID)).toBe(true);+ });++ it('should return false for company card required violation when the submitter has already submitted the report', () => {+ const iouReport: Report = {+ ...createRandomReport(0, undefined),+ type: CONST.REPORT.TYPE.EXPENSE,+ statusNum: CONST.REPORT.STATUS_NUM.SUBMITTED,+ stateNum: CONST.REPORT.STATE_NUM.SUBMITTED,+ ownerAccountID: CURRENT_USER_ID,+ managerID: SECOND_USER_ID,+ };++ const policy: Policy = {+ ...createRandomPolicy(0, CONST.POLICY.TYPE.CORPORATE),+ role: CONST.POLICY.ROLE.USER,+ };++ expect(TransactionUtils.shouldShowViolation(iouReport, policy, CONST.VIOLATIONS.COMPANY_CARD_REQUIRED, CURRENT_USER_EMAIL, CURRENT_USER_ID)).toBe(false);+ });++ it('should return true for company card required violation on a submitted report for the approver', () => {+ const iouReport: Report = {+ ...createRandomReport(0, undefined),+ type: CONST.REPORT.TYPE.EXPENSE,+ statusNum: CONST.REPORT.STATUS_NUM.SUBMITTED,+ stateNum: CONST.REPORT.STATE_NUM.SUBMITTED,+ ownerAccountID: SECOND_USER_ID,+ managerID: CURRENT_USER_ID,+ };++ const policy: Policy = {+ ...createRandomPolicy(0, CONST.POLICY.TYPE.CORPORATE),+ role: CONST.POLICY.ROLE.ADMIN,+ };++ expect(TransactionUtils.shouldShowViolation(iouReport, policy, CONST.VIOLATIONS.COMPANY_CARD_REQUIRED, CURRENT_USER_EMAIL, CURRENT_USER_ID)).toBe(true);+ });
});
npm test -- tests/unit/TransactionUtilsTest.ts -t 'shouldShowViolation' → 7 passed. eslint on both files → 0 errors.
How to test it
Everything works with a single account:
Create a workspace and upgrade its Plan type to Control (Workspace > Overview > Plan type).
Enable More features > Rules, then turn on Workspace > Rules > Expenses > Require company cards for all purchases.
Submit a manual cash expense on that workspace.
Before the patch the violation, RBR, Fix pill and To-do stay after step 3. After the patch they clear on submit.
Two gotchas that cost me time — the expense also picks up an unrelated Missing category violation, which keeps the RBR and Fix pill alive on its own, so set a category before judging steps 3–4; and if you'd rather skip the Control upgrade, you can inject the violation from the dev console instead:
Pass — the violation shows before submit and clears from all surfaces after submit.
Step
Status
Observation
Before submitting, expense details show red "Company card purchases required" violation
pass
Draft €25.00 "Test Merchant" cash expense showed the red message before Submit was pressed.
After submitting, message is gone from expense details
pass
Report went to Outstanding and the company-card message was gone.
After submitting, no RBR dot and no orange Fix pill in LHN
pass
LHN row showed a green Approve pill, no red dot, no Fix pill (after setting the category to clear the unrelated violation).
After submitting, Inbox > To-dos does not list the report with a Fix action
pass
To-dos listed the report with an Approve action pill, not Fix.
Evidence (4)
Expense details showing red Company card purchases required violation before submit
Expense details after submit, company-card violation message gone
LHN showing green Approve pill, no RBR dot, no Fix pill
Inbox To-dos listing the report with Approve action, not Fix
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/99793#issuecomment-5457988432) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
I was able to reproduce the bug, and yes, I think Melvin’s proposal is correct(at least the mechanism)
The only thing we need is clear guidance on when exactly this error should be displayed, as I’m not sure that !isSubmitter || isReportOpen is the correct condition. I think an internal developer could help clarify the expected behavior here.
Activity
exfy-zapier commentedon Aug 28, 2026
This has been labelled "Needs Reproduction". Follow the steps here: https://stackoverflowteams.com/c/expensify/questions/16989
MelvinBot commentedon Aug 28, 2026
Proposal
Reproduced on web (dev NewDot). Enabled Require company cards for all purchases on a Control workspace, created a cash expense, submitted the report. The violation, the red brick road, the orange Fix pill and the Inbox To-dos entry all persist after submission, and nothing the submitter can click resolves them.
What is the root cause of that problem?
companyCardRequiredwas added as a display-only violation and was never given a visibility rule, so it is shown to everyone in every report state.All violation surfaces funnel through
shouldShowViolation(), which carries per-violation "can this user act on it?" branches forautoReportedRejectedExpense,overAutoApprovalLimit,rter,receiptNotSmartScanned,missingAttendeesandmissingCategory.companyCardRequiredhas no branch, so it falls through toreturn trueat line 2135.The only report-state filter on the brick-road path is
isOpenOrProcessingReport, andprocessingis exactly the submitted state — so submitting does not clear it. Worse, submitting is what creates the Fix pill:reportAttributes.ts:599-613only setsACTION_BADGE.FIXonce the green Submit action is gone.The submitter genuinely cannot fix it: the violation is mapped to the
'none'field (useViolations.ts:71) so it has no editable row, it renders as a non-interactive message (MoneyRequestView.tsx:1662-1668), it is not dismissible, and it has no Mark as cash / Mark as resolved / Review path. Only a workspace admin can clear it, by disabling the rule.What changes do you think we should make in order to solve the problem?
Add a
COMPANY_CARD_REQUIREDbranch toshouldShowViolation()that returnsfalsefor the submitter once the report is no longer open, and keeps returningtruefor admins and approvers, who can act on it. This mirrors the existingreceiptNotSmartScannedbranch.One change fixes every surface, because
useTransactionViolationsfilters through the same function: the RHP message, the LHN brick road and Fix badge, the Inbox To-dos count, and the Search red row.Add a unit test asserting the violation is hidden from the submitter on a
SUBMITTEDreport and still visible to an admin.Alternatives considered and reproduction evidence
Alternatives:
excludedNoticeNamesForLHN— does not work. That list only applies to notice-type violations; this is a hard violation, and it would leave the RHP message and the Search row untouched.How it was introduced: #76728 (merged 2025-12-15) added the constant, the workspace rule and the message. It touched no visibility, brick-road or action-badge code, and the PR's own test plan states the only way the violation clears is an admin disabling the rule.
Note on the message text: the violation is generated server-side; the App only reads it. The fix above is entirely client-side, so no cross-repo change is needed.
Evidence (4)
Draft expense showing Company card purchases required violation pre-submit
Report still showing the violation after submission (status Outstanding)
Inbox To-dos tab still listing the submitted report with a Fix action
Clicking Fix opens the same report chat with no resolution UI
💡 Suggested AI code review rule
This looks like a recurring, mechanically detectable pattern, so it may be worth a coding-standards rule. Proposed for
Expensify/App:CONSISTENCY-19Give every new violation an explicit visibility ruleCONST.VIOLATIONSwithout adding a matching branch toshouldShowViolation(), flag it and ask the author to state who should see it and in which report states.return true, so the violation drives the red brick road, the Fix action badge and the Inbox To-dos count for users who cannot resolve it — exactly this issue.^\+\s+[A-Z_]+: 'inside theVIOLATIONSobject insrc/CONST/index.ts, andsrc/libs/TransactionUtils/index.tshas no addedviolationName === CONST.VIOLATIONS.<NEW_NAME>branch.shouldShowViolation()fall-throughreceiptNotSmartScannedbranchIf it's worth adding, a maintainer can open it as a draft PR in
Expensify/App'scoding-standardsskill.Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/99793)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
view run
melvin-bot commentedon Aug 28, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @Eskalifer1 (
External)melvin-bot commentedon Aug 28, 2026
Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.
Eskalifer1 commentedon Aug 31, 2026
@MelvinBot add some code diffs so i can test reliably
MelvinBot commentedon Aug 31, 2026
Here's the diff for the proposal, plus how I tested it.
The fix
One branch in
shouldShowViolation(). Every surface (RHP message, LHN brick road + Fix pill, Inbox To-dos, Search row) funnels through it, so this one change covers them all.I deliberately did not add an admin/approver carve-out for the submitter. A submitter who also happens to be the workspace admin still can't clear it from the report — they clear it in workspace rules — so keeping the unactionable Fix pill for them would just reproduce the bug in the most common test setup (one account owning the workspace).
Unit tests (
tests/unit/TransactionUtilsTest.ts, inside the existingdescribe('shouldShowViolation'))@@ describe('shouldShowViolation', () => { expect(TransactionUtils.shouldShowViolation(iouReport, policy, CONST.VIOLATIONS.OVER_AUTO_APPROVAL_LIMIT, CURRENT_USER_EMAIL, CURRENT_USER_ID)).toBe(true); }); + + it('should return true for company card required violation when the report is still open', () => { + const iouReport: Report = { + ...createRandomReport(0, undefined), + type: CONST.REPORT.TYPE.EXPENSE, + statusNum: CONST.REPORT.STATUS_NUM.OPEN, + stateNum: CONST.REPORT.STATE_NUM.OPEN, + ownerAccountID: CURRENT_USER_ID, + managerID: SECOND_USER_ID, + }; + + const policy: Policy = { + ...createRandomPolicy(0, CONST.POLICY.TYPE.CORPORATE), + role: CONST.POLICY.ROLE.USER, + }; + + expect(TransactionUtils.shouldShowViolation(iouReport, policy, CONST.VIOLATIONS.COMPANY_CARD_REQUIRED, CURRENT_USER_EMAIL, CURRENT_USER_ID)).toBe(true); + }); + + it('should return false for company card required violation when the submitter has already submitted the report', () => { + const iouReport: Report = { + ...createRandomReport(0, undefined), + type: CONST.REPORT.TYPE.EXPENSE, + statusNum: CONST.REPORT.STATUS_NUM.SUBMITTED, + stateNum: CONST.REPORT.STATE_NUM.SUBMITTED, + ownerAccountID: CURRENT_USER_ID, + managerID: SECOND_USER_ID, + }; + + const policy: Policy = { + ...createRandomPolicy(0, CONST.POLICY.TYPE.CORPORATE), + role: CONST.POLICY.ROLE.USER, + }; + + expect(TransactionUtils.shouldShowViolation(iouReport, policy, CONST.VIOLATIONS.COMPANY_CARD_REQUIRED, CURRENT_USER_EMAIL, CURRENT_USER_ID)).toBe(false); + }); + + it('should return true for company card required violation on a submitted report for the approver', () => { + const iouReport: Report = { + ...createRandomReport(0, undefined), + type: CONST.REPORT.TYPE.EXPENSE, + statusNum: CONST.REPORT.STATUS_NUM.SUBMITTED, + stateNum: CONST.REPORT.STATE_NUM.SUBMITTED, + ownerAccountID: SECOND_USER_ID, + managerID: CURRENT_USER_ID, + }; + + const policy: Policy = { + ...createRandomPolicy(0, CONST.POLICY.TYPE.CORPORATE), + role: CONST.POLICY.ROLE.ADMIN, + }; + + expect(TransactionUtils.shouldShowViolation(iouReport, policy, CONST.VIOLATIONS.COMPANY_CARD_REQUIRED, CURRENT_USER_EMAIL, CURRENT_USER_ID)).toBe(true); + }); });npm test -- tests/unit/TransactionUtilsTest.ts -t 'shouldShowViolation'→ 7 passed.eslinton both files → 0 errors.How to test it
Everything works with a single account:
Before the patch the violation, RBR, Fix pill and To-do stay after step 3. After the patch they clear on submit.
Two gotchas that cost me time — the expense also picks up an unrelated Missing category violation, which keeps the RBR and Fix pill alive on its own, so set a category before judging steps 3–4; and if you'd rather skip the Control upgrade, you can inject the violation from the dev console instead:
Result on the patched build (web, dev NewDot)
Pass — the violation shows before submit and clears from all surfaces after submit.
Evidence (4)
Expense details showing red Company card purchases required violation before submit
Expense details after submit, company-card violation message gone
LHN showing green Approve pill, no RBR dot, no Fix pill
Inbox To-dos listing the report with Approve action, not Fix
Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/99793#issuecomment-5457988432)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
view run
Eskalifer1 commentedon Aug 31, 2026
I was able to reproduce the bug, and yes, I think Melvin’s proposal is correct(at least the mechanism)
The only thing we need is clear guidance on when exactly this error should be displayed, as I’m not sure that
!isSubmitter || isReportOpenis the correct condition. I think an internal developer could help clarify the expected behavior here.🎀 👀 🎀 C+ reviewed
melvin-bot commentedon Aug 31, 2026
Triggered auto assignment to @chuckdries, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
32 remaining items
melvin-bot commentedon Sep 14, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Sep 14, 2026
Payment Summary
Resolving PRs:
Stop showing the LHN RBR, Fix badge and To-do for companyCardRequired after submit #100190
Assignee: @Eskalifer1 requires payment (Needs manual offer from BZ)
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Sep 16, 2026
Payment Summary
Contributor+: @Eskalifer1 paid $250 via Upwork
Eskalifer1 commentedon Sep 16, 2026
Hi @mallenexpensify, i'm still getting paid via Upwork
mallenexpensify commentedon Sep 17, 2026
@Eskalifer1 can you please accept the job below? Please reply here and tag me once you have.
https://www.upwork.com/jobs/~022100705050096324744
Eskalifer1 commentedon Sep 18, 2026
Hi @mallenexpensify, i have accepted, thank you!
mallenexpensify commentedon Sep 18, 2026
@Eskalifer1 paid, summary updated above. Thx.