Yokan / rebuild
Course 1 8624561

AUTOMATIC_UPDATE_CONSTRAINTS.md

docs/features/AUTOMATIC_UPDATE_CONSTRAINTS.md

documentation / design asset89 lines
1# Automatic update device and network conditions23Library settings → **Automatic update conditions** configures all media types in4the current profile. Choose the existing download-network policy (the default),5Any connected network, Unmetered, or Wi-Fi only, and optionally require external6power. Manual library/group/single-title refresh remains available independently.7Wi-Fi and unmetered are distinct: paid Wi-Fi satisfies Wi-Fi only, whereas a8reported metered connection does not satisfy Unmetered.910**Check conditions** displays whether the selected restrictions are satisfied or11which reading/condition is missing. Policy changes cancel obsolete checks. Unknown,12denied or timed-out readings defer explicit restrictions; they never imply Wi-Fi,13free data or external power. Opening legacy defaults makes no new telemetry calls.14Readings are cached for up to five seconds across title-admission checks. Battery15APIs are only requested when power is required. Unrelated settings changes do not16reprobe, and an explicit check bypasses the cache.1718For devices without network-cost reporting, **When network cost is unavailable**19lets the user keep waiting or explicitly classify the unknown connection as metered20or unmetered. This classification only fills an unknown cost. It cannot override a21reported metered connection, data-saver/low-data mode or a disconnected network.22There is no fabricated power or Wi-Fi reading and no implicit fallback for either.2324The shared runner checks admission before refresh and the updater checks again25after waiting for its service lock and before each title request. Conditions changing26after a request has started are checked before the next title; this is not a promise27of instantaneous cancellation on every platform. Completed title writes remain28durable, unchecked-title error reports remain intact, and deferred work produces no29success notification. Foreground timers keep the schedule slot eligible for retry.30OS adapters retain retry eligibility rather than treating a deferral as completion.3132## Platform integrations and concrete limits3334- Android reads the active network's capabilities and the sticky battery/power35  broadcast. WorkManager gets library-specific charging/network constraints;36  metadata, sync and backup constraints retain their existing settings. Daily37  settings updates replace constraints without resetting the time anchor; changing38  the daily time still reanchors. Android 9+ can request a Wi-Fi transport directly;39  older versions also enforce Wi-Fi in shared admission. A condition deferral is40  separate from the ordinary three-failure retry limit.41- iOS reads a short-lived NWPathMonitor and UIDevice battery state. Path monitoring42  is cancelled and its callback cleared on completion, timeout or cancellation.43  Battery telemetry is process-wide. BGProcessingTaskRequest uses external-power44  admission, and deferred work is resubmitted with a 15-minute earliest retry.45  iOS still chooses actual execution time. Existing fixed OS identifiers belong46  to the Default profile; other profiles use their foreground timers while open.47- Desktop uses bounded read-only queries: macOS route/hardware-port/power output,48  Windows network-cost/connection-profile and power APIs through noninteractive49  PowerShell, and Linux default routes/sysfs/NetworkManager. Commands have runtime50  and output bounds and are terminated on caller cancellation. No credentials,51  network names or battery identifiers are stored or logged. Windows/Linux parser52  fixtures do not imply live verification on those operating systems.53- Browser uses available connection/online/battery APIs. Its battery promise has a54  bounded wait, denial remains unknown, and network-only checks never call it.55  The browser timer runs while the app is open; a closed page cannot run this work.5657Browser telemetry is a real platform limit: Battery Status is unavailable in some58major browsers, and network transport/cost reporting is not universal. In those59cases external-power or Wi-Fi requirements stay deferred with a visible unavailable60reason. macOS cost reporting, unknown virtual/VPN transport, missing Linux tools and61unsupported desktop system APIs also retain unknown readings. The unknown-cost62classification handles cost explicitly; it does not claim missing hardware support.63These are documented capability limits, not successful hardware detection.6465Preferences persist under device-local library feature settings. The gate and66status belong to the captured profile, and cancellation cannot publish a successful67late check into another profile. No source/provider HTTP probe discovers device state.6869## Evidence and verification7071Verification passed: 54 desktop checks, 71 Kotlin/Wasm browser tests and 3 Android72WorkManager unit checks, with no failures, errors or skipped tests. Desktop, Android,73iOS simulator ARM64 and web compiled. Tests exercise strict typed parsing, unknown/denied74readings, cache expiry/clock rollback, policy changes, cancellation, profile isolation,75service-lock admission, mid-run deferral, retained error reports and schedule retry.76Desktop command tests use real bounded processes; browser tests cross the actual77Kotlin/JavaScript boundary with isolated navigator fixtures, including a stalled78battery promise. Native power changes and OS job timing are not claimed as exercised.7980Primary references:81[Android work constraints](https://developer.android.com/develop/background-work/background-tasks/persistent/getting-started/define-work),82[Wi-Fi NetworkRequest constraints](https://developer.android.com/reference/androidx/work/Constraints.Builder),83[Android power readings](https://developer.android.com/reference/android/os/BatteryManager),84[Apple background processing](https://developer.apple.com/documentation/backgroundtasks/bgprocessingtaskrequest),85[Apple path interfaces](https://developer.apple.com/documentation/network/nw_path_uses_interface_type(_:_:)),86[Windows connection profiles](https://learn.microsoft.com/en-us/uwp/api/windows.networking.connectivity.connectionprofile),87[NetworkManager](https://networkmanager.pages.freedesktop.org/NetworkManager/NetworkManager/nmcli.html),88[Battery Status specification](https://www.w3.org/TR/battery-status/),89[browser compatibility overview](https://developer.mozilla.org/en-US/docs/Web/API/Battery_Status_API).90

Search chapters, reference and source filenames.