Skip to content

Comments

Prevent version.isSnapshot from incorrectly identifying versions with hashes as snapshots#3659

Merged
rtyley merged 1 commit intoscala-steward-org:mainfrom
guardian:jsh-rb/hash-does-not-indicate-snapshot
Jul 6, 2025
Merged

Prevent version.isSnapshot from incorrectly identifying versions with hashes as snapshots#3659
rtyley merged 1 commit intoscala-steward-org:mainfrom
guardian:jsh-rb/hash-does-not-indicate-snapshot

Conversation

@jonathonherbert
Copy link
Contributor

What's changed?

At the moment, we're attempting to create a workflow to raise PRs against consuming projects when we publish prereleases.

In attempting to use updates.allowPrereleases to do that, we've encountered an issue where the commit hash in our prerelease version (e.g. 0.0.37-PREVIEW.try-out-verify-artifact-hashes.2024-04-25T1652.c7fa7c2b) results in scala-steward misidentifying our release as a snapshot. As a result, it won't consider it as a valid next version.

This PR corrects the behaviour of version.isSnapshot, which was incorrectly identifying versions with hashes as snapshots.

As far as we're aware, snapshotted versions are usually identified by a -SNAPSHOT suffix, which the case below already covers:

@jonathonherbert jonathonherbert force-pushed the jsh-rb/hash-does-not-indicate-snapshot branch from ef70026 to d58d2fd Compare June 17, 2025 14:47
@rtyley rtyley force-pushed the jsh-rb/hash-does-not-indicate-snapshot branch from d58d2fd to e930c3c Compare July 6, 2025 13:54
@codecov
Copy link

codecov bot commented Jul 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.75%. Comparing base (26d54ba) to head (e930c3c).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3659      +/-   ##
==========================================
- Coverage   89.76%   89.75%   -0.01%     
==========================================
  Files         174      174              
  Lines        5049     5048       -1     
  Branches      503      487      -16     
==========================================
- Hits         4532     4531       -1     
  Misses        517      517              

☔ View full report in Codecov by Sentry.
📢 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.

@rtyley
Copy link
Contributor

rtyley commented Jul 6, 2025

I couldn't find any evidence that version numbers with hashes in them should always be considered as snapshot releases - here's a counter-example, where a non-snapshot release of an sbt dependency contained a hash in its version number:

https://mvnrepository.com/artifact/org.scala-sbt.ivy/ivy/2.3.0-sbt-396a783bba347016e7fe30dacc60d355be607fe2

...so I think this PR is correct: version.isSnapshot should not consider a version number to denote a snapshot just because it contains a hash.

@rtyley rtyley merged commit 3dabed0 into scala-steward-org:main Jul 6, 2025
10 checks passed
@rtyley rtyley deleted the jsh-rb/hash-does-not-indicate-snapshot branch July 6, 2025 14:09
@mzuehlke mzuehlke added this to the 0.35.0 milestone Jul 6, 2025
@rtyley rtyley changed the title Prevent version.isSnapshot from incorrectly identifying versions with hashes as snapshots Prevent version.isSnapshot from incorrectly identifying versions with hashes as snapshots Jul 8, 2025
jonathonherbert added a commit to guardian/scala-steward-public-repos that referenced this pull request Jul 9, 2025
jonathonherbert added a commit to guardian/scala-steward-public-repos that referenced this pull request Jul 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants