8000 Apple device lifecycle and permissions: thicket-device-apple, the galleries' Device section (#114) by rleibman · Pull Request #132 · rleibman/thicket · GitHub
[go: up one dir, main page]

Skip to content

Apple device lifecycle and permissions: thicket-device-apple, the galleries' Device section (#114) - #132

Merged
rleibman merged 11 commits into
mainfrom
issue/114-apple-device
Nov 2, 2026
Merged

rleibman merged 11 commits into
mainfrom
issue/114-apple-device

Conversation

@rleibman
Copy link
Copy Markdown
Owner

Closes #114.

thicket-device-apple (in platforms): the app's lifecycle and permissions on macOS and iOS. Both Apple galleries now pass device = Some(AppleDevice()), and their self-tests check the Device section through the real notifications.

What it is

  • A Swift library of its own, in the jar (modules/device-apple/shim, libthicketdevice.a, 43 KB macOS / 46 KB simulator), modelled on thicket-http-apple. I chose Swift over a C helper because the observers are block-based NotificationCenter registrations, the permission APIs take completion blocks, and Apple location: thicket-location-apple over CLLocationManager (iOS); macOS Location.unavailable #118 needs a CLLocationManagerDelegate, which is an Objective-C class. An app without the module links none of it, and none of UserNotifications or AVFoundation.
  • The ABI is DeviceAbi in tools/shim-gen (thk_dev_*, 9 functions, its own callback typedefs), checked by DeviceConsistencySpec (7 tests). Unlike HTTP it calls back into Scala, but only on the main thread: answers that arrive on another queue are moved there first. Every callback is wrapped in GcState.guarded.
  • iOS lifecycle: Foreground runs from a scene's willEnterForeground to the last scene's didEnterBackground. It does not use activation. In a probe, the notifications alert did not even deactivate the scene, and a headless simulator never activated a scene at all. Terminate is UIApplication.willTerminateNotification. simctl terminate never sends it.
  • macOS lifecycle: NSApp.occlusionState, through one notification that covers hide, minimise, order-out and being covered. It means "on screen", not "active", which matches GTK. While the screen is locked every window is occluded, so the app is in the background. Terminate is NSApplication.willTerminateNotification.
  • Permissions:
    • Camera and microphone go through AVCaptureDevice; notifications through UNUserNotificationCenter (provisional counts as Granted). Restricted is real on Apple. Not yet asked reads as Denied.
    • A missing NSCameraUsageDescription / NSMicrophoneUsageDescription throws IllegalStateException naming the key, because iOS would terminate the app instead.
    • Notifications outside an app bundle also throw: UNUserNotificationCenter raises there, and the macOS gallery is a plain executable.
    • Location throws UnsupportedOperationException until Apple location: thicket-location-apple over CLLocationManager (iOS); macOS Location.unavailable #118.
  • sbt-thicket: a new thicketDeviceApple task unpacks and links the library, and ThicketNativeFlags.appleDevice has a test in SharedFlagsSpec.

Answering the alert: XCUITest

Nothing else can tap the simulator headlessly:

  • simctl has no tap;
  • simctl privacy has no notifications service;
  • a logic test may not use XCUIApplication ("Device is not configured for UI testing");
  • System Events has no assistive access here (-1719).

examples/ios-host/tapper is a UI-testing bundle with no target app that taps SpringBoard's button (~8 s a tap). run-ios-app.sh gains:

  • drive, for [gallery] DRIVE home|front|deny lines, as on Android;
  • EXTRA_LIBS, USAGE_STRINGS, FRESH_INSTALL and PRIVACY_GRANT.

A DRIVE action that fails now fails the run.

Measured

bin/verify-apple.sh "iPhone 17e": 17/17 steps on 9cff276. There is one new step, shim-device, and abi now includes DeviceConsistencySpec.

  • iOS gallery 191 (179 + 12):
    • Settings over the app → B 8000 ackground in 4.0–4.6 s from the DRIVE line;
    • relaunch → Foreground in 0.6–1.3 s, the same process;
    • "Don't Allow" → Denied in 6–16 s;
    • asked again → Denied at once, with no alert;
    • the microphone, granted by simctl privacy, → Granted;
    • the camera's missing usage string throws;
    • the terminate hook runs on a posted willTerminateNotification;
    • the app stayed in the foreground under the alert.
  • macOS gallery 195 (185 + 10), twice:
    • hidden → Background in 49 ms, unhidden → Foreground in 33 ms;
    • minimised → Background in 595 ms, restored → Foreground in 528 ms;
    • notifications throw outside an app bundle;
    • the terminate hook runs from a real NSApp.terminate and prints the verdict, so a hook that never runs leaves no verdict.
    • With the screen locked, the lifecycle checks are skipped and the run says so: 191 (185 + 6).

Controls (each fix removed, then restored)

  • iOS:
    • no didEnterBackground observer → the app is suspended unseen and the run ends with no verdict;
    • no willEnterForeground → 2 FAIL;
    • answers not delivered → 3 FAIL;
    • no will-terminate observer → 1 FAIL;
    • no usage-string check → 1 FAIL (Success(Denied)).
  • macOS:
    • no will-terminate observer → no verdict;
    • no occlusion observer → 4 FAIL.

Found on the way

The first full verify passed even though the alert was never shown.

  • Cause: on a just-booted simulator, uninstalling did not forget an earlier "Don't Allow" (7 of 9 tries). Uninstalled in the boot it was given in, it was forgotten every time (9 tries).
  • Fixes:
    • the self-test checks that the permission is not yet asked (AppleDevice.testing.notYetAsked);
    • a failed DRIVE fails the run;
    • a fresh-install run also uninstalls at its end;
    • the tapper skips xcodebuild's failure sysdiagnose, which had held a failed tap for 10 minutes.

For #118 / #120

  • Add Permission.Location (code 0) to DeviceShim.swift's status, permission_missing and request (requestWhenInUseAuthorization plus a delegate in the same file), and flip the gallery's "Location throws" check.
  • AppleLifecycle.state is what WhileInFront follows.

Not done

  • A real notifications answer on macOS. It needs an app bundle, and the prompt there is a Notification Center banner that cannot be clicked headlessly.

🤖 Generated with Claude Code

Roberto Leibman and others added 8 commits October 30, 2026 13:39
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>
Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

An unresolved active finding remains, namely a misplaced Scaladoc comment that no longer documents the generic checker adapter while leaving storageChecks undocumented.

1 open issue
What changed in this PR

This PR implements the Apple half of thicket-device (#114): app lifecycle and permissions on macOS and iOS. It adds a new thicket-device-apple module backed by its own Swift static library (libthicketdevice.a, carried in the jar like thicket-http-apple), wires AppleDevice() into both Apple galleries, and adds gallery self-tests that exercise the Device section through real platform notifications — including an XCUITest "tapper" to answer the iOS notifications alert headlessly. The surface follows the established shim-gen contract (ABI → C header → Scala externs → Swift), with a new DeviceAbi and DeviceConsistencySpec enforcing no drift.

Changes:

  • New thicket-device-apple module: DeviceShim.swift (lifecycle via scene/occlusion notifications, permissions via AVCaptureDevice/UNUserNotificationCenter, main-thread callback delivery), AppleDevice/AppleLifecycle/ApplePermissions, generated DeviceShim.scala/thicket_device.h, and DeviceAbi + DeviceConsistencySpec.
  • Build/plumbing: build.sbt module + packaging + platforms aggregate, ThicketNativeFlags.appleDevice, ThicketDeviceApple unpack plugin, SharedFlagsSpec, .scalafmt.conf exclusion.
  • Gallery + test harness: GalleryDeviceChecks, GallerySelfTest terminate-hook verdict, run-ios-app.sh drive/EXTRA_LIBS/USAGE_STRINGS/FRESH_INSTALL/PRIVACY_GRANT, tapper XCUITest project, verify-apple.sh step, plus docs updates.
File Description
tools/​shim-gen/​.../​DeviceAbi.scala New thk_dev_* ABI (9 fns, own callback typedefs)
tools/​shim-gen/​.../​DeviceConsistencySpec.scala 7 tests enforcing header/externs/Swift/ABI agreement
tools/​shim-gen/​.../​Parse.scala Skips self-defined typedef callback lines
tools/​shim-gen/​.../​Emit.scala, Main.scala Generate device header + Scala externs
modules/​device-apple/​.../​DeviceShim.swift Swift lib: lifecycle observers, permissions, main-thread delivery
modules/​device-apple/​.../​AppleDevice.scala, DeviceShim.scala Scala lifecycle/permissions + generated externs
modules/​device-apple/​shim/​* Header, build script, .gitignore
tools/​sbt-thicket/​* appleDevice flags, unpack plugin, test
build.sbt, .scalafmt.conf, bin/​verify-apple.sh Module wiring, packaging, verify step
examples/​gallery/​.../​GalleryDeviceChecks.scala, GallerySelfTest.scala Device self-test checks + terminate-hook verdict
examples/​gallery/​{macos,ios}/​..., Gallery.scala Pass device = Some(AppleDevice())
examples/​ios-host/​{run-ios-app.sh,tapper/​*}, gallery build-app.sh DRIVE harness + XCUITest tapper
docs/​*, README.mds Status/decision/release/doc updates

The implementation is cohesive, closely mirrors the existing thicket-http-apple pattern, and is backed by measured controls. I noted one documentation issue: a storageChecks Scaladoc that the refactor left misattached to the new checker adapter in GallerySelfTest.scala. Note that much of this change is Apple-only native/FFI code whose runtime correctness can only be validated on a Mac/simulator, which this review environment cannot build or run.

Review effort: Balanced

…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>
@rleibman
rleibman commented Nov 1, 2026
Copy link
Copy Markdown
Owner Author

A finding from #137 (#120, stacked on this PR), worth knowing before merging: on the merged branch, ios-gallery failed #114's "notifications start Denied, not yet asked" check in 3 of 3 full bin/verify-apple.sh runs on "iPhone 17e". A "Don't Allow" from an earlier run survived the reboot and the uninstall, so the end-of-run uninstall fix didn't hold there. After xcrun simctl privacy "iPhone 17e" reset all and one more run, it passed (196 checks). My own run of this PR on "iPhone 18 Pro", a device that had never been asked, passed. So the check is right; the reset between runs is what isn't reliable yet.

@rleibman
rleibman commented Nov 1, 2026
Copy link
Copy Markdown
Owner Author

A likelier cause for the notifications flake above, measured by #138 (#118): on a just-booted simulator, getNotificationSettings sometimes takes longer than notificationStatus()'s 5 s cap. A probe got notYetAsked false after 5002 ms on 3 of 7 fresh boots, and on 1 of 3 boots with no CoreLocation in the app. So it isn't caused by #118. The timeout reads as Denied, which fails "notifications start not yet asked". Twice the request itself never answered, which left the one-at-a-time permission queue stuck and failed the request queued behind it. This may also be what was read as "uninstalling did not forget an earlier Don't Allow". A fix would wait longer for the first settings read on a fresh boot, or treat a timeout as unknown rather than Denied, and time out a request that never answers so the queue moves on.

rleibman and others added 2 commits November 1, 2026 13:43
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>
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>
rleibman added a commit that referenced this pull request Nov 2, 2026
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>
rleibman added a commit that referenced this pull request Nov 2, 2026
Both sides grew the Apple galleries: Services get device, location, clipboard
and haptics; the self-test runs storage -> device -> location -> clipboard ->
sheet -> big list; the Apple galleries depend on locationApple, clipboardApple
and hapticsApple. docs/12, 14 and the decision log keep both sides; its
2026-11-01 entry moved back to the top.

Measured: platforms/Test/compile clean. Shared gallery code is unchanged from
427494e but for #127's Apple-only additions. Not measured: the Apple self-tests
on the combined gallery (the Mac's).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rleibman
rleibman commented Nov 2, 2026
Copy link
Copy Markdown
Owner Author

Merged main in (#127 Apple clipboard/haptics, #136/#139 docs/17). Both sides extend the Apple galleries, so the resolution chains the self-test groups (device → clipboard → sheet → big list) and passes every Apple service in GalleryIos/GalleryMac. platforms/Test/compile is clean here; the combined Apple self-tests have not run. Please re-run bin/verify-apple.sh and update the counts in docs/12 and the decision log. Merge order that avoids more conflicts: #132, then #137 and #138 (both contain #132).

🤖 Generated with Claude Code

@rleibman
rleibman merged commit 4d03133 into main Nov 2, 2026
1 of 2 checks passed
rleibman pushed a commit that referenced this pull request Nov 2, 2026
…rged

#132 merged as a squash, so this tree is main plus #138's own change, the
difference from #132's final commit (5979dc2). One conflict, in the decision
log: main's two new entries (camera preview, share) kept beside this PR's.
The generated DeviceShim.scala and thicket_device.h were regenerated
(14 thk_dev functions).

Measured on the result, "iPhone 17e": bin/verify-apple.sh 17/17, macOS
gallery 199 per run (twice), iOS gallery 202.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rleibman added a commit that referenced this pull request Nov 2, 2026
…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>

* #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>
rleibman pushed a commit that referenced this pull request Nov 2, 2026
…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>
rleibman added a commit that referenced this pull request Nov 2, 2026
…navailable (#120) (#137)

* 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>

* WIP #120: thicket-motion-ios: MotionAbi (thk_mot_*, 4 functions), Swift 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>

* WIP #120: the gallery's Motion section on Apple: IosMotion on iOS, Motion.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>

* WIP #120: thicketMotionIos in sbt-thicket; MotionShim.scala excluded 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>

* WIP #120: docs: decision log, docs/09 §9.11, 12, 14, 16, motion README

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>

* #120: the verify-apple results in the decision log

18/18 on ef811a1; 17/18 twice on the merge 3f6ea69 (#114's leftover notifications refusal after
a reboot; motion checks pass); iOS gallery alone 196, macOS 196 unlocked / 192 locked.

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>

* Apple location: thicket-location-apple over CLLocationManager (iOS); 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>

* #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
10BC8
: 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>

---------

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>
rleibman added a commit that referenced this pull request Nov 3, 2026
#128) (#140)

Every failed apple.yml run since #132 failed ios-gallery on "notifications
start Denied, not yet asked" (5 of 5 checked). verify-apple reboots the
simulator before each iOS step, and right after a boot getNotificationSettings
can take longer than the shim's 5 s cap, which read as denied.

The shim now answers 4, "no answer within 5 s". ApplePermissions.status still
reports it as Denied: the API is unchanged and the main thread waits no
longer. AppleDevice.testing.notYetAsked asks again, up to about 60 s, and logs
the codes it saw.

Measured from a cold boot, "iPhone 18 Pro Max" with the Mac at load average
166: codes 4,4,4,4,4,3 in 28.7 s, and the check passed. A clean full
verify-apple run waits for a quiet machine.

Co-authored-by: Roberto Leibman <rleibman@magrathea.local>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
rleibman added a commit that referenced this pull request Nov 3, 2026
…ntry (#144)

The entry appeared twice: once at the top of the 11-01 group, once between
the 10-30 entries, byte-identical (md5 deec7cd7 for both). It came from my
merge of #132's branch into #138 (bf07e36), which moved the entry back to
the top while git also kept it where the other side had it. Only the copy
out of place is removed; no entry's text changes.

Checked: grep counts the entry's heading once (was twice).

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

Apple device lifecycle and permissions: thicket-device-apple, the galleries' Device section

2 participants

0