fix(multitude): restore coverage for transcode_utf16_into#499
Open
martin-kolinek wants to merge 1 commit into
Open
fix(multitude): restore coverage for transcode_utf16_into#499martin-kolinek wants to merge 1 commit into
martin-kolinek wants to merge 1 commit into
Conversation
PR #478 (feat(thread_aware): add feature-gated ThreadAware impls for 3rd-party crate types) dropped codecov from 100% to 99.9% even though it didn't touch multitude. The 11 missed lines are the body of the private `transcode_utf16_into` helper in `crates/multitude/src/arena/alloc_utf16.rs`. Root cause: the helper is `#[inline(always)]`, so no out-of-line copy exists in the test binary. llvm-cov has to attribute hits to inlined copies via debuginfo, and that mapping is fragile -- it shifted when PR #478 added new optional deps (`bytes`, `http`, `jiff02`, `uuid`) to `thread_aware`, which is a transitive dep of multitude via bytesbuf. Fix: gate the `inline(always)` on `not(coverage_nightly)` so under coverage instrumentation the function keeps a real callable body that llvm-cov attributes hits to deterministically. Release/dev/CI test builds keep `inline(always)` exactly as today -- zero perf change for users. Verified locally with `cargo +nightly-2026-05-30 llvm-cov --all-features -p multitude --lcov`: before the change, alloc_utf16.rs reports 72 hit / 11 missed (exactly lines 213, 219-225, 227, 228, 230); after the change, 83 hit / 0 missed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Restores deterministic llvm-cov line attribution for multitude’s private UTF-16 transcoding helper by avoiding forced inlining during coverage builds, addressing a recent project coverage drop without changing runtime behavior for normal builds.
Changes:
- Replaces unconditional
#[inline(always)]ontranscode_utf16_intowith#[cfg_attr(not(coverage_nightly), inline(always))]. - Adds an inline comment explaining why coverage builds should keep an out-of-line function body for stable line mapping.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #499 +/- ##
======================================
Coverage 99.9% 100.0%
======================================
Files 336 336
Lines 24829 24829
======================================
+ Hits 24818 24829 +11
+ Misses 11 0 -11 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
PR #478 (
feat(thread_aware): add feature-gated ThreadAware impls for 3rd-party crate types) dropped codecov coverage onmainfrom 100% to 99.9% even though it didn't touch themultitudecrate at all (its own patch coverage was 100%).The 11 missed lines are all the body of the private
transcode_utf16_intohelper incrates/multitude/src/arena/alloc_utf16.rs: lines 213, 219–225, 227, 228, 230.Root cause
The helper is
#[inline(always)], so no out-of-line function body exists in the compiled test binary.cargo llvm-covhas to attribute hits to the inlined copies via debuginfo, and that mapping is fragile — it shifted when PR #478 added new optional deps (bytes,http,jiff02,uuid) tothread_aware, which is a transitive dep ofmultitudeviabytesbuf. The function is still exercised by existing tests (alloc_utf16_str_arc_from_str, the oversized routes tests added in #487, etc.); coverage just stops getting attributed to the source lines.Fix
Gate the
inline(always)onnot(coverage_nightly):#[cfg_attr(not(coverage_nightly), inline(always))]Under coverage instrumentation the function keeps a real callable body that llvm-cov attributes hits to deterministically. Release/dev/CI test builds keep
inline(always)exactly as today — zero perf change for users.The
coverage_nightlycfg is already a known idiom in this crate (used widely with#[coverage(off)]andfeature(coverage_attribute)).Verification
Ran
cargo +nightly-2026-05-30 llvm-cov --all-features -p multitude --lcovlocally:alloc_utf16.rsreports 72 hit / 11 missed (exactly lines 213, 219–225, 227, 228, 230 — matches what codecov shows onmain).alloc_utf16.rsreports 83 hit / 0 missed. 100% restored.