Skip to content

Commit 8cf61b5

Browse files
robingenzclaude
andcommitted
docs: OkHttp 4 in the benchmark, and the bounded start with the headless and the foreign reload
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
1 parent 4393464 commit 8cf61b5

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎CLAUDE.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ This package keeps what is React Native's: which bundle the host loads, the relo
2424
## How the SDK meets React Native
2525

2626
- **The host asks for its bundle.** React Native fixes the JavaScript it loads when its host is created, so the app hands that question to the SDK: `HotCodePush.bundleURL()` in `AppDelegate.swift`, `HotCodePushReactHost.getDefaultReactHost` in `MainApplication.kt`. Both are asked again on every reload.
27-
- **The core starts on that first question**, and the host waits for it: the start's verdict — the pending switch, the rollback of a release that never became ready — is in before any JavaScript runs, so a start never loads one bundle and reloads into another.
27+
- **The core starts on that first question**, and the host waits for it: the start's verdict — the pending switch, the rollback of a release that never became ready — is in before any JavaScript runs, so a start never loads one bundle and reloads into another. The wait is the core's two seconds: past it the host serves the embedded bundle and the core reloads it into the right one once the start answers. A host that is not in the foreground at that question starts headless, so no release is applied and no gate armed. A reload the SDK did not ask for is reported to the core as a reload, never a start.
2828
- **A host that never asked** runs JavaScript the SDK does not serve — Metro in a debug build, or an app that is not wired. The core then runs with `enabledInDebugBuilds` off, and every result is `SKIPPED` with `BUILD_DEBUG`; a debug build's resource file, which the build step writes without an embedded bundle, says the same on its own.
2929
- **A switch is a reload of the host**, `RCTTriggerReloadCommandListeners` and `ReactHost.reload`: the JavaScript restarts, the process stays. The cores hold every reload but a rollback until the app is up in the run, the app's own `applyUpdate()` and `clearUpdates()` included: a reload while React Native starts an instance crashes the app on iOS. The app is up once it has rendered, called `notifyReady()` or run into the readiness timeout. This package holds no reload back: the loader persists the core's choice and reloads a host that has asked for its bundle. What the cores need from it is the first render, reported on every start and after every reload, whatever `readySignal` is: `HotCodePushRuntime` calls the core's `handleRendered()` in `handleContentDidAppear` on iOS and in `observeFirstRender` on Android, which `HotCodePushReactHost` calls for every JavaScript instance.
3030
- **Readiness is the first frame after the root view renders**, observed natively: `RCTContentDidAppearNotification` on iOS, the first mount of each JavaScript instance that leaves a view inside a React root on Android, since React Native logs its content-appeared marker once per surface and not again after a reload, and mounts the root itself before any render. A bundle that mounts nothing never becomes ready.

‎benchmarks/README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ The cold starts are measured on builds made against a stack the CLI is logged in
2525
On the current baseline the Android release APK grows by about 760 KB.
2626
About 310 KB of it is `libappmodules.so`, the Turbo Module's generated C++ once for each of the four ABIs the demo ships, of which an app bundle delivers one.
2727
About 150 KB of it is `libhotcodepush_bspatch.so`, the core's native library that applies a delta pack's patches, FreeBSD's bspatch and the decompression of bzip2 1.0.8, once for each of the same four ABIs, of which an app bundle delivers one: 133 KB of files, and the padding that aligns each to a 16 KB page, since the APK stores them uncompressed.
28-
The rest is in the two dex files, the package's JavaScript in the bundle, the resource file and OkHttp 5's public suffix list, which replaces the compressed one OkHttp 4 carried.
29-
The package's code and the shared core's sit in `classes.dex`; `classes2.dex` is mostly OkHttp 5 and Okio, which take the place of the OkHttp 4 React Native brings, and is byte for byte what it was before the cores gained bspatch; the core verifies signatures with Android's own API, so no cryptography library ships.
28+
The rest is in the two dex files, the package's JavaScript in the bundle and the resource file.
29+
The package's code and the shared core's sit in `classes.dex`; `classes2.dex` is mostly the OkHttp 4 and Okio the core shares with React Native, whose cookie jar OkHttp 5 would break; the core verifies signatures with Android's own API, so no cryptography library ships.
3030
The simulator app grows by about 3.5 MB, nearly all of it in the `HotCodePushDemo` binary: the module and the core are linked statically, and a simulator build is a two-slice fat binary, so a device build carries about half of that; the rest is the core's privacy-manifest bundle, about 12 KB of JavaScript and the resource file.
3131

3232
## Running it

0 commit comments

Comments
 (0)