Skip to content

Upgrade Sinatra 3.2 to 4.2 and Rack 2.2 to 3.2#91

Open
bennyfactor wants to merge 7 commits intomainfrom
upgrade/sinatra-4
Open

Upgrade Sinatra 3.2 to 4.2 and Rack 2.2 to 3.2#91
bennyfactor wants to merge 7 commits intomainfrom
upgrade/sinatra-4

Conversation

@bennyfactor
Copy link
Copy Markdown
Owner

Summary

  • Sinatra 3.2.0 → 4.2.1, Rack 2.2.22 → 3.2.6, rack-protection 3.2.0 → 4.2.1
  • Fixes URI::RFC3986_PARSER.unescape deprecation warning on Ruby 3.4
  • Updates error handler response access for Rack 3 compatibility (response.content_type instead of response['Content-Type'], handle body as array or string)
  • All existing tests pass unchanged — no breaking changes in request handling, multipart uploads, sessions, or routing

Audit performed

  • Verified all 27 request.body.read calls (none double-read, no rewind needed)
  • Verified multipart file upload params[:file][:tempfile] works with Rack 3
  • Verified error handlers correctly preserve JSON API responses
  • Verified find_template override, halt, redirect, session, pass all work
  • Verified all Rack-dependent gems are compatible (rack-attack, omniauth, rack-test, puma)

New tests added

  • Multipart file upload integration test
  • API error handler JSON preservation tests
  • API 404 response test

Test plan

  • Full test suite: 1240 examples, 0 failures
  • URI deprecation warning eliminated
  • Verify in staging with Apache + FastCGI deployment
  • Verify in Docker + Puma deployment

🤖 Generated with Claude Code

- Update Gemfile constraints for sinatra ~> 4.0 and rack-protection ~> 4.0
- Fix error handler response access for Rack 3 compatibility
- URI::RFC3986_PARSER.unescape deprecation warning resolved
Copilot AI review requested due to automatic review settings April 21, 2026 01:27
@github-actions
Copy link
Copy Markdown

Prerelease Gem Built

Version: 0.3.5.pre.91

Install from GitHub Packages

Add to your Gemfile:

source "https://rubygems.pkg.github.com/bennyfactor" do
  gem "v7cms", "0.3.5.pre.91"
end

Or install directly:

gem install v7cms -v "0.3.5.pre.91" --source "https://rubygems.pkg.github.com/bennyfactor"

Download Artifact

The gem is also available as a build artifact on this workflow run.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 21, 2026

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ RUBY rubocop 3 0 0 6.15s

See detailed reports in MegaLinter artifacts
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security
Show us your support by starring ⭐ the repository

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Upgrades the app’s core Rack/Sinatra stack to Sinatra 4.x + Rack 3.x and adjusts error handling/tests to maintain JSON API behavior under the new response/header APIs.

Changes:

  • Bump sinatra to ~> 4.0 and rack-protection to ~> 4.0, with corresponding Gemfile.lock updates (Rack 3.2.x, Sinatra 4.2.x, etc.).
  • Update error handlers to use Rack 3-compatible response access (response.content_type, and body handling for array vs string).
  • Add request specs for API JSON error responses and multipart upload behavior.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
spec/routes/errors_spec.rb Adds API error-response JSON parsing assertions.
spec/routes/assets_spec.rb Adds multipart upload request specs for /api/assets.
lib/v7cms/application.rb Updates 403/500 handlers to preserve JSON responses under Rack 3.
Gemfile.lock Locks upgraded Sinatra/Rack-related dependency versions (adds rack-session, logger deps, etc.).
Gemfile Updates top-level gem constraints for Sinatra and rack-protection.

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

Comment thread lib/v7cms/application.rb
Comment thread spec/routes/errors_spec.rb Outdated
Comment thread lib/v7cms/application.rb
Copilot AI review requested due to automatic review settings April 21, 2026 02:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 5 changed files in this pull request and generated 4 comments.


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

Comment thread spec/routes/assets_spec.rb
Comment thread spec/routes/errors_spec.rb Outdated
Comment thread spec/routes/errors_spec.rb
Comment thread spec/routes/errors_spec.rb Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

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


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

Comment thread spec/routes/assets_spec.rb
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

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


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

Comment thread Gemfile
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.

2 participants