fix(cargo): don't inject a redundant summary line when 0 crates compiled - #3385
Open
pszymkowiak wants to merge 1 commit into
Open
fix(cargo): don't inject a redundant summary line when 0 crates compiled#3385pszymkowiak wants to merge 1 commit into
pszymkowiak wants to merge 1 commit into
Conversation
cargo_build_success_line() always prepended "cargo build (N crates compiled)" even when N was 0 and cargo's own "Finished" line already said so — turning a 1-line raw output into 2 lines, a net token increase instead of a reduction (caught by scripts/benchmark.sh: 18 -> 25 tokens, -38%). Also covers the sibling case with no captured "Finished" line at all, which #1140 originally targeted but never landed (closed for being branched off the wrong base, not on merit). Fixes #759 Supersedes #1140 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cargo_build_success_line()always prepended a"cargo build (N crates compiled)"line — even whenN == 0and cargo's ownFinishedline already said so. On a no-op build (nothing to recompile), this turns a single-line raw output into two lines: a net token increase, not a reduction.Caught live via
scripts/benchmark.sh:Also covers the sibling case where no
Finishedline is captured at all (still 0 crates compiled) — distinguishing a genuine success from a silent failure.Fix
Context
masterinstead ofdevelop, producing a diverging/conflicting diff) — not rejected on merit. This PR covers both the case fix(cargo): disambiguate success output when 0 crates compiled #1140 addressed (finished_line == None) and the case it left unchanged (finished_line == Some(..), which is the one actually caught by the benchmark).Test plan
test_filter_cargo_build_up_to_date_with_finished_line,test_filter_cargo_build_up_to_date_no_finished_linetest_filter_cargo_build_success(compiled > 0 path) unaffectedcargo fmt --all && cargo clippy --all-targets && cargo test --all— 2494 passed, 0 failed🤖 Generated with Claude Code
Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com