Skip to content

ci: no job runs cargo test --release, so every cfg(not(debug_assertions)) test is dead #428

Description

@justin13888

mise run test-rust (mise.toml:141-146) runs cargo nextest run three times, always in the test profile, and nothing else in mise.toml or .github/workflows/ci.yml passes --release. [profile.release] (Cargo.toml:97-99) does not set debug-assertions, so it defaults off.

The consequence: a #[cfg(not(debug_assertions))] test is compiled out of every build CI makes, and therefore never runs.

There are three such tests today, all in capsule-i18n/src/format.rs, and all of them pin production behaviour rather than debug behaviour:

  • release_builds_pass_the_construct_through_unchanged — a refused ICU construct is copied through verbatim instead of crashing a release build on a catalog it could previously render badly.
  • release_builds_render_the_first_arm_of_a_plural_with_no_other — a malformed plural still renders text.
  • release_builds_pass_a_too_deeply_nested_plural_through.

Each has a #[cfg(debug_assertions)] #[should_panic] twin that CI does run, so the assertion is covered and only the pass-through is not. That split is deliberate — the whole design of the refusal is "loud in debug, harmless in release" — but it only means something if both halves are executed somewhere.

This also caught a real failure once: before #414, an_unrenderable_icu_construct_is_refused_in_debug_builds was #[should_panic] with no cfg gate, so cargo test -p capsule-i18n --release failed outright. Nobody noticed, because nobody ran it.

Deliverable: a test-rust-release task (or a --release arm inside test-rust) wired into the CI test job and, if the cost is acceptable, pre-push. Note nextest and --release compile a second copy of the workspace, so the runtime cost is not free — scoping it to the crates that have profile-gated tests is a reasonable answer, provided something fails when a new one appears elsewhere.

Found while landing #414 (slice S-I7); recorded there under Owed-CI.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    choreRoutine maintenance or non-feature tasks

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions