Skip to content

fix(tracking): weight by-command savings percentage - #3510

Closed
cakeni wants to merge 1 commit into
rtk-ai:developfrom
cakeni:codex/gain-weighted-percentage
Closed

cakeni wants to merge 1 commit into
rtk-ai:developfrom
cakeni:codex/gain-weighted-percentage

Conversation

@cakeni

@cakeni cakeni commented Aug 10, 2026 •

Copy link
Copy Markdown

Summary

  • derive each by-command savings percentage from aggregate saved and input token totals
  • label the weighted value as Total% instead of Avg%
  • cover weighted long-tail command data and zero-input passthrough records

Closes #3506

Test plan

  • cargo fmt --all --check
  • cargo clippy --all-targets
  • cargo test --all -- --test-threads=1
  • targeted regression test confirmed red before the fix (expected 89.2079%, got 50%) and green after it
  • manual testing with an isolated RTK_DB_PATH: rtk proxy followed by rtk gain displayed the Total% column

AI assistance was used during investigation or implementation.

@CLAassistant

CLAassistant commented Aug 10, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

dev1abz added a commit to dev1abz/rtk that referenced this pull request Aug 12, 2026
@KuSh

KuSh commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

Closing in favour of #891, which makes the same weighted rate fix to get_by_command, has already been approved, and adds a changelog entry and a warning on the CommandStats alias. The in-memory tests here, especially the zero input case, are a good addition, so please offer them on #891 if you would like them kept.

@KuSh KuSh closed this Sep 6, 2026
@KuSh KuSh added the duplicate This issue or pull request already exists label Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

duplicate This issue or pull request already exists

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gain: by-command table puts SUM(saved_tokens) next to AVG(savings_pct), producing rows that can't be read together

3 participants