Conversation
|
Sentry Issue: BITPAY-APP-2X |
cmgustavo
force-pushed
the
chore/fs-backup-move-hardening-01
branch
from
August 31, 2026 21:13
c11bf67 to
61ad3e8
Compare
|
Sentry Issue: BITPAY-APP-7 |
|
Sentry Issue: BITPAY-APP-52 |
|
Sentry Issue: BITPAY-APP-K |
|
Sentry Issue: BITPAY-APP-N |
cmgustavo
force-pushed
the
chore/fs-backup-move-hardening-01
branch
from
September 2, 2026 20:53
61ad3e8 to
d6c33d6
Compare
|
Sentry Issue: BITPAY-APP-21 |
cmgustavo
force-pushed
the
chore/fs-backup-move-hardening-01
branch
from
September 9, 2026 20:07
d6c33d6 to
ccfbb14
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the ENOENT family in src/store/backup/fs-backup.ts:
BITPAY-APP-7,-2X,-52,-K,-Nand-21. Ruled out with data: not disk space (fails with 163 GB free), not low-end devices (spread across all three device.class buckets), not Android-only.Two bugs:
cache/bitpay/reduxcan be cleared by the OS at any moment, including between ensureDir() and the write. There was no retry, so every occurrence reported and no backup landed.BITPAY-APP-21is that rotation path — all 10 occurrences carry theBackup rotate failedbreadcrumb, none carryBackup read final failed.Changes:
Test on iOS and Android
Driven by a temporary
__DEV__harness (not part of this diff) that wipesBASE_DIRright afterensureDir()and forces the rotation to throw, once each per app launch. Replacing thereduxdirectory with a regular file does not work:exists()returns true andensureDirskips themkdiron both attempts.Directory wiped between
ensureDir()and the write — the retry recreates it and the backup lands:Rotation forced to fail, leaving the final file occupying the destination — this is the iOS bug, and before this PR the move died here:
Library/Caches/bitpay/reduxholds a freshpersist-root.jsonin both cases, with no.tmpleft behind.Android
Same two cases, driven by the same harness. With the rotation forced to fail,
renameTooverwrites the occupied final file on the first move and the unlink fallback never runs — the asymmetry this PR relies on, and the reasonmoveOverwritingattempts the move before clearing the destination:/data/data/com.bitpay.wallet/cache/bitpay/reduxends up in the same state as iOS.