Skip to content

rtk gain reports a missing hook on only one of its five views — never on the empty report, where it matters most #4035

Closed

Description

@KuSh

Summary

rtk gain reports a missing or outdated hook on only one of its five invocations: the default view, and only when there is tracking data. --daily, --weekly, --monthly, --all and the empty report all stay silent.

The empty report is the worst case. With no hook installed nothing is tracked, so "no data" is usually caused by the missing hook — and that is exactly the run where the user is told nothing:

$ rtk gain
No tracking data yet.
Run some rtk commands to start tracking savings.

The advice never appears, because rtk gain is also exempt from the daily [rtk] /!\ No hook installed reminder — it is exempt on the grounds that it prints its own.

Cause

In src/analytics/gain.rs, the hook_check::status() block sits inside the default-view branch (if !daily && !weekly && !monthly && !all), which is itself after the summary.total_commands == 0 early return. Two gates, so four of five views and the empty report never reach it.

Reproduction

Measured with an isolated HOME holding a .claude directory and no hook registered, counting [warn] No hook installed lines:

invocation warnings
rtk gain (with data) 1
rtk gain --daily 0
rtk gain --weekly 0
rtk gain --all 0
rtk gain (empty database) 0

Expected

Every text view reports it, including the empty one. The JSON and CSV exports return before this point and should stay free of it.

Activity

  1. added
    bug
    good first issue
    on Sep 13, 2026
  2. rtk-wshm-sync-bot commented on Sep 13, 2026

    @rtk-wshm-sync-bot

    wshm · Automated triage by AI

    🔍 Automated Triage

    🐛 Category bug
    🟡 Priority medium
    🎯 Confidence 90%

    Summary

    rtk gain only checks/reports the missing-hook status in the default view with data, silently skipping --daily/--weekly/--monthly/--all and the empty-report case where the warning matters most; fix by moving the hook_check::status() call outside the two gating conditions in src/analytics/gain.rs.

    This looks like a simple fix that could be auto-resolved. Repo maintainers can use /wshm fix to attempt it.

    📁 Relevant files
    • src/analytics/gain.rs

    Triaged automatically by wshm · This is an automated analysis, not a human review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:clibuggood first issuepriority:medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions