Skip to content

Conversation

@anakinj
Copy link
Member

@anakinj anakinj commented Apr 20, 2025

Description

Ensure we run the test suite on a older openssl gem version (2.0).

Checklist

Before the PR can be merged be sure the following are checked:

  • There are tests for the fix or feature added/changed
  • A description of the changes and a reference to the PR has been added to CHANGELOG.md. More details in the CONTRIBUTING.md

@anakinj anakinj requested a review from Copilot June 11, 2025 18:46
Copy link
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

This PR ensures backwards compatibility by running the test suite on an older OpenSSL gem version and updating related configurations.

  • Implements a skip mechanism in tests when RSA-PSS support is missing
  • Removes tests that raise errors for PS algorithms with newer OpenSSL versions
  • Adjusts the gemfile, RuboCop configuration, and workflow Ruby version to support the legacy OpenSSL gem

Reviewed Changes

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

Show a summary per file
File Description
spec/jwt/jwt_spec.rb Adds skip checks for RSA-PSS support and removes error tests for PS algorithms
spec/jwt/jwa/ps_spec.rb Adds skip check for RSA-PSS support in PS-specific tests
lib/jwt/error.rb Removes the RequiredDependencyError, aligning with backwards compatibility changes
gemfiles/openssl.gemfile Downgrades the OpenSSL gem version constraint to support older versions
.rubocop.yml Disables the Naming/PredicateMethod rule to align with compatibility requirements
.github/workflows/test.yml Downgrades the Ruby version for one test matrix from 3.0 to 2.5 to reflect compatibility needs
Comments suppressed due to low confidence (4)

spec/jwt/jwt_spec.rb:204

  • [nitpick] Consider adding a comment explaining why tests for PS algorithms in the error branch were removed, clarifying the intent for backwards compatibility.
if Gem::Version.new(OpenSSL::VERSION) >= Gem::Version.new('2.1')

lib/jwt/error.rb:7

  • Verify that removing the RequiredDependencyError does not negatively affect error handling in parts of the code that rely on this exception.
class RequiredDependencyError < StandardError; end

gemfiles/openssl.gemfile:5

  • Ensure that constraining the openssl gem to versions '< 2.0' aligns with the intended compatibility and does not inadvertently exclude required features.
gem "openssl", "< 2.0"

.github/workflows/test.yml:53

  • Downgrading the Ruby version for this test matrix could impact compatibility and behavior of modern syntax features; please ensure the test suite comprehensively covers potential version-specific issues.
ruby: "2.5"

EnforcedStyle: gemspec

Naming/PredicateMethod:
Enabled: false
Copy link

Copilot AI Jun 11, 2025

Choose a reason for hiding this comment

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

[nitpick] Disabling the Naming/PredicateMethod rule might mask potential naming consistency issues; consider documenting the rationale for this change.

Suggested change
Enabled: false
Enabled: false # Disabled to allow flexibility in naming methods that do not strictly follow predicate conventions.

Copilot uses AI. Check for mistakes.
@anakinj anakinj merged commit f66e7a8 into jwt:main Jun 11, 2025
14 of 15 checks passed
drobny added a commit to drobny/clerk-sdk-ruby that referenced this pull request Jun 26, 2025
The core gem was upgraded to version 3 a couple of weeks ago
https://github.com/jwt/ruby-jwt/tree/v3.0.0.

Removed the RequiredDependencyError constant as that has been
removed in the gem itself as part of jwt/ruby-jwt#676
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