Skip to content

Bootstrap gem symbols from Rubydex graph#2607

Open
Morriar wants to merge 2 commits intomainfrom
at-rubydex-bootstrap
Open

Bootstrap gem symbols from Rubydex graph#2607
Morriar wants to merge 2 commits intomainfrom
at-rubydex-bootstrap

Conversation

@Morriar
Copy link
Copy Markdown
Contributor

@Morriar Morriar commented Apr 23, 2026

Summary

Extracted from #2524. Instead of shelling out to Sorbet to get the symbol table for a gem's files, we use the Rubydex graph which is already available and faster. The engine symbols path also switches to Rubydex for consistency.

  • Replace Sorbet's symbol table (symbols_from_paths) with Rubydex graph for bootstrapping gem symbols in the pipeline
  • The gem graph is now always built (not conditional on include_doc), and reused for both symbol bootstrapping and documentation
  • Remove gem_symbols from SymbolLoader and load_bootstrap_symbols from Pipeline since Rubydex handles both cases

Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
@Morriar Morriar requested a review from a team as a code owner April 23, 2026 07:10
@Morriar Morriar added the chore label Apr 23, 2026
Comment on lines +31 to +34
namespaces = graph.declarations.grep(Rubydex::Namespace).map(&:name)
constants = graph.declarations.grep(Rubydex::Constant).map(&:name)
aliases = graph.declarations.grep(Rubydex::ConstantAlias).map(&:name)
(namespaces + constants + aliases).to_set
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It seems we're separating 3 collections just to immediately merge them back. How about something like this?

Suggested change
namespaces = graph.declarations.grep(Rubydex::Namespace).map(&:name)
constants = graph.declarations.grep(Rubydex::Constant).map(&:name)
aliases = graph.declarations.grep(Rubydex::ConstantAlias).map(&:name)
(namespaces + constants + aliases).to_set
graph.declarations.select do |decl|
decl.is_a?(Rubydex::Namespace) ||
decl.is_a?(Rubydex::Constant) ||
decl.is_a?(Rubydex::ConstantAlias)
end
end.to_set

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants