Repository navigation
fix(gain): report hook warning on every rtk gain text view - #4039
AngelVRodC wants to merge 1 commit into
Conversation
The missing/outdated hook warning only printed on the default view with tracking data; --daily/--weekly/--monthly/--all and the empty report were silent. The empty report was the worst case: with no hook nothing is tracked, so 'No tracking data yet' usually IS the missing hook. Extract warn_hook_issues() and call it once after the JSON/CSV early return, before the summary load / empty-report return. All five text views plus the empty report now show it exactly once; exports stay clean by construction. Fixes rtk-ai#4035
📊 Automated PR Analysis
SummaryFixes rtk gain so the missing/outdated hook warning is shown on every text view (default, --daily, --weekly, --monthly, --all) and the empty-database report, not just the default view with data. The warning logic was extracted into a warn_hook_issues() function called once after the JSON/CSV early return, ensuring exports stay warning-free while all text output paths surface the warning exactly once. Review Checklist
Linked issues: #4035 Analyzed automatically by wshm · This is an automated analysis, not a human review. |
|
DUPLICATE, recommend closing — superseded by #4038, which was opened for the same issue (#4035) about three hours earlier. Closing this one on timing alone would waste the better half of it, so it has not been: your nine-case matrix is now the test file in #4038, credited to you in the file header and as It was better than what #4038 had in four ways, each of which I checked by mutating the implementation:
Three cases were added on top, for the One housekeeping note, since it is not your fault and would have stalled this regardless: the CLA bot never reported on this PR at all — no pass, no pending. If you send another PR and see no CLA check appear, that is a bot problem worth flagging rather than waiting on. Thanks — the matrix is the part of this that ships. |
Summary
rtk gainprinted the missing/outdated hook warning only on the default view with tracking data.--daily,--weekly,--monthly,--alland the empty report were silent — and the empty report is the worst case, because with no hook installed nothing is tracked, so "No tracking data yet" is usually caused by the missing hook.warn_hook_issues()and call it once inrun()after the JSON/CSV early return, before the summary load /total_commands == 0early return. All five text views plus the empty report now show the warning exactly once; exports stay clean by construction (they return earlier).check_rtk_disabled_bypass()and the untrusted-filters warning (still default-view-gated), and the daily[rtk] /!\ No hook installedreminder'sgainexemption inmain.rs(rationale preserved — gain prints its own).Closes #4035
Test plan
cargo fmt --all && cargo clippy --all-targets && cargo test— fmt clean, 0 clippy warnings, 3218 tests passtests/gain_hook_warning_test.rs(9 cases, Unix-gated, isolatedHOME): warning present exactly once on default/--daily/--weekly/--monthly/--all/empty-DB views; absent from--format jsonand--format csv; absent when no~/.claudeexists (not-applicable state stays silent)HOMEwith.claudeand no hook, empty DB →[warn] No hook installednow appears onrtk gainrtk gainoutput inspectedsrc/analytics/gain.rswarn_hook_issues(), single call before empty-report returntests/gain_hook_warning_test.rs