Skip to content

ToSemanticString should always return 3-component version string - #94

Merged
Tyrrrz merged 2 commits into
primefrom
copilot/fix-version-to-semantic-string
Jul 24, 2026
Merged

ToSemanticString should always return 3-component version string#94
Tyrrrz merged 2 commits into
primefrom
copilot/fix-version-to-semantic-string

Conversation

Copilot AI commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Version.ToSemanticString() could return a 2-component string (e.g. "1.2") when the Build component was unset, violating the semantic versioning requirement of always having major.minor.patch.

Changes

  • VersionExtensions.cs: Append .0 when Build < 0, ensuring a minimum of 3 components
  • VersionExtensionsTests.cs: Update expectation for new Version(1, 2) from "1.2""1.2.0"
new Version(1, 2).ToSemanticString()    // was "1.2", now "1.2.0"
new Version(1, 2, 3).ToSemanticString() // unchanged: "1.2.3"

@Tyrrrz Tyrrrz changed the title fix: ToSemanticString always returns 3-component version string ToSemanticString should always return 3-component version string Jul 24, 2026
@Tyrrrz Tyrrrz added the bug Something isn't working label Jul 24, 2026
@Tyrrrz
Tyrrrz marked this pull request as ready for review July 24, 2026 12:09
Copilot AI review requested due to automatic review settings July 24, 2026 12:09
@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.51%. Comparing base (3c1e3f1) to head (582d8e5).
⚠️ Report is 1 commits behind head on prime.

Additional details and impacted files
@@            Coverage Diff             @@
##            prime      #94      +/-   ##
==========================================
+ Coverage   86.36%   86.51%   +0.15%     
==========================================
  Files          78       78              
  Lines        1393     1409      +16     
  Branches      239      242       +3     
==========================================
+ Hits         1203     1219      +16     
  Misses        137      137              
  Partials       53       53              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts Version.ToSemanticString() to always output at least three numeric components (major.minor.patch) by converting new Version(major, minor) from "major.minor" to "major.minor.0", aligning output with semantic-version expectations.

Changes:

  • Ensure ToSemanticString() appends ".0" when Version.Build is unset (Build < 0).
  • Update the corresponding unit test expectation for new Version(1, 2) to "1.2.0".

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
PowerKit/Extensions/VersionExtensions.cs Ensures at least 3 components by appending .0 when the build/patch component is missing.
PowerKit.Tests/Extensions/VersionExtensionsTests.cs Updates expected string output for new Version(1, 2) to match the new behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread PowerKit/Extensions/VersionExtensions.cs
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants