Reimplementation of Optimistic report names functionality#69147
Conversation
This PR combines the functionality from three previously reverted PRs: - Expensify#65862: Initial optimistic Custom Report Names implementation - Expensify#68726: Fix for reassure performance tests - Expensify#68737: Extended transaction support for report name computation ### Key Features: - Real-time, formula-based report titles that update as expense data changes - Support for report fields: type, startdate, total, currency, policyname, created - Functions: frontpart, substr, domain for string manipulation - Optimistic updates work offline and provide visible changes without network - Transaction updates trigger report name recalculation - Performance optimized with caching and targeted updates - Beta flag controlled: authAutoReportTitle ### Implementation Details: - Formula.ts: Formula parsing and computation engine - OptimisticReportNames.ts: Main logic for report name updates - OptimisticReportNamesConnectionManager.ts: Onyx data context manager - Enhanced API middleware to process optimistic data - Performance and unit tests included 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
|
🚧 @jasperhuangg has triggered a test Expensify/App build. You can view the workflow run here. |
This comment has been minimized.
This comment has been minimized.
|
Test is failing, but this comes from Test failing: |
|
🚧 @jasperhuangg 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, Desktop, and Web. Happy testing! 🧪🧪
|
…bined-optimistic-report-names
This is necessary to make use of explit betas.
|
🚧 @mountiny has triggered a test Expensify/App build. You can view the workflow run here. |
|
🚧 @mountiny 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, Desktop, and Web. Happy testing! 🧪🧪
|
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! 🧪🧪
|
sosek108
left a comment
There was a problem hiding this comment.
@neil-marcellini I've applied changes according to your comments
neil-marcellini
left a comment
There was a problem hiding this comment.
Good to go from me. Thanks!
| /** | ||
| * Extract transaction ID from an Onyx key | ||
| */ | ||
| // eslint-disable-next-line @typescript-eslint/no-unused-vars -- this will be used in near future |
There was a problem hiding this comment.
NAB: can be done in a follow-up. We can remove this ESLint disable comment because we use this function now.
| } | ||
|
|
||
| /** | ||
| * Get all reports associated with a policy ID |
There was a problem hiding this comment.
NAB: can be done in a follow up. Please update the comment to make it accurate.
|
@sosek108 I updated the description with a link to a document that describes how to set up the beta. @akinwale would you please do a C+ review now? If you find any bugs, please report them here, but they also don't need to be blockers as this is under a beta. You should request changes if you see a problem that would affect users outside the beta or if there's some really bad code I missed. |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari69147-web-1.mp469147-web-2.mp4MacOS: Desktop |
|
✋ 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.2.9-0 🚀
|
|
@neil-marcellini @trjExpensify Can we use Expensifail account for this PR? Would it be automatically added to BETA? |
|
@mvtglobally it should be not automatically turned on on Expensifail accounts as there is check if the beta here is explicitly enabled. It'd be great to check that though |
|
🚀 Deployed to staging by https://github.com/neil-marcellini in version: 9.2.11-0 🚀
|
|
@sosek108 |
|
@mvtglobally these changes are applied to the account, so you'd need different account to test this with / without beta flag |
|
Yes to be extra clear, once it's applied to the account it can be in any browser session or device. |
|
@mvtglobally I recently learned that the beta updates are only sent to app when a user signs in, and not automatically, at least using this beta which is somewhat "special". If you follow the pre-testing steps exactly in the document, setting the beta on OldDot, then signing in on NewDot, it should work as desired. I will also create an issue to immediately send updates for the beta so that we have more control moving forward. |
|
🚀 Deployed to production by https://github.com/francoisl in version: 9.2.12-4 🚀
|
Explanation of Change
This PR combines the functionality from three previously reverted PRs:
Key Features:
Implementation Details:
Fixed Issues
$ #69175
$ #59689
PROPOSAL:
Tests
Follow QA Steps fields below
Offline tests
Force offline modeand do same steps as in QA Steps section.Report titles should be properly formated
QA Steps
Before running tests ensure your account has access to BETA functionality
useCustomReportNamesNewExpensify. To add yourself to the beta, please follow the pre-testing steps as described in this document.The report titles should not flicker in any case. By flicker I mean that you can see the report title change value 2 times on any of described action.
Test Case 1 – All Report Fields Combined
{report:type} - {report:total} from {report:policyname} on {report:startdate}
Custom Expense Report - USD$X.XX from [WorkspaceName] on [StartDate]
Test Case 2 – Date Fields Comparison
Created {report:created} vs Started {report:startdate}
Test Case 3 – Currency and Total Display
{report:currency} {report:total} report
Test Case 4 – Substring Function
ID: {report:type|substr:0:3}-{report:total|substr:1:4}
Test Case 5 – Transaction Addition Impact
Total: {report:total} Start: {report:startdate}
Test Case 6 – Policy Name Change Impact
Report from {report:policyname}
Test case 7 - Transactions
SSetNameValuePair('useCustomReportNamesNewExpensify', 'true');Report from {report:startdate}a. first with date
2025-08-16b. second with date
2025-08-17Report from 2025-08-16Force offlineoption2025-08-14Report from 2025-08-142025-08-17Report from 2025-08-162025-08-05Report from 2025-08-05PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))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
Android: mWeb Chrome
iOS: Native
Nagranie.z.ekranu.2025-08-11.o.15.24.45.mov
iOS: mWeb Safari
MacOS: Chrome / Safari
Nagranie.z.ekranu.2025-08-11.o.15.08.40.mov
MacOS: Desktop
Nagranie.z.ekranu.2025-08-11.o.15.19.39.mov