Repository navigation
fix(wt-perf): move timeline tests to lib + exclude bin from test compile - #2604
Merged
Merged
Conversation
The `[lib] name = "wt_perf"` and `[[bin]] name = "wt-perf"` artifacts both normalize to the same `wt_perf` basename. cargo-affected's runner shim disambiguates same-basename test binaries via a marker probe, but markers only fire for `kind = "test" | "bench" | "example"` — `lib` and `bin` get none. Once #2558 added inline tests under `bin/wt-perf`, both candidates appeared in cargo-affected's binary map without markers, so any hash drift between list and run aborted the shim with `basename fallback ambiguous`. The collect-affected job on main has been broken since #2558 merged. Two changes together fix it: - Move `render_timeline` (and its `describe`/`duration_of` helpers) plus the inline tests from `src/main.rs` into `src/lib.rs`. The bin no longer carries any `#[cfg(test)]` items. - Set `test = false` on the `[[bin]]` in Cargo.toml so cargo doesn't emit a test binary for it. This removes the bin from cargo-affected's binary map entirely, so even with hash drift the basename fallback finds a single candidate (the lib). The bin still gets compiled at `target/debug/wt-perf` because `tests/builds.rs` triggers it. Co-Authored-By: Claude <[email protected]>
Owner
|
is this a problem with cargo-affected? file an issue upstream if so |
Owner
|
I'll merge to prevent failures, but we should fix upstream and then possibly revert |
Collaborator
Author
|
Yes — root cause is in cargo-affected's marker probe: it only emits source-path markers for |
max-sixty
added a commit
that referenced
this pull request
May 5, 2026
PR #2604 moved timeline tests out of `tests/helpers/wt-perf/src/main.rs` into `src/lib.rs` and set `test = false` on the `[[bin]]` to dodge [cargo-affected#13](max-sixty/cargo-affected#13) — the runner shim couldn't disambiguate `[lib]` and `[[bin]]` artifacts that both normalize to `wt_perf` when neither kind carries a marker. [cargo-affected#14](max-sixty/cargo-affected#14) fixed that upstream by reading `NEXTEST_BINARY_ID` from the nextest env directly, so the shim now handles lib+bin collisions natively. The workaround is no longer needed. This restores the three files in `tests/helpers/wt-perf/` to their pre-#2604 state: tests live in `main.rs` again, the bin compiles its `#[cfg(test)]` block under nextest, and the `test = false` line is gone. CI installs `cargo-affected` from git without a pin (see `.github/workflows/ci.yaml:287`, `:359`), so the upstream fix is picked up automatically — no pin bump. ## Verification - `cargo build -p wt-perf` ✓ - `cargo test -p wt-perf` ✓ — both inline tests run from `main.rs` (`tests::cmd_failure_annotates_name`, `tests::renders_sorted_timeline_with_summary`), plus the `tests/builds.rs::builds` integration test. - The `affected tests` and `collect affected coverage` jobs in this PR's CI will exercise the actual fix end-to-end. > _This was written by Claude Code on behalf of @max-sixty_ Co-authored-by: Claude <[email protected]>
This was referenced May 5, 2026
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.
Problem
The
collect affected coveragejob has been failing on every push to main since #2558 merged, with the same error shape:Root cause: the
[lib] name = "wt_perf"and[[bin]] name = "wt-perf"artifacts both normalize to the samewt_perfbasename. cargo-affected's runner shim disambiguates same-basename test binaries via a marker probe, but markers only fire forkind = "test" | "bench" | "example"—libandbinget none. Once #2558 added inline tests underbin/wt-perf, both candidates appeared in cargo-affected's binary map without markers, so any hash drift between list and run aborted the shim withbasename fallback ambiguous.Issue #2571 previously diagnosed this as transient, but it has continued to fail every run since (25295115776, 25301191157, 25303363793, 25309058661, 25336005330) with the same error shape — it is durable, not transient.
Solution
Two changes together fix it:
render_timeline(and itsdescribe/duration_ofhelpers) plus the inline tests fromsrc/main.rsintosrc/lib.rs. The bin no longer carries any#[cfg(test)]items.test = falseon the[[bin]]inCargo.tomlso cargo doesn't emit a test binary for it. This removes the bin from cargo-affected's binary map entirely, so even with hash drift the basename fallback finds a single candidate (the lib). The bin still gets compiled attarget/debug/wt-perfbecausetests/builds.rstriggers it.Testing
cargo build -p wt-perf— produces the binary attarget/debug/wt-perfandwt-perf --helpworks as before.cargo test -p wt-perf— both timeline tests (renders_sorted_timeline_with_summary,cmd_failure_annotates_name) pass under the lib target; the bin target no longer ships a test binary.cargo clippy -p wt-perf --tests— clean.This commit is identical to f168bde on the orphaned
fix/ci-25289365418branch (cherry-picked here onto a current main).Automated fix for failed run