Skip to content

Add Ruby 3.0 and Ruby 3.1 to the CI matrix#315

Merged
flavorjones merged 5 commits intosparklemotion:masterfrom
petergoldstein:feature/add_ruby_3_0_and_3_1
May 25, 2022
Merged

Add Ruby 3.0 and Ruby 3.1 to the CI matrix#315
flavorjones merged 5 commits intosparklemotion:masterfrom
petergoldstein:feature/add_ruby_3_0_and_3_1

Conversation

@petergoldstein
Copy link
Copy Markdown
Contributor

In addition to updating the CI configuration to include Ruby 3.0 and Ruby 3.1, a number of other changes were necessary to get this to green across the board. I could use a review by the maintainers to ensure these were done correctly. They were:

  1. Updating from the use of the unsupported mini_portile gem to the mini_portile2 gem, as the former isn't compatible with Ruby 3.1.
  2. Case normalizing the type values returned by table_info to lower case, which is what the tests expect. On Mac and Windows these were returned upper case (this test failure exists in CI before this PR)
  3. Updating a test that directly accesses the types of a query result to accept both upper and lower case values

With these changes, everything runs green.

@casperisfine
Copy link
Copy Markdown

👍 , I just ran into the same thing. cc @tenderlove @flavorjones, would be nice to merge this.

@flavorjones
Copy link
Copy Markdown
Member

I've kicked CI to demonstrate green but I've not been involved with sqlite3 in 12 years. I'd like someone who's more familiar with sqlite3 and this code to determine whether the downcase fixes for column types is the right thing to do (since it's not clear to me why or when this behavior changed). @tenderlove ?

Comment thread test/test_integration_resultset.rb Outdated

def test_types
assert_equal [ "integer", "text" ], @result.types
assert_equal [ "integer", "text" ], @result.types.map { |t| t.downcase }
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Why do we need to downcase here if it's already handled in pragmas.rb?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@casperisfine Because the pragmas.rb change only impacts the table_info call. The types call here goes directly to the extension.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

My bad. Can we add a similar downcase in there to preserve backward compatiblity?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@casperisfine I made that change. Please take a look and let me know what you think.

Reverted downcase in spec, and updated another spec to use a lower cased type ('BLOB' => 'blob').  Updated ordering of arguments in the latter spec.
Comment thread test/test_statement.rb

assert_equal ['hello'], row.first
assert_equal row.first.types, ['BLOB']
assert_equal ['blob'], row.first.types
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think I'm confused now... Some types were capitalized before but not all of them???

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I did this a while back, so frankly I don't remember the details off the top of my head. But you can see my comments in #2 in my original description. I was seeing case inconsistency across different operating systems.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@casperisfine You can see an action that demonstrates the issue here - https://github.com/sparklemotion/sqlite3-ruby/runs/6090043254 . Ubuntu passes (lowercase) but Windows/Mac does not. This was ultimately all coming from the underlying C code, whose behavior didn't seem to be consistent across operating systems. So I had the Ruby code case normalize, based on what had been in the specs (assuming that was the historically expected behavior)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Ok, thanks for the info, I'll try to dig into this a bit more next week. We also need to look at what the common callers expects (e.g. Active Record)

Copy link
Copy Markdown
Contributor Author

@petergoldstein petergoldstein May 18, 2022

Choose a reason for hiding this comment

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks @petergoldstein, then I think we can assume this never was consistent.

@casperisfine
Copy link
Copy Markdown

@tenderlove / @flavorjones I suggest we merge this.

@flavorjones flavorjones merged commit 09f0276 into sparklemotion:master May 25, 2022
@flavorjones
Copy link
Copy Markdown
Member

@casperisfine do you need a release, too?

@casperisfine
Copy link
Copy Markdown

@flavorjones not yet, I wanted this merged to fix CI on #317, for which I'd love a release yes.

This was referenced May 25, 2022
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.

3 participants