Skip to content

fix(billing): make historical money projections explicit - #811

Merged
LIghtJUNction merged 2 commits into
mainfrom
fix/history-money-projections-20261012
Oct 11, 2026
Merged

LIghtJUNction merged 2 commits into
mainfrom
fix/history-money-projections-20261012

Conversation

@LIghtJUNction

Copy link
Copy Markdown
Member

历史日志、使用量图表和 finance export 中的旧额度,可能按当前额度基准被展示为错误的法币金额;NULL 额度也会被显示成真实零,未知模型额度会制造 0%/100% 占比。本 PR 增加只读历史金额投影:单笔金额只信日志捕获的历史 credits-per-USD,累计用户用量复用 migration projector,基准或原值缺失时明确显示未知/原单位。原始历史值、当前钱包余额和原支付币种金额不修改。

  • Go 返回明确的 USD projection、availability/basis,日志统计的原始 SUM 与基准扫描使用同一只读快照;finance export 保留 raw 值并追加可用的历史投影。
  • Web 使用明确投影展示明细、复制、统计、图表和 CSV;小时桶缺单位基准时保留原始点数。invalid_stored_quota 显示 —,真实零且缺 K 仍显示 0 Raw credits。任一模型原始额度未知时,整个期间的占比均为空;真实 0+1 仍为 0%/100%。
  • 与 fix(finance): use frozen currency basis for fixed request costs #807 的 finance 成本估算及已合并 fix(web): preserve frozen currency bases in billing history #809 的历史单价/支付单位修复区分范围;affiliate/checkin/subscription 历史单位展示留待单独处理。

本地验证(最终 head 2758ebb78942c3d81ebeb1d28dc7045448f438d1,base 7be6ee81a5089a558cad34d95851bcc8bb80061c):

  • Go 10 个文件 SHA 未变,复用同源检查:171 PASS、2 SKIP;go vet ./model ./controller 与 go build -o /dev/null . PASS。两项 PostgreSQL fixture 因未配置一次性 loopback PostgreSQL DSN 跳过:TestTokenLogOptionalPaginationPostgres、TestUsageProjectionSnapshotPostgresKeepsConcurrentHistoricalRefundConsistent。SQLite WAL 并发快照测试已通过,不能代替真实 PostgreSQL 验证。
  • 最终受影响的 13 个 Web 文件使用固定 Bun 1.3.14:8 个测试文件共 60 PASS,typecheck、改动文件 lint/format 与 git diff --check PASS;独立复核确认 54 个最终 blob、测试日志 SHA 和两项 P2 修复。

验证限制:最终源码的完整 Web build/bundle 与全套 Web 测试未重跑。旧 v3 的 115 个测试、build/bundle 只保留有限证据,因为实际使用 Bun 1.4.0-canary.1,不能当成固定工具链或最终源码完整构建证明。全树 Web lint 保留未改动 home/sculptures/marks.test.ts 的 4 条 import(namespace) 错误,改动文件 lint 通过。与固定 #807 head 8003a8909aa848b309044f61662630625904dacd 及含 #809 的 main 5cc7c7a2ccc0fe8a265debe7bb99cce0c48eb99b 合并预览无冲突,整合树尚未测试。没有浏览器、负载或生产验收;该 PR 不纳入当前 Web145 发布,不代表合并、正式发布或部署资格。

Copilot AI balanced review requested due to automatic review settings October 11, 2026 19:54
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@LIghtJUNction
LIghtJUNction merged commit b4600b4 into main Oct 11, 2026
@LIghtJUNction
LIghtJUNction deleted the fix/history-money-projections-20261012 branch October 11, 2026 21:38
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.

2 participants