8000 Apple CI: a notifications read that times out is no answer, not Denied (#128) by rleibman · Pull Request #140 · rleibman/thicket · GitHub
[go: up one dir, main page]

Skip to content

Apple CI: a notifications read that times out is no answer, not Denied (#128) - #140

Merged
rleibman merged 1 commit into
mainfrom
issue/128-apple-ci
Nov 3, 2026
Merged

rleibman merged 1 commit into
mainfrom
issue/128-apple-ci

Conversation

@rleibman
@rleibman rleibman commented Nov 2, 2026
Copy link
Copy Markdown
Owner

Closes #128.

Why Apple CI is red now

Every failed apple.yml run 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.sh reboots the simulator before each iOS step. Right after a boot, getNotificationSettings can take longer than the shim's 5 s cap, and the cap read as denied.

The fix

  • The shim answers a new code, 4, meaning "no answer within 5 s".
  • ApplePermissions.status still reports it as Denied. 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.notYetAsked asks again, for up to about 60 s, and logs the codes it saw.

Measured

Run Result
Before, from a cold boot 4 read as Denied, so the check fails
After, from a cold boot (iPhone 18 Pro Max, Mac load average 166) [device] Notifications status codes 4,4,4,4,4,3 in 28697 ms, and the check passes

Not yet measured: a clean full verify-apple.sh run. 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

🤖 Generated with Claude Code

#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>
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.

🔵 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 code 4 instead of denied on the 5 s semaphore timeout; ApplePermissions.status maps 1 | 3 | 4 → Denied.
  • AppleDevice.testing.notYetAsked now re-reads the status up to 12 times (≈60 s, each timeout blocks 5 s) while it keeps seeing 4, 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 code 4.
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

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

Full bin/verify-apple.sh "iPhone 18 Pro Max" run on c5557ce: 17 of 18 steps passed. It ran while holding the shared lock, with the Mac's load average at 20–124 because other agents were compiling.

  • The notifications check now passes: [device] Notifications status codes 3 in 3 ms.
    • The earlier cold-boot run read 4,4,4,4,4,3 in 28.7 s and passed through the retry.
  • The one failure is unrelated to this PR: ios-gallery, "and the platform paints each one".
    • Two thin glyphs, Remove (minus) and More (ellipsis), painted exactly 2.0% of their buttons.
    • The check requires f > 0.02 (GallerySelfTest.scala:1406–1411).
    • It failed the same way in my first cold-boot run on this simulator model, a model not used for these runs before. So it looks like a threshold right at the edge for this screen, not load.
    • I haven't changed it here. Two ways to fix it, if you want: make the bound >= 0.02, or measure those two glyphs against their own floor.
  • The rest: macOS gallery 392 ok over 2 runs; iOS gallery 206 ok with that one failure. All other steps passed, getting-started among them.

@rleibman
rleibman merged commit df84d01 into main Nov 3, 2026
1 of 3 checks passed
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 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>
rleibman added a commit that referenced this pull request Nov 3, 2026
Conflict only in docs/decisions.md: both 2026-11-02 entries kept.

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.

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.

2 participants

0