Skip to content

Cache Home status across navigation#9372

Open
h3nock wants to merge 4 commits into
BasedHardware:mainfrom
h3nock:feat/desktop-home-status-cache
Open

Cache Home status across navigation#9372
h3nock wants to merge 4 commits into
BasedHardware:mainfrom
h3nock:feat/desktop-home-status-cache

Conversation

@h3nock

@h3nock h3nock commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

What changed and why

Keep Home status and connector metrics in a long-lived store so returning to Home renders cached values immediately instead of repeating connector, Apple Notes, file, export, and knowledge-count discovery. Refreshes remain stale-aware, imports refresh the affected knowledge counts, and session resets clear cached account state.

Product invariants affected

none

How it was verified

  • Exercised the Home navigation flow in the named omi-home-status-cache desktop bundle and confirmed cached status remains available when leaving and returning to Home.
  • xcrun swift build -c debug --package-path Desktop --scratch-path /tmp/omi-home-status-cache-swift-build completed successfully on the latest upstream/main.
  • The repository-wide suite still has the previously identified unrelated API routing assertion and Firebase test-initialization crash; neither failure is in code touched by this PR.

Tests

  • xcrun swift test --package-path Desktop --scratch-path /tmp/omi-home-status-cache-swift-build --filter HomeStatusStoreTests passed 6/6 tests.
  • Coverage includes stale-cache throttling, shared concurrent refreshes, import-driven count refreshes, stale-response protection, persisted device history, and manual-import refreshes.

Scoped cleanups (optional)

none

Review in cubic

h3nock and others added 4 commits July 9, 2026 21:45
Persist connector metrics and device-history status under the signed-in user, migrate legacy cache keys once, and clear in-memory status on session reset. Track the owner of legacy onboarding import summaries to prevent cross-account reuse.

Verification: xcrun swift test --package-path Desktop --scratch-path /tmp/omi-pr9372-account-cache-build --filter 'HomeStatusStoreTests|ImportConnectorStatusStoreTests|OnboardingFlowTests|OnboardingDataSourceRowStatusTests' (24 passed). Built and launched the omi-home-cache-scope named bundle, navigated Apps to Home through omi-ctl, and found no related app-log errors.
Migrate ViewModelContainer account ID reads to DefaultsKey so the PR merge result remains within the raw-key hygiene baseline.\n\nVerified:\n- python3 desktop/macos/scripts/check-userdefaults-key-ratchet.py\n- exact PR merge simulation: 183 raw keys (baseline 184)\n- xcrun swift test --package-path Desktop --scratch-path /tmp/omi-pr9372-account-cache-build --filter 'DefaultsKeyTests|StartupWarmupPolicyTests' (46 passed)
@Git-on-my-level

Copy link
Copy Markdown
Collaborator

Thanks for the careful work here. This looks like a cohesive desktop performance/privacy improvement: moving Home status into a long-lived store should make returning to Home feel much faster, and I like that the PR adds account-scoped persistence plus focused tests for stale-cache throttling, concurrent refresh coalescing, import-triggered count refreshes, stale-response protection, and account switching.

I’m not seeing a concrete blocker in the diff from static review, and the relevant desktop Swift build/tests/checks are green. I’m leaving this as a positive maintainer signal rather than a formal approval because the change touches account-scoped cached status for connector metrics, memory-import state, export status, and Omi-device history. That is a user-data/privacy-sensitive surface, so a human maintainer should sanity-check the intended account-boundary behavior before merge.

Specific things I’d want the maintainer to confirm:

  • The legacy UserDefaults migration behavior is acceptable when existing unscoped connector/device-history keys are first associated with the currently signed-in user.
  • No Home status or connector metrics can be written or restored under the wrong signed-in account during sign-in/sign-out or no-user startup states.
  • The new shared HomeStatusStore lifecycle in ViewModelContainer is the intended owner for both Dashboard and Apps connector status.

Overall: promising and well-tested, but needs human maintainer review because it changes cached per-account status behavior.

@Git-on-my-level Git-on-my-level added needs-maintainer-review Needs human maintainer review before merge security-review Touches auth, provider routing, secrets, or security-sensitive surfaces labels Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-maintainer-review Needs human maintainer review before merge security-review Touches auth, provider routing, secrets, or security-sensitive surfaces

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants