Repository navigation
Apple pickers: thicket-pickers-apple over PHPicker, UIDocumentPicker, NSOpenPanel/NSSavePanel (#125) - #142
Merged
Conversation
…), Swift library, ApplePickers shimGen/testFull 44/44 (PickersConsistencySpec 7). libthicketpickers.a 68 128 bytes (macOS), 93 904 bytes (simulator). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
macOS gallery: 209 ok, 0 FAIL (196 + 13 picker checks); photo copied into the cache 282 ms after the answer. macOS 27's panels are out of process (openAndSavePanelService): the sheet, its configuration and its own cancel: are the real panel's; the accept is testing.choose. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… photo and document; verify-apple shim-pickers; sbt-thicket thicketPickersApple XCUITest reaches PHPickerViewController's grid and the document browser through the app's accessibility tree (measured on iPhone 17e with a probe app): photo, cancel, document and export each tapped in ~5 s; a test that touched an app takes 300 s to tear down, so the app actions exit(0) once tapped (18 s per tap.sh run instead of 314 s). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Control on macOS: with PickedFiles' copy removed (the original path handed back), the gallery fails 2 checks (photo and document not in the cache); restored, 209 ok, 0 FAIL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…y once the last is dismissed iOS gallery on iPhone 17e, before these: the deny tap's 300 s teardown held up every later DRIVE line (11 FAIL); then the photo pick passed (copied 7 160 ms after the tap) but the next picker, presented while the first was animating away, was dropped by UIKit (6 FAIL). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… a failed step iOS gallery on iPhone 17e: ALL CHECKS PASSED, 218 ok (207 + 11 picker checks). The photo copied into the cache 7 309 ms after the tap; the saved file read back from Files (31 bytes). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… 13) Controls, PickedFiles' copy removed: macOS 2 FAIL, iOS 2 FAIL (the photo handed back from PhotosUI's temp directory; the document already deleted from the Inbox). Restored, both pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…S gallery 218 and todo 83 alone ios-gallery failed on the known fresh-boot notifications trap (its 11 picker checks passed); ios-todo (no pickers linked) failed 4 presentation checks. Both pass alone on the warm simulator. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Note
Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.
🟡 Changes recommended
Approval is blocked because the review evidence reports two critical issues—an invalid JVM-to-Scala-Native sbt dependency and a likely non-compiling discard() implementation—plus a resource leak from an unclosed Files.list stream.
2 open issues
What changed in this PR
This pull request adds the Apple implementation of thicket-pickers by introducing a new Scala Native module (thicket-pickers-apple) backed by a Swift shim, and wires it into the iOS/macOS gallery examples, verification scripts, and shim-gen tooling.
Changes:
- Add
modules/pickers-apple(Scala Native + Swift) implementing photo/document pickers on iOS (PHPicker/UIDocumentPicker) and macOS (NSOpenPanel/NSSavePanel), copying picked files into the cache and returning results on the main thread. - Extend
tools/shim-genwith aPickersAbisurface plus emit/parse/consistency tests for the newthk_pick_*ABI. - Update sbt tooling, examples, verification scripts, and documentation to support building/driving/testing Apple pickers.
Approval Readiness
This pull request requires changes.
| File | Notes |
|---|---|
tools/shim-gen/src/test/scala/thicket/tools/shim/PickersConsistencySpec.scala |
Adds consistency tests to keep pickers header/externs/Swift shim aligned. |
tools/shim-gen/src/main/scala/thicket/tools/shim/PickersAbi.scala |
Defines the thk_pick_* ABI surface for shim generation. |
tools/shim-gen/src/main/scala/thicket/tools/shim/Parse.scala |
Updates parsing support for pickers callback typedef/typealias. |
tools/shim-gen/src/main/scala/thicket/tools/shim/Main.scala |
Wires pickers header/extern outputs into shim-gen. |
tools/shim-gen/src/main/scala/thicket/tools/shim/Emit.scala |
Emits pickers header and Scala externs. |
tools/sbt-thicket/src/test/scala/thicket/sbt/SharedFlagsSpec.scala |
Adds tests for new native flag/linking helpers. |
tools/sbt-thicket/src/main/scala/thicket/sbt/ThicketApplePlugins.scala |
Adds plugin support to unpack/use the pickers shim artifacts. |
tools/sbt-thicket/shared/src/main/scala/thicket/sbt/ThicketNativeFlags.scala |
Adds Apple pickers native linking flags helper. |
tools/sbt-thicket/README.md |
Documents new pickers-related sbt tasks/behavior. |
modules/pickers/README.md |
Updates pickers documentation to include the Apple implementation. |
modules/pickers-apple/src/main/scala/thicket/pickers/apple/PickersShim.scala |
Adds generated Scala Native extern bindings for the pickers ABI. |
modules/pickers-apple/src/main/scala/thicket/pickers/apple/ApplePickers.scala |
Implements Apple pickers behavior (copy-to-cache, save staging, UI-thread delivery). |
modules/pickers-apple/shim/Sources/PickersShim.swift |
Swift shim implementing thk_pick_* over iOS/macOS pickers and test hooks. |
modules/pickers-apple/shim/include/thicket_pickers.h |
Generated C header describing the pickers ABI. |
modules/pickers-apple/shim/build-shim.sh |
Build script for libthicketpickers.a (macOS + iOS simulator). |
modules/pickers-apple/.gitignore |
Ignores built shim outputs. |
examples/ios-host/tapper/TapperUITests/TapperUITests.swift |
Extends UI tests to drive picker flows and adjusts teardown behavior. |
examples/ios-host/tapper/tap.sh |
Updates tapper driver script for new actions/log-based success detection. |
examples/gallery/README.md |
Documents how Apple pickers are exercised/validated in the gallery. |
examples/gallery/macos/src/main/scala/example/gallery/GalleryMac.scala |
Wires Apple pickers into the macOS gallery. |
examples/gallery/ios/src/main/scala/example/gallery/GalleryIos.scala |
Wires Apple pickers into the iOS gallery. |
examples/gallery/ios/ios-app/build-app.sh |
Adds simulator setup and verification steps for picker-driven flows. |
examples/gallery/apple-shared/src/main/scala/example/gallery/GallerySelfTest.scala |
Integrates picker checks into the shared Apple gallery self-test. |
examples/gallery/apple-shared/src/main/scala/example/gallery/GalleryPickerChecks.scala |
Implements self-test checks for picker behaviors and invariants. |
docs/decisions.md |
Records design/constraints/measurements for Apple pickers. |
docs/16-device-services.md |
Updates device-services documentation to reflect Apple pickers support. |
docs/14-releasing.md |
Updates release docs to include the new pickers-apple artifact. |
docs/12-component-status.md |
Updates component status/test counts for pickers and shim-gen. |
build.sbt |
Adds the pickersApple module and wires it into builds/examples/tooling. |
bin/verify-apple.sh |
Adds a shim-pickers verification step and updates Apple verification flow. |
.scalafmt.conf |
Excludes generated externs from scalafmt. |
Review effort: Balanced
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Refactor staged file check to ensure resource closure. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
e67724d replaced `discard` but also removed `dir`, `file` and the `onWorker(...) { written =>` that opens the block, so the file no longer parsed (scalafmt: "`end of file` expected but `}` found" at line 100). The three lines are back; the autofix's `discard` is kept. Checked here: sbt scalafmtAll and platforms/Test/compile, 0 errors (it failed before this change). Not checked: the Apple self-tests (they need the Mac). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both PRs add a gallery section and a tapper action, so they meet in ten files: - build.sbt, GalleryIos, GalleryMac: both shareApple and pickersApple, both services. - GallerySelfTest: motion -> share -> clipboard -> pickers -> sheet. Share stays before the clipboard (its "Copy" must not be the last copy, #134). - build-app.sh drive(): the four picker actions and share-copy. - Tapper: both fixes for XCTest's 300 s tear-down kept. TapperUITests keeps #125's actions and exit(0), with #134's '<bundle id>|<label>' tap first (ending in done() too); tap.sh is #134's wait-and-kill loop, passing #125's TEST_RUNNER_APP and TEST_RUNNER_FILE, rebuilt when a .swift is newer. - docs/12: both counts, noted as measured apart. docs/14: both modules. decisions.md: both entries. Checked here: sbt scalafmtAll and platforms/Test/compile, 0 errors; bash -n on tap.sh and build-app.sh. Not checked: the Swift tapper compiling, and any Apple self-test (they need the Mac); the combined gallery is unmeasured. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rleibman
added a commit
that referenced
this pull request
Nov 3, 2026
Both add a Swift library through shim-gen and sbt-thicket, and a gallery section driven by the tapper, so they meet in 17 files; everything is kept: - shim-gen: Emit has pickers' and camera's header/extern emitters (main's file plus #143's two functions), Main generates all, Parse knows both callback types. sbt-thicket: ThicketPickersApple and ThicketCameraApple, both keys and settings. .scalafmt.conf excludes both generated externs. - build.sbt, verify-apple.sh (shim-pickers and shim-camera), docs 12/14/16. - Galleries: GallerySelfTest.run takes camera and pickers; the chain is motion -> camera -> share -> clipboard -> pickers -> sheet. GalleryIos builds both. build-app.sh links both libraries, has both DRIVE action sets (pick-photo/cancel-photo/... and photo/cancel), WAIT_SECONDS 600 (each alone fit in 480; together not measured). - Tapper: main's actions (#125, #134) with #129's "app <id> a|b" form checked first; done() now prints "[tapper] done", which every form ends with, and tap.sh is #143's wait-and-kill loop on done/failed, passing #125's TEST_RUNNER_APP and TEST_RUNNER_FILE. Checked here: sbt scalafmtAll and platforms/Test/compile, 0 errors; shimGen 51/51 (with the next commit), sbtThicket 13/13; bash -n on tap.sh and build-app.sh. Not checked: the Swift (tapper, shims) compiling, and any Apple self-test; the gallery with both sections is unmeasured. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rleibman
added a commit
that referenced
this pull request
Nov 3, 2026
Conflict only in docs/decisions.md: both 2026-11-02 entries kept, the embedding point's on top. #142 is Apple code, the Apple galleries and tooling, so the GTK (144) and Android (95) counts measured on this branch stand. Checked here: sbt scalafmtAll, Test/compile and platforms/Test/compile, 0 errors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rleibman
added a commit
that referenced
this pull request
Nov 4, 2026
…ple (#147) #142 and #143 each added their Apple module (Scala Native) to the Android gallery's dependsOn, beside the Android one; the Android gallery uses neither, and build.sh packages its own jar list, which never had them. Measured: galleryAndroid/compile and platforms/Test/compile, 0 errors; SELFTEST=1 examples/gallery/android/build.sh on s2test, 95 checks, ALL CHECKS PASSED (95 before as well). Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Closes #125.
What
thicket-pickers-apple: the Apple half ofthicket-pickers, a Swift library of its own (libthicketpickers.a), inplatforms. Both Apple galleries passpickers = Some((photos, documents)).PHPickerViewController(images,selectionLimit = limit),UIDocumentPickerViewController(forOpeningContentTypes:asCopy: true), andforExporting:asCopy: trueforsave.NSOpenPanel/NSSavePanelas sheets on the gallery's window.PickedFileson a worker thread. Results arrive on the main thread. A cancel answers empty, orNoneforsave. Only one picker can be up at a time..cbut not.m.PickersAbiintools/shim-gen(11thk_pick_*functions, one callback type), checked byPickersConsistencySpec(shimGen 37 → 44).sbt-thicketgainsthicketPickersAppleandThicketNativeFlags.applePickers.bin/verify-apple.shgains ashim-pickersstep.Measured
bin/verify-apple.sh "iPhone 17e"on f861be4Controls. With
PickedFiles' copy removed (the original path handed back):NoSuchFileException).verify-apple: two steps failed in the full run.
ios-galleryhit the known fresh-boot trap: Apple device lifecycle and permissions: thicket-device-apple, the galleries' Device section #114's notifications check failed, so no alert came (4 FAIL). Its 11 picker checks passed.ios-todofailed 4 sheet/alert presentation checks. The todo app links no pickers.How it is driven
photo,cancel,documentandexport.build-app.shadds the logo withsimctl addmedia, puts a text file in "On My iPhone", and checks the saved file afterwards.openAndSavePanelServiceeven for an unsandboxed app:-[NSSavePanel ok:]raises "not implemented", and neither key events nor (untrusted) accessibility reach the panel's buttons.NSUseRemoteSavePanel=NOgives an in-process open panel, but only to a process with a bundle id; the save panel stays remote.cancel(_:). It answers an accept withApplePickers.testing.choose, which uses the panel's own completion with a known file.Found on the way
exit(0)s after tapping, andtap.shreads its "tapped" line.🤖 Generated with Claude Code