feat(ipodtouch4): add persistent Pocket Runtime hot updates - #397
feat(ipodtouch4): add persistent Pocket Runtime hot updates#397HalfSweet wants to merge 1 commit into
Conversation
doodlewind
left a comment
There was a problem hiding this comment.
Before merging, I’d like to tighten a few architecture boundaries. The implementation direction is good, but this PR is large enough that I don’t want the iPod runtime to become a second runtime architecture that drifts from 3DS.
My merge gate would be:
-
Unify PKRT server semantics.
We now have two independent PKRT server state machines:hosts/3ds/src/devserver.candengine/runtime/dev_server.c. They already differ in protocol behavior (for example unknown frames / auth rejection behavior). Please move the common auth, framing, control, upload, timeout, and dispatch semantics into one shared implementation, leaving only platform/socket-specific integration in the hosts. Target name / discovery label should also be configuration, not hard-coded iPod-specific values in the generic runtime layer. -
Move target/build-plan admission policy out of
quickjs-c.
pocket_runtime_validate_plan()currently hard-codes target policy such aspresentation: "native"and the allowed feature set (input.touch,text.glyphs.baked). The QuickJS executor should not own device capability policy. Please keep thevalidate_planhost callback, but implement the actual validation in the package/target-contract layer or generated host-side contract code, so there is one source of truth for target capabilities. -
Finish the generic runtime-client split.
tools/pocket-runtime-client.tsshould contain only generic PKRT client/session functionality. PICA RGB decoding, dual-screen composition, and PNG generation are 3DS-specific and should live in a 3DS-specific module. Also avoid production tooling importingtests/png.ts. -
Do one real-device acceptance pass before merge.
The host harness is strong, but it does not cover UIKit/EAGL lifecycle, actual presentation, installation, or USB forwarding. Please verify repeated guest replacement and recovery on a real iPod touch 4, including first-frame failure, later-frame failure, foreground/background transitions, reconnect, and several consecutive reloads. In particular, confirm the GL teardown/recreation path does not leak or retain stale resources.
I don’t think this needs a rewrite. The guest replacement/recovery manager and .pocket admission work are solid; the main issue is making sure the new persistent runtime becomes shared infrastructure rather than an iPod-specific fork of the existing 3DS runtime behavior.
The iPod touch 4 host currently embeds each guest into its IPA. Add a separate
PocketRuntime.appthat accepts.pocketupdates over the shared 3DS Runtime protocol, keeping native installation separate from guest iteration.bun ipodtouch4:runtimecommands for native build/deployment, USB pairing, guest packaging, push, source watching, DevTools and status. USB uses the existing pinned SSH forwarder; LAN supports paired discovery and explicit addresses.Validation:
PocketRuntime.ipaagainst the pinned iOS 6 sysroot; built Clear's.pocket.git diff --checkpassed.tsc --noEmitreports two existing errors in unchangedtests/companion-session.test.ts(lines 19 and 26). Full-crate rustfmt reports existing formatting differences in the GLES files and a pre-existing test inlib.rs; the added Rust module passes formatting.Device acceptance remains outstanding: this machine lacks libimobiledevice/iproxy and the iPod's pinned SSH credentials. Host tests do not exercise UIKit, GPU presentation or device installation/USB forwarding. This version uses a 320×480 density-2 foreground Runtime; screenshots continue through the existing USB capture command.