Fix MolarFlow per-hour abbreviations#1682
Merged
Merged
Conversation
ReviewClean, well-scoped bug fix for #1663. Verified the root cause and the fix directly. Correctness
Generated code
Breaking change
Test coverage
Overall: small, correct, well-validated fix. No concerns blocking merge. |
angularsen
marked this pull request as ready for review
July 17, 2026 16:53
angularsen
enabled auto-merge (squash)
July 17, 2026 16:54
angularsen
added a commit
that referenced
this pull request
Jul 17, 2026
## Motivation Backport of #1682 for the v5 maintenance branch. Issue #1663 reports that the generated abbreviations for MolarFlow per-hour units are shifted by one kilo prefix: - `MolarFlowUnit.MolePerHour` formats/parses as `kmol/h` - `MolarFlowUnit.KilomolePerHour` formats/parses as `kkmol/h` The root cause is that `MolePerHour` has `Prefixes: [ "Kilo" ]`, but its base abbreviation in `MolarFlow.json` was already written as `kmol/h`. The prefix generator then prepended another `k` for the generated `KilomolePerHour` unit. ## Changes - Change `MolePerHour` abbreviation from `kmol/h` to `mol/h`. - Regenerate MolarFlow resources and generated tests. - Generated abbreviations now match the other molar-flow units: - `MolePerHour`: `mol/h` - `KilomolePerHour`: `kmol/h` ## Validation - `dotnet run --project CodeGen -p:NuGetAudit=false` - `dotnet test UnitsNet.Tests -f net48 --filter "FullyQualifiedName~MolarFlowTests" -p:NuGetAudit=false` - `dotnet test UnitsNet.Tests -f net9.0 -p:NuGetAudit=false` Note: plain restore/codegen on this maintenance branch is currently blocked by an unrelated NuGet audit warning for `NuGet.Protocol` 6.12.1, so validation used `NuGetAudit=false` to avoid changing dependencies in this bugfix PR. Refs #1663.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1682 +/- ##
======================================
Coverage 96% 96%
======================================
Files 450 450
Lines 29306 29306
======================================
Hits 28271 28271
Misses 1035 1035 ☔ 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.
Motivation
Issue #1663 reports that the generated abbreviations for MolarFlow per-hour units are shifted by one kilo prefix:
MolarFlowUnit.MolePerHourformats/parses askmol/hMolarFlowUnit.KilomolePerHourformats/parses askkmol/hThe root cause is that
MolePerHourhasPrefixes: [ "Kilo" ], but its base abbreviation inMolarFlow.jsonwas already written askmol/h. The prefix generator then prepended anotherkfor the generatedKilomolePerHourunit.Changes
MolePerHourabbreviation fromkmol/htomol/h.MolePerHour:mol/hKilomolePerHour:kmol/hValidation
generate-code.batdotnet test UnitsNet.Tests --filter "FullyQualifiedName~MolarFlowTests"Fixes #1663.