Repository navigation
feat(client): persist offline environment data and mobile preferences - #3795
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
ApprovabilityVerdict: Needs human review Diff is too large for automated approval analysis. A human reviewer should evaluate this PR. You can customize Macroscope's approvability policy. Learn more. |
Move home collapse persistence and shared mobile preference state onto the persistence-focused branch. Model preference storage as an Effect service and expose hydration through keep-alive atoms. Co-authored-by: codex <codex@users.noreply.github.com>
Use idiomatic Effect services and errors, make optimistic preference rollback concurrency-safe, avoid stale teardown writes, and self-heal bounded mobile cache files. Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Regenerate the workspace lockfile with both desktop packaging updates and Expo SQLite persistence.\n\nCo-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
left a comment
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Bugbot Autofix is ON, but a cloud agent failed to start.
Reviewed by Cursor Bugbot for commit 43884b5. Configure here.
Co-authored-by: codex <codex@users.noreply.github.com>

Summary
Adds durable offline environment data, centralized mobile preferences, and scoped client-cache management.
Offline environment data
Mobile preferences
Client storage controls
Impact
Mobile users can configure pending tasks with their last-known model and branch while offline, inspect locally cached data, and reclaim it without disconnecting environments. Web clients share the durable environment-cache behavior. Mobile preferences now have one async state owner with predictable hydration and update semantics.
Validation
vp checkvp run typecheckvp run lint:mobilevp test apps/mobile/src(76 files, 427 tests)Note
Medium Risk
One-time SQLite and legacy file-cache migration on app start can leave partial data if migration fails; preference SQLite/SecureStore reconciliation affects appearance and Live Activity behavior across upgrades.
Overview
Mobile offline data moves from document-directory JSON files into Expo SQLite (
expo-sqliteplugin,t3code-client.db) via a newMobileDatabaseservice and a dedicatedEnvironmentCacheStoreimplementation for shell/thread snapshots, server config, and VCS refs. Legacy file caches are migrated on first DB upgrade; corrupt rows are dropped on read. The old inline cache logic is removed fromconnection/storage.ts;EnvironmentCacheStoreis composed throughpersistence/layerand the appruntime.Persistence refactor deletes
lib/storage.tsin favor ofMobileSecureStorage,MobileStorage, andMobilePreferencesStore(SQLite for preferences with SecureStore fallback/reconciliation). Connection catalog storage nowyield*s secure storage instead of injected storage objects.persistence/imperative.tskeeps Promise APIs for legacy call sites on top of the shared managed runtime.Preferences UX adds keep-alive atoms (
mobilePreferencesAtom/updateMobilePreferencesAtom) with optimistic patches, wires appearance and settings to them, persists collapsed home project groups, and adds Settings → Client Storage to inspect and clear per-environment or all offline caches without touching connections/credentials.Live Activities / cloud link uses
linkEnvironmentToCloudWithPreferencewith explicit flags,updateAgentAwarenessRegistrationPreferenceswith in-flight preference overrides, and rolls back local and relay state when toggling fails.Build/tooling: EAS profiles set
NODE_OPTIONS=--max-old-space-size=4096; newdev:client:previewscript. Effect service conventions doc gains dependency/runtime boundary guidance. Minor CursorAdapter test splits JSON log assertions.Reviewed by Cursor Bugbot for commit 9dd6245. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Persist offline environment data and mobile user preferences in the mobile app
MobileDatabaseservice and a structuredEnvironmentCacheStoreto cache server configuration and VCS branch lists per environment, enabling cached data to be shown when offline and refreshed when connected.MobilePreferencesStorebacked byMobileSecureStorage(expo-secure-store) with optimistic update support; preferences now survive app restarts and failed saves attempt rollback.src/lib/storage.tswith a structured persistence layer undersrc/persistence/comprisingmobile-database.ts,mobile-preferences.ts,mobile-secure-storage.ts,mobile-storage.ts, and a unifiedlayer.tswired into the app runtime.mobilePreferencesAtom); Live Activity preference changes now propagate to all linked cloud environments and revert locally and remotely on failure.SettingsClientStorageRouteScreen) showing per-environment SQLite cache usage with options to clear individual or all environment caches.EnvironmentCacheStoreandclient-runtimepersistence contracts to includeloadServerConfig/saveServerConfigandloadVcsRefs/saveVcsRefsmethods.server-configandvcs-refsobject stores.Macroscope summarized 9dd6245.