Skip to content

Show the violation Fix nudge on the same reports in the Inbox and Home - #103407

Merged
MonilBhavsar merged 11 commits into
Expensify:mainfrom
dukenv0307:violation-fix-parity
Oct 19, 2026
Merged

MonilBhavsar merged 11 commits into
Expensify:mainfrom
dukenv0307:violation-fix-parity

Conversation

@dukenv0307

@dukenv0307 dukenv0307 commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

Show the violation Fix nudge on the same reports in the Inbox and Home
Here's the requirement:

  • Instant submit = “Fix” shown on outstanding reports prior to any approval.
  • Everything else = “Fix” for draft reports only.

Fixed Issues

$ #102792
PROPOSAL:

Tests

Precondition: A WS that enables Require receipt (>= $25) and Require itemized receipt (>= $75)
Frequency is manually

Test case 1: Frequency is manually

  1. Submitter drafts 2 expenses without receipt ($50 and $100)
  2. Verify that on the Home page, you can see the to-do task to fix the violations
  3. Submit the report
  4. Verify that the Home page and LHN show nothing

Test case 2: Frequency is instantly

  1. Submitter creates 1 expense without receipt ($50)
  2. Verify that on the Home page you can see the to-do task to fix the violations and on LHN you can see the Fix badge
  3. Update the amount to $10
  4. Verify that the Home page and LHN show nothing
  • Verify that no errors appear in the JS console

Offline tests

Same as above

QA Steps

Same as above

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

Case 1:

Screen.Recording.2026-10-08.at.09.08.09.mov

Case 2:

Screen.Recording.2026-10-08.at.09.23.07.mov

@dukenv0307

Copy link
Copy Markdown
Contributor Author

@MelvinBot review

@MelvinBot

Copy link
Copy Markdown
Contributor

PR Review

The approach is right: one shared gate (isReportEligibleForViolationFix) for the Inbox RBR and Home. I found one logic gap and two test issues.

1. "Prior to any approval" isn't enforced on multi-level approval chains (should fix)
src/libs/ReportUtils.ts:2050-2055 allows any processing report on instant submit. When the first of several approvers approves, the report stays SUBMITTED/SUBMITTED and only managerID changes (ReportWorkflow.ts:537-539). So both the Inbox and Home still show Fix after an approval. A suggested fix is to add && !hasReportBeenForwardedSinceLastSubmit(report) to the instant-submit branch (ReportUtils.ts:2078). Please also add a parity cell for a forwarded report.

2. Two existing companyCardRequired tests now pass for the wrong reason
These tests still default to isInstantSubmit = false on a submitted report:

The new eligibility gate returns null before the companyCardRequired exclusion runs, so the exclusion is no longer tested. Pass isInstantSubmit = true to both tests, as you did for the other two.

3. The new tests don't follow the testing convention (minor)
ViolationFixParityTest.ts and the new ReportUtilsTest cases lack the // Given / // When / // Then comments that tests/README.md requires.

Nit: modifiedAmount is excluded slightly differently

Home drops modifiedAmount on processing reports when it's typed notice or warning (useReviewFlaggedExpenses.ts:78). The Inbox drops it only from the notice check (ReportUtils.ts:10185). A warning-typed modifiedAmount would light the Inbox but not Home. The existing test comment says the back end doesn't send that today, so this is low risk. Matching the notice-only check would keep the two surfaces identical.


view run

@dukenv0307
dukenv0307 marked this pull request as ready for review October 8, 2026 02:59
@dukenv0307
dukenv0307 requested review from a team as code owners October 8, 2026 02:59
@melvin-bot
melvin-bot Bot requested review from brunovjk and trjExpensify and removed request for a team October 8, 2026 02:59
@melvin-bot

melvin-bot Bot commented Oct 8, 2026

Copy link
Copy Markdown

@brunovjk Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot
melvin-bot Bot removed the request for review from a team October 8, 2026 02:59
@brunovjk

brunovjk commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Reviewing ASAP

@trjExpensify trjExpensify left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This label isn't showing Fix?

Image

@dukenv0307

Copy link
Copy Markdown
Contributor Author

@trjExpensify Yes, based on the confirmation here

// When the report is ready to submit, always show the green Submit badge
// regardless of violations — the user can submit without fix.

@trjExpensify

Copy link
Copy Markdown
Contributor

Mhm okay, it does look like it's from the original imp so fine by me. 👍

@dukenv0307

Copy link
Copy Markdown
Contributor Author

@brunovjk kindly bump

@dukenv0307

Copy link
Copy Markdown
Contributor Author

@brunovjk all yours!

@brunovjk

Copy link
Copy Markdown
Contributor

Great, reviewing ASAP.

@dukenv0307

Copy link
Copy Markdown
Contributor Author

@brunovjk kindly bump

@codecov

codecov Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.

Files with missing lines Coverage Δ
src/libs/ReportUtils.ts 88.55% <100.00%> (-0.03%) ⬇️
...ges/home/ForYouSection/useReviewFlaggedExpenses.ts 95.00% <100.00%> (+0.47%) ⬆️
src/selectors/ReportAction.ts 91.17% <88.88%> (-0.35%) ⬇️
... and 10 files with indirect coverage changes

@brunovjk

brunovjk commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified any copy / text that was added to the app is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
103407_android_native_manually.mov
Android: mWeb Chrome
103407_android_native_manually.mov
iOS: HybridApp
103407_ios_native_instantly.mov
103407_ios_native_manually.mov
iOS: mWeb Safari
103407_ios_native_manually.mov
MacOS: Chrome / Safari
103407_web_chrome_instantly.mov
103407_web_chrome_manually.mov

@brunovjk

Copy link
Copy Markdown
Contributor

Sorry for the delay, @dukenv0307. The codes look good to me; I’m still testing them across all platforms. I’ll be back in a moment.

@melvin-bot

melvin-bot Bot commented Oct 16, 2026

Copy link
Copy Markdown

We did not find an internal engineer to review this PR, trying to assign a random engineer to #102792 as well as to this PR... Please reach out for help on Slack if no one gets assigned!

@melvin-bot
melvin-bot Bot requested a review from MonilBhavsar October 16, 2026 20:16
@MonilBhavsar
MonilBhavsar merged commit 92178b4 into Expensify:main Oct 19, 2026
35 of 37 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🚧 MonilBhavsar has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/MonilBhavsar in version: 9.5.14-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@MelvinBot

Copy link
Copy Markdown
Contributor

No help site update is needed. This PR is a bug fix that makes Home and the Inbox show the Fix nudge on the same reports. No article describes which reports get that nudge, and existing text such as "A Fix badge means something needs attention" (Understanding-Report-Statuses-and-Actions.md) is still accurate.


view run

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/grgia in version: 9.5.14-3 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

@cretadn22

cretadn22 commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

@dukenv0307 @trjExpensify I'm reviewing #105705 where the red dot is missing from the LHN for an expense with a missing required category. I traced my local reproduction to this PR and would like to confirm the intended behavior.

My setup is a workspace with manual submission and approvals on. The report is submitted, and the transaction has a missingCategory violation. isReportEligibleForViolationFix returns false for this report because the workspace isn't on instant submit and the report isn't a draft, so getViolatingReportIDForRBRInLHN returns null

The expected result in #105705 goes against the requirement in this PR: "Everything else = Fix for draft reports only." The issue expects a red dot in my setup, while this PR removes it once the report is submitted.

Screen.Recording.2026-11-08.at.00.43.33.mov

Could you help confirm:

  1. Should a submitted report on a non-instant-submit workspace never show the red dot, even for a violation the user may still be able to fix, such as a missing category?
  2. If so, should [$175] LHN - Red dot is missing from the LHN when an expense has a missing category #105705 be closed as expected behavior

Thanks!

@trjExpensify

Copy link
Copy Markdown
Contributor

This code block shared above traces back this PR and this slack discussion. So the expectation in that workspace setup you outlined is that the LHN of Inbox shows a green Submit button prior to submission and there isn't a Fix badge for them after submission. Worth noting we've also added a modal to confirm they want to submit a report with violations.

So I think that other issue can be closed.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants