Skip to content

fix(tests): give helper-crate dummy tests crate-prefixed filenames - #2493

Closed
worktrunk-bot wants to merge 1 commit into
mainfrom
fix/ci-25147440158
Closed

worktrunk-bot wants to merge 1 commit into
mainfrom
fix/ci-25147440158

Conversation

@worktrunk-bot

Copy link
Copy Markdown
Collaborator

Problem

The collect affected coverage job has been failing on every push to main since the cargo-affected jobs were added in #2475. Failed run: 25147440158.

The runner-shim aborts with:

cargo-affected runner-shim: failed to resolve binary_id for
  /home/runner/work/worktrunk/worktrunk/target/debug/deps/builds-8cd2602cd0d82929:
  binary not found in map ...; target-name fallback ambiguous —
  2 entries share basename "builds" (["mock-stub::builds", "wt-perf::builds"])
  and neither filesystem state nor binary-content marker disambiguates

Both tests/helpers/mock-stub/tests/builds.rs and tests/helpers/wt-perf/tests/builds.rs are one-line dummy tests whose only job is to force their crate's binary to compile under cargo test. Cargo derives the test target name from the file stem, so each produced a binary named builds-<hash>. Whenever the recorded hash drifts (incremental rebuilds, different runner image, etc.), cargo-affected's shim falls back to a basename match — which is ambiguous between the two crates and has nothing else to break the tie.

Solution

Rename the files so each test target gets a crate-prefixed, unique basename:

  • tests/helpers/mock-stub/tests/builds.rs → tests/helpers/mock-stub/tests/mock_stub_builds.rs
  • tests/helpers/wt-perf/tests/builds.rs → tests/helpers/wt-perf/tests/wt_perf_builds.rs

Both Cargo.toml HOW THE BINARY GETS BUILT notes are updated to reference the new filenames and to call out the disambiguation constraint, so a future helper crate doesn't reintroduce a generic name like builds.rs.

This is the local fix that's tractable from the worktrunk side. Even if cargo-affected later improves its disambiguation, unique basenames are the more robust contract.

Testing

Local cargo test -p mock-stub -p wt-perf builds and passes; produced executables are now mock_stub_builds-<hash> and wt_perf_builds-<hash>, removing the basename collision the shim was tripping on.


Automated fix for failed run.

Both `tests/helpers/mock-stub/tests/builds.rs` and
`tests/helpers/wt-perf/tests/builds.rs` produced test target binaries
named `builds`, with no other distinguishing artifact on disk.
cargo-affected's runner-shim resolves a binary path to a target id by
exact-hash match, then by basename fallback, then by filesystem state
or binary-content marker. With the same basename in two crates and
nothing to break the tie, the shim aborts the run, which fails the
`collect affected coverage` job on every push to main.

Rename the files to `mock_stub_builds.rs` and `wt_perf_builds.rs` so
the test target basenames are unique, and mention the constraint in
each crate's HOW THE BINARY GETS BUILT note so a future helper crate
doesn't reintroduce the collision.

Co-Authored-By: Claude <[email protected]>
@worktrunk-bot worktrunk-bot added the automated-fix Automated CI fix label Apr 30, 2026
@max-sixty

Copy link
Copy Markdown
Owner

we'll fix upstream

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated-fix Automated CI fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants