Skip to content

Fix DEPRECATION_HORIZON sed pattern in script/release - #2704

Closed
joelhawksley wants to merge 1 commit into
3.xfrom
apply-release-fixes-3x
Closed

Fix DEPRECATION_HORIZON sed pattern in script/release#2704
joelhawksley wants to merge 1 commit into
3.xfrom
apply-release-fixes-3x

Conversation

@joelhawksley

Copy link
Copy Markdown
Member

Backport of the DEPRECATION_HORIZON sed fix from main (companion to #2691 on main).

Root cause

lib/view_component/deprecation.rb stores the value as a quoted string:

DEPRECATION_HORIZON = "4.0.0"

But script/release's sed was:

sed -E -i '' -e "s/DEPRECATION_HORIZON = [0-9]+/DEPRECATION_HORIZON = \$((major + 1))/g"

[0-9]+ requires ≥1 digit immediately after = , but the next character is the opening quote. So the substitution matched nothing and silently no-oped on every 3.x release — the horizon has never actually been bumped by the script.

Fix

Match the full quoted X.Y.Z and replace with "<major+1>.0.0", mirroring the fix I made on main.

Applicability of other main-branch release fixes

For reference, most of the recent main-branch release fixes do not apply to 3.x:

  • 3.x has no release.yml, publish-release.yml, or push_gem.yml workflows — releases are done locally.
  • script/release on 3.x is interactive-only (no CI-args branch) and doesn't call build_docs.
  • script/publish on 3.x is just bundle exec rake release + gh-pages push — no gh release create, no check_github_permissions.

Only this sed bug is relevant. Verified locally on macOS with BSD sed: starting value "5.0.0" + major=3 → "4.0.0"; ruby -c reports Syntax OK.

The value in lib/view_component/deprecation.rb is a quoted string
('DEPRECATION_HORIZON = "4.0.0"'), but the sed pattern was:

  s/DEPRECATION_HORIZON = [0-9]+/DEPRECATION_HORIZON = $((major + 1))/g

'[0-9]+' requires at least one digit immediately after the '= ', but
the next character is the opening quote. So the substitution matched
nothing and silently no-oped on every 3.x release — the deprecation
horizon has never been bumped as a result.

Match the full quoted 'X.Y.Z' and replace with '"<major+1>.0.0"'.

Verified locally on macOS (BSD sed): a starting value of "5.0.0"
with major=3 becomes "4.0.0", and ruby -c reports Syntax OK on the
result.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 217f0a0d-a9f2-4607-9643-5fcb3e34f20f
@joelhawksley

Copy link
Copy Markdown
Member Author

Superseded by the port PR (opening next), which includes this fix along with the full release-workflow port.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant