Skip to content

feat(mobile): ship js changes over the air - #357

Merged
nixuuu merged 1 commit into
devfrom
feat/mobile-ota-updates
Nov 8, 2026
Merged

nixuuu merged 1 commit into
devfrom
feat/mobile-ota-updates

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 8, 2026

Copy link
Copy Markdown
Member

Canopy currently rebuilds the iOS app for every mobile change. This adds signed OTA delivery for JavaScript/assets that match an installed native runtime; native changes still build iOS and submit to TestFlight. Android binaries remain manual-only.

Design and channels

expo-updates 58.0.21 uses fingerprint runtime versions. SDK 58's balanced preset ignores marketing/build-number bumps and hashes native dependencies, configuration and local native modules. The public signing certificate is an explicit fingerprint input, so certificate rotation requires new binaries. Launch checks use a 0 ms fallback timeout: cached code starts immediately, downloads apply on the next cold launch, and no reload is requested during a session.

Release source Update channel TestFlight profile Manual APK profile
dev nightly production preview
next beta production-beta preview-beta
main / stable tag stable production-stable preview-stable

All release profiles use the EAS production environment. The planner rejects channel aliases, paused channels and rollout mappings; beta/stable must point exclusively at their own same-name update branches.

Signing and release behaviour

Only apps/mobile/certs/updates-certificate.pem is committed. The private key was generated in ignored worktree scratch, saved as Actions secret EXPO_UPDATES_PRIVATE_KEY, then deleted locally. Publishing writes a 0600 file, removes the key from the EAS child environment, and deletes the file on exit/failure. The binary embeds the certificate and canopy-updates / rsa-v1_5-sha256 metadata. SDK 58 native source defaults unsigned manifests to disallowed; missing signatures, wrong key IDs and invalid signatures fail before a remote update is accepted. Hosted signing requires an Expo Production/Enterprise plan.

Mobile release requires a successful Release publication and the correct tag on its SHA. It preserves the mobile/workspace path filter, derives the marketing version from the tag and keeps EAS remote build numbers. Platform fingerprints and channel-specific EAS build inventory select full iOS build vs OTA. A compatible Android build can receive OTA while an iOS native change builds; no automatic Android build command exists. Signed OTA always targets both platforms. Runtime mismatch prevents old APKs from receiving incompatible updates.

Reruns deduplicate active native builds and signed tag/full-SHA publications. Failed builds remain retryable, query failures abort, older delivered commits are skipped, and a successful iOS build cannot hide a missing Android OTA. Offline policy tests exercise these paths and signing-file cleanup.

For a self-hosted Expo Updates protocol server, change updates.url in apps/mobile/app.json and replace scripts/mobile-publish-update.sh, including its latest/status reads. EAS build inventory stays in the planner; the update-service boundary stays in that adapter. Changing the URL requires new binaries, while old installations keep using the old endpoint.

The first release after merge must be a full native build: existing installations lack expo-updates and the certificate. OTA starts with the next JS-only change after installing that build. Android needs its first updated APK built manually.

Verification

  • Passed: frozen Bun install, generated-code check, monorepo typecheck, lint, formatting, web build, mobile typecheck, Expo lint, Expo Doctor (20/20).
  • Passed: public Expo config, native config introspection (certificate/metadata embedded on both platforms), local fingerprints for iOS/Android, EAS profile config reads, EAS update help, both Hermes bundle exports, actionlint and shellcheck.
  • Passed: 12 offline release-policy tests. A marketing-version bump preserved the fingerprint; changing the public certificate changed it. Signed-update rejection was checked against official docs and installed iOS/Android SDK source.
  • Passed: full check:tmp — 1,799 passed, 161 skipped, 0 failed, 19,151 assertions across 322 files; no test-owned temporary files left. Scratch stayed under the worktree. The initial run exposed parent-repository discovery in plain-folder fixtures and was stopped; the complete rerun capped Git discovery at the scratch boundary and passed.
  • No real EAS build, submit or update publication was run. Native startup/update delivery and device layout were not exercised.

Copy audit — docs/copy.md §8

Before: no local mobile-update information. After: Settings → General → About → Updates, e.g. Beta · a1b2c3d4 · Nov 8, Nightly · Bundled · Nov 8, or Development build; description: “Updates apply after you close and reopen Canopy.” This identifies the running bundle and explains when downloads take effect.

Audit Result
1–2: clarity, case, punctuation, glossary Short English labels/statuses; one factual sentence; existing update-channel terminology.
3–5: actions, errors, empty states Read-only row; no new buttons, errors or empty states.
6–8: repetition, missing data, humour Channel/ID/date appear once; optional missing date/ID omitted; no humour.
9: text lengths and widths Fixed channel names, 8-character OTA ID and locale-formatted short date; existing wrapping/selectable SettingsValue. Source inspection only; device visual QA remains unverified.
10: accessible meaning Plain text carries all information, using existing theme-aware Settings components.

@nixuuu
nixuuu merged commit 6188259 into dev Nov 8, 2026
10 checks passed
@nixuuu
nixuuu deleted the feat/mobile-ota-updates branch November 8, 2026 13:00
nixuuu added a commit that referenced this pull request Nov 8, 2026
Settings now covers the workspace with an opaque native transition. Back
gestures return from a Settings section to its list before dismissing
Settings.

### Causes and changes

- The wide root stack faded Settings over the thread while also
removing/recreating the workspace sidebar. Move workspace routes into
`(main)` and present Settings above that complete, stable surface.
Android slides from the bottom; iOS uses its native stack transition.
Reduced motion disables navigation animation. Wide thread/bot changes
still swap in place inside the clipped panel, preserving #234's sidebar
protection.
- Settings sections lived in component state, so iOS only knew about the
outer Settings route. Give sections their own native stack and disable
the outer iOS gesture while a section owns Back. Shortcuts anchor the
Settings list beneath their section; X dismisses all Settings.
- Split view: Back from a selected section returns to the list +
General, then closes Settings. Selecting another section replaces the
current section, so sidebar browsing does not accumulate history.
Documented in `docs/mobile.md`.
- Audit: side threads opened from thread details/subagent panels and bot
exchanges already push real routes. Bot settings/details sheets already
unwind through `onRequestClose`; Android device checks confirm settings
→ details → chat. Fix the pairing scanner's missing Android Back
handling and protect paired/unpaired route history. No dependency
changes.

### Device evidence

Recorded before and after with T3 device tools on Android 16 phone and
unfolded Fold, in light and dark mode. Extracted transition frames show
Settings sliding as a solid surface, with no thread/settings text double
exposure and no sidebar resize. Before/after recordings and frame sheets
are retained in the implementation worktree under
`.tmp/mobile-settings/`; they are deliberately not committed and are not
hosted GitHub attachments:

| Check | Evidence |
| --- | --- |
| Before, phone/Fold × light/dark |
`before-{phone,fold}-{light,dark}.mp4` and corresponding `*-frames.png`
|
| Final open/close, phone/Fold × light/dark |
`final-{phone,fold}-{light,dark}.mp4` and `*-open.png` / `*-close.png` |
| Android section → Settings root → thread, button + edge gesture |
`after-phone-light.mp4`, `after-fold-light.mp4`, dark counterparts |
| iOS General → list → thread, left-edge swipe | `ios-final-swipe.mp4`
(fresh simulator dev client) |
| Side thread → parent by gesture | `android-nested-back.mp4`,
`ios-nested-back.mp4` |
| Bot settings → details → chat; scanner → form | `android-nested-back`
recording chunks, `android-pairing-back.mp4` |
| Reduced motion | `android-reduced-motion.mp4` |

Cold starts on Android and iOS were checked after removing unused
explicit workspace screen ordering; no route-reconciliation warning
remained. Native clients were built locally (private Linux Android
SDK/Gradle, arm64, two workers, 3 GB heap; private Mac simulator build
with ≥12 GB free at build start). No store/EAS builds.

Device recordings/native builds precede an unchanged rebase onto
`61882593` (#357). Installation and static checks were repeated
afterward; this PR changes no dependencies or workflows.

### Verification and gaps

- Passed: `bun install`, `bun run gen:check`, `bun run typecheck`, `bun
run lint`, `bun run format:check`, web build, mobile typecheck and `bunx
expo lint`. No UI tests added.
- Full `bun run check:tmp` did not finish cleanly: it ended with signal
143 during worker tests, after three linked-project failures and one
shell timeout. Targeted rerun: shell passed; the same three project
assertions failed identically on untouched base `f583c5ca` (10 passed /
3 failed across the three files). Both targeted runs reported nothing
left in their temp dir. Separate worker run passed: 264 passed, 19
skipped, 0 failed across 47 files; temp cleanup passed.
- The three baseline failures are `add-project.test.ts` (local folder
unexpectedly attached) and `linked-projects.test.ts` (owner-scoped
origin metadata and shutdown-home merged identity). They are outside the
mobile change. Full-suite gate remains unverified/failed; this PR stays
draft for that gap.
- Device checks used emulators/simulator, not physical hardware. iOS
split-width gestures, an actual fold/rotation during navigation, and
frame-by-frame predictive-back progress were not separately verified;
completed Android edge gestures and Back events were verified. The split
behavior uses the same documented native section history on both
platforms.

Copy audit: no UI text changed.

Fixes: #234
Related: #245
nixuuu added a commit that referenced this pull request Nov 8, 2026
The mobile composer now follows native keyboard frames on the UI thread,
including interactive movement. Thread and bot conversations adjust
their bottom inset with the keyboard. The composer fade is fixed at 32
dp and the feed reserves only the composer's actual settled height.

Fixes: #292
Related: #308

### Recording findings and fixes

- **Keyboard opens through a stationary composer, then the composer
jumps.** Replace `KeyboardArea` and JS keyboard listeners with
`react-native-keyboard-controller` 1.22.7, a provider per native window,
and native frame worklets. Use frame positions rather than iOS
start-event destinations; no separate keyboard easing.
- **Keyboard hides while the composer floats above an empty gap, then
drops.** The same native frame translation drives dismissal and
interactive gestures; safe-area compensation sits outside the measured
composer.
- **Visible messages jump when the keyboard opens or closes.** Move chat
insets and offsets together, normalize the inverted iOS inset for
following/scroll anchoring, and prevent keyboard corrections from
triggering compact-on-scroll. Preserve native visible-message anchoring
while reading history.
- **Attach opens while the keyboard and composer cross beneath it.**
Wait for native keyboard dismissal before presenting attach/model/effort
sheets and other modal panels. Searchable modal windows own their
keyboard provider; mentions remain within the moving composer viewport.
Native Photos/Files presentation follows menu dismissal.
- **Oversized composer/fade on iPhone portrait and unfolded Fold.**
Remove two empty 44 dp status slots, an empty 20 dp syncing row, and the
retained expanded reserve. Keep active status rows/popovers outside the
measured input, separate keyboard/safe-area space, and render a fixed 32
dp fade above its top edge.
- **Phone sheet scaling exposes edge seams and keyboard padding limits
dim coverage.** Keep the scrim full-window and animate phone sheets with
translation only. Wide cards retain the shared motion tokens; reduced
motion removes extra UI animation.

Writing mode retains attach/model/effort controls, scroll compaction
stays gesture-driven, and the same keyboard container serves bot chat.
Package changes are limited to the keyboard dependency and its lock
entries. Mobile architecture documentation is updated.

### Evidence and verification

- Extracted the supplied keyboard/reference recordings at 60 fps around
transitions. Before: the keyboard crosses a stationary composer around
4.65 s; dismissal leaves the composer floating around 5.82 s; attach
overlaps the keyboard around 11.48 s. The supplied phone and Fold
recordings also expose the oversized reserved area/fade. Captured a
local iOS baseline and after recordings against an isolated long
conversation.
- iPhone 17 Pro simulator, iOS 26.3: inspected light/dark show/hide,
swipe-down interactive dismissal, writing mode with a long draft, scroll
compaction/return to latest, attach while typing, native Photos/Files
presentation and cancellation, model/effort pickers, mention
suggestions, subagent panel, and bot chat. Sampled after frames show
composer/feed movement accompanying the keyboard without the old delayed
jump or floating gap; sheets appear after dismissal with full-window dim
coverage. The fade stays short and the empty reserve is gone. Recording
requested 60 fps; the simulator exports variable-rate video, so this is
sampled visual evidence, not a constant-60-fps timing guarantee or
physical-device parity claim.
- Android arm64 development client compiled locally and installed on the
phone and unfolded Fold. Phone light static layout confirms the smaller
composer area. Motion checks were invalid because the device tool
selected its headless IME. Switching to Settings to restore a visible
IME then failed twice with `run-as: package not an application:
com.android.settings`; stopped after the advised retry. **Android
keyboard/interactive/predictive/edge-to-edge checks, phone dark checks,
and Fold portrait/landscape light/dark visual checks remain
unverified.** No new AVD was created.
- Used the single approved EAS iOS `development-simulator` build,
[b145130c](https://expo.dev/accounts/itsol/projects/canopy-mobile/builds/b145130c-748c-4d69-afe1-23418ad09082),
including the keyboard native module. Both native clients predate the
separately merged OTA dependency (#357). After rebasing onto #357/#358,
the verification-only source copy retains the pre-OTA General Settings
file to avoid importing an absent Expo Updates native module; keyboard
code and the new route structure match this branch. **Exact-head native
startup with OTA, physical iOS devices, hardware keyboard, and system
reduced-motion behavior remain unverified** (reduced-motion paths
reviewed in code). No compatibility workaround is committed and no
second EAS build was run.
- Gates passed: `bun install`, `bun run gen:check`, root/mobile
typecheck, root lint/format check, `bunx expo lint`, Expo Doctor
(20/20), web build, CNG generation, both final native JS exports,
Android native compilation and the approved iOS native build. `bun run
check:tmp`: **1799 passed, 161 skipped, 0 failed**, no test-owned temp
leftovers. Rebased onto current `origin/dev`, including the `(main)`
route moves from #358.

Draft pending the remaining native visual checks. Evidence videos/frames
stay outside version control.

### Review

- Componentize pass completed before the final commit: shared
native-window/frame ownership, keyboard viewport/presentation helpers,
overlay surface, a dedicated iOS chat scroll adapter, and conditional
connection status; no duplicated keyboard listeners. Final self-review
covered safe-area ownership, actual-height measurement, gesture
compaction, modal handoff, reduced motion, route rebase, and dependency
scope.
- Copy audit: no UI text changed.
- No UI tests added, following repository policy.
nixuuu added a commit that referenced this pull request Nov 8, 2026
…ld (#360)

The Mobile release run for `v0.2.0-nightly.103` failed with
`mobile-publish-update.sh: line 59: 2: Runtime required`.
`scripts/mobile-release.sh` looks up the latest OTA update for the
runtime of the last delivered iOS build on the channel. This is the
first release after #357, so there is no delivered build on the
`nightly` channel, `last_runtime` is empty and the publisher refuses the
lookup — the whole planner aborts and no iOS build reaches TestFlight.

The planner now skips the lookup when there is no delivered build
(nothing can have been published to a runtime that was never shipped),
so the first release falls through to a full native build as intended.

Tests: new offline planner case "the first release on a channel without
a delivered build builds iOS" fails on the old script and passes now;
all 13 mobile release policy tests pass. Typecheck, lint and format
clean.

Copy audit: no UI text changed.

Fixes: #357
nixuuu added a commit that referenced this pull request Nov 8, 2026
Fixes: #357

The first mobile release after #357/#360 (`nightly.104`, run
42501709806) queued the iOS build and TestFlight submission, but OTA
publication failed:

> EAS Update code signing requires a subscription to the EAS Production
or Enterprise plan. This account (itsol) currently has a subscription to
the Starter plan.

The maintainer chose unsigned EAS Update on Starter until the company's
own Expo Updates server replaces EAS. Trust now rests on EAS and HTTPS,
without an independent Canopy signature; compromise of the EAS account
or service could replace JS. Signing will return with the self-hosted
server.

Changes:

- Remove the app's signing configuration, public certificate,
`.gitignore` exception and explicit fingerprint input. Both platform
fingerprints change, so the next iOS release needs a full build. The
already submitted `nightly.104` binary embeds the certificate and will
receive no unsigned OTA until replaced.
- Publish without a private key or `--private-key-path`; remove the
signing-key requirement from history and deduplication. Preserve exact
release-message matching, runtime/branch filtering, rollback exclusion,
channel isolation, build-versus-OTA planning, manual-only Android
builds, idempotency and older-commit skipping.
- Stop passing `EXPO_UPDATES_PRIVATE_KEY` in the workflow. Leave the
GitHub secret untouched and unused for signing's return. Preserve the
server-swap boundary: `updates.url` and `mobile-publish-update.sh`.
- Replace signer-file tests with unsigned publication, deduplication and
failure coverage; update Polish mobile/release docs and the mobile
instructions.

Validation:

- `bun install`, `bun run gen:check`, `bun run typecheck` (including
mobile), `bun run lint`, `bun run format:check`, `bun run check:tmp`,
and `bun run --filter @canopy/web build`.
- `bun test scripts/mobile-release.test.ts`: 17 passed.
- Full `check:tmp`: 1,804 passed, 161 skipped, zero failures; no test
temp directories left. Scratch data stayed under the worktree, with a
Git discovery ceiling so plain-folder fixtures could not discover the
parent checkout.
- `bunx --no-install expo config --type public --json`: no
`codeSigningCertificate` or `codeSigningMetadata`; offline
`@expo/fingerprint` generation succeeded for both platforms and
confirmed changed hashes.
- actionlint 1.7.12, shellcheck 0.11.0, `bunx --no-install expo lint`,
and Expo Doctor (20/20 checks).
- No real EAS build, submit or update commands were run. The existing
GitHub secret was not modified.

Copy audit: no UI text changed; the Settings update line is unchanged.
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.

1 participant