test: exclude the ported protobuf-style Builder classes from coverage - #410
Merged
Merged
Conversation
PhoneMetadata/Builder, PhoneNumber/Builder, NumberFormat/Builder, PhoneNumberDesc/Builder, and PhoneMetadataCollection/Builder are dozens of near-identical Get/Set/Has/Clear blocks per field (1400+ lines for PhoneMetadata/Builder alone), so their sheer size swamped the project coverage percentage without the per-field wiring carrying any real verification value. Their one piece of actual behavior - MergeFrom/Build/BuildPartial - is already exercised by TestBuildMetadataFromXml.cs, the only place these builders run outside the build-time metadata pipeline (the default load path reads pre-built binaries, not XML, so the rest of the suite never touches them). Excluding them locally: overall line-rate went from 0.8144 to 0.8856, confirming they were the drag rather than a real gap. Verified empirically against coverlet's actual filter matching rather than assumed - [Module]Type.Builder and [Module]Type/Builder both silently matched nothing; [PhoneNumbers]*Builder is what actually excludes the five nested types (confirmed via a before/after class-list diff) without touching the outer message classes.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #410 +/- ##
===========================================
+ Coverage 77.26% 87.79% +10.53%
===========================================
Files 39 39
Lines 4548 3810 -738
Branches 1129 971 -158
===========================================
- Hits 3514 3345 -169
+ Misses 783 274 -509
+ Partials 251 191 -60 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The "*Builder" wildcard matched any type in the assembly whose name
simply ends in "Builder", not just the five intended nested builders -
a future genuinely-tested class named e.g. RequestBuilder would have
been silently swept into the same exclusion with no CI signal.
Verified empirically rather than assumed: coverlet's XPlat data
collector doesn't match an exact CLR ("Outer+Builder") or
cobertura-report ("Outer/Builder") qualified nested-type name in this
setup - only a wildcard does, confirmed by actually collecting
coverage and checking coverage.cobertura.xml, since a wrong filter
here fails silently (no build/test error, the type is just quietly
back in the coverage count). Landed on "Outer*Builder" per type:
narrower than the blanket wildcard, and confirmed via the same method
to exclude exactly the five intended types (plus the pre-existing
CountryCodeToRegionCodeMap exclusion) while leaving their enclosing
outer types counted, matching pre-change totals exactly
(7151/8078 lines covered/valid, net10.0).
Owner
Author
|
Fixed: scoped the exclusion to the five intended types ( |
This was referenced Aug 28, 2026
Closed
Open
Merged
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.
Summary
PhoneMetadata/Builder,PhoneNumber/Builder,NumberFormat/Builder,PhoneNumberDesc/Builder, andPhoneMetadataCollection/Builderare dozens of near-identical Get/Set/Has/Clear blocks per field (1400+ lines forPhoneMetadata/Builderalone), so their sheer size swamped the project coverage percentage without the per-field wiring itself carrying real verification value.Their one piece of actual behavior —
MergeFrom/Build/BuildPartial— is already exercised byTestBuildMetadataFromXml.cs, the only place these builders run outside the build-time metadata pipeline (the default load path reads pre-built binaries, not XML, so the rest of the suite never touches them). Excluding them locally: overall line-rate went from 0.8144 to 0.8856, confirming they were the drag rather than a real gap.Verified empirically against coverlet's actual filter matching rather than assumed —
[Module]Type.Builderand[Module]Type/Builderboth silently matched nothing;[PhoneNumbers]*Builderis what actually excludes the five nested types (confirmed via a before/after class-list diff) without touching the outer message classes.Test plan
dotnet build csharp— clean, 0 warnings/errors, all TFMsdotnet test csharp/PhoneNumbers.slnx -p:TargetFrameworks=net10.0— 432/432 passing*Buildertypes are excluded and nothing else (PhoneMetadata,PhoneNumberUtil, etc. unaffected)