Skip to content

fix(discover): say which savings figures were measured and which averaged - #4137

Open
KuSh wants to merge 1 commit into
lex/08-exec-oraclefrom
lex/09-estimate-marker
Open

KuSh wants to merge 1 commit into
lex/08-exec-oraclefrom
lex/09-estimate-marker

Conversation

@KuSh

@KuSh KuSh commented Sep 19, 2026 •

Copy link
Copy Markdown
Collaborator

Total: 681 commands -> ~108.3K tokens saveable reads as one number of one
kind. It is not. A figure comes either from the output size the transcript
recorded for that tool call, or from a flat per-category constant used when
there is nothing to measure — and the two look identical in the table.

The split is not incidental. output_len measures what the last command of a
line wrote, so a command feeding a pipe is never the one it describes: every
opportunity that is an opportunity because it feeds a pipe is averaged, by
construction. Each table now says how much of it was averaged, next to its
total, the way the report already discloses estimated coverage at the top.

On this project's history that reads:

Total: 852 commands -> ~98.6K tokens saveable
769 of 852 sized by per-category average, the rest measured
Total: 681 commands -> ~108.3K tokens saveable by changing how they are run
524 of 681 sized by per-category average, the rest measured

The first line is the surprise: the missed-savings table is nine tenths
averaged too, not just the opportunities one. Whether the per-category constants
deserve that weight is a separate question, and a report that hides which
numbers rest on them cannot even raise it.

strip_disabled_prefix becomes split_env_prefix. It splits off any env
prefix; that one caller then looks for RTK_DISABLED= in what came back is the
caller's business, and the old name described the caller rather than the
function.

Test plan

  • cargo fmt --all && cargo clippy --all-targets && cargo test --all — 5915 passing, clippy clean, at this commit rather than only at the tip of the stack
  • a table of mixed provenance reports N of M sized by per-category average, a wholly averaged one says so outright, and a fully measured one says nothing

Part of #4315 (#4129 → #4138). Based on #4136. Each commit gates green on its own, so the stack is bisectable.

🤖 Generated with Claude Code

@KuSh
KuSh added this pull request to stack #4139 September 19, 2026 13:31
@KuSh
KuSh marked this pull request as ready for review September 19, 2026 16:21
@KuSh
KuSh force-pushed the lex/09-estimate-marker branch from a78e98c to 8795af7 Compare September 19, 2026 21:14
@KuSh
KuSh force-pushed the lex/09-estimate-marker branch from 8795af7 to 6c05375 Compare September 20, 2026 23:23
@KuSh
KuSh force-pushed the lex/09-estimate-marker branch from 6c05375 to 13fce4c Compare September 25, 2026 22:55
@KuSh
KuSh force-pushed the lex/09-estimate-marker branch from 13fce4c to 39583c2 Compare September 25, 2026 23:15
@KuSh
KuSh force-pushed the lex/09-estimate-marker branch 2 times, most recently from 827ead3 to e01d73f Compare September 25, 2026 23:29
@KuSh
KuSh force-pushed the lex/09-estimate-marker branch from e01d73f to c82205d Compare September 26, 2026 17:56
@KuSh
KuSh force-pushed the lex/09-estimate-marker branch from c82205d to 9290135 Compare September 26, 2026 21:30
@KuSh
KuSh force-pushed the lex/09-estimate-marker branch 2 times, most recently from 14bb3b7 to 4e61b6e Compare October 1, 2026 16:20
@KuSh
KuSh force-pushed the lex/09-estimate-marker branch 4 times, most recently from a7329b1 to 7d44e92 Compare October 2, 2026 15:07
@KuSh
KuSh force-pushed the lex/09-estimate-marker branch from 7d44e92 to 03ce493 Compare October 5, 2026 22:36
@KuSh
KuSh force-pushed the lex/09-estimate-marker branch from 03ce493 to 34156a1 Compare October 7, 2026 07:16
@KuSh
KuSh force-pushed the lex/09-estimate-marker branch 2 times, most recently from 06a1a9c to bc9cdc5 Compare October 15, 2026 12:03
@KuSh
KuSh force-pushed the lex/09-estimate-marker branch 3 times, most recently from cfc5573 to 22d514b Compare October 26, 2026 11:29
@KuSh
KuSh force-pushed the lex/09-estimate-marker branch 2 times, most recently from 8769ef9 to 15b653a Compare October 28, 2026 23:54
@KuSh
KuSh force-pushed the lex/09-estimate-marker branch 2 times, most recently from 4135d69 to 3d0321b Compare November 1, 2026 15:19
@TaKO8Ki
TaKO8Ki force-pushed the lex/09-estimate-marker branch from 3d0321b to e9bfed6 Compare November 2, 2026 11:31
@KuSh
KuSh force-pushed the lex/09-estimate-marker branch 2 times, most recently from c1ef67c to 686557b Compare November 3, 2026 06:27
@KuSh
KuSh marked this pull request as draft November 4, 2026 07:41
@KuSh
KuSh force-pushed the lex/09-estimate-marker branch from 686557b to a004478 Compare November 5, 2026 11:48
@KuSh
KuSh marked this pull request as ready for review November 5, 2026 12:22
@KuSh
KuSh force-pushed the lex/09-estimate-marker branch 2 times, most recently from 807eea2 to f7be617 Compare November 18, 2026 01:06
@KuSh
KuSh force-pushed the lex/09-estimate-marker branch 2 times, most recently from 91f4776 to a14a65a Compare November 21, 2026 09:57
…aged

`Total: 681 commands -> ~108.3K tokens saveable` reads as one number of one
kind. It is not. A figure comes either from the output size the transcript
recorded for that tool call, or from a flat per-category constant used when
there is nothing to measure — and the two look identical in the table.

The split is not incidental. `output_len` measures what the last command of a
line wrote, so a command feeding a pipe is never the one it describes: every
opportunity that is an opportunity *because* it feeds a pipe is averaged, by
construction. Each table now says how much of it was averaged, next to its
total, the way the report already discloses estimated coverage at the top.

On this project's history that reads:

  Total: 852 commands -> ~98.6K tokens saveable
    769 of 852 sized by per-category average, the rest measured
  Total: 681 commands -> ~108.3K tokens saveable by changing how they are run
    524 of 681 sized by per-category average, the rest measured

The first line is the surprise: the missed-savings table is nine tenths
averaged too, not just the opportunities one. Whether the per-category constants
deserve that weight is a separate question, and a report that hides which
numbers rest on them cannot even raise it.

`strip_disabled_prefix` becomes `split_env_prefix`. It splits off any env
prefix; that one caller then looks for `RTK_DISABLED=` in what came back is the
caller's business, and the old name described the caller rather than the
function.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@KuSh
KuSh force-pushed the lex/09-estimate-marker branch from a14a65a to 164cef5 Compare November 25, 2026 02:13
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