Skip to content

fix: re-arm daily limits iOS drops and show when they can't start - #137

Merged
ykisana merged 1 commit into
mainfrom
fix/daily-limit-registration
Nov 19, 2026
Merged

ykisana merged 1 commit into
mainfrom
fix/daily-limit-registration

Conversation

@ykisana

@ykisana ykisana commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Three ways Max Daily Limits could be off with nothing showing it:

  1. iOS drops the limits' activity. UsageLimitService.registerAll returned early whenever the saved fingerprint matched, without checking that iOS still lists usageLimits_daily. Developers report that iOS sometimes drops registered activities. The limits then stayed off until the next day's first open or an edit. Schedules already re-register when iOS no longer lists them.
  2. iOS refuses to start them. For example, at iOS's 20 schedules-and-timers limit (schedules register first), every limit is off. That only went to the OS log.
  3. No way to tell why a threshold was dropped. The monitor dropped threshold callbacks within 10 s of registering, or too soon after the reset, without saying so. That made the limit reports hard to diagnose.

Fix

  1. When nothing changed but iOS no longer lists usageLimits_daily, Normal registers the limits again.

  2. When iOS refuses to start them:

    • Max Daily Limits shows a red notice.
    • Home › Status shows the limits as Off with the reason:
      • at the activity limit: "Daily limits are off: iOS only tracks 20 schedules and timers at once. Turn off a schedule and they'll start the next time you open Normal."
      • otherwise: "Daily limits are off: iOS couldn't start them. Normal tries again each time you open it."
    • It clears once registration works or every limit is removed.
  3. Debug builds log to CallbackLog:

    • when limits register;
    • whether the monitor kept each threshold ("reached", "warning") or dropped it, with the reason.

    These logs pinned down the bug fix: count a new daily limit from when it's set on its first day #135 fixes: on a device, a limit added after its apps were already over fired 0.1 s after registering and was dropped.

Tests

  • New unit tests:
    • an unchanged, registered set isn't touched;
    • an unchanged set is registered again once iOS stops listing it (fails without the fix);
    • the activity-limit error is reported until registration succeeds;
    • other errors show the general message;
    • removing every limit clears the error;
    • with 19 schedules filling iOS's 20 slots, a new limit reports "too many" until a schedule is turned off, then registers.
  • Both problems reproduce on main with the real services and a fake iOS activity center:
    • with 19 enabled schedules, a newly added limit is never registered and still reads "Available";
    • once the activity is gone, reopening the same day doesn't register it again.
  • All limits share one iOS activity (usageLimits_daily), so any number of limits uses one of the 20 slots.
  • Unit: 916/916 (iOS 17.5).
  • UI on iOS 17.5: 62/62.
  • Checked the notice on Max Daily Limits and Status with a forced failure, in a temporary probe that isn't included.

@ykisana
ykisana marked this pull request as draft November 19, 2026 05:46
@ykisana

ykisana commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor Author

This was suggested by AI via code triage only, going to verify if real issue first and then verify fix

- Register daily limits again when iOS no longer lists their activity, the
  way schedules already do. An unchanged set used to return early, so the
  limits stayed off until the next day's first open or an edit.
- When iOS refuses to start them (its 20 schedules-and-timers cap or another
  error), say so on Max Daily Limits and Status instead of only logging it.
- Debug builds log when limits register, and whether the monitor kept or
  dropped each threshold and why.
@ykisana
ykisana force-pushed the fix/daily-limit-registration branch from 7c47d48 to e34940a Compare November 19, 2026 17:12
@ykisana
ykisana marked this pull request as ready for review November 19, 2026 17:30
@ykisana
ykisana merged commit b2dc4d0 into main Nov 19, 2026
4 checks passed
@ykisana
ykisana deleted the fix/daily-limit-registration branch November 19, 2026 17:30
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.

1 participant