Skip to content

Speed up status snapshot loading - #71

Merged
theotarr merged 1 commit into
mainfrom
codex/faster-status-snapshot
Jul 16, 2026
Merged

Speed up status snapshot loading#71
theotarr merged 1 commit into
mainfrom
codex/faster-status-snapshot

Conversation

@theotarr

@theotarr theotarr commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • reuse the menu-bar status cache for onboarding and Status-page platform counts
  • include per-integration message/contact counts in the cache without raw-schema diagnostics
  • memoize projection counts until projection state changes, with explicit invalidation after all projection writes and clears
  • share one hydration path across the daemon, onboarding snapshot, and daemon-down CLI fallback
  • avoid rebuilding integration summaries twice and remove the redundant native skill-status subprocess
  • index the canonical raw-event schema expression used by phone-call counts and explicit diagnostics

Root cause

Opening the Status page triggered cued onboarding snapshot, which calculated raw-event schema diagnostics and per-account projection counts repeatedly. On the live 3.9 GB database this took roughly 30–32 seconds. The lightweight cache had top-level totals but zero per-platform contact/message statistics, so the UI had to wait for the full snapshot before rendering its breakdown.

The targeted phone-call query was also scanning all local iMessage raw events and took roughly 25 seconds on the live database.

Impact

The live onboarding snapshot benchmark is now roughly 1.4 seconds. The menu-bar cache exposes the platform breakdown immediately, and unchanged 15-second cache refreshes reuse memoized projection counts instead of regrouping the projected tables.

Raw schema diagnostics remain available on explicit full status/doctor paths, but are no longer part of onboarding or menu-bar critical paths. Their canonical expression now has a matching index, removing the temporary GROUP BY structure and accelerating targeted phone-call counts.

Validation

  • thermonuclear code-quality review: approved with no remaining blockers
  • pnpm typecheck
  • pnpm build
  • Biome checks for all changed TypeScript files
  • 510/510 Vitest tests
  • query-plan tests verify both raw-event queries use the expression index
  • swift build --package-path native/macos/CuedNative -c release
  • live database benchmark and cache smoke checks

@theotarr
theotarr force-pushed the codex/faster-status-snapshot branch 2 times, most recently from b4f0225 to 6d87734 Compare July 16, 2026 20:09
@theotarr
theotarr force-pushed the codex/faster-status-snapshot branch from 6d87734 to 1f27ec7 Compare July 16, 2026 20:35
@theotarr
theotarr marked this pull request as ready for review July 16, 2026 20:37
@theotarr
theotarr merged commit c9ead4f into main Jul 16, 2026
2 checks passed
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