RBS's manifest includes "set", but "set" was promoted to core and is no longer a library
Hey, just getting an error when running rbs collection update, while rbs is a required dependency in the Gemfile:
Uncaught exception: Cannot find `set` from standard libraries
/Users/hjwylde/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rbs-3.0.0/lib/rbs/collection/config/lockfile_generator.rb:156:in `assign_stdlib'
/Users/hjwylde/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rbs-3.0.0/lib/rbs/collection/config/lockfile_generator.rb:129:in `block in assign_gem'
/Users/hjwylde/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rbs-3.0.0/lib/rbs/collection/config/lockfile_generator.rb:128:in `each'
/Users/hjwylde/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rbs-3.0.0/lib/rbs/collection/config/lockfile_generator.rb:128:in `assign_gem'
/Users/hjwylde/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rbs-3.0.0/lib/rbs/collection/config/lockfile_generator.rb:79:in `block in generate'
/Users/hjwylde/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rbs-3.0.0/lib/rbs/collection/config/lockfile_generator.rb:73:in `each'
/Users/hjwylde/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rbs-3.0.0/lib/rbs/collection/config/lockfile_generator.rb:73:in `generate'
/Users/hjwylde/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rbs-3.0.0/lib/rbs/collection/config/lockfile_generator.rb:27:in `generate'
/Users/hjwylde/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rbs-3.0.0/lib/rbs/collection/config.rb:36:in `generate_lockfile'
/Users/hjwylde/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rbs-3.0.0/lib/rbs/cli.rb:1073:in `run_collection'
/Users/hjwylde/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rbs-3.0.0/lib/rbs/cli.rb:135:in `run'
/Users/hjwylde/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rbs-3.0.0/exe/rbs:7:in `<top (required)>'
/Users/hjwylde/Git/jetbrains/rubysigs/bin/rbs:29:in `load'
/Users/hjwylde/Git/jetbrains/rubysigs/bin/rbs:29:in `<top (required)>'
/Users/hjwylde/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/debase-3.0.0.beta.6/lib/debase.rb:213:in `load_protect'
/Users/hjwylde/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/debase-3.0.0.beta.6/lib/debase.rb:213:in `debug_load'
/Users/hjwylde/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rbs-3.0.0/lib/rbs/collection/config/lockfile_generator.rb:156:in `assign_stdlib': Cannot find `set` from standard libraries (RuntimeError)
from /Users/hjwylde/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rbs-3.0.0/lib/rbs/collection/config/lockfile_generator.rb:129:in `block in assign_gem'
from /Users/hjwylde/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rbs-3.0.0/lib/rbs/collection/config/lockfile_generator.rb:128:in `each'
from /Users/hjwylde/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rbs-3.0.0/lib/rbs/collection/config/lockfile_generator.rb:128:in `assign_gem'
from /Users/hjwylde/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rbs-3.0.0/lib/rbs/collection/config/lockfile_generator.rb:79:in `block in generate'
from /Users/hjwylde/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rbs-3.0.0/lib/rbs/collection/config/lockfile_generator.rb:73:in `each'
from /Users/hjwylde/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rbs-3.0.0/lib/rbs/collection/config/lockfile_generator.rb:73:in `generate'
from /Users/hjwylde/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rbs-3.0.0/lib/rbs/collection/config/lockfile_generator.rb:27:in `generate'
from /Users/hjwylde/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rbs-3.0.0/lib/rbs/collection/config.rb:36:in `generate_lockfile'
from /Users/hjwylde/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rbs-3.0.0/lib/rbs/cli.rb:1073:in `run_collection'
from /Users/hjwylde/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rbs-3.0.0/lib/rbs/cli.rb:135:in `run'
from /Users/hjwylde/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rbs-3.0.0/exe/rbs:7:in `<top (required)>'
from /Users/hjwylde/Git/jetbrains/rubysigs/bin/rbs:29:in `load'
from /Users/hjwylde/Git/jetbrains/rubysigs/bin/rbs:29:in `<top (required)>'
from /Users/hjwylde/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/debase-3.0.0.beta.6/lib/debase.rb:213:in `load_protect'
from /Users/hjwylde/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/debase-3.0.0.beta.6/lib/debase.rb:213:in `debug_load'
from /Users/hjwylde/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/ruby-debug-ide-3.0.0.beta.10/lib/ruby-debug-ide.rb:96:in `debug_program'
from /Users/hjwylde/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/ruby-debug-ide-3.0.0.beta.10/bin/rdebug-ide:230:in `<main>'
Process finished with exit code 1
I believe the issue is because "set" is no longer in stdlibs, and is a part of the core signatures, yet RBS still mentions it in its manifest file: https://github.com/ruby/rbs/blob/master/sig/manifest.yaml
Just as a side note/small request: it seems like it may not be possible to try and fix issues with dependencies such as this from the user side, as even adding 'ignore: true' to the collection config for 'set' did not prevent it from attempting to load it.
It may be nice for users to make it a bit more robust, so that when a dependency has an invalid manifest that rbs collection commands can still work. I think that if a gem has an invalid manifest/config file, then commands could result in an error, but if a dependency has an invalid manifest then commands could output a warning and try and do their best to continue.
Sounds nice. Maybe I can try to let rbs collection continue working even if:
- Something unknown is included in its dependency, and
- The format of
manifest.yamlis broken
Hey, just getting an error when running rbs collection update, while rbs is a required dependency in the Gemfile:
This problem has been reported in #1250 and it is fixed by #1251. @soutaro will release RBS v3.0.1 including #1251 soon.
It may be nice for users to make it a bit more robust, so that when a dependency has an invalid manifest that rbs collection commands can still work. I think that if a gem has an invalid manifest/config file, then commands could result in an error, but if a dependency has an invalid manifest then commands could output a warning and try and do their best to continue.
Thanks for sharing your idea! It sounds nice.
I'll investigate and implement this feature.
The following text is a memo to organize my thought about this problem. I wondered if this change becomes over-engineering at first. So I listed all situations that cause this problem. Now I think we should modify RBS w/ your proposal.
This problem occurs in the following situations.
- A stdlib is moved to a core library
- The problem of
setoccurs for this reason.
- The problem of
- A stdlib is moved to a bundled gem
- For example, rexml gem has been moved from the default gem to the bundled gem. https://www.ruby-lang.org/en/news/2020/12/25/ruby-3-0-0-released/
- In this case, RBS files under
stdlib/directory should be exported to the gem_rbs_collection orsig/directory in the gem's package. It causes the same problem.
-
gem_rbs_collectionincludes a brokenmanifest.yaml- If the repository contains an invalid
manifest.yaml, it causes the same problem.- For example, if
manifest.yamlhasseetas a dependency entry, which is a typo ofset,rbs collection installraises an error.
- For example, if
- We can avoid this problem by testing, so it's not a big problem.
- If the repository contains an invalid
- A gem package includes a broken
manifest.yaml- It's the same as
gem_rbs_collection's case. - We cannot prevent this problem completely unlike
gem_rbs_collection. Because gem's owner may skip testing.
- It's the same as
In cases 3 and 4, the user easily avoids this problem. The user can just ignore the broken gem, or pin the gem version to the old one. So the more robust rbs collection is not necessary for these cases.
But, in cases 1 and 2, the user cannot avoid this problem themself without updating or fixing rbs gem version. It means rbs gem has to treat the problem somehow. I think your proposal is better than the current approach, hard-coded removed gem names.
This problem has been reported in https://github.com/ruby/rbs/issues/1250 and it is fixed by https://github.com/ruby/rbs/pull/1251. @soutaro will release RBS v3.0.1 including https://github.com/ruby/rbs/pull/1251 soon.
Thank you! I missed that. I'll update to 3.0.1 :).
I'll investigate and implement this feature.
Cheers, I imagine it's also not a big priority either way, just a nice to have (in some form or another). Probably this situation won't occur too often, but the idea will help for when it does occasionally occur.