8000 fix(quota): restart estimates at the upstream reset after a plan upgrade for 0.9.11 by InfinityPacer · Pull Request #39 · InfinityPacer/meterleaf · GitHub
[go: up one dir, main page]

Skip to content

fix(quota): restart estimates at the upstream reset after a plan upgrade for 0.9.11 - #39

Merged
InfinityPacer merged 2 commits into
mainfrom
fix/quota-plan-upgrade-reset
Oct 14, 2026
Merged

InfinityPacer merged 2 commits into
mainfrom
fix/quota-plan-upgrade-reset

Conversation

@InfinityPacer
Copy link
Copy Markdown
Owner

问题

Claude 套餐从 Max 5x 升到 20x 时,上游当即把 7 天和 Fable 已用百分比清零(重置时间不变),但 Claude Code 要等打开 /usage 刷新账户资料后才上报新套餐。服务端以发现套餐变化的时刻作为新套餐起点,把之前的清零读数排除在外,重新起算的基准落在 1%,且整体关闭了四舍五入校正,导致新套餐预估晚一步出现、初期明显偏低。

另外两处显示问题:

  • 上游同一重置点在整点前后差不到一秒,按分钟截断后在 15:59 与 16:00 之间来回变化。
  • 手机额度卡片中 5h 从「等待更新」恢复后,iPhone Safari 未重算 grid 的 auto 列宽,重置时间超出卡片右边。

改动

  • 发现套餐变化时,从上一次套餐观察之后、本次观察之前的最后一次上游重新计数处起算;只在确有套餐变化时回溯。基准是 0% 时保留首次到达的取整校正。
  • 重置时间按最接近的整分钟展示(首页卡片、账户详情、等待状态)。
  • 额度标题行改为 flex,左侧标题收缩、右侧时间保持原宽。
  • 更新 docs/reporting.md 中套餐变化的预估说明;版本 0.9.11,数据库结构版本未变,升级无需备份。

验证

  • bun test tests 444 通过,bun run typecheck、bun run build、所改文件 Prettier 与 git diff --check 通过。
  • 新增「套餐变化晚于上游清零」回归测试,在旧代码上失败;另有测试确认不会越过上一次套餐观察借用清零点。
  • 用 NAS 上真实的升级前后读数回放:旧代码在 1% 时没有预估,新代码在 1% 时即给出与 2% 时一致的预估。
  • 演示页在 Chromium 与 WebKit 下 320、375、430 宽度检查,重置时间单行且不超出卡片,桌面布局不变。本地 WebKit 未复现原始溢出,iPhone 上的效果待升级后确认。

🤖 Generated with Claude Code

InfinityPacer and others add B669 ed 2 commits October 14, 2026 19:41
Claude Code reports a new plan only after it refreshes the account profile,
while the upstream counter is already reset. Start the new plan segment at
that reset so the zero reading anchors spend and rounding correction.

Also round displayed reset times to the nearest minute and lay out the quota
header with flex so the reset time stays inside the card on iOS Safari.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@InfinityPacer
InfinityPacer merged commit eac6f92 into main Oct 14, 2026
2 checks passed
@InfinityPacer
InfinityPacer deleted the fix/quota-plan-upgrade-reset branch October 14, 2026 11:43
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