Repository navigation
fix(tvos): persist server configuration and sessions - #63
Conversation
|
@SHRIVES93 is attempting to deploy a commit to the quixomatic's projects Team on Vercel. A member of the Team first needs to authorize it. |
a772043 to
f29e839
Compare
AsyncStorage 2.2.0 stores tvOS values in NSCachesDirectory, where the OS can remove saved settings. Failed hydration also previously mounted the entry route with incomplete state and sent configured users back to onboarding. - Store the six small session/onboarding values in an allowlisted UserDefaults Expo module; acknowledge writes and migrate surviving cache values with deletion markers. Preserve the keychain-free tvOS workaround and other platforms' existing storage backends. - Gate routing on successful hydration and provide remote/touch Retry on storage failure. Surface failed saves, logout, and server changes. - Clear both credential interfaces on logout while retaining the server. Invalidate only the current bearer on 401 and serialize token updates so stale responses cannot erase a new login; retain state on transient failures. - Document migration, storage limits, and the required native binary update. Validation: native storage and session regressions pass. The user confirms all physical Apple TV session persistence and recovery acceptance tests pass.
The persistence fix needs regressions that distinguish missing settings from failed hydration and verify saved state across fresh application processes. - Add 28 Bun regressions against production session, startup, routing, device, credential, and REST modules, substituting native storage/network boundaries. Cover migration/cache eviction, restart, invalid sessions, transient failures, read/write/cleanup errors, logout, Change Server, and concurrent/stale 401s. - Check the production UserDefaults implementation with a temporary Swift test suite: persist/reopen, deletion markers, allowlist/size/corruption rejection, and rollback when synchronization fails. - Add the native app test command, focused CI for regressions/typechecking and Swift checks, and instructions for device validation. Validation: session regressions and native store checks pass; the user confirms all physical Apple TV acceptance tests pass.
70f679b to
55e6f82
Compare
55e6f82 to
79daca9
Compare
…omatic#64) On tvOS, AsyncStorage lives in a purgeable cache, so the server URL + session were wiped on reboot and the TV fell back to onboarding. Back those small values with core RN Settings (NSUserDefaults), the one durable tvOS store, gated to Apple TV (Platform.OS==="ios" && isTV); empty-string tombstones handle deletes; a one-time migration carries over surviving AsyncStorage values. iPad/iPhone/Android unchanged. Strips the bespoke native Swift module, its CI workflow, and the multi-process test harness in favor of the built-in Settings module. Claude-Session: https://claude.ai/code/session_0141ntBdutphMZLw7DW5jUYJ
The real bug is AsyncStorage being purged on tvOS; backing the session with UserDefaults (via RN Settings) fixes it, and the original boot is correct again. So drop the parts that overreached beyond persistence: the startup retry wall, the 401 auto-logout in api.ts, and the token-write serialization in auth.ts. The app/ screens revert to main byte-for-byte. auth.ts/cred-store keep only the storage swap plus clearing better-auth's session on sign-out / Change Server, all gated to Apple TV. Net change vs main is now just the four storage files.
|
@SHRIVES93, thank you for putting this together! You nailed the root cause that had been biting Apple TV: AsyncStorage on tvOS lives in a purgeable cache, so the server and session got wiped on reboot and the TV dropped back to onboarding. That was the hard part to figure out. I reshaped the solution a bit before merging. What changed and why:
Net result is your fix in its simplest form: the storage swap across four files. I'm merging now so I can cut a TestFlight build and check the power-cycle on a real Apple TV. Really appreciate you digging into this and raising it the right way. Keep the contributions coming.
|
What & why
Fix Apple TV returning to server setup after restarting Airwave. AsyncStorage stores tvOS values in purgeable caches, and failed hydration could route to onboarding with incomplete state.
Store six small session/onboarding values in an allowlisted UserDefaults Expo module, migrate surviving values, acknowledge writes, and offer Retry on storage errors. Logout retains the server; Change Server clears it; current-session 401s require login while transient failures retain state. Other platforms retain their storage backends.
Fixes #64. Separate commits contain the fix and session regressions/CI. Remote navigation is separate in #65.
Validation
pnpm check-typeswas run after a full locked install. It reports errors in unchanged desktop, server, web, site, and tv-tauri code, including Electrobun declarations and missing generated files. CI awaits upstream approval.A new native binary is required; already-purged settings cannot be recovered. Exact App Store v1.3 source remains unverified. No version, dependency, secrets, or signing changes.