Near-term action
Build a bounded vertical slice
Prototype host switching, source control, a sustained-output terminal, one file or diff flow, and one native capability. Do not rewrite the full mobile app before these paths pass the decision gates.
Architecture decision · Revised July 21, 2026
A comparison of a desktop-served hybrid mobile application and signed React Native OTA updates, with a staged recommendation that tests the highest-risk assumptions before Orca commits to either implementation.
Prototype Option B: keep a useful native companion shell, but deliver each paired
desktop's matching mobile web application through the authenticated connection and
render it in a locked-down WebView. Benchmark terminal and interaction performance,
complete a security review, and validate the product through an actual App Store
submission before a full rewrite. If any gate fails, proceed with Option A, the
self-hosted signed expo-updates design documented here.
01 · Decision
Option B attacks the larger long-term cost: Orca currently has separate desktop and mobile feature implementations connected by a compatibility-sensitive RPC boundary. Option A improves delivery speed but leaves that boundary and duplicated UI in place. Option B can remove most of both, but only if WebView performance, security, and App Review are acceptable.
Near-term action
Prototype host switching, source control, a sustained-output terminal, one file or diff flow, and one native capability. Do not rewrite the full mobile app before these paths pass the decision gates.
Fallback
The signed OTA architecture still provides materially faster React Native fixes. Its GCP, KMS, approval, runtime-version, and recovery design can proceed if the hybrid approach fails validation.
02 · Current state
The mobile project uses Expo 55, React Native 0.83, Expo Router, and the new architecture. Most frequently changed behavior is TS/TSX. The repository also has a desktop-served web client, a same-server static asset handler, mobile-scoped RPC, and paired E2EE transports, but those pieces are not yet a secure privileged WebView delivery system.
| Area | Current fact | Architecture implication |
|---|---|---|
| High-change features | Source control, terminal, tasks, files, diffs, sessions, and UI polish | Option A can update them; Option B can ship them with the desktop. |
| Native boundary | Pairing, notifications, camera, image picking, clipboard, haptics, and audio | These remain in a store-delivered shell under either option. |
| Terminal | The React Native app already embeds xterm in a WebView | Web technology is proven, but bridge and streaming cost are known risks. |
| Connectivity | Direct and Relay paths use paired identity, secure storage, and E2EE RPC | Option B should reuse this trust relationship instead of adding open HTTP. |
| Desktop web build | A bundled full-desktop web client and static handler already exist | A dedicated mobile web entry is still required. |
| Relay delivery | Relay transports E2EE RPC frames, not HTTP web assets | Option B needs an authenticated manifest and chunked asset protocol. |
| OTA client |
expo-updates and runtime-version targeting are not configured
|
Option A still requires a new store shell before the first OTA release. |
03 · Candidate architectures
Store-delivered native shell
pairing · secure credentials · host selection · recovery
notifications · deep links · camera · audio · image picker
clipboard · haptics · versioned capability bridge
│
paired identity + E2EE session
│
▼
Desktop release ──► dedicated mobile web bundle + matching RPC API
│
▼
authenticated bundle descriptor + immutable asset chunks
│
▼
app-controlled, per-host WebView origin and cache
The desktop build owns host-specific workspace UI and its API contract. A desktop update therefore carries the matching mobile UI. The shell owns long-lived secrets, networking policy, lifecycle, and native capabilities; web content receives only negotiated capabilities and host-scoped operations.
CI builds compatible React Native bundle + assets
│
preview automatic / production approved
│
▼
Cloud KMS signs manifest ──► GCS immutable objects + CDN
│
▼
Cloud Run selects release from Firestore channel state
│
▼
expo-updates verifies, downloads, and caches
│
▼
apply on next cold launch; embedded bundle remains fallback
The existing React Native application remains the feature UI. Compatible JS bundles can ship between store releases, while native modules, permissions, entitlements, Expo or React Native upgrades, and custom audio code still require store binaries.
04 · Long-term comparison
| Dimension | Option B · Hybrid web UI | Option A · Signed OTA |
|---|---|---|
| Primary benefit | Desktop UI and API release together; much less feature duplication and skew | Fast JS/TS fixes while preserving the existing native application |
| Compatibility boundary | Narrow native bridge; each desktop serves its matching host UI | Every supported mobile runtime must remain compatible with desktop RPC |
| Remaining version matrix | Native shell × bridge version × desktop-served UI × OS WebView | Native runtime × OTA bundle × desktop/API version |
| Central operations | No OTA control plane; desktop packaging includes the web build | Cloud Run, GCS/CDN, Firestore, KMS, CI approval, retention, telemetry |
| Security center | Paired identity, authenticated assets, origin isolation, bridge policy | OTA key, CI promotion, manifest service, storage, CDN, runtime targeting |
| Compromise scope | A desktop controls its UI; a narrow bridge limits access to phone capabilities | A compromised OTA publisher can target compatible installed runtimes |
| Performance risk | Higher: startup, memory, gestures, accessibility, high-rate bridge traffic | Lower architectural change; existing React Native behavior remains |
| Offline behavior | Native recovery works; host UI needs a verified per-host cache | Current, cached, or embedded app launches without the update service |
| Rollback unit | Desktop and matching UI; prior cached UI also needs compatible server APIs | Republished known-good update or rollback-to-embedded directive |
| User consistency | Different paired desktop versions may show different mobile UI | One mobile channel can present a more uniform UI across hosts |
| Store-review posture | Meaningful uncertainty under minimum-functionality and remote-code rules | More established pattern, still constrained by downloaded-functionality rules |
| Security-fix reach | Host UI fixes reach desktops that take the matching desktop update | A compatible fix can be promoted centrally to active mobile runtimes |
05 · Option B security
Source-control, terminal, and file UI can issue consequential operations and invoke native capabilities. Authenticating RPC alone is insufficient: replaced HTML or JavaScript could operate through the user's legitimate session.
Prefer an immutable bundle descriptor and bounded asset chunks inside the existing authenticated E2EE connection. Pinned HTTPS/WSS tied to paired identity is an alternative only if it also works through direct, Relay, and SSH topologies. Never load privileged content over unauthenticated plain HTTP.
Never place pairing tokens or long-lived credentials in a URL, fragment, WebView storage, page source, navigation history, or logs. The web UI receives a host-scoped channel handle, not the pairing secret.
Verify every asset hash before atomic activation and key the cache by paired desktop identity plus web build ID, not by a changing endpoint URL. Isolate web storage and service-worker scope between hosts.
Allow only the active Orca document and verified assets. Block iframes, popups, arbitrary navigation, mixed content, file access, and unnecessary permissions. Route approved external links through the native system browser.
Default sources to none, permit only immutable self assets, prohibit inline evaluation, and constrain connections to the native broker or exact paired endpoint. Render untrusted repository HTML in a separate bridge-less sandbox.
Failure behavior
Hash mismatches, unknown required bridge versions, navigation attempts, or WebView crashes return to a native retry screen, never an unverified network page.
Cache behavior
Bound retention by paired identity and build ID, validate archive paths and size limits, remove the cache with the pairing, and never reuse it for another host.
06 · Native capability bridge
The handshake should exchange shellProtocolVersion,
uiBuildId, active host identity, WebView-instance session ID, and
supported capability versions. Optional unsupported capabilities stay hidden; an
unsupported required baseline returns to native recovery with a store-update
explanation.
| Capability family | Bridge contract | Guardrails |
|---|---|---|
| Host RPC | Mobile-scoped typed request, response, stream, cancel, and connection events | Server allowlist, schemas, host binding, backpressure, size limits |
| Images | System camera or image picker returns a bounded result or scoped stream | User gesture, MIME and size limits, no arbitrary device paths |
| Microphone and audio | Explicit start/stop session and bounded audio stream | Visible state, permission gate, one owner, cleanup on background |
| Clipboard | Separate read and write operations | User gesture for reads, payload limits, platform privacy behavior |
| Haptics | Small enum of semantic feedback types | Rate limit; no arbitrary vibration patterns |
| External links | Request native open for an absolute URL | Scheme allowlist and confirmation where appropriate |
| Notifications and deep links | Native shell routes typed events to the active host UI | No credentials in payloads; validate host and route |
07 · Performance and reliability
WebView is likely adequate for lists, forms, files, and diffs, but Orca should not infer whole-app performance from its current terminal WebView. That terminal also shows that frequent native-to-WebView messages require careful coalescing.
| Risk | Prototype requirement | Failure signal |
|---|---|---|
| Cold and warm start | Load a verified per-host cache; fetch only when the build ID changes | Blank UI, routine network-gated launch, or visible multi-stage flicker |
| Terminal throughput | Batch frames, enforce backpressure, test output, input, and reconnect | Dropped bytes, ordering errors, high battery use, input lag, scroll jank |
| Large diffs and files | Virtualize rows, stream content, and cap retained document state | Memory pressure, WebView termination, or long main-thread tasks |
| Mobile interaction | Test keyboard, IME, selection, safe areas, rotation, gestures, accessibility | A desktop-responsive UI that remains awkward or inaccessible on touch |
| Host switching | Revoke streams and capabilities, isolate storage, load matching UI | Cross-host state, stale actions, or credentials surviving the switch |
| SSH and Relay latency | Run direct, Relay, SSH-hosted, interrupted, and resumed paths | Assets or RPC that work only on a local LAN |
Preferred data path
Start with a native E2EE broker and batched typed bridge. If terminal throughput is inadequate, evaluate a short-lived host-scoped page channel, never the durable pairing credential.
Recovery ownership
Pairing, host selection, offline state, credential repair, crash recovery, and incompatible-shell messaging must not depend on served web content.
08 · App Store risk
Apple guideline 4.2 says an app should provide utility and UI beyond a repackaged website. Guideline 2.5.2 restricts downloaded code that changes functionality, and 4.7.2 can restrict exposing native APIs to remotely delivered HTML5 or JavaScript software without prior permission. Orca should not characterize Option B as remote desktop under 4.2.7: the UI is rendered on the phone and connections may traverse the internet. A genuine native companion is more defensible than a wrapper, but acceptance is discretionary and may change between reviews.
Review package
Validation order
09 · Option A fallback
If Option B fails, use the open-source expo-updates client and Expo
Updates Protocol with a small GCP control plane and immutable CDN delivery plane.
Expo's sample custom server is a protocol demonstration, so Orca owns production
hardening.
Manifest selection
Select by platform, explicit runtime version, and channel. Keep manifests and release objects immutable; mutable state records active releases and audit events.
Static delivery
Store content-addressed bundles and assets with immutable cache lifetimes. Service failure delays checks but does not block cached or embedded app launch.
Signing
Use RSA_SIGN_PKCS1_2048_SHA256 with an embedded compatible X.509
trust root. Sign the exact manifest or directive bytes after production approval.
Release behavior
Preview releases publish automatically. Production uses a protected CI approval with Slack notification. Routine updates apply on the next cold launch.
rollBackToEmbedded directive when the
embedded store bundle is the intended recovery. A pointer change can contain exposure
for clients that have not installed the release; it is not complete rollback.
| Incident action | Effect | Required control |
|---|---|---|
| Contain | Stop offering the bad release to clients that have not installed it | Move or disable the channel pointer and audit the change |
| Republish known-good | Installed clients receive old content under a newer update identity | Create and sign a new manifest, verify assets, then promote |
| Return to embedded | Client makes downloaded updates ineligible and uses the store bundle | Newer signed directive and tested multipart server/client support |
Desktop Windows signing uses SignPath's OSS program, whose key is SignPath-controlled and manually approved. SignPath documents arbitrary hash signing as a Code Signing Gateway feature, so the OSS arrangement should not be assumed to sign Expo manifests. Use a separate non-exportable RSA key in Cloud KMS. CI enforces human production approval; KMS performs the cryptographic operation after approval.
10 · Validation plan
testedThrough range. Automated
range and native-source checks, both native compilers, and signed iOS cold restoration
pass; the actual older/newer store-binary and Desktop-package matrix remains a release
gate.
11 · Decision gates
References