Skip to content

[No QA] Pin react-native-onyx to PR #792 head for retry-idempotency end-to-end testing#91626

Draft
elirangoshen wants to merge 1 commit into
Expensify:mainfrom
callstack-internal:elirangoshen/fix/retry-side-effects-idempotency
Draft

[No QA] Pin react-native-onyx to PR #792 head for retry-idempotency end-to-end testing#91626
elirangoshen wants to merge 1 commit into
Expensify:mainfrom
callstack-internal:elirangoshen/fix/retry-side-effects-idempotency

Conversation

@elirangoshen
Copy link
Copy Markdown
Contributor

@elirangoshen elirangoshen commented May 25, 2026

Explanation of Change

Companion to Expensify/react-native-onyx#792Make retried Onyx writes idempotent on storage retry.

This PR is testing-only: it bumps the react-native-onyx pin in package.json / package-lock.json from 3.0.73 (npm) to the head commit of the onyx-side branch (callstack-internal/react-native-onyx#de62ae5eae69a4aaf0b1b734e408ba5db2a9c79b) so the upstream fix can be exercised end-to-end against a real App session. It is not intended to merge into App main — the pin will be reverted once #792 lands and ships in a regular onyx release.

The onyx PR fixes two pre-existing bugs in every Onyx write path that goes through retryOperation (flagged on the #787 review and deferred to follow-up):

  1. Routing bug — On retry of mergeCollectionWithPatches / setCollectionWithRetry / partialSetCollection, brand-new keys were silently downgraded from Storage.multiSet to Storage.multiMerge because the existing/new key split got recomputed against a cache the first attempt had already mutated. Benign on IDB, crash-prone on storage backends that require multiSet for missing keys.
  2. Notification dupkeysChanged / keyChanged fired again on every retry attempt, double-notifying Onyx.connect({waitForCollectionCallback: true}) subscribers (which re-fire on every call by contract).

Fix shape on the onyx side: each retriable write splits into an outer orchestrator (cache + subscriber notify + storage prep, called once) and a file-private write helper (Storage.multiSet/multiMerge + retryOperation + dev-tools log). retryOperation re-enters the write helper, not the orchestrator. Full details in the onyx PR description.

Fixed Issues

$ N/A — companion testing PR for Expensify/react-native-onyx#792. No App-side issue.
PROPOSAL: N/A

Tests

The four refactored onyx write paths (mergeCollectionWithPatches, multiSetWithRetry, setCollectionWithRetry, partialSetCollection) are reached from the App via Pusher events, the OpenApp response, every Onyx.update batch that contains a MERGE_COLLECTION / MULTI_SET / SET_COLLECTION op, LHN refresh, Search filters, chat sends, mark-all-as-read, hold/unhold, workspace switching, etc.

Setup

  1. Check out this branch (elirangoshen/fix/retry-side-effects-idempotency).
  2. npm install under Node 20.20.0, then npm run web.
  3. Open https://dev.new.expensify.com:8082/ in Chrome with DevTools open.
  4. Sign in to a test account.

Functional smoke — no regression in the refactored paths

The fix preserves the cache-first invariant from #787, so all of these should look indistinguishable from main to the user:

  1. Initial hydration — after login, LHN reports list and workspace switcher populate within a few seconds. No missing rows vs. a baseline session on main. (exercises mergeCollectionWithPatches via Pusher / OpenApp)
  2. Chat message — open a chat, send a message. Appears immediately (optimistic merge into reportActions_), confirms via Pusher, persists after reload. (mergeCollectionWithPatches)
  3. Mark all as read — click the mark-all-as-read action. All unread badges clear immediately and stay cleared after reload. (mergeCollectionWithPatches)
  4. Search & filter — open Search, apply a filter. Results populate within a few seconds; live updates as filters change; no duplicates. (mergeCollectionWithPatches + setCollectionWithRetry)
  5. Hold / unhold an expense — toggle hold on an expense in a report. Badge appears/clears immediately; persists after reload. (mergeCollectionWithPatches)
  6. Submit expense — FAB → Submit expense. Expense appears in the report immediately, no duplicate, persists after reload. (mergeCollectionWithPatches)
  7. Switch workspaces — switch via the workspace switcher. LHN reports filter to the new workspace within a few seconds. (mergeCollectionWithPatches)

Storage-failure simulation — the core regression guard

This is the test that exercises the retry path the fix targets. With the fix in place, retries on storage failure should produce one subscriber notification per logical operation (not one per retry attempt), and brand-new keys should stay routed through multiSet even when an earlier multiMerge retry kicks in.

  1. With the App running and authenticated, open Chrome DevTools → Application tab → IndexedDB.
  2. Find the database used by Onyx (typically named OnyxDB).
  3. Right-click → Delete database while the App is still running and connected (do not reload).
  4. Immediately trigger a mergeCollection-driven action — switch workspaces, send a chat message, or apply a search filter.
  5. Expected with this pin in place: the UI updates correctly; the new state is visible to subscribers even though the underlying IDB write fails and retryOperation kicks in. Console shows storage error logs and retry attempts (look for Failed to save to storage. Error: ... retryAttempt: N/5), but no white screen, no stale UI, no data loss within the session, and no duplicate waitForCollectionCallback subscriber invocations.
  6. Try the same with a multiSet-driven action and a setCollection-driven action (Search filter result population) to cover the other refactored paths.
  7. (Optional regression check) Revert the pin to 3.0.73 locally and re-run step 4. Without the fix you'll see Onyx.connect({waitForCollectionCallback: true}) callbacks firing twice in DevTools traces.

Cold-cache merge — preserves the pre-warm fast path from #787

  1. Sign out and clear site data to force a cold cache.
  2. Sign back in. LHN should populate within the same window as a baseline main session — the cache pre-warm path (existing in mergeCollectionWithPatches) is untouched by Add hotkey navigation of the chat history in desktop #792.
  • Verify that no errors appear in the JS console

Offline tests

This PR is a dependency-pin bump only; there is no offline behavior to test that isn't already covered by the existing Onyx offline-first invariants. The fix specifically protects subscribers from going stale when a storage write fails — the user-visible behavior offline is better with this pin (UI reflects the merge even if IDB writes back-pressure), not worse. Spot-check the existing offline path:

  1. Toggle "Offline" in DevTools Network tab.
  2. Send a chat message → appears optimistically.
  3. Toggle back online → message confirms via Pusher.
  4. Verify no white screen, no stale UI.

QA Steps

Same as Tests above. Title is prefixed [No QA] because this PR will not be merged — it's a testing companion for the linked onyx PR.

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the `### Fixed Issues` section above (no Expensify issue — companion to onyx PR Add hotkey navigation of the chat history in desktop #792)
  • 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) (the entire PR is a failure-scenario probe — see "Storage-failure simulation" above)
    • 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) (pending manual run)
    • 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). (pending manual run)
  • I included screenshots or videos for tests on all platforms (pending manual run)
  • 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) (456/456 unit tests on the onyx side; pending manual App run)
  • 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`) (N/A — pin bump only)
    • I verified that comments were added to code that is not self explanatory (N/A — pin bump only)
    • 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. (N/A — pin bump only)
    • I verified any copy / text shown in the product is localized (N/A)
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods (N/A)
    • I verified any copy / text that was added to the app is grammatically correct in English. (N/A)
    • I verified proper file naming conventions were followed for any new files or renamed files. (N/A — no file changes other than package.json/lock)
    • I verified the JSDocs style guidelines (in `STYLE.md`) were followed (N/A)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers (N/A — pin bump; the new pattern lives in onyx PR Add hotkey navigation of the chat history in desktop #792)
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (456 onyx unit tests; spot-checked the smoke flows above locally)
  • I verified all code is DRY (N/A — pin bump)
  • I verified any variables that can be defined as constants are defined as such (N/A — pin bump)
  • I verified that if a function's arguments changed that all usages have also been updated correctly (N/A — no signature changes leak into App)
  • If any new file was added I verified that: (N/A — no new files)
    • 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: (N/A — no CSS)
  • If new assets were added or existing ones were modified, I verified that: (N/A — no assets)
  • 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 (N/A — pin bump)
  • 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 (this PR modifies a shared library dependency; smoke tests above cover the high-traffic call sites)
  • 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. (N/A)
  • 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 (N/A — pin bump)
  • If the PR modifies the UI (N/A — pin bump)
  • If a new page is added, I verified it's using the `ScrollView` component (N/A — no new pages)
  • I added unit tests for any new feature or bug fix in this PR (unit tests live on the onyx side — see PR #792)
  • 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. (N/A yet — no review)

Screenshots/Videos

Manual smoke + storage-failure simulation videos will be attached here once the platform runs are done.

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2026-05-26.at.14.41.29.mov
Screen.Recording.2026-05-26.at.14.42.06.mov
Screen.Recording.2026-05-26.at.14.42.27.mov
Screen.Recording.2026-05-26.at.14.43.07.mov
Screen.Recording.2026-05-26.at.14.44.17.mov
Screen.Recording.2026-05-26.at.14.44.48.mov

🤖 Generated with Claude Code

Bumps the react-native-onyx pin from 3.0.73 (npm) to
callstack-internal/react-native-onyx#de62ae5e — the head of the
elirangoshen/fix/retry-side-effects-idempotency branch on the fork.

This companion App PR exists so PR Expensify#792 (Make retried Onyx writes
idempotent on storage retry) can be exercised end-to-end against a
running App session. It is not intended to merge into App main; the
pin will be reverted once Expensify#792 lands and ships in a regular onyx
release.

Companion to: Expensify/react-native-onyx#792

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ This PR is possibly changing native code and/or updating libraries, it may cause problems with HybridApp. Please check if any patch updates are required in the HybridApp repo and run an AdHoc build to verify that HybridApp will not break. Ask Contributor Plus for help if you are not sure how to handle this. ⚠️

@elirangoshen elirangoshen marked this pull request as ready for review May 26, 2026 12:47
@elirangoshen elirangoshen requested a review from a team as a code owner May 26, 2026 12:47
@melvin-bot melvin-bot Bot requested review from MariaHCD and removed request for a team May 26, 2026 12:48
@melvin-bot
Copy link
Copy Markdown

melvin-bot Bot commented May 26, 2026

@MariaHCD 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]

@elirangoshen elirangoshen marked this pull request as draft May 26, 2026 12:48
@elirangoshen
Copy link
Copy Markdown
Contributor Author

no need. to check this its only for testing purposes

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4444f41c3f

ℹ️ 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".

Comment thread package.json
"react-native-nitro-modules": "0.35.0",
"react-native-nitro-sqlite": "9.6.0",
"react-native-onyx": "3.0.73",
"react-native-onyx": "git+https://github.com/callstack-internal/react-native-onyx.git#de62ae5eae69a4aaf0b1b734e408ba5db2a9c79b",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Avoid pinning dependency to private GitHub repository

Pointing react-native-onyx to github.com/callstack-internal/... makes installs depend on access to that private repo, so npm install/npm ci will fail for contributors, forks, and CI jobs that do not have those credentials. This effectively blocks anyone outside the authorized org from reproducing the build or running tests, which is a release-blocking regression compared to consuming a public npm tag or public commit source.

Useful? React with 👍 / 👎.

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.

1 participant