Repository navigation
perf(usage): skip unchanged cache rewrites - #16220
sanshengai wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (12)
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughClaude, Codex, and OpenCode scanners now return Merge Risk: ⚪ Minimal · up to The change skips durable cache rewrites only when usage data is unchanged while preserving writes for source, worktree, plugin, and error-state changes; no actionable merge-blocking risk remains after normal checks and review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Closing as stale. main has moved on substantially since this branch was opened on Aug 24, and I am no longer following it. Happy to reopen a rebased, single-change PR if maintainers still want the fix. |
Summary
Why
Usage refreshes run on a five-minute freshness window. Even when every transcript/database is unchanged and the scanners only reuse cached projections, the lifecycle currently serializes and atomically rewrites the entire provider JSON. On the measured profile that means up to 61.8 MiB across Codex + Claude per no-op refresh.
After this change, a no-op refresh updates its in-memory completion time but performs zero durable file opens or renames. A real source/worktree/error-state change still uses the existing durable snapshot writer.
Related performance umbrella: #16211
Complementary startup-memory change: #16219
This PR is independently mergeable against
main; it does not require #16219.Compatibility
sourceProjectionChangedis optional in the shared provider contractValidation
pnpm exec vitest run --config config/vitest.config.ts src/main/usage src/main/codex-usage src/main/claude-usage src/main/opencode-usage— 21 files, 107 tests passedpnpm exec oxlint ...changed TypeScript files...pnpm run typecheck:nodepnpm run check:max-lines-ratchetgit diff --checkpnpm testitself cannot load the optionalwindows-native-registrynative module under the local Node 24.19.0 environment, so the same repository Vitest config was invoked directly.AI assistance
This contribution was developed with AI assistance and manually reviewed for source deletion/reclaim, worktree-attribution invalidation, plugin compatibility, error recovery, and durable-write semantics.