Plan 2: Split data layer into focused modules
Split the monolithic frontend db.ts into focused data modules while preserving the public @/db barrel API:
- data/query-client.ts owns the shared TanStack Query client.
- data/mutation-tracker.ts owns in-flight mutation tracking.
- data/change-id-pool.ts owns preallocated jj change IDs.
- data/watchers.ts owns repository watcher ref-counting and query invalidation.
- data/actions/repo-actions.ts owns repository sync behavior.
- data/collections/* owns TanStack DB collections for repositories, revisions, revision changes, revision diffs, commit recency, and unified diff/change records.
- data/prefetch.ts owns revision diff/change prefetch helpers.
No call sites were changed; existing imports continue to use @/db, which now re-exports from the new module structure.
Validation:
- cd apps/desktop && bun run typecheck
- cd apps/desktop && bun run lint
- cd apps/desktop && bun run test