Breaks with Ruby 3.3.0
Closed this issue ยท 6 comments
The newest anyway_config version 2.6.1 seems to break when used with the newest Ruby version 3.3.0 (which has just been released a couple of hours ago). Interestingly, with Ruby version 3.3.0-rc1 it seems to work (maybe a regression?). We discovered that issue, because we are using AnyCable in a Rails project.
What did you do?
Upgraded Ruby from 3.3.0-rc1 to the official 3.3.0 release.
What actually happened?
When starting the rails server or if we just run the specs of this gem with the new Ruby version, we are getting errors:
Failure/Error: require "anyway/tracing"
SyntaxError:
/Users/sebastianpoll/Desktop/anyway_config-master/lib/anyway/tracing.rb:32: anonymous keyword rest parameter is also used within block
/Users/sebastianpoll/Desktop/anyway_config-master/lib/anyway/tracing.rb:48: anonymous keyword rest parameter is also used within block
/Users/sebastianpoll/Desktop/anyway_config-master/lib/anyway/tracing.rb:50: anonymous keyword rest parameter is also used within block
Edit: CI in anyway_config does not include 3.3 yet, but if its added, the error gets reproduced by Github-Actions as well:
Environment
Ruby Version:
3.3.0. If we downgrade to 3.3.0-rc1 it works.
Anyway Config Version:
2.6.1. if we downgrade to 2.5.4 it works.
Would be cool, if you could have a look, thx! ๐
it looks like the "anonymous arguments" are not supported.
When I run the specs with ruby 3.3.0, it gives me this error:
Failure/Error: require "anyway/tracing"
SyntaxError:
/anyway_config/lib/anyway/tracing.rb:32: anonymous keyword rest parameter is also used within block
/anyway_config/lib/anyway/tracing.rb:48: anonymous keyword rest parameter is also used within block
/anyway_config/lib/anyway/tracing.rb:50: anonymous keyword rest parameter is also used within block
Replacing all the occurrences of **
with **opts
seems to fix the tests, but maybe the maintainer has a plan to support newer syntax with older ruby versions through ruby-next ๐ค
I'm here for the same. My ruby 3.3.0 upgrade is stalled out on this error. Anybody get past it?
@atstockland: As a temporary fix, we simply pin the anyway_config version to 2.5.4:
gem "anyway_config", "2.5.4"
The error is coming from lines like below
def record_value(val, *path, **)
key = path.pop
trace = if val.is_a?(Hash)
Trace.new.tap { it.merge_values(val, **) } # <------------------------ this line
else
Trace.new(:value, val, **)
end
target_trace = path.empty? ? self : value.dig(*path)
target_trace.record_key(key.to_s, trace)
val
end
Looks like, the whole thing is about this bug.
As I see it will be fixed in the next minor version of Ruby.
Downgrading is a good solution for now or maybe updates to ruby-next could be useful ๐
Unfortunately, pinning is not always a workaround. In our case, we use imgproxy, which has a hard dependency on 2.6:
Could not find compatible versions
Because imgproxy >= 3.0.0 depends on anyway_config ~> 2.6
and Gemfile depends on anyway_config = 2.5.4,
imgproxy >= 3.0.0 cannot be used.
So, because Gemfile depends on imgproxy ~> 3.0,
version solving has failed.
Fixed by b661b5f and released in 2.6.2.
Thanks to @kalashnikovisme for pointing out to the Ruby 3.3.0 bug with **
.