Skip to content

feat(gains): add --reset flag#1056

Open
vzwjustin wants to merge 7 commits intortk-ai:developfrom
vzwjustin:develop
Open

feat(gains): add --reset flag#1056
vzwjustin wants to merge 7 commits intortk-ai:developfrom
vzwjustin:develop

Conversation

@vzwjustin
Copy link
Copy Markdown

Summary

Test plan

  • cargo fmt --all && cargo clippy --all-targets && cargo test
  • Manual testing: rtk <command> output inspected

Important: All PRs must target the develop branch (not master).
See CONTRIBUTING.md for details.

claude added 4 commits April 2, 2026 19:19
Adds `rtk gain --reset` to clear all token savings stats back to zero.
Implements `Tracker::reset_all()` in tracking.rs and wires the flag
through the Gain command args and gain::run().

https://claude.ai/code/session_015WXbDdxEU3pXPBtheDkXcd
- reset_all() now clears both `commands` and `parse_failures` atomically
  via execute_batch (fixes incomplete reset reported by reviewer)
- Add [y/N] confirmation prompt before --reset; mirrors init.rs pattern
- Add --yes flag to skip prompt in scripts/CI
- Add unit test: test_reset_all_clears_both_tables verifies both tables
  are empty after reset

https://claude.ai/code/session_015WXbDdxEU3pXPBtheDkXcd
Avoids raw ANSI codes when stdout is piped, consistent with all
other output in gain.rs.

https://claude.ai/code/session_015WXbDdxEU3pXPBtheDkXcd
Tracker::new() uses a shared on-disk SQLite DB. Running reset_all()
in a parallel test suite wipes records inserted by other concurrent
tests, causing intermittent failures.

Add Tracker::new_in_memory() (cfg(test) only) backed by an isolated
Connection::open_in_memory(), and switch test_reset_all_clears_both_tables
to use it. Extracted init_schema() helper to avoid duplicating DDL.

https://claude.ai/code/session_015WXbDdxEU3pXPBtheDkXcd
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 6, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ vzwjustin
❌ claude
You have signed the CLA already but the status is still pending? Let us recheck it.

@vzwjustin
Copy link
Copy Markdown
Author

Branch has been corrected

@vzwjustin vzwjustin marked this pull request as draft April 7, 2026 01:39
@vzwjustin vzwjustin marked this pull request as ready for review April 7, 2026 01:41
@vzwjustin vzwjustin changed the title Develop Reset stats Apr 7, 2026
@aeppling aeppling self-assigned this Apr 7, 2026
@aeppling aeppling changed the title Reset stats feat(gains): add --reset flag Apr 7, 2026
@aeppling
Copy link
Copy Markdown
Contributor

aeppling commented Apr 7, 2026

Hey @vzwjustin , we will just merge the user documentation from #1029 so you can then add the new flag for gain command in this doc, then merge.

Thanks for recreating with correct target

I will tag you here once doc is merged on develop

@aeppling
Copy link
Copy Markdown
Contributor

aeppling commented Apr 7, 2026

Reviewed and approved, merge condition :

Will wait for #1029 to get merge in develop so we can update user doc for this, then merge this with doc

@aeppling
Copy link
Copy Markdown
Contributor

aeppling commented Apr 8, 2026

@vzwjustin #1029 landed on develop can you update the rtk gain command documentation to provide information about your new flag please ?

@vzwjustin
Copy link
Copy Markdown
Author

Yep give me a little bit

Adds reset flag documentation to the upstream file path:
- Quick Reference: reset usage examples with and without --yes
- Command Options: Reset Flag table with --reset and --yes descriptions
- Warning note about irreversibility and non-interactive behaviour

https://claude.ai/code/session_015WXbDdxEU3pXPBtheDkXcd
claude and others added 2 commits April 8, 2026 22:53
Upstream moved this to docs/usage/AUDIT_GUIDE.md in deda44f.
Removing the old path so git resolves the rename correctly on merge.

https://claude.ai/code/session_015WXbDdxEU3pXPBtheDkXcd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants