8000 feat(quota): show per-window cache hit rate on account cards for 0.12.2 by InfinityPacer · Pull Request #50 · InfinityPacer/meterleaf · GitHub
[go: up one dir, main page]

Skip to content

feat(quota): show per-window cache hit rate on account cards for 0.12.2 - #50

Merged
InfinityPacer merged 2 commits into
mainfrom
feat/quota-cache-rate
Oct 23, 2026
Merged

InfinityPacer merged 2 commits into
mainfrom
feat/quota-cache-rate

Conversation

@InfinityPacer
Copy link
Copy Markdown
Owner

问题

  • 多账户时只能在统计页看到整体缓存命中率,看不出每个账户、每个额度窗口各自的命中情况。
  • 服务端早已为每个额度窗口汇总了命中率需要的三个输入桶,只是没有传给账户卡片。

结果

  • 额度窗口的视图新增 periodCacheRate,按本周期计算,口径与统计页一致,即缓存读取占普通输入、缓存读取、缓存写入之和的比例,只计三项都已知的请求。没有这类请求时为 null,页面整项不显示,不会显示 0%。
  • 报表索引路径(src/storage/report-index.ts)和明细路径(src/domain/quota.ts)用同一规则,演示数据同步补上。
  • 桌面账户行在「已用」下方显示「命中 86.5%」,比例列保持 76px,进度条长度不变。手机卡片在窗口标题行显示「5h · 已用 28% · 命中 86.5%」,放不下时整项换行。悬停显示完整含义。
  • docs/reporting.md 补充账户区说明,CHANGELOG.md 记入 0.12.2。
  • 数据库结构未变,只需升级服务端镜像,采集器不用替换。

验证

  • bun run typecheck 通过,bun test tests 548 个测试全部通过,bun run build 成功。新增测试覆盖缺项请求不计入命中率、新周期没有请求时为 null。
  • 演示数据在深色主题下检查 375、1361、1440、1512px 四种宽度,无溢出,1361px 下进度条 129px。
  • 本机采集器近 7 天原始记录可按账户算出命中率,Pro 99.0%、Team Premium 98.7%、OpenCode Go 98.1%,三个账户都没有缺项请求。

截图(演示数据,1440px 深色)见维护者本地 test-results/cache-rate-v5-1440.png,视觉已由维护者确认。

🤖 Generated with Claude Code

InfinityPacer and others added 2 commits October 24, 2026 00:49
Each quota window now carries the cache hit rate for its current period,
using the same rule as the report summary: cache reads over the three
input buckets, counted only for requests whose buckets are all known.
Phone cards append it to the window heading; desktop rows show it under
the used percentage. Unknown rates stay hidden instead of reading 0%.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@InfinityPacer
InfinityPacer merged commit 9cbb7a3 into main Oct 23, 2026
2 checks passed
@InfinityPacer
InfinityPacer deleted the feat/quota-cache-rate branch October 23, 2026 16:55
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

0