Skip to content

Add sig/manifest.yaml to declare stdlib dependencies#1711

Merged
marcoroth merged 1 commit into
marcoroth:mainfrom
tk0miya:sig/manifest.yaml
May 5, 2026
Merged

Add sig/manifest.yaml to declare stdlib dependencies#1711
marcoroth merged 1 commit into
marcoroth:mainfrom
tk0miya:sig/manifest.yaml

Conversation

@tk0miya

@tk0miya tk0miya commented May 5, 2026

Copy link
Copy Markdown
Contributor

sig/herb/token_list.rbs declares a class inheriting from SimpleDelegator, which comes from the delegate standard library. Since delegate is a default gem, it does not appear in the gemspec, and rbs collection install cannot resolve it on the consumer side.

With Steep 2.0, this previously-silent issue surfaces as a hard error:

Type checking failed due to error in library RBS file
Cannot find type `SimpleDelegator`
(.../herb-0.10.1/sig/herb/token_list.rbs:4:2)
Diagnostic ID: Ruby::LibraryRBSError

Declare the implicit standard library dependencies in sig/manifest.yaml so downstream users get correct type resolution.

Refs: https://github.com/ruby/rbs/blob/master/docs/gem.md

`sig/herb/token_list.rbs` declares a class inheriting from
`SimpleDelegator`, which comes from the `delegate` standard library.
Since `delegate` is a default gem, it does not appear in the gemspec,
and `rbs collection install` cannot resolve it on the consumer side.

With Steep 2.0, this previously-silent issue surfaces as a hard error:

    Type checking failed due to error in library RBS file
    Cannot find type `SimpleDelegator`
    (.../herb-0.10.1/sig/herb/token_list.rbs:4:2)
    Diagnostic ID: Ruby::LibraryRBSError

Declare the implicit standard library dependencies in
`sig/manifest.yaml` so downstream users get correct type resolution.

Refs: https://github.com/ruby/rbs/blob/master/docs/gem.md

@marcoroth marcoroth left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thank you @tk0miya! 🙏🏼

Is there a way we can check in CI that Herb is bundling/exposing the RBS signatures properly so we don't introduce any regressions?

@marcoroth marcoroth merged commit c87b08d into marcoroth:main May 5, 2026
12 checks passed
@tk0miya tk0miya deleted the sig/manifest.yaml branch May 6, 2026 07:40
@tk0miya

tk0miya commented May 6, 2026

Copy link
Copy Markdown
Contributor Author

@marcoroth we can check the validity of types via rbs validate command. As a trial, I implemented the validation on https://github.com/marcoroth/herb/compare/main...tk0miya:herb:rbs_validate?expand=1.

At present, some serialized_* type aliases are not defined. So we need to define them before validating them on CI.

@marcoroth

Copy link
Copy Markdown
Owner

Awesome, thank you for investigating @tk0miya!

If we move the bundle exec rbs validate command to the existing build.yml we should also have the serialized_* types available as they are getting generated automatically from the ERB files in templates/ via the rake templates command here: https://github.com/marcoroth/herb/blob/main/templates/sig/serialized_ast_nodes.rbs.erb

@marcoroth marcoroth added the rbs label May 6, 2026
marcoroth pushed a commit that referenced this pull request May 6, 2026
To avoid the regressions of the RBS definition, this adds automatic RBS
validation on CI.

This also contains the following changes around RBS:

* Update to RBS-4.0 and Steep-2.0
* Manage types of dependencies via rbs_collection.yaml (see
https://github.com/ruby/rbs/blob/master/docs/collection.md)

ref:
#1711 (review)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants