Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[error-recovery] Extract into unimodule #5357

Merged
merged 3 commits into from
Oct 29, 2019

Conversation

lukmccall
Copy link
Contributor

Why

Resolve #5256.

Test Plan

I've tested it with simple demo https://snack.expo.io/@lukaszkosmaty/error-recovery-test.
I've also tested scoped behaviour.

Copy link
Contributor

@sjchmiela sjchmiela left a comment

Choose a reason for hiding this comment

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

Nice work! 💪

packages/expo-error-recovery/README.md Outdated Show resolved Hide resolved
packages/expo-error-recovery/android/build.gradle Outdated Show resolved Hide resolved
packages/expo-error-recovery/android/build.gradle Outdated Show resolved Hide resolved
packages/expo/src/launch/withExpoRoot.tsx Outdated Show resolved Hide resolved
packages/expo-error-recovery/src/ErrorRecovery.ts Outdated Show resolved Hide resolved
packages/expo-error-recovery/src/ErrorRecovery.ts Outdated Show resolved Hide resolved
@lukmccall lukmccall force-pushed the @lukmccall/errorRecovery-unimodule branch from 6dc19d6 to fd4a8fd Compare August 28, 2019 07:15
@lukmccall lukmccall force-pushed the @lukmccall/errorRecovery-unimodule branch from fd4a8fd to e79ee06 Compare August 30, 2019 12:44
Copy link
Contributor

@bbarthec bbarthec left a comment

Choose a reason for hiding this comment

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

LGTM 💯

packages/expo-error-recovery/README.md Outdated Show resolved Hide resolved
packages/expo-error-recovery/src/ErrorRecovery.ts Outdated Show resolved Hide resolved
@lukmccall lukmccall requested a review from ide September 18, 2019 08:37
Copy link
Member

@ide ide left a comment

Choose a reason for hiding this comment

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

The new code looks good. There are still some CI failures https://circleci.com/gh/expo/expo/92601 and merge conflicts that need to be fixed.

Copy link
Contributor

@sjchmiela sjchmiela left a comment

Choose a reason for hiding this comment

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

Great job! Left some comments on things we still have to figure out. 💪

packages/expo-error-recovery/src/ErrorRecovery.ts Outdated Show resolved Hide resolved
packages/expo-error-recovery/src/ErrorRecovery.ts Outdated Show resolved Hide resolved
@@ -14,6 +14,7 @@
import host.exp.exponent.kernel.ExperienceId;
import host.exp.exponent.storage.ExponentSharedPreferences;

// todo: Remove this once SDK34 is phased out
Copy link
Contributor

Choose a reason for hiding this comment

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

There's a whole bunch of code in Kernel depending on ErrorRecoveryManager, like ReactNativeActivity#shouldShowErrorScreen (called by BaseExperienceActivity#consumeErrorQueue (called byBaseExperienceActivity.addError…))

and Updates depending on app.json#updates.checkAutomatically === 'ON_ERROR_RECOVERY'

if (experienceMetadata != null && experienceMetadata.optBoolean(ExponentSharedPreferences.EXPERIENCE_METADATA_LOADING_ERROR)) {

Maybe we should annotate that code too with a clear strategy on how to deprecate it? Currently I don't see any support kept for ON_ERROR_RECOVERY setting for Updates. How do you handle it in expo-ota PR, @mczernek?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've tried to read and understood ErrorRecoveryManager code.
Here is what this class does:

  • Android
    • owns recovery props
    • has shouldReloadOnError methods, which indicate if experience should reload after the crash (for me it's a little bit strange because this method depends on the time between app loading and crashing).
  • iOS
    • associates arbitrary developer info with experience id (we don't use this)
    • knows if auto-reload after an error is possible
    • tracks state of experience (is recovering, has errors, last loaded)
    • knows if error screen should be shown

Imho, we should leave most of this class. However, maybe renaming will be good options.
This class has more common with error handling than with error recovering.

Copy link
Contributor

Choose a reason for hiding this comment

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

So to sum up, ErrorRecoveryManager's responsibilities are:

  • recovery props memory — moved to native module
  • knows whether to show error screen based on timing of crashes/successful loads — this can stay even longer than when SDK34 is phased out, we may want to leave this feature. Moreover, it is independent from the recovery props memory responsibility
  • informs other pieces of the infrastructure (Updates) that the experience is erroring — this, fortunately, is also independent from the recovery props memory responsibility.

ErrorRecoveryManager doesn't need to be removed, it can stay as a part of ExpoKit. We just removed the memory responbility. 🙂

@lukmccall lukmccall force-pushed the @lukmccall/errorRecovery-unimodule branch from 4001caf to 94b6f44 Compare September 19, 2019 07:35
@lukmccall lukmccall force-pushed the @lukmccall/errorRecovery-unimodule branch 2 times, most recently from 9fa2ae0 to 4d61725 Compare September 23, 2019 14:36
@lukmccall lukmccall force-pushed the @lukmccall/errorRecovery-unimodule branch from 4d61725 to ccde2c7 Compare September 24, 2019 07:11
Copy link
Contributor

@sjchmiela sjchmiela left a comment

Choose a reason for hiding this comment

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

I've looked at ErrorRecoveryManagers again and here's what I found

@@ -14,6 +14,7 @@
import host.exp.exponent.kernel.ExperienceId;
import host.exp.exponent.storage.ExponentSharedPreferences;

// todo: Remove this once SDK34 is phased out
Copy link
Contributor

Choose a reason for hiding this comment

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

So to sum up, ErrorRecoveryManager's responsibilities are:

  • recovery props memory — moved to native module
  • knows whether to show error screen based on timing of crashes/successful loads — this can stay even longer than when SDK34 is phased out, we may want to leave this feature. Moreover, it is independent from the recovery props memory responsibility
  • informs other pieces of the infrastructure (Updates) that the experience is erroring — this, fortunately, is also independent from the recovery props memory responsibility.

ErrorRecoveryManager doesn't need to be removed, it can stay as a part of ExpoKit. We just removed the memory responbility. 🙂

ios/Exponent/Kernel/Services/EXErrorRecoveryManager.h Outdated Show resolved Hide resolved
@lukmccall lukmccall force-pushed the @lukmccall/errorRecovery-unimodule branch from 75355c4 to 9a9b3b1 Compare October 22, 2019 11:31
Copy link
Contributor

@sjchmiela sjchmiela left a comment

Choose a reason for hiding this comment

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

A couple of comments, apart from them — it's ready when it comes to my review!

@lukmccall lukmccall force-pushed the @lukmccall/errorRecovery-unimodule branch from 11528ea to 3c6eee2 Compare October 28, 2019 08:57
Copy link
Contributor

@sjchmiela sjchmiela left a comment

Choose a reason for hiding this comment

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

Great work! 👏 The only thing left is for @EvanBacon to respond to https://github.com/expo/expo/pull/5357/files#r327406072. 🙂 Otherwise it should be good to merge!

@lukmccall lukmccall force-pushed the @lukmccall/errorRecovery-unimodule branch from 3c6eee2 to 846d899 Compare October 28, 2019 10:23
@lukmccall lukmccall force-pushed the @lukmccall/errorRecovery-unimodule branch from 846d899 to 7843c53 Compare October 28, 2019 10:26
@tsapeta tsapeta merged commit 0f064ba into master Oct 29, 2019
@tsapeta tsapeta deleted the @lukmccall/errorRecovery-unimodule branch October 29, 2019 14:57
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.

Extract ErrorRecovery into a unimodule
6 participants