Skip to content

Comments

fix: include command name in err/test tracking labels#256

Open
sahilmgandhi wants to merge 1 commit intortk-ai:masterfrom
sahilmgandhi:fix/err-tracking-labels
Open

fix: include command name in err/test tracking labels#256
sahilmgandhi wants to merge 1 commit intortk-ai:masterfrom
sahilmgandhi:fix/err-tracking-labels

Conversation

@sahilmgandhi
Copy link

@sahilmgandhi sahilmgandhi commented Feb 23, 2026

This PR stems from me writing a custom rtk script for company specific commands, and I wrapped them with rtk err. I would like for them to show up as individual entries when I run rtk gain to see how many came from my custom commands versus built in rtk commands.

Summary

  • rtk err and rtk test hardcoded their tracking labels to "rtk run-err" and "rtk run-test", which meant rtk gain lumped all wrapped commands into a single generic entry with no visibility into which command was actually run
  • Now the tracking label includes the wrapped command (e.g., rtk err pre-commit run --verbose, rtk test cargo test), consistent with how other subcommands like rtk gh pr view already track themselves

Test plan

  • cargo test runner passes
  • Run rtk err <some-command> and verify rtk gain --history shows the full label
  • Verify rtk gain per-command breakdown shows distinct entries for different rtk err commands
Before

  All rtk err invocations collapse into a single opaque rtk run-err entry:

  Recent Commands
  ──────────────────────────────────────────────────
  02-23 04:00 ▲ rtk run-err               -98% (1.4K)
  02-23 03:55 ▲ rtk run-err               -23% (1.2K)
  02-23 03:50 • rtk run-err               -0% (0)

  By Command
  ──────────────────────────────────────────────────
    #  Command              Count   Saved    Avg%
  ──────────────────────────────────────────────────
    ?  rtk run-err              3   2.6K    40.4%

  No way to tell which commands were wrapped or where savings came from.

  After

  Each command gets its own identifiable entry:

  Recent Commands
  ──────────────────────────────────────────────────
  02-23 05:03 • rtk err echo hello wor... -29% (5)
  02-23 05:03 ▲ rtk err cat /Users/sah... -98% (360)
  02-23 05:03 ▲ rtk err ls -la /Users/... -98% (758)
  02-23 04:34 ▲ rtk err ls -la /Users/... -99% (1.3K)
  02-23 04:33 • rtk err echo testing g... -0% (0)

rtk err and rtk test hardcoded their tracking labels to generic
"rtk run-err" and "rtk run-test", losing the identity of the
wrapped command in `rtk gain` output. Now they use the actual
command (e.g., "rtk err pre-commit run --verbose") consistent
with how other subcommands track themselves.
@sahilmgandhi sahilmgandhi marked this pull request as ready for review February 23, 2026 05:00
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