New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Experiments with liquid 5.x #9229
base: master
Are you sure you want to change the base?
Conversation
This would be great to have because Ruby 3.2.0 dropped taint checking, and Liquid 4.0.3 still uses it, resulting in Jekyll failing to build with Ruby 3.2.0. |
We need to disable liquid-5.4 and liquid-c to have the tests pass initially.
Before Liquid 5.4, context.registers are good old plain Hash. After Liquid 5.4, context.registers is_a Liquid::Registers
The following errors is raised when jekyll-seo-tag is used with liquid-5.4.0. This is caused by the fact that context.registers no longer returns Hash, but Liquid::Registers. Addressing: /opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/liquid-5.4.0/lib/liquid/template.rb:176:in `render': undefined method `each' for #<Liquid::Registers:0x00007f2b142ddfc0> options[:registers]&.each do |key, register| ^^^^^^ from /opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/liquid-5.4.0/lib/liquid/template.rb:204:in `render!' from /opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/jekyll-seo-tag-2.8.0/lib/jekyll-seo-tag.rb:36:in `render' from /opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/liquid-5.4.0/lib/liquid/tag.rb:51:in `render_to_output_buffer' from /opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/liquid-5.4.0/lib/liquid/block_body.rb:80:in `render_node' from /opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/liquid-5.4.0/lib/liquid/block_body.rb:230:in `render_node' from /opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/liquid-5.4.0/lib/liquid/block_body.rb:213:in `render_to_output_buffer' from /opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/liquid-5.4.0/lib/liquid/document.rb:41:in `render_to_output_buffer' from /opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/liquid-5.4.0/lib/liquid/template.rb:194:in `render' from /opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/liquid-5.4.0/lib/liquid/template.rb:204:in `render!' Related to: jekyll/jekyll#9229
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think of just relying on RUBY_VERSION
to determine the version of liquid to use?
@@ -40,7 +40,7 @@ Gem::Specification.new do |s| | |||
s.add_runtime_dependency("jekyll-watch", "~> 2.0") | |||
s.add_runtime_dependency("kramdown", "~> 2.3", ">= 2.3.1") | |||
s.add_runtime_dependency("kramdown-parser-gfm", "~> 1.0") | |||
s.add_runtime_dependency("liquid", "~> 4.0") | |||
s.add_runtime_dependency("liquid", ">= 4.0", "< 5.4") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s.add_runtime_dependency("liquid", ">= 4.0", "< 5.4") | |
if RUBY_VERSION.to_f < 3.2.0 | |
s.add_runtime_dependency("liquid", "~> 4.0.3") | |
else | |
s.add_runtime_dependency("liquid", "~> 5.4.0") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am fine with this as far as you are. But we need to depend on liquid < 5.4.
- s.add_runtime_dependency("liquid", "~> 5.4.0")
+ s.add_runtime_dependency("liquid", "~> 5.3.0")
5.4 breaks further as you can see in the the test CI run on my repo: https://github.com/isimluk/jekyll/actions/runs/3777777021/jobs/6421776463
liquid 5.4.0 changed Registers
to be a plain old ruby class whilst previously it has been Hash. I have a PR for that at Shopify/liquid#1663 but 5.4.0 remains unusable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think of just relying on
RUBY_VERSION
to determine the version of liquid to use?
I actually tend to think that is good idea. But how do you feel about the removal of liquid-c support that this PR currently brings ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah setting the latest allowed version to 5.4 sounds reasonable to me.
Removing liquid-c is outside my understanding. It looks like it was introduced years ago, but wasn't actually being required until #7792 came along. Maybe it's fine to remove
@@ -21,6 +21,10 @@ environment: | |||
- RUBY_FOLDER_VER: "27" | |||
TZINFO_VERSION: "~> 2.0" | |||
TEST_SUITE: "test" | |||
- RUBY_FOLDER_VER: "27" | |||
LIQUID_VERSION: "~> 4.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LIQUID_VERSION: "~> 4.0" |
if ENV["LIQUID_VERSION"].to_s.empty? | ||
gem "liquid", "~> 5.3.0" | ||
else | ||
gem "liquid", ENV["LIQUID_VERSION"] | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ENV["LIQUID_VERSION"].to_s.empty? | |
gem "liquid", "~> 5.3.0" | |
else | |
gem "liquid", ENV["LIQUID_VERSION"] | |
end | |
if RUBY_VERSION.to_f < 3.2.0 | |
gem "liquid", "~> 4.0.3" | |
else | |
gem "liquid", "~> 5.4.0" | |
end |
- label: Ruby 2.7 with Liquid v4 | ||
ruby_version: "2.7" | ||
liquid_version: "~> 4.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- label: Ruby 2.7 with Liquid v4 | |
ruby_version: "2.7" | |
liquid_version: "~> 4.0" |
- label: Ruby 3.1.2 with Liquid v4 | ||
ruby_version: "3.1.2" | ||
liquid_version: "~> 4.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- label: Ruby 3.1.2 with Liquid v4 | |
ruby_version: "3.1.2" | |
liquid_version: "~> 4.0" |
Summary
Prior attempts #9036, #9030, #8662, #8760, #8615, #8535
Context
Liquid 5.x provides multiple breaking changes. But liquid 4.x won't work all that well with ruby 3.2.0.
WIP
This PR is cool but disables liquid-c. Therefore it is marked wip.