Refactor getViolationTranslation to use options object#86463
Refactor getViolationTranslation to use options object#86463neil-marcellini merged 6 commits intomainfrom
Conversation
…positional params Replace 8 positional parameters with a ViolationTranslationOptions object, eliminating undefined fillers at call sites and improving readability. Co-authored-by: Neil Marcellini <neil-marcellini@users.noreply.github.com>
…lationTranslationOptionsObject Made-with: Cursor
The test file was still calling getViolationTranslation with the old positional parameters instead of the new ViolationTranslationOptions object, causing TypeScript errors. Co-authored-by: Neil Marcellini <neil-marcellini@users.noreply.github.com>
|
Fixed the failing typecheck: updated |
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
Replace the (violation, translate, options?) signature with a single ViolationTranslationParams object containing all parameters, consistent with other functions in the codebase that use params objects. Co-authored-by: Neil Marcellini <neil-marcellini@users.noreply.github.com> Made-with: Cursor
|
@MelvinBot please test this PR following the test steps in the description. Trigger a missing category violation by creating an expense without a category in a workspace that requires categories, then verify the violation message displays correctly on the expense view and the RBR shows on the report. |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppandroid-app-2026-04-07_11.29.58.mp4Android: mWeb Chromeandroid-chrome-2026-04-07_11.31.50.mp4iOS: HybridAppios-app-2026-04-07_11.23.32.mp4iOS: mWeb Safariios-safari-2026-04-07_11.24.50.mp4MacOS: Chrome / Safaridesktop-chrome-2026-04-07_11.20.18.mp4 |
|
@MelvinBot Please fill out the QA steps. I don't think this should be |
|
Updated the QA steps in the PR description. The steps cover triggering a "missing category" violation and verifying the violation message displays correctly on the expense detail view, RBR indicator, and report header. |
Keep the options object style for brokenCardConnection530 test that main added with positional params, matching this PR's refactor. Made-with: Cursor
|
@dukenv0307 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] |
…r') in test Co-authored-by: Neil Marcellini <neil-marcellini@users.noreply.github.com>
|
Fixed the failing typecheck: the test was calling |
|
🚧 @neil-marcellini has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/neil-marcellini in version: 9.3.54-0 🚀
Bundle Size Analysis (Sentry): |
|
No help site changes are required. This PR is a pure internal code refactor (changing |
|
🚀 Deployed to production by https://github.com/roryabraham in version: 9.3.54-7 🚀
|


Explanation of Change
Refactors
getViolationTranslation()to accept a singleViolationTranslationParamsobject instead of separate positional parameters (violation,translate,options?). All parameters — includingviolationandtranslate— are now part of one named-property object, consistent with the params-object pattern used elsewhere in the codebase. This makes call sites more readable and makes it easier to add new parameters in the future.Fixed Issues
$ #86335
Tests
This is a pure refactor with no behavioral changes. All call sites pass the same values via named properties.
Setup — trigger a "missing category" violation:
Verify violations display correctly:
5. Open the submitted expense — you should see a red "Missing category" violation message on the expense detail view
6. Go back to the chat — the report should show a red brick road (RBR) indicator
7. Tap the RBR to open the report and confirm the violation message is visible in the report header area
8. Verify that no errors appear in the JS console
Offline tests
N/A — this is a code-only refactor that doesn't change runtime behavior or network interactions.
QA Steps
Setup — trigger a "missing category" violation:
Verify violations display correctly:
5. Open the submitted expense — you should see a red "Missing category" violation message on the expense detail view
6. Go back to the chat — the report should show a red brick road (RBR) indicator
7. Tap the RBR to open the report and confirm the violation message is visible in the report header area
8. Verify that no errors appear in the JS console related to violations
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
N/A — pure refactor, no UI changes
Android: mWeb Chrome
N/A — pure refactor, no UI changes
iOS: Native
N/A — pure refactor, no UI changes
iOS: mWeb Safari
N/A — pure refactor, no UI changes
MacOS: Chrome / Safari
N/A — pure refactor, no UI changes