feat(ui): display cache hit rate with one decimal place#967
Conversation
Round cache hit rate to one decimal instead of integer, and add optional fractionDigits parameter to the percent formatter so other percentage displays are unaffected.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughCache hit rate display across the session context is refined to show decimal precision. The metric calculation rounds to finer granularity, the percent formatter gains optional fraction-digit control, and the tab display calls it with one decimal place; e2e and unit tests update their assertions. ChangesCache Hit Rate Decimal Precision
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Suggested priority: P2 (includes user-path files (packages/app/src/components/session/session-context-format.ts, packages/app/src/components/session/session-context-metrics.test.ts, packages/app/src/components/session/session-context-metrics.ts, packages/app/src/components/session/session-context-tab.tsx)).
P1/P0 are reserved for maintainer confirmation. Please relabel manually if this is a release blocker, security issue, data-loss risk, or updater/runtime failure.
There was a problem hiding this comment.
Code Review
This pull request updates the cache hit rate calculation and formatting to display with one decimal place (e.g., "90.0%" instead of "90%"). Feedback was provided regarding the cache hit rate calculation, pointing out that returning null when there are no cache reads but there are cache writes incorrectly hides the cache hit rate (showing "—" instead of "0.0%"). A suggestion was made to only return null when both reads and writes are zero or less.
Perf delta summaryComparator: pass
|
Bump PawWork desktop release version to 2026.5.29. Changes since v2026.5.28: - feat(settings): move Connections to Integrations + global toast monitor (#975) - feat(ui): display cache hit rate with one decimal place (#967) - fix: stabilize session opening state (#969) - fix(session): repair stale paginated question blockers (#962) - fix(ui): refit read-file icon into 0-20 viewBox (#964) - fix: allow running tools to expand - fix: add run lifecycle diagnostics - fix: harden Electron repair fallback - refactor: remove legacy theme choices - ci: stabilize e2e Playwright install and PR triage paths Verification: diff scope matches prior release bump (#958) — only the version string in packages/desktop-electron/package.json and the workspace entry in bun.lock. All CI checks green (e2e-artifacts required a rerun due to Playwright browser install flake unrelated to this change).
Summary
Round cache hit rate in session context panel to one decimal place instead of integer. Add optional
fractionDigitsparameter topercent()formatter so other percentage displays (e.g. context usage) remain unchanged. No related issue — this is a small self-contained enhancement.Why
The current integer display loses precision on small hit rates (e.g. 7.1% shows as 7%). One decimal place gives a meaningful improvement without visual noise.
Related Issue
None.
Human Review Status
Approved by @Astro-Han
Review Focus
percent()formatter now takes an optional second argument; verify only cache hit rate passes it (line 197 in tab.tsx), not the usage stat (line 238).toLocaleString(locale, { minimumFractionDigits, maximumFractionDigits })instead oftoFixedto preserve locale-aware decimal separators.Risk Notes
None. The change is backward-compatible:
percent(value)without the second argument behaves identically to before.How To Verify
Screenshots or Recordings
E2E snap grid generated at
docs/design/preview/screenshots/session-context-cache.png— visually confirmed by @Astro-Han: cache hit rate displays90.0%with one decimal place.Checklist
bug,enhancement,task,documentation. Type labels are author-added; the labeler bot does NOT assign them. Add the label in the GitHub UI, then tick this.app,ui,platform,harness,ci. The labeler bot assigns these on PR open based on changed paths. Confirm the bot's choice (or override if wrong), then tick this.P0,P1,P2,P3. The priority-triage bot suggests one on PR open. Confirm or override, then tick this.Pending,Approved by @<reviewer>, orNot required: <reason>(default isPending; "not required" is restricted to bot-authored low-risk PRs).dev, and my PR title and commit messages use Conventional Commits in English.Summary by CodeRabbit
Release Notes