From 9b04056b93ed2bb59607403c486fef5f4d697960 Mon Sep 17 00:00:00 2001 From: Johnathan Corgan Date: Thu, 17 Sep 2026 19:59:24 +0000 Subject: [PATCH] fix(test/ci): compile the library tests in release mode, and keep them compiling `Node::debug_assert_peer_maps_coherent` exists only under `#[cfg(debug_assertions)]`, and the handshake-presence test called it without that gate, so `cargo test --release --lib` failed to build with E0599 while every sibling call site was gated correctly. Gate the call rather than the whole test, so the rest of its assertions still run under `--release`. Nothing noticed, because no runner ever compiled the test target with optimisations: local CI builds release binaries but tests in debug, and the GitHub unit-test job does the same. Add `cargo test --release --lib --no-run` to both runners so the next debug-only helper used without its gate fails at once instead of waiting for someone to run the suite in release. --- .github/workflows/ci.yml | 8 ++++++++ src/node/tests/unit.rs | 5 ++++- testing/ci-local.sh | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0fb4a7dc..f9bb2c6b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -330,6 +330,14 @@ jobs: - name: Run library tests with the tick-body profiler enabled run: cargo test --lib --features profiling + # Debug-only helpers (anything behind #[cfg(debug_assertions)]) vanish in + # a release build, so a test calling one without the same gate breaks a + # build no other job performs: every run above compiles the test target + # in debug. Compile it in release too, without running it — the point is + # that it builds at all. Mirrored in testing/ci-local.sh. + - name: Compile the library tests in release mode + run: cargo test --release --lib --no-run + # ───────────────────────────────────────────────────────────────────────────── # Job 2b – Unit tests (macOS) # ───────────────────────────────────────────────────────────────────────────── diff --git a/src/node/tests/unit.rs b/src/node/tests/unit.rs index 12b0ff7b..5bc4ca87 100644 --- a/src/node/tests/unit.rs +++ b/src/node/tests/unit.rs @@ -3977,7 +3977,10 @@ fn handshake_presence_tracks_the_carrier_not_the_noise_handles() { "rekey-msg2 discriminator: {when}" ); // Fires the live-carrier coherence assertion; a machine that had gone - // invisible would panic here rather than fail an assert_eq above. + // invisible would panic here rather than fail an assert_eq above. The + // helper only exists in debug builds, so the rest of this test carries + // on without it under `--release`. + #[cfg(debug_assertions)] node.debug_assert_peer_maps_coherent(); }; diff --git a/testing/ci-local.sh b/testing/ci-local.sh index 9b097be5..5a4b6a4f 100755 --- a/testing/ci-local.sh +++ b/testing/ci-local.sh @@ -603,6 +603,20 @@ run_tests() { else record "unit-tests-profiling" 1 fi + + # Debug-only helpers (anything behind #[cfg(debug_assertions)]) vanish in a + # release build, so a test calling one without the same gate breaks a build + # nothing here ever performs: every run above compiles the test target in + # debug. Compile it in release too, without running it — the point is that + # it builds at all. Mirrored in .github/workflows/ci.yml; check-ci-parity.sh + # compares integration suites only and would not catch a stage added to one + # runner and not the other. + info "cargo test --release --lib --no-run" + if cargo test --release --lib --no-run 2>&1; then + record "release-test-compile" 0 + else + record "release-test-compile" 1 + fi } # ── Stage 3: Integration Tests ─────────────────────────────────────────────