Repository navigation
Apple motion: thicket-motion-ios over CMMotionManager; macOS Motion.unavailable (#120) - #137
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hone 17e Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…le, README Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ceShim.scala Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… settle 30 s before a fresh install Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ttle Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rol 4 FAIL hidden -> Background 49 ms, unhidden -> Foreground 33 ms, minimised 595 ms, restored 528 ms. bin/verify-apple.sh "iPhone 17e": 17/17 steps on 9cff276; iOS gallery 191 (179 + 12), macOS gallery 195 twice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ft over CMMotionManager, IosMotionProvider shimGen/testFull 37/37 (MotionConsistencySpec 7). libthicketmotion.a 15 056 bytes (ios-sim). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tion.unavailable on macOS, GalleryMotionChecks iOS gallery on iPhone 17e: 195 ok, 0 FAIL; the 5 motion checks pass (0 starts, nothing active). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…from scalafmt; formatted Controls on iPhone 17e: Motion.apply ignoring availability -> 1 FAIL (3 starts for 0 available). macOS gallery 196 ok (195 + 1 motion), unlocked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eview) The comment describing the storage checks had ended up above `checker`, a plain adapter, leaving storageChecks undocumented. It's back on storageChecks, and checker has its own line. docs/14's platforms list and the decision log keep both sides. Measured on the merge, "iPhone 18 Pro": bin/verify-apple.sh 17/17 (macOS gallery 195 x 2, iOS 191). getting-started failed once reading the sbt version under parallel load, and passed re-run alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
verify-apple.sh "iPhone 17e" on ef811a1: 18/18 (shim-motion new); iOS gallery 196, macOS 196 twice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…o issue/120-apple-motion Conflicts kept both sides: build.sbt, GallerySelfTest.scala, README, docs 12/14/16, gallery README. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🔵 Needs a closer look
Device-dependent iOS Swift/CMMotionManager logic, including the acceleration sign negation and self-test branch, is unverifiable on Linux CI without hardware and the change is blocked on a prerequisite PR merging first.
No open issues 🎉
What changed in this PR
This PR adds thicket-motion-ios, the Apple/iOS half of the motion service (issue #120), layered on top of #132 (thicket-device-apple), whose commits are included in this diff until it merges. It provides a MotionProvider over Core Motion's CMMotionManager in its own Swift static library (libthicketmotion.a), wires IosMotion() = Motion(IosMotionProvider, AppleLifecycle), keeps macOS on Motion.unavailable, and adds the generated ABI plumbing, gallery self-tests, and documentation to match.
Changes:
- New
thicket-motion-iosmodule: Swift shim + generatedthk_mot_*ABI (MotionAbi, header, externs,MotionConsistencySpec),IosMotionProvider(acceleration converted from g and negated to Android's sign, one sharedCMMotionManagerper process), andIosMotion(). - Shim-gen generalized:
cType/cDeclnow take a callback prefix so device/motion headers emit their own callback typedefs;Emit/Main/Parse/Abigain device + motion support and a newVec3Cbtype. - Gallery + docs:
MotionDemo.sensorsLabelnow shows each unavailable sensor's reason (shared GTK/macOS/iOS), newGalleryMotionChecks, macOS/iOS gallery wiring,verify-apple.shshim-motionstep, and extensive doc updates.
| File | Description |
|---|---|
modules/motion-ios/.../IosMotion.scala |
IosMotionProvider + IosMotion(); per-sensor listener sharing, g→m/s² negation, main-thread sample dispatch |
modules/motion-ios/shim/Sources/MotionShim.swift |
Swift bridge over CMMotionManager (@_cdecl thk_mot_*) |
modules/motion-ios/.../MotionShim.scala, shim/include/thicket_motion.h |
Generated externs + C header |
modules/motion-ios/shim/build-shim.sh, .gitignore |
iOS-sim-only Swift build; ignore build output |
tools/shim-gen/.../MotionAbi.scala, DeviceAbi.scala |
thk_mot_* / thk_dev_* ABI definitions |
tools/shim-gen/.../Emit.scala, Main.scala, Parse.scala, Abi.scala |
Callback-prefix parameterization, device/motion emit + parse, Vec3Cb type |
tools/shim-gen/.../MotionConsistencySpec.scala, DeviceConsistencySpec.scala |
ABI drift checks (7 tests each) |
tools/sbt-thicket/.../ThicketApplePlugins.scala, ThicketNativeFlags.scala, SharedFlagsSpec.scala, README.md |
thicketMotionIos/thicketDeviceApple unpack tasks + appleDevice link flags |
examples/gallery/.../MotionDemo.scala |
sensorsLabel groups unavailable sensors by reason |
examples/gallery/apple-shared/.../GalleryMotionChecks.scala, GalleryDeviceChecks.scala, GallerySelfTest.scala |
New Apple Motion/Device self-test checks and wiring |
examples/gallery/{ios,macos}/.../Gallery*.scala, ios-app/build-app.sh |
Pass AppleDevice() + motion; build-script lib/usage-string/drive setup |
modules/device-apple/..., examples/ios-host/... |
#132 device-apple shim, AppleDevice, XCUITest tapper + run-ios-app.sh drive support |
build.sbt |
New deviceApple / motionIos projects; gallery deps + link flags; platforms aggregate |
bin/verify-apple.sh, .scalafmt.conf |
shim-device/shim-motion steps; exclude generated shims |
docs/*, README.md, modules/*/README.md |
Status, release, decision-log, and open-question updates |
Note: the acceleration sign negation and the on-device reading self-test branch are explicitly unmeasured (no hardware; simulator has no motion sensors), and the iOS Swift code cannot be validated on Linux CI — these warrant human confirmation, and the change also depends on #132 merging first.
Review effort: Balanced
One conflict, the decision log: both entries kept, #114's first. Measured: platforms/Test/compile clean; checkLinux exit 0 on the second run. The first run failed one effectZioJVM test (not identified: --error hid the name); effectZioJVM/testFull alone then passed 25/25, and the whole check passed on the rerun, so a timing flake under load, as #117's was. Apple self-tests not run here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two conflicts, the decision log (both entries kept, Apple's first) and docs/14's list of platform modules (both sets). Measured: checkLinux exit 0; platforms/Test/compile clean. MotionDemo's sensorsLabel changes the shared gallery, so: GTK gallery 137, todo 69 (bin/gtk-selftests.sh under a headless gnome-shell: the desktop was locked, and the first, locked run failed only the Device foreground check); Android gallery 86/86 on s2test. Apple self-tests not run here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both sides grew the Apple galleries: - GalleryIos/GalleryMac: Services get device, clipboard and haptics. - GallerySelfTest: storage -> device -> clipboard -> sheet -> big list, both check groups kept. - build.sbt: the Apple galleries depend on deviceApple, clipboardApple and hapticsApple. - verify-apple.sh's header, docs/12's Apple counts (the two measured apart; the combined run is the Mac's) and the decision log keep both. Measured: platforms/Test/compile clean (type-checks the Apple Scala). Not measured: the Apple self-tests on the combined gallery, which need the Mac. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both sides grew the Apple galleries: Services get device, motion, clipboard and haptics; the self-test runs storage -> device -> motion -> clipboard -> sheet -> big list; the Apple galleries depend on motionIos, clipboardApple and hapticsApple. Docs keep both sides (README, docs/12, 14, 16); the decision log's 2026-11-01 entry moved back to the top. Measured: platforms/Test/compile clean. #127 is Apple-only, so cc3ee5a's GTK (137) and Android (86) counts stand. Not measured: the Apple self-tests on the combined gallery (the Mac's). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merged 🤖 Generated with Claude Code |
…leries' Device section (#114) (#132) * WIP #114: thicket-device-apple, its Swift library and the thk_dev ABI Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * WIP #114: the Apple galleries' device checks Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * WIP #114: iOS DRIVE hooks, XCUITest tapper; iOS gallery 191/191 on iPhone 17e Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * WIP #114: verify-apple shim-device step, sbt-thicket thicketDeviceApple, README Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * WIP #114: docs, decision log, scalafmt exclude for the generated DeviceShim.scala Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * WIP #114: catch a leftover refusal (notYetAsked, failed DRIVE fails), settle 30 s before a fresh install Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * WIP #114: uninstall at the end of a fresh-install run instead of a settle Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * #114: macOS measured unlocked: gallery 195 (185 + 10), occlusion control 4 FAIL hidden -> Background 49 ms, unhidden -> Foreground 33 ms, minimised 595 ms, restored 528 ms. bin/verify-apple.sh "iPhone 17e": 17/17 steps on 9cff276; iOS gallery 191 (179 + 12), macOS gallery 195 twice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Roberto Leibman <rleibman@magrathea.local> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…ider (#135) * Share: thicket-share and -android, files served by Thicket's own provider docs/16 §16.10 item 5, to the owner's decision of 2026-11-01: a framework ContentProvider the app declares in its manifest, not AndroidX's FileProvider. - thicket-share: Share.text, Share.file, availability; SharedFiles (copies served only from their own directory, with their type; pruned after a day); RecordingShare; Share.unavailable for GTK. - thicket-share-android: ACTION_SEND through the chooser. ThicketFileProvider, not exported, read-only, serves only <cache>/thicket-shared, under FLAG_GRANT_READ_URI_PERMISSION and the intent's ClipData. Undeclared, a file share throws naming the element. Measured: - checkLinux (with-keyring, 8 GB): exit 0; ShareSpec 5/5, JVM and Native. - GTK gallery 137 (136 + 1), todo 69, under a headless gnome-shell (desktop locked). - Android gallery 85/85 (81 + 4) on s2test: build.sh taps the gallery's own share target in the real chooser; text and file (name, type, bytes) arrive, and the provider logs com.android.intentresolver reading the file through the grant. Falsified: without the grant, the share sheet's read disappears and that check fails. Found: ART has no Files.writeString/readString; the first run threw NoSuchMethodError. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Refactor sharing process with error handling Refactor sharing logic to use Try for error handling. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…macOS Location.unavailable (#118) (#138) * WIP #114: thicket-device-apple, its Swift library and the thk_dev ABI Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * WIP #114: the Apple galleries' device checks Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * WIP #114: iOS DRIVE hooks, XCUITest tapper; iOS gallery 191/191 on iPhone 17e Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * WIP #114: verify-apple shim-device step, sbt-thicket thicketDeviceApple, README Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * WIP #114: docs, decision log, scalafmt exclude for the generated DeviceShim.scala Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * WIP #114: catch a leftover refusal (notYetAsked, failed DRIVE fails), settle 30 s before a fresh install Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * WIP #114: uninstall at the end of a fresh-install run instead of a settle Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * 10000 #114: macOS measured unlocked: gallery 195 (185 + 10), occlusion control 4 FAIL hidden -> Background 49 ms, unhidden -> Foreground 33 ms, minimised 595 ms, restored 528 ms. bin/verify-apple.sh "iPhone 17e": 17/17 steps on 9cff276; iOS gallery 191 (179 + 12), macOS gallery 195 twice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * WIP #118: thicket-location-apple over CLLocationManager in libthicketdevice; gallery location checks Untested on the simulator yet. thk_dev_location_* (5 functions) in DeviceAbi; DeviceConsistencySpec 7/7. libthicketdevice.a 91 KB macOS / 92 KB simulator (43 / 46 KB before). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * WIP #118: iOS gallery waits up to 6 min Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * WIP #118: iOS location self-test passes on iPhone Air, 199 checks (191 + 8) The background check records what the section shows while away: iOS suspends the app, so a 3 s timer set in the background never fired (the first runs timed out there). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * WIP #118: docs 14, 16, the location, device and gallery READMEs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * #118: decision log and docs/12: iOS gallery 199 (191 + 8), macOS 192 locked (191 + 1) Control: without WhileInFront's background stop, 1 FAIL (1 counted, 2 in libthicketdevice) while the on-screen check passes. Found: on a just-booted simulator getNotificationSettings exceeds the 5 s cap on 3 of 7 boots (with or without CoreLocation), read as Denied (#114). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * #118: decision log: verify-apple.sh "iPhone Air" 17/17 on 2e2d61a Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * #118: decision log: it was the first full run that failed getting-started Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Apple device lifecycle and permissions: thicket-device-apple, the galleries' Device section (#114) (#132) * WIP #114: thicket-device-apple, its Swift library and the thk_dev ABI Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * WIP #114: the Apple galleries' device checks Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * WIP #114: iOS DRIVE hooks, XCUITest tapper; iOS gallery 191/191 on iPhone 17e Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * WIP #114: verify-apple shim-device step, sbt-thicket thicketDeviceApple, README Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * WIP #114: docs, decision log, scalafmt exclude for the generated DeviceShim.scala Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * WIP #114: catch a leftover refusal (notYetAsked, failed DRIVE fails), settle 30 s before a fresh install Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * WIP #114: uninstall at the end of a fresh-install run instead of a settle Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * #114: macOS measured unlocked: gallery 195 (185 + 10), occlusion control 4 FAIL hidden -> Background 49 ms, unhidden -> Foreground 33 ms, minimised 595 ms, restored 528 ms. bin/verify-apple.sh "iPhone 17e": 17/17 steps on 9cff276; iOS gallery 191 (179 + 12), macOS gallery 195 twice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Roberto Leibman <rleibman@magrathea.local> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> * Share: thicket-share and -android, files served by Thicket's own provider (#135) * Share: thicket-share and -android, files served by Thicket's own provider docs/16 §16.10 item 5, to the owner's decision of 2026-11-01: a framework ContentProvider the app declares in its manifest, not AndroidX's FileProvider. - thicket-share: Share.text, Share.file, availability; SharedFiles (copies served only from their own directory, with their type; pruned after a day); RecordingShare; Share.unavailable for GTK. - thicket-share-android: ACTION_SEND through the chooser. ThicketFileProvider, not exported, read-only, serves only <cache>/thicket-shared, under FLAG_GRANT_READ_URI_PERMISSION and the intent's ClipData. Undeclared, a file share throws naming the element. Measured: - checkLinux (with-keyring, 8 GB): exit 0; ShareSpec 5/5, JVM and Native. - GTK gallery 137 (136 + 1), todo 69, under a headless gnome-shell (desktop locked). - Android gallery 85/85 (81 + 4) on s2test: build.sh taps the gallery's own share target in the real chooser; text and file (name, type, bytes) arrive, and the provider logs com.android.intentresolver reading the file through the grant. Falsified: without the grant, the share sheet's read disappears and that check fails. Found: ART has no Files.writeString/readString; the first run threw NoSuchMethodError. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Refactor sharing process with error handling Refactor sharing logic to use Try for error handling. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Roberto Leibman <rleibman@magrathea.local> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…as merged #132 merged as a squash and #138 (location) merged since. So this tree is main plus #137's own change, its difference from #132's final commit. Eight conflicts, each a location-beside-motion addition kept on both sides: the gallery's dependencies and services, the self-test chain (device, location, motion, clipboard), and the docs rows. Generated files regenerated (4 thk_mot functions). Measured on the result, "iPhone 17e": bin/verify-apple.sh 17 of 18, macOS gallery 200 per run and iOS 206 + 1 FAIL. The failure is #132's cold-boot notifications flake ("not yet asked" read as Denied). The iOS gallery re-run on the warm simulator: 207/207. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Closes #120.
Built on #132 (
issue/114-apple-device), which must merge first. The diff againstmainincludes #132's commits until then.What
thicket-motion-ios(modules/motion-ios):IosMotionProvider, aMotionProvideroverCMMotionManager, andIosMotion()=Motion(IosMotionProvider, AppleLifecycle). The lifecycle comes fromthicket-device'sWhileInFront, as on Android.libthicketmotion.a(15 056 bytes, iOS simulator only). Swift rather than C because thestart…Updates(to:withHandler:)handlers are blocks.CMMotionManagerisAPI_UNAVAILABLE(macos).sbt-thicket's iOS plugin gainsthicketMotionIosto unpack it.MotionAbiin shim-gen (thk_mot_*, 4 functions) withMotionConsistencySpec(7 tests). A newVec3Cbcallback type passes a sample as three doubles, not a struct.stop…Updates.modules/motion/README.md's convention. The simulator has no motion hardware and I had no device to check it on. If a device flat on a table reads -9.8, drop the minus inIosMotionProvider.acceleration.docs/09§9.11.Motion.unavailable("no motion sensors on the desktop yet"), as GTK does.MotionDemo.sensorsLabelnow shows each unavailable sensor's reason. This is shared code, and GTK's expected label is computed with the same function.bin/verify-apple.shhas a newshim-motionstep..scalafmt.confexcludes the generatedMotionShim.scala.Measured
IosMotionProviderunder the realAppleLifecycleis started 0 times;is…Activeis false for all three);Motion.applyignoring availability, the start-count check fails (3 start(s) for 0 available, 1 FAIL). Restored, it passes.shimGen37/37.bin/verify-apple.sh "iPhone 17e": 18/18 onef811a1, before merging Apple device lifecycle and permissions: thicket-device-apple, the galleries' Device section (#114) #132's moved base.3f6ea69, it passed 17/18, twice. Both timesios-galleryfailed only Apple device lifecycle and permissions: thicket-device-apple, the galleries' Device section #114's "notifications start … not yet asked" check: a "Don't Allow" survived the reboot and the uninstall.simctl privacy reset alland one more run, the iOS gallery passed with 196.Not done
GalleryMotionChecksis written but has never run.=== DRIVE geo … ===line and lost a check line. Details are in the decision log.🤖 Generated with Claude Code