Commit 31bd332
authored
feat!: Ensure user has onboarded before allowing usage of SnapController (#3731)
Adds a new required constructor argument `ensureOnboardingComplete`.
This should be a promise that resolves once the user has been onboarded.
We can use this to ensure that a user has fully onboarded and decided
whether to opt-out of Snaps before using Snaps at all. The function is
used as part of `assertCanUsePlatform`.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Require onboarding completion via new `ensureOnboardingComplete` hook
and asynchronously gate Snap operations (install, start, handle
requests, registry updates) until onboarding finishes.
>
> - **SnapController API**:
> - Add required constructor hook `ensureOnboardingComplete():
Promise<void>` and store internally.
> - Make platform check async: `#assertCanUsePlatform` now awaits
onboarding completion, then validates feature flags.
> - Await platform check in `updateRegistry`, `startSnap`,
`installSnaps`, `#updateSnap`, and `handleRequest`.
> - **Tests**:
> - Add test ensuring requests wait for onboarding completion before
execution.
> - Update helpers to pass mocked `ensureOnboardingComplete` by default.
> - Adjust call-count expectations and minor timing in affected tests;
remove a couple of unused delegated actions in test utils.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
dd19141. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent c7e59b6 commit 31bd332
File tree
3 files changed
+88
-23
lines changed- packages/snaps-controllers/src
- snaps
- test-utils
3 files changed
+88
-23
lines changedLines changed: 65 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
795 | 795 | | |
796 | 796 | | |
797 | 797 | | |
798 | | - | |
| 798 | + | |
799 | 799 | | |
800 | 800 | | |
801 | 801 | | |
| |||
1869 | 1869 | | |
1870 | 1870 | | |
1871 | 1871 | | |
1872 | | - | |
1873 | | - | |
1874 | | - | |
1875 | | - | |
| 1872 | + | |
| 1873 | + | |
| 1874 | + | |
| 1875 | + | |
| 1876 | + | |
| 1877 | + | |
1876 | 1878 | | |
1877 | 1879 | | |
1878 | 1880 | | |
| |||
2681 | 2683 | | |
2682 | 2684 | | |
2683 | 2685 | | |
| 2686 | + | |
| 2687 | + | |
| 2688 | + | |
| 2689 | + | |
| 2690 | + | |
| 2691 | + | |
| 2692 | + | |
| 2693 | + | |
| 2694 | + | |
| 2695 | + | |
| 2696 | + | |
| 2697 | + | |
| 2698 | + | |
| 2699 | + | |
| 2700 | + | |
| 2701 | + | |
| 2702 | + | |
| 2703 | + | |
| 2704 | + | |
| 2705 | + | |
| 2706 | + | |
| 2707 | + | |
| 2708 | + | |
| 2709 | + | |
| 2710 | + | |
| 2711 | + | |
| 2712 | + | |
| 2713 | + | |
| 2714 | + | |
| 2715 | + | |
| 2716 | + | |
| 2717 | + | |
| 2718 | + | |
| 2719 | + | |
| 2720 | + | |
| 2721 | + | |
| 2722 | + | |
| 2723 | + | |
| 2724 | + | |
| 2725 | + | |
| 2726 | + | |
| 2727 | + | |
| 2728 | + | |
| 2729 | + | |
| 2730 | + | |
| 2731 | + | |
| 2732 | + | |
| 2733 | + | |
| 2734 | + | |
2684 | 2735 | | |
2685 | 2736 | | |
2686 | 2737 | | |
| |||
5448 | 5499 | | |
5449 | 5500 | | |
5450 | 5501 | | |
5451 | | - | |
| 5502 | + | |
5452 | 5503 | | |
5453 | 5504 | | |
5454 | 5505 | | |
| |||
5598 | 5649 | | |
5599 | 5650 | | |
5600 | 5651 | | |
5601 | | - | |
| 5652 | + | |
5602 | 5653 | | |
5603 | 5654 | | |
5604 | 5655 | | |
| |||
6845 | 6896 | | |
6846 | 6897 | | |
6847 | 6898 | | |
6848 | | - | |
| 6899 | + | |
6849 | 6900 | | |
6850 | 6901 | | |
6851 | 6902 | | |
| |||
7538 | 7589 | | |
7539 | 7590 | | |
7540 | 7591 | | |
7541 | | - | |
| 7592 | + | |
7542 | 7593 | | |
7543 | 7594 | | |
7544 | 7595 | | |
| |||
8414 | 8465 | | |
8415 | 8466 | | |
8416 | 8467 | | |
8417 | | - | |
| 8468 | + | |
8418 | 8469 | | |
8419 | 8470 | | |
8420 | 8471 | | |
| |||
8579 | 8630 | | |
8580 | 8631 | | |
8581 | 8632 | | |
8582 | | - | |
| 8633 | + | |
8583 | 8634 | | |
8584 | 8635 | | |
8585 | 8636 | | |
| |||
8695 | 8746 | | |
8696 | 8747 | | |
8697 | 8748 | | |
8698 | | - | |
| 8749 | + | |
8699 | 8750 | | |
8700 | 8751 | | |
8701 | 8752 | | |
| |||
8836 | 8887 | | |
8837 | 8888 | | |
8838 | 8889 | | |
8839 | | - | |
| 8890 | + | |
8840 | 8891 | | |
8841 | 8892 | | |
8842 | 8893 | | |
| |||
9191 | 9242 | | |
9192 | 9243 | | |
9193 | 9244 | | |
9194 | | - | |
| 9245 | + | |
9195 | 9246 | | |
9196 | 9247 | | |
9197 | 9248 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
815 | 815 | | |
816 | 816 | | |
817 | 817 | | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
818 | 825 | | |
819 | 826 | | |
820 | 827 | | |
| |||
932 | 939 | | |
933 | 940 | | |
934 | 941 | | |
| 942 | + | |
| 943 | + | |
935 | 944 | | |
936 | 945 | | |
937 | 946 | | |
| |||
951 | 960 | | |
952 | 961 | | |
953 | 962 | | |
| 963 | + | |
954 | 964 | | |
955 | 965 | | |
956 | 966 | | |
| |||
1034 | 1044 | | |
1035 | 1045 | | |
1036 | 1046 | | |
| 1047 | + | |
1037 | 1048 | | |
1038 | 1049 | | |
1039 | 1050 | | |
| |||
1467 | 1478 | | |
1468 | 1479 | | |
1469 | 1480 | | |
1470 | | - | |
| 1481 | + | |
1471 | 1482 | | |
1472 | 1483 | | |
1473 | 1484 | | |
| |||
1645 | 1656 | | |
1646 | 1657 | | |
1647 | 1658 | | |
1648 | | - | |
| 1659 | + | |
1649 | 1660 | | |
1650 | | - | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
1651 | 1665 | | |
1652 | 1666 | | |
1653 | 1667 | | |
| |||
1730 | 1744 | | |
1731 | 1745 | | |
1732 | 1746 | | |
1733 | | - | |
| 1747 | + | |
1734 | 1748 | | |
1735 | 1749 | | |
1736 | 1750 | | |
| |||
2630 | 2644 | | |
2631 | 2645 | | |
2632 | 2646 | | |
2633 | | - | |
| 2647 | + | |
2634 | 2648 | | |
2635 | 2649 | | |
2636 | 2650 | | |
| |||
2916 | 2930 | | |
2917 | 2931 | | |
2918 | 2932 | | |
2919 | | - | |
| 2933 | + | |
2920 | 2934 | | |
2921 | 2935 | | |
2922 | 2936 | | |
| |||
3551 | 3565 | | |
3552 | 3566 | | |
3553 | 3567 | | |
3554 | | - | |
| 3568 | + | |
3555 | 3569 | | |
3556 | 3570 | | |
3557 | 3571 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
479 | 479 | | |
480 | 480 | | |
481 | 481 | | |
482 | | - | |
483 | 482 | | |
484 | 483 | | |
485 | 484 | | |
| |||
490 | 489 | | |
491 | 490 | | |
492 | 491 | | |
493 | | - | |
494 | 492 | | |
495 | 493 | | |
496 | 494 | | |
| |||
574 | 572 | | |
575 | 573 | | |
576 | 574 | | |
| 575 | + | |
577 | 576 | | |
578 | 577 | | |
579 | 578 | | |
| |||
608 | 607 | | |
609 | 608 | | |
610 | 609 | | |
| 610 | + | |
611 | 611 | | |
612 | 612 | | |
613 | 613 | | |
| |||
0 commit comments