Skip to content

fix(usage): show aggregate TPS in panel#35

Merged
choi138 merged 1 commit into
mainfrom
fix/usage-panel-tps
Jun 26, 2026
Merged

fix(usage): show aggregate TPS in panel#35
choi138 merged 1 commit into
mainfrom
fix/usage-panel-tps

Conversation

@choi138

@choi138 choi138 commented Jun 25, 2026

Copy link
Copy Markdown
Owner

Summary

  • Show period aggregate output TPS in the usage panel using output tokens over wall-clock work time.
  • Remove the panel display dependency on live token velocity while keeping the velocity monitor available for animation.
  • Add focused coverage for aggregate TPS calculation and zero-work-time behavior.

Testing

  • swiftformat . --lint
  • git diff --check
  • xcodebuild build -project Toki.xcodeproj -scheme Toki -destination "platform=macOS" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
  • xcodebuild test -project Toki.xcodeproj -scheme Toki -destination "platform=macOS" -only-testing:TokiTests/UsageFormattingBehaviorTests CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO

Summary by CodeRabbit

  • 새 기능

    • 사용 기간 기준의 출력 처리량(TPS)이 자동으로 계산되어 표시됩니다.
    • 출력 토큰 수와 작업 시간에 따라 처리량이 더 정확하게 반영됩니다.
  • 버그 수정

    • 처리량 값이 없거나 시간이 0인 경우에는 0으로 안전하게 표시됩니다.
    • TPS 표시가 로딩 상태와 함께 일관되게 동작하도록 개선되었습니다.
  • 테스트

    • 처리량 계산이 정상값과 0 반환 케이스에서 올바르게 동작하는지 검증이 추가되었습니다.

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 665d6c46-c136-451d-9a5c-65aafd16dbc9

📥 Commits

Reviewing files that changed from the base of the PR and between c6e76c4 and f85b4f8.

📒 Files selected for processing (4)
  • Toki/Domain/Usage/UsageData.swift
  • Toki/Features/UsagePanel/PanelOverviewViews.swift
  • Toki/Features/UsagePanel/UsagePanelView.swift
  • TokiTests/UsageFormattingBehaviorTests.swift

Walkthrough

UsageData에 출력 토큰/초 계산 프로퍼티가 추가되고, Usage Panel의 TPS 행이 이 값을 사용하도록 바뀌었습니다. 관련 테스트가 정상 계산과 0 반환을 검증합니다.

Changes

사용량 TPS 계산과 패널 바인딩

Layer / File(s) Summary
TPS 계산과 검증
Toki/Domain/Usage/UsageData.swift, TokiTests/UsageFormattingBehaviorTests.swift
UsageData가 출력 토큰과 벽시계 초로 periodOutputTokensPerSecond를 계산하고, 테스트가 일반 케이스와 0 반환을 검증함.
TPS 표시 바인딩
Toki/Features/UsagePanel/PanelOverviewViews.swift, Toki/Features/UsagePanel/UsagePanelView.swift
overview 탭이 PanelTokenBreakdownViewusageisLoading만 전달하고, TPS 행은 usage.periodOutputTokensPerSecond와 전달된 로딩 상태를 사용함.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • choi138/toki#32: PanelOverviewViews.swift의 TPS 행이 같은 사용량 속도 지표를 표시하도록 연결된 변경이 포함됩니다.
  • choi138/toki#34: Usage Panel의 TPS 값 소스가 출력 토큰 속도 쪽으로 이동한 변경이 있어 현재 PR과 코드 경로가 맞닿아 있습니다.

Poem

🐰 토끼가 귀를 쫑긋, TPS가 반짝!
출력 토큰이 초마다 살랑살랑,
0이면 조용히 풀밭에 앉고,
패널은 새 값으로 폴짝 춤춰요.
당근도 이 속도엔 고개를 끄덕! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 패널에서 기간 집계 TPS를 표시하도록 변경한 핵심 내용을 잘 요약합니다.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/usage-panel-tps

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@choi138 choi138 merged commit a684c30 into main Jun 26, 2026
3 checks passed
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