Skip to content

feat!: add the production platform - #117

Merged
owenthcarey merged 11 commits into
mainfrom
feat/production-platform
Nov 4, 2026
Merged

owenthcarey merged 11 commits into
mainfrom
feat/production-platform

Conversation

@owenthcarey

Copy link
Copy Markdown
Contributor

Implements RFC 0008: the production platform, or the layer Expo adds on top of React Native. It's breaking by design, with no shims. The RFC lists every removal.

What changed

  • Plugins v2. pn_plugin.json now covers Info.plist keys, entitlements, privacy manifests, Android manifest fragments, Gradle plugins, options with ${option} substitution, requirements, and browser preview code. It stays declarative, with no build-time code. Apps turn plugins on with [plugins].use and [plugins.<name>].
  • 12 first-party capabilities, each in pythonnative.<name>: audio, background, biometrics, camera, location, maps, notifications, pickers, purchases, push, sensors, video. Camera, Location, Biometrics, and Notifications moved out of the core.
  • Native lifecycle hooks and permission providers, so AppDelegate and MainActivity no longer call specific modules.
  • Store release. pn submit ios|android, pn links, pn run --release, release gates, and artifact checks that a project using no capabilities doesn't reference sensitive frameworks. pn build ios --upload is gone.
  • Failure recovery. A root error boundary in release, pn.set_error_fallback, pn.set_error_handler, and bounded surface restarts.
  • Networking. pn.WebSocket, multipart uploads with progress, and streaming responses.
  • A smaller top level. pythonnative.__all__ is down to 197 names.
  • Field Notes (examples/fieldnotes), a reference app that makes every capability except push work together, with a dev sync server, Maestro flows, and a guided tour in the docs.

Framework bugs Field Notes found

These predate this PR, and per-feature tests had missed them. All are fixed here:

  • Android builds with an app icon failed on duplicate launcher resources.
  • Every Android Icon and tab bar icon drew nothing. Codegen made Optional[Union[...]] a non-optional union with a JSON null case, so shapes never inherited root paint. This regenerates the native contracts, and PNActivityIndicatorColor becomes PNViewBorderColor.
  • Screens restored after Android process death were blank.
  • KeyboardAvoidingView subtracted the keyboard twice on Android below API 35. Android now reports overlap beside height.

Also: ExoPlayer stops at the end of a clip as AVPlayer does, uploads are read off the render loop, and event errors use the documented "event" phase rather than event 'on_press'.

Verified

On an iOS 26.2 simulator and an API 31 Android emulator:

  • One app with all 12 capabilities builds on both platforms
  • Maestro capabilities suite and plugin_config flow on both. On Android, video and websocket passed in a rerun after a fix to video; the full suite wasn't repeated after the later keyboard fix
  • Field Notes smoke and journal flows in release on both, built with its icon and no manual patching
  • Android process death restores the screen with its content
  • 91 XCTest tests, Android unit tests, full pytest, ruff, black, mypy, mkdocs build --strict, browser acceptance tests, check-e2e-coverage
  • check-release-artifacts on both platforms
  • PythonNative Go builds on both platforms with 11 capabilities, and runs a capability project on iOS
  • The wheel and sdist contain all 12 plugin manifests

check-distributions.py couldn't check the local wheel, because it rejects this Mac's platform tag, which isn't in the release matrix. CI's wheel job is the real check.

Not verified

This needs hardware, credentials, or accounts I didn't have. Please don't read this PR as saying these work:

  • Any real App Store or Play upload. pn submit ran only against a fake Play server and a stubbed altool.
  • Real APNs or FCM delivery, and anything on a physical device.
  • iOS camera capture (a simulator has no camera) and barcodes through a lens. On the emulator's back camera, CameraX stills hit a HAL crash and surface as capture_failed.
  • iOS audio recording. AVAudioRecorder hung in Core Audio on this host's simulator and times out as recording_failed after 20 seconds. Playback was exercised, but nothing was heard.
  • Purchase sheets, and Play Billing past "service unavailable".
  • A real BGTaskScheduler launch on iOS.
  • Android map rendering, which needs an API key.
  • Universal links and app links against a real domain.
  • ACTION_PICK_IMAGES.
  • KeyboardAvoidingView on API 35+, where windows are edge-to-edge. Only API 31 was available, so that path is reasoned from platform behavior. It's the first thing to check on a newer emulator.

Known rough edges, not fixed here

  • None children are dropped before diffing, so a conditional child remounts its siblings. Field Notes works around it with keys.
  • iOS TextInput has no placeholder when multiline. Android TextInput ignores padding and always shows its clear button. The iOS 26 Switch overflows its box.
  • AVAudioRecorder is referenced by any app using audio, so App Store review might flag a playback-only app for a missing microphone purpose string.
  • PythonNative Go once showed a stale overlay from another project on a red "could not start" screen, then recovered on the next launch. The cause wasn't found.

Work in progress on RFC 0008: moves location and biometrics into first-party
plugins and removes the camera and notifications modules from the core.
Add examples/fieldnotes, the reference app for RFC 0008, with its server,
tests, flows, and docs. Building it found four framework bugs:

- Android builds with an app icon failed on duplicate launcher resources.
- Android SVG icons drew nothing, because optional unions decoded to a
  non-optional JSON null case and shapes never inherited root paint.
- Screens restored after Android process death were blank.
- KeyboardAvoidingView subtracted the keyboard twice below API 35.

Also make ExoPlayer stop at the end of a clip as AVPlayer does, read
uploads off the render loop, report event errors under the documented
"event" phase, and mark RFC 0008 as implemented.
@owenthcarey owenthcarey changed the title feat!: add the production platform (RFC 0008) feat!: add the production platform Nov 3, 2026
…a front camera

The e2e suite's strict mypy check rejected plain-str state passed to
Literal props and an f-string over a str-or-bytes message.

The default CI AVD has only a back camera, so the camera flow's flip to
the front camera reported unavailable. Pass -camera-front emulated,
matching the local AVD the flow was written against.
CI's Android emulator is 320x640, so results below a map, a button row,
or the availability list sit below the fold. The maps, notifications,
and sensors flows now scroll to each result instead of asserting it in
place. Verified on an emulator resized to 320x640 at 160 dpi.
…vents

The script installs and launches the app itself, so Maestro's launchApp,
which grants permissions, only runs on a retry. On the first attempt the
camera prompt covered the Camera demo before open_demo saw its title.

The video flow's events sit below the player on CI's 320x640 screen, so
each one is scrolled to rather than waited for in place.
The editor asks for location in an effect after it renders, so the
prompt can arrive after the flow's one optional tap has already passed,
then cover the fields. The flows now answer it until the lookup it
started is over.
…chases

- android.files now copies only from inside the plugin or from a file the
  app named in a path option, like every other plugin source. Before, a
  plugin could copy any file on the build machine into the app.
- Surface recovery stops when the fallback screen can't mount either,
  instead of remounting it forever.
- WebSocket closes its connection when opening fails, so a refused
  handshake doesn't leak it. Overlapping pings each get their pong, so a
  ping during a heartbeat no longer closes a healthy connection. IPv6
  hosts keep their brackets in the Host header.
- set_error_fallback accepts every ErrorBoundary form through the same
  dispatch the boundary uses, including an element or no arguments.
- The fake store consumes only with consume=True, as Google Play does,
  and a failed listen() is retried by the next on_update subscriber.
@owenthcarey
owenthcarey merged commit 9c8daf9 into main Nov 4, 2026
63 of 64 checks passed
@owenthcarey
owenthcarey deleted the feat/production-platform branch November 4, 2026 05:56
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