Files
worktrunk/tests
e261e50761 fix(wt-perf): move timeline tests to lib + exclude bin from test compile (#2604)
## Problem

The `collect affected coverage` job has been failing on every push to
main since #2558 merged, with the same error shape:

```
FAIL [   0.009s] (3487/3491) wt-perf::bin/wt-perf tests::cmd_failure_annotates_name
    cargo-affected runner-shim: failed to resolve binary_id for /home/runner/work/worktrunk/worktrunk/target/affected/build/debug/deps/wt_perf-01f04725fd165542: binary not found in map (path: /home/runner/work/worktrunk/worktrunk/target/affected/build/debug/deps/wt_perf-01f04725fd165542); target-name basename fallback ambiguous — 2 candidates share target name "wt_perf" ([wt-perf, wt-perf::bin/wt-perf]) and the marker probe matched 0 of them (none; candidates without markers: wt-perf::bin/wt-perf, wt-perf); re-run `cargo affected collect`
```

Root cause: 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`.

Issue #2571 previously diagnosed this as transient, but it has continued
to fail every run since (25295115776, 25301191157, 25303363793,
25309058661,
[25336005330](https://github.com/max-sixty/worktrunk/actions/runs/25336005330))
with the same error shape — it is durable, not transient.

## Solution

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.

## Testing

- `cargo build -p wt-perf` — produces the binary at
`target/debug/wt-perf` and `wt-perf --help` works 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 f168bdef on the orphaned
`fix/ci-25289365418` branch (cherry-picked here onto a current main).

---
Automated fix for [failed
run](https://github.com/max-sixty/worktrunk/actions/runs/25336005330)

Co-authored-by: worktrunk-bot <254187624+worktrunk-bot@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
2026-05-04 13:19:32 -07:00
..