[NO QA] feat: Add ExportDownload Onyx foundation and shared export action functions - #90706
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1e04e6f412
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7fa1148b78
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (!exportDownloads[key]) { | ||
| continue; | ||
| } | ||
| const exportID = key.replace(ONYXKEYS.COLLECTION.EXPORT_DOWNLOAD, ''); | ||
| clearExportDownload(exportID); |
There was a problem hiding this comment.
Skip clearing in-progress exports during startup cleanup
clearStaleExportDownloads() clears every non-null export entry on app init without checking state, so entries still in preparing are also removed. If a user restarts while an export is processing, startup cleanup will clear that in-progress export and trigger ClearExportDownload, which can prevent the eventual ready export from being delivered to this client.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
@mollfpr Could you take a look at this comment, do we need to check state before calling clearExportDownload?
There was a problem hiding this comment.
Yup, we need to check the state here. Clear only for ready or failed — preparing should be skipped, otherwise an in-progress export gets a server ClearExportDownload fired against it on app restart and may never get delivered.
|
No new product considerations - removing my assignment and unsubscribing. |
|
@daledah can you jump on the re-review today? |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0f44234fde
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| ); | ||
|
|
||
| Download.clearDownloads(); | ||
| clearStaleExportDownloads(); |
There was a problem hiding this comment.
Avoid deleting ready exports on app mount
Calling clearStaleExportDownloads() unconditionally during authenticated startup clears every persisted export whose state is ready or failed and queues ClearExportDownload for it. If a user refreshes or reopens the app after an export has become ready but before they download it or ask Concierge to send it, this mount path deletes the local Onyx entry and then deletes the server-side NVP, so the ready export can no longer be presented to the user. This cleanup needs an actual staleness/dismissal condition rather than running for all ready exports on startup.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Based on this comment, I think we should only skip the preparing state for now. Once the full flow is implemented, we can revisit and re-evaluate this behavior based on the concern you raised.
| expect(value).toEqual(expect.objectContaining({state: 'ready', reportCount: 5})); | ||
| }); | ||
|
|
||
| test('clearStaleExportDownloads calls clearExportDownload for each non-null entry', async () => { |
There was a problem hiding this comment.
@truph01 The clearStaleExportDownloads test only verifies that ready/failed entries are cleared, but there's no test asserting that a preparing entry is preserved. Could you please update the test?
There was a problem hiding this comment.
I updated unit tests
|
@daledah I resolved your comments |
|
🚧 @mollfpr 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/mollfpr in version: 9.3.79-1 🚀
Bundle Size Analysis (Sentry): |
|
No help site changes are required for this PR. This PR adds internal plumbing only (new |
|
🚀 Deployed to production by https://github.com/roryabraham in version: 9.3.79-4 🚀
|
Explanation of Change
Adds the shared foundation for the Bulk Report PDF Export and Improve Report Export Realtime Delivery projects. No user-visible changes — nothing renders yet.
Type & constants
ExportDownloadOnyx type (discriminated bystate:preparing | ready | failed) with optionalreportCount,failedReportCount(PDF-only), andshouldSendFromConcierge.CONST.EXPORT_DOWNLOAD.STATEconstants andONYXKEYS.COLLECTION.EXPORT_DOWNLOADcollection key (nvp_exportDownload_).API commands
SendExportFileFromConciergeandClearExportDownloadwrite commands, each taking{exportID}.Actions (
src/libs/actions/Export.ts)sendExportFileFromConcierge(exportID)— optimistically merges{shouldSendFromConcierge: true}; failure data clears the key.clearExportDownload(exportID)— optimistically sets the Onyx key tonull.clearStaleExportDownloads(exportDownloads)— pure function that iterates the collection and clears each non-null entry. Called fromAuthScreensInitHandleron mount (alongsideDownload.clearDownloads()), with the collection provided viauseOnyx.Tests
tests/unit/ExportActionsTest.tscovers optimistic merge, failure data, clear, and stale cleanup.Fixed Issues
$ #90295
PROPOSAL:
Tests
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include ""[No QA].""
PR 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))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
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari