Commit b60cba2
feat: Implement New migration failure detection cp-7.60.0 (#22757)
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->
## **Description**
<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->
Due to the previous implementation of detecting migration failures to
prompt the Vault Recovery screen causing the Vault Recovery screen to
show up on a fresh install to users who had previously had the MM app
installed.
This is due to on iOS due to keychain not being reset on app uninstall.
This method uses a flag stored in FileSystem Storage to check instead of
the presence of a backed up vault.
Bug: #22567
Bitrise Build:
https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/3efcb785-454e-4fa6-8cd3-8b8b8b224999
## **Changelog**
<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`
If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`
(This helps the Release Engineer do their job more quickly and
accurately)
-->
CHANGELOG entry:
## **Related issues**
Fixes:
## **Manual testing steps**
```gherkin
Feature: my feature name
Scenario: user [verb for user action]
Given [describe expected initial app state]
When user [verb for user action]
Then [describe expected outcome]
```
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<!-- [screenshots/recordings] -->
### **After**
<!-- [screenshots/recordings] -->
## **Pre-merge author checklist**
- [ ] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
## **Pre-merge reviewer checklist**
- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Use a FilesystemStorage-backed migration error flag to trigger vault
recovery from onboarding and clear it after successful restore; set the
flag on migration failures and add corresponding tests.
>
> - **Onboarding**:
> - Read `MIGRATION_ERROR_HAPPENED` from `FilesystemStorage`; if
`'true'` and `getVaultFromBackup()` returns a vault, reset navigation to
`Routes.VAULT_RECOVERY.RESTORE_WALLET`.
> - Skip check in E2E or when `route.params.delete` is set; add error
logging.
> - **Vault Recovery (WalletRestored)**:
> - On continue, remove `MIGRATION_ERROR_HAPPENED` via
`FilesystemStorage.removeItem`; log failures but still navigate to
`Routes.ONBOARDING.LOGIN` with `{ isVaultRecovery: true }`.
> - **Migrations**:
> - On any migration error, set `MIGRATION_ERROR_HAPPENED` in
`FilesystemStorage` (uses `Device.isIos()` to avoid iCloud backup)
before rethrowing.
> - **Constants**:
> - Add `MIGRATION_ERROR_HAPPENED` to `app/constants/storage.ts`.
> - **Tests**:
> - Update/add tests for onboarding migration check, recovery redirect
conditions, error handling, and clearing the flag in `WalletRestored`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
e1156ba. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: metamaskbot <[email protected]>1 parent 85f7a91 commit b60cba2
File tree
6 files changed
+352
-67
lines changed- app
- components/Views
- Onboarding
- RestoreWallet
- constants
- store/migrations
6 files changed
+352
-67
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
| |||
380 | 382 | | |
381 | 383 | | |
382 | 384 | | |
383 | | - | |
384 | | - | |
385 | 385 | | |
386 | | - | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
387 | 391 | | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | | - | |
392 | | - | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
393 | 395 | | |
394 | | - | |
395 | | - | |
396 | | - | |
397 | | - | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
398 | 402 | | |
399 | 403 | | |
400 | 404 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
7 | 21 | | |
8 | 22 | | |
9 | 23 | | |
| |||
15 | 29 | | |
16 | 30 | | |
17 | 31 | | |
| 32 | + | |
| 33 | + | |
18 | 34 | | |
19 | 35 | | |
20 | 36 | | |
| |||
27 | 43 | | |
28 | 44 | | |
29 | 45 | | |
| 46 | + | |
| 47 | + | |
30 | 48 | | |
31 | 49 | | |
32 | 50 | | |
| |||
1355 | 1373 | | |
1356 | 1374 | | |
1357 | 1375 | | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
1358 | 1380 | | |
1359 | 1381 | | |
1360 | | - | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
1361 | 1388 | | |
1362 | 1389 | | |
1363 | 1390 | | |
1364 | 1391 | | |
1365 | | - | |
| 1392 | + | |
| 1393 | + | |
1366 | 1394 | | |
1367 | 1395 | | |
1368 | 1396 | | |
| |||
1372 | 1400 | | |
1373 | 1401 | | |
1374 | 1402 | | |
1375 | | - | |
1376 | | - | |
| 1403 | + | |
| 1404 | + | |
1377 | 1405 | | |
1378 | 1406 | | |
1379 | | - | |
1380 | | - | |
| 1407 | + | |
| 1408 | + | |
1381 | 1409 | | |
1382 | 1410 | | |
1383 | 1411 | | |
1384 | 1412 | | |
1385 | 1413 | | |
| 1414 | + | |
1386 | 1415 | | |
1387 | 1416 | | |
1388 | 1417 | | |
| |||
1394 | 1423 | | |
1395 | 1424 | | |
1396 | 1425 | | |
1397 | | - | |
| 1426 | + | |
1398 | 1427 | | |
1399 | 1428 | | |
1400 | | - | |
1401 | | - | |
| 1429 | + | |
| 1430 | + | |
1402 | 1431 | | |
1403 | 1432 | | |
1404 | 1433 | | |
1405 | 1434 | | |
1406 | 1435 | | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
| 1573 | + | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
1407 | 1587 | | |
1408 | 1588 | | |
1409 | 1589 | | |
| |||
0 commit comments