Skip to content

[CP prod] fix: The Violation column can be selected without the necessary filters - #101104

Merged
neil-marcellini merged 5 commits into
Expensify:mainfrom
nkdengineer:fix/100877
Sep 15, 2026
Merged

neil-marcellini merged 5 commits into
Expensify:mainfrom
nkdengineer:fix/100877

Conversation

@nkdengineer

@nkdengineer nkdengineer commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

fix: The Violation column can be selected without the necessary filters

Fixed Issues

$ #100877
$ #101212
PROPOSAL: #100877 (comment)

Tests

  1. Go Spend > Expense
  2. Verify that the Violations column isn't displayed in the table
  3. Click on display > Edit column
  4. Verify that the Violations option is not displayed in the list
  5. Click on Filter > Has > Select Submitted violation/Approved violation
  6. Verify that the Violations column is displayed in the table
  7. Click on display > Edit column
  8. Verify that the Violations option is displayed in the list and can't be deselected
  • Verify that no errors appear in the JS console

Offline tests

QA Steps

Same as test

  • 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 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 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
Screen.Recording.2026-09-14.at.22.04.41.mov
Android: mWeb Chrome
Screen.Recording.2026-09-14.at.22.02.20.mov
iOS: Native
Screen.Recording.2026-09-14.at.22.08.52.mov
iOS: mWeb Safari
Screen.Recording.2026-09-14.at.22.03.52.mov
MacOS: Chrome / Safari
Screen.Recording.2026-09-14.at.21.59.04.mov

@nkdengineer
nkdengineer marked this pull request as ready for review September 14, 2026 15:44
@nkdengineer
nkdengineer requested review from a team as code owners September 14, 2026 15:44
@melvin-bot
melvin-bot Bot requested review from daledah and joekaufmanexpensify and removed request for a team and joekaufmanexpensify September 14, 2026 15:44
@melvin-bot

melvin-bot Bot commented Sep 14, 2026

Copy link
Copy Markdown

@daledah 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 September 14, 2026 15:44
@codecov

codecov Bot commented Sep 14, 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 Δ
.../components/Search/FilterDropdowns/SortByPopup.tsx 3.03% <ø> (ø)
...archList/ListItem/TransactionGroupListExpanded.tsx 67.18% <ø> (ø)
src/components/Search/hooks/useSearchSnapshot.ts 86.81% <ø> (ø)
src/hooks/useSearchBulkActions.ts 72.13% <100.00%> (ø)
src/hooks/useSearchOverlay.tsx 55.88% <ø> (ø)
src/libs/SearchQueryUtils.ts 88.39% <100.00%> (+0.22%) ⬆️
src/libs/SearchUIUtils.ts 72.20% <100.00%> (+0.02%) ⬆️
...ponents/Search/SearchList/ListItem/GroupHeader.tsx 78.57% <60.00%> (-0.19%) ⬇️
src/pages/Search/SearchColumnsPage.tsx 0.00% <0.00%> (ø)
... and 10 files with indirect coverage changes

Comment thread src/libs/SearchQueryUtils.ts Outdated
@daledah

daledah commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Thanks @nkdengineer for the PR. I'll review it today, please resolve conflict

@nkdengineer

Copy link
Copy Markdown
Contributor Author

please resolve conflict

I've done.

@daledah

daledah commented Sep 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 proper code patterns were followed (see Reviewing the code)
    • 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 verified that this PR follows the guidelines as stated in the Review Guidelines
  • 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 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 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.
  • 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
android.mov
Android: mWeb Chrome
android-mweb.mov
iOS: HybridApp
ios.mov
iOS: mWeb Safari
ios-mwev.mov
MacOS: Chrome / Safari
web-resize.mp4

Comment thread src/components/Search/SearchList/ListItem/GroupHeader.tsx Outdated
Comment thread src/libs/SearchQueryUtils.ts Outdated
@daledah

daledah commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

@nkdengineer, the code changes look good overall, with just a couple of minor comments.

@neil-marcellini neil-marcellini 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.

Thanks for the fix. It's looking good to me. Some NAB comments that could be done in a follow up or before merging. Tom reported this issue Investigate blank Violations column on regular expense search and the fixes here should resolve it too, so I added it to the PR description. We should CP this to production.

Here are screenshots from main and this branch showing that I can reproduce the problem for an expense with an approved violation, and the problem is then solved on this branch.

Main:
Image

This branch:

Image

Comment thread src/libs/SearchUIUtils.ts
isPolicyTaxEnabled?: boolean;
fallbackPolicyID?: string;
sortBy?: SearchSortBy;
shouldShowViolationsColumn?: boolean;

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.

NAB: It looks like we compute this boolean at every call site, so it might be easier to pass in the queryJSON and compute this within the function, but not a big deal either way.

Comment thread src/libs/SearchQueryUtils.ts
@neil-marcellini neil-marcellini changed the title fix: The Violation column can be selected without the necessary filters [CP prod] fix: The Violation column can be selected without the necessary filters Sep 15, 2026
@nkdengineer

Copy link
Copy Markdown
Contributor Author

@neil-marcellini Yeah, the same issue wwith Tom's issue was reported in Slack yesterday then I fixed it here

@neil-marcellini
neil-marcellini merged commit 15012f0 into Expensify:main Sep 15, 2026
38 of 39 checks passed
@neil-marcellini

Copy link
Copy Markdown
Contributor

Can you pls DM me a link to that Slack report? Or otherwise comment there and make sure we don't have duplicate issues?

@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@github-actions

Copy link
Copy Markdown
Contributor

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

OSBotify pushed a commit that referenced this pull request Sep 15, 2026
[CP prod] fix: The Violation column can be selected without the necessary filters

(cherry picked from commit 15012f0)

(cherry-picked to staging by luacmartins)
@OSBotify OSBotify added the CP Staging marks PRs that have been CP'd to staging label Sep 15, 2026
@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Cherry-picked to staging by https://github.com/luacmartins in version: 9.4.78-3 🚀

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

@MelvinBot

Copy link
Copy Markdown
Contributor

Yes — help site changes were required, and I opened a draft PR: Docs updates for E/A#101104 Violations column requires a violation filter.

Why the docs needed updating: this PR makes the Violations column conditional — it's only listed in Display > Edit columns when has:submitted-violation or has:approved-violation is applied, it can't be deselected while one of those filters is active, and it's dropped from a saved column layout once both are removed. The help site described Edit columns as a free choice of columns and never mentioned that dependency, so a member who went looking for Violations had no article explaining why it wasn't there.

What changed (3 articles, docs-only):

File Change
docs/articles/new-expensify/reports-and-expenses/Using-Reports-in-New-Expensify.md Added Violations to the column list and a new ## How to add the Violations column in Spend section covering the filter steps, the locked column, and what happens when the filter is removed
docs/articles/new-expensify/reports-and-expenses/Use-Search-Operators-to-Filter-and-Analyze.md Added approved-violation to the documented has: values — it was missing, and this PR makes it a first-class trigger alongside submitted-violation
docs/articles/new-expensify/insights/View-the-Violations-by-submitter-report.md Added an FAQ entry for why the Violations column doesn't appear in a member's own search — this article is where members first see the column
UI label verification and authoring compliance

I drove dev NewDot web to confirm labels and current behavior:

  • Left nav tab is exactly Spend; the toolbar button is Display and the option is Edit columns.
  • With no violation filter applied, Violations is absent from the Edit columns list — the behavior this PR introduces, confirmed live.
  • The Has filter options Submitted violation and Approved violation did not render on the test account. That's expected, not a bug: src/libs/SearchUIUtils.ts:5438 only surfaces them when an accessible group policy has rules enabled, and the test account has no such workspace. I verified the label strings against src/languages/en.ts:9773-9774 instead, and documented the Rules prerequisite in the article since it's the most likely reason a member can't find the filter at all.
  • I also corrected View Results to View results in that article to match src/languages/en.ts:9601.

The writing follows docs/HELPSITE_NAMING_CONVENTIONS.md, docs/HELP_AUTHORING_GUIDELINES.md, and docs/TEMPLATE.md: no ### or deeper headings, task-based ## headings, exact UI labels in bold, and relative cross-links placed outside numbered steps.

Per the test-selection-matrix skill, no local AI test bundle applies to a markdown-only change under docs/articles. cspell was blocked in this sandbox; CI will run it.

@nkdengineer, please review the linked help site PR and confirm it reflects the current behavior. Then mark the linked help site PR Ready for review

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/luacmartins in version: 9.4.78-3 🚀

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

Bundle Size Analysis (Sentry):

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Cherry-picked to staging by https://github.com/luacmartins in version: 9.4.80-0 🚀

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

@MelvinBot

Copy link
Copy Markdown
Contributor

Yes — help site changes were required. Draft PR: Docs updates for E/A#101104 Violations column requires violation filter (Expensify/App#101272), labeled HelpDot and assigned to nkdengineer.

Why the docs needed updating: this PR makes the Violations column conditional. It no longer appears just because the returned expenses carry violation data — it now requires the Submitted violation or Approved violation option under the Has filter, and while one of those is applied the column is always shown and can't be deselected. Three articles described the old behavior.

Article Change
Using-Reports-in-New-Expensify.md Adds the Violations exception to How to customize the Spend column view, plus a FAQ entry for members who go looking for the column in Edit columns and can't find it
Use-Search-Operators-to-Filter-and-Analyze.md Adds the missing approved-violation value to the documented has: operator, and notes that the column is left out of results without one of the two violation filters
View-the-Violations-by-submitter-report.md Adds a FAQ entry: the suggested search applies Submitted violation for you, so clearing it while exploring removes the Violations column from the table and from a Current view CSV
How the copy was verified

UI labels were read from the live web UI (accessibility snapshot, not inferred from screenshots) and cross-checked against src/languages/en.ts: nav tab Spend, sub-tab Expenses, toolbar buttons Display and Filters (plural), menu option Edit columns, filter row Has, and options Submitted violation / Approved violation.

Two things worth knowing about that check:

  • On the signed-in test account, Display > Edit columns listed no Violations option and the Has filter offered only Receipt, Attachment, and Category. That is consistent with this PR, and the missing Has options are separately expected: SearchUIUtils.ts:5438-5461 gates both violation options behind a group workspace with Rules enabled, which the test account doesn't have. The docs say so.
  • No help site article claimed the column appeared automatically, so nothing had to be corrected — the gap was that the rule was undocumented, which is what the draft PR fixes.

One check I could not complete locally: cspell on the changed Markdown. The sandbox blocked the binary, so CI is the gate. The added copy introduces no new proper nouns or coined terms.

@nkdengineer, please review the linked help site PR and confirm it reflects the current behavior. Then mark the linked help site PR Ready for review

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/luacmartins in version: 9.4.80-0 🚀

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

Bundle Size Analysis (Sentry):

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

Labels

CP Production CP Staging marks PRs that have been CP'd to staging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants