Skip to content

fix(test): locate synth via CARGO_BIN_EXE — un-red Code Coverage - #908

Merged
avrabe merged 1 commit into
mainfrom
fix/coverage-binary-path
Aug 5, 2026
Merged

fix(test): locate synth via CARGO_BIN_EXE — un-red Code Coverage#908
avrabe merged 1 commit into
mainfrom
fix/coverage-binary-path

Conversation

@avrabe

@avrabe avrabe commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

The Code Coverage job has been failing repo-wide — on main and on every open PR — for a reason that has nothing to do with coverage.

crates/synth-cli/tests/async_intrinsics_gate.rs is the only CLI test that hand-rolls its binary path: two .parent() hops up from current_exe(), then push "synth". Correct for the plain target/debug/deps/<test> layout, wrong for any other. Under cargo llvm-cov the test binary lives at

target/llvm-cov-target/debug/build/synth-cli/<hash>/out/<test>

so the walk yields …/<hash>/synth, which does not exist. Both tests then fail on a missing binary, not on anything they assert:

test error_context_family_is_lowered_and_emits_field_name_symbol ... FAILED
test result: FAILED. 0 passed; 2 failed

The required Test job runs the plain layout and stays green, so a genuinely red gate sat unnoticed — the same "the checker is the defect, not the checked" shape as the vacuous gates and the correlated validators elsewhere in this release.

Fix: use env!("CARGO_BIN_EXE_synth"), which Cargo sets at compile time to the built binary's real path and is therefore layout-independent by construction. Every other CLI integration test in that directory already does this.

Verified in the exact failing configuration, not a proxy:

configuration result
cargo llvm-cov --no-report --tests --test async_intrinsics_gate 2 passed, 0 failed
plain cargo test 2 passed
relocated CARGO_TARGET_DIR 2 passed

Also cargo fmt --check clean. No production code touched — this is a test-harness fix only.

@codecov

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@avrabe avrabe closed this Aug 5, 2026
@avrabe
avrabe force-pushed the fix/coverage-binary-path branch from 3d289ce to 8a9446b Compare August 5, 2026 04:13
@avrabe avrabe reopened this Aug 5, 2026
…overage`

`Code Coverage` has been RED repo-wide — on main and on every open PR — for a
reason unrelated to coverage.

Two CLI tests hand-rolled their binary path: two `.parent()` hops up from
`current_exe()`, then push "synth". That resolves for the plain
`target/debug/deps/<test>` layout and for nothing else. Under `cargo llvm-cov`
the test binary lives at

    target/llvm-cov-target/debug/build/synth-cli/<hash>/out/<test>

so the walk produced `.../<hash>/synth` — a path that does not exist — and the
tests failed on a MISSING BINARY rather than on anything they assert: 2 in
async_intrinsics_gate.rs and ~56 in wast_compile.rs. The required `Test` job
runs the plain layout and stayed green throughout, so a real gate sat red for a
reason nobody read — the same "the checker is the defect" class as the vacuous
gates and the correlated validators elsewhere in this release.

Both now use `env!("CARGO_BIN_EXE_synth")`, which Cargo sets at compile time to
the built binary's real path and is therefore layout-independent by
construction — the mechanism every other CLI integration test already used.
wast_compile.rs's comment even said "cargo sets this for integration tests",
which is true of CARGO_BIN_EXE_synth and not of the walk beneath it.

Swept: zero code-level `current_exe()` binary walks remain under
crates/*/tests/, so this closes the class rather than the reported instance.

Verified in the EXACT failing configuration, not a proxy:

    cargo llvm-cov --no-report --tests -p synth-cli \
      --test wast_compile --test async_intrinsics_gate
    -> 56 passed, 2 passed, 2 passed; 0 failed

plus the plain layout and a relocated CARGO_TARGET_DIR. `cargo fmt --check`
clean. No production code touched.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YJK5LZZEkV5smCY1jKn18L
@avrabe
avrabe force-pushed the fix/coverage-binary-path branch from 8c2efd7 to e598a58 Compare August 5, 2026 06:06
@avrabe
avrabe merged commit 2e6e6df into main Aug 5, 2026
55 checks passed
@avrabe
avrabe deleted the fix/coverage-binary-path branch August 5, 2026 08:11
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