Repository navigation
Apple CI: a notifications read that times out is no answer, not Denied (#128) - #140
Conversation
#128) 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: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🔵 Needs a closer look
The Apple Swift shim change cannot be built or run on Linux and the PR itself reports no measured clean full verify-apple.sh run, leaving the fix's end-to-end behavior unverified.
No open issues 🎉
What changed in this PR
This PR fixes a red Apple CI (apple.yml), where the ios-gallery step failed on "notifications start Denied, not yet asked" on every run since #132 merged. The root cause: bin/verify-apple.sh reboots the simulator before each iOS step, and right after a boot UNUserNotificationCenter.getNotificationSettings can take longer than the shim's 5 s cap. Previously the timeout was read as denied, which is indistinguishable from a real "not yet asked" refusal. The fix introduces a distinct shim status code 4 ("no answer within 5 s") so the self-test can retry rather than treat a slow read as a refusal, while keeping the public Permissions API unchanged (code 4 still maps to Denied, so the UI-building main-thread read waits no longer than before).
Changes:
- The Swift shim (
notificationStatus()) returns a new code4instead ofdeniedon the 5 s semaphore timeout;ApplePermissions.statusmaps1 | 3 | 4→Denied. AppleDevice.testing.notYetAskednow re-reads the status up to 12 times (≈60 s, each timeout blocks 5 s) while it keeps seeing4, logging the observed codes, so a transient boot-time slowness no longer fails the self-test.- ABI docs (
DeviceAbi.scala,thicket_device.h) and the decision log are updated to describe code4.
| File | Description |
|---|---|
modules/device-apple/shim/Sources/DeviceShim.swift |
Adds unknown=4 constant and returns it on the notifications settings timeout instead of denied. |
modules/device-apple/src/main/scala/thicket/device/apple/AppleDevice.scala |
Maps code 4 to Denied in status, and makes notYetAsked retry (bounded to ≈60 s) while it reads 4, logging codes. |
tools/shim-gen/src/main/scala/thicket/tools/shim/DeviceAbi.scala |
Updates the thk_dev_permission_status doc to enumerate statuses including 4. |
modules/device-apple/shim/include/thicket_device.h |
Regenerated header doc matching the DeviceAbi change. |
8000
docs/decisions.md |
Appends a dated decision-log entry explaining the fix and its measurement. |
No blocking issues were found. The retry loop is correctly bounded (codes.size < 12), and because each 4 only returns after the shim's 5 s wait, there is no busy-loop risk. The doc-only ABI change is safe for DeviceConsistencySpec, which compares parsed declarations rather than comment text.
One minor, non-blocking observation (outside the changed diff regions, so not filed as a line comment): the file-level status summary in thicket_device.h/DeviceAbi.scala/Emit.scala ("A status is 0 granted, 1 denied, 2 restricted, 3 not yet asked, -1 not supported") still omits the newly added code 4. Worth aligning in a follow-up for documentation completeness.
Review effort: Balanced
|
Full
|
Conflict only in docs/decisions.md: both 2026-11-02 entries kept. The rest merged cleanly. Checked here: sbt scalafmtAll and platforms/Test/compile, 0 errors. Not checked: the Apple self-tests (they need the Mac). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Closes #128.
Why Apple CI is red now
Every failed
apple.ymlrun since #132 merged fails one step,ios-gallery, on "notifications start Denied, not yet asked". I checked 5 of 5: 41391530485, 41390412068, 41374569722, 41374441105, 41374248305.bin/verify-apple.shreboots the simulator before each iOS step. Right after a boot,getNotificationSettingscan take longer than the shim's 5 s cap, and the cap read asdenied.The fix
ApplePermissions.statusstill reports it asDenied. The API is unchanged, and the main thread waits no longer. The gallery reads this status while building its screen, so a longer wait there would freeze the UI.AppleDevice.testing.notYetAskedasks again, for up to about 60 s, and logs the codes it saw.Measured
4read as Denied, so the check fails[device] Notifications status codes 4,4,4,4,4,3 in 28697 ms, and the check passesNot yet measured: a clean full
verify-apple.shrun. Three agents were building and running simulators, with the load average at 166. Under that load, other checks timed out: pictures painting, and location updates. I'll re-run it when the machine is quiet and post the result here.The rest of #128
maintoo.http-iosapp killed with no output (one run, 41122835117) hasn't recurred.🤖 Generated with Claude Code