Skip to Content
Octapus

Shipping updates

Replace a bundle without an app release, and fall back safely when an update does not fit the installed app.

A native bundle is a plain folder (app.hbc, app.ofrm, app.css, manifest.json). Your app loads it from a URL, so the folder does not have to live inside the app: you can download a newer one and launch that instead. This is how hot updates work with Octapus.

The update unit

Ship the whole folder oct build produced for that target, every time. The pieces belong together:

  • app.ofrm was baked from that exact app.hbc, and records its hash.
  • manifest.json records the bytecode version, the host protocol, and a SHA-256 for each file, so your update server and the app agree on what a bundle is.

Octapus never adopts a snapshot that was baked from a different app.hbc. If the two get mixed up, the screen renders from JavaScript instead, and no early input is replayed onto the wrong elements.

Check before you launch

An update built by a newer oct may need a newer app. Check the downloaded bundle before you show it, and fall back to the one inside your app:

let downloaded = OctapusBundle(directory: updateDirectory)
let embedded = OctapusBundle(directory: Bundle.main.url(forResource: "ios", withExtension: nil)!)

let bundle = downloaded.isSupported ? downloaded : embedded
if let reason = downloaded.incompatibility {
  print("skipping update:", reason)  // e.g. "bundle host protocol 3 > supported 2"
}
let screen = OctapusViewController(bundle: bundle)

A bundle is refused when:

ReasonMeaning
manifest.json missingBundles loaded from a folder must have their manifest
bundle host protocol N > supported MBuilt by a CLI that speaks a newer protocol than this app's Octapus
app.hbc missing or not Hermes bytecodeThe download is incomplete or corrupted
app.hbc is Hermes bytecode vX, this runtime runs vYCompiled for a different Hermes version

Octapus runs the same check itself when a view launches, before anything is drawn. Checking first just lets you choose the fallback.

When something still goes wrong

Octapus fails closed instead of leaving a screen that looks alive but is not:

  • A snapshot file it cannot read is reported as an .error event and skipped; the screen renders from JavaScript.
  • If hydration fails (the bytecode throws, or never renders), the snapshot is cleared and held input is dropped, so users are never tapping a dead screen. Listen for .error events, or .metrics whose phase is .failed(reason), to fall back to your embedded bundle.

On iOS, cached first screens follow the bundle

The on-device first-screen cache is keyed by the bundle's bytecode and CSS. A new bundle gets a new cache entry automatically; you do not have to clear anything.

On this page