Release Post template sets an incorrect current_version when the minor version is .10
Overview
In 14.3 and prior, deprecations were displayed in the release post as a full content block.
From 14.4 and above, deprecations were no longer commited to www-gitlab-com but were instead hosted in Docs. And so, we only list the feature_name of the deprecation and link to its entry in the Docs.
The release post template displays either the full content block or only the name by determining which version of the post is displayed with this code:
- current_version = Gem::Version.new(current_article.data.release_number.to_f)
However, "14.10".to_f => 14.1 and so the template thinks the 14.10 deprecation list (which only contains the name) should use the block for 14.1
I am working on a quick fix for a solution, but we need a better answer here.
I can't remove .to_f because this code defines current_article.data.release_number as "Preview" in certain instances that I haven't gotten to the bottom of yet.
For now, the pipeline seems to be happy enough with my hard-coded fix and deprecations prior to and after 14.3 are displaying, including these for 14.10. But, your recommendation for a better solution here is very much welcomed!
Proposal
I had a look. In general, the to_f is incorrect, because the release name is not a float number, but rather two integers separated by a point, so that 14.10 is different from 14.1 . Gem::Version.new can be passed a string, so it could be used in general with current_version = Gem::Version.new(current_article.data.release_number) , but that would break with Preview as you say (because the string is expected to be numbers separated by dot). One option is to have a special condition for the Preview case, setting it to 0, and otherwise passing the string without to_f, instead of having the condition for 14.10
- if current_article.data.release_number == "Preview" - current_version = Gem::Version.new(0) - else - current_version = Gem::Version.new(current_article.data.release_number)