Repository navigation
Conversation
…de#1379) * RbsCollection * Gem caching in External spec * RbsCollection specs * Stale code * Linting
The no-YARD gem mapper lost pins that YARD used to produce: * Mixins called on an explicit receiver. Only receiverless include/extend/prepend were mapped, so ActiveSupport's `Object.prepend(self)` (which is how `require_dependency` reaches every class) and `Integer.prepend ActiveSupport::NumericWithFormat` made all the methods those modules add to core classes invisible. * ActiveSupport's `class_attribute`, whose accessors are created at run time. Rails documents them with `## :singleton-method:` comment directives that YARD turned into methods. `process_class_attribute` generates the same accessors and honors instance_accessor/instance_reader/instance_writer/instance_predicate. Fixes several solargraph-rails definitions (require_dependency on ActiveJob, Rails::Application, ActionDispatch::Routing::Mapper and ActiveRecord; ActionController callbacks; ActiveRecord::Base.enumerate_columns_in_select_statements; ActiveRecord::Base#signed_id_verifier_secret; Integer#to_formatted_s).
External now selects collection entries for the gems it loads, but the lookup expected a collection directory whose version matches the installed gem. Two kinds of signature sets were silently dropped: * Gems whose signatures are published under a different version than the gem. gem_rbs_collection ships `actionpack/6.0` for every Rails 6 and 7 release and `devise/4.9` for Devise 4 and 5, so actionpack 7.0.10 and devise 5.0.4 got no signatures at all (this is what hid the ActionController callback DSL). RbsCollection#best_key now falls back to the closest version the collection provides for that gem, preferring the highest one that does not exceed it. * Stdlib entries in the lockfile (`date/0`, `json/0`, ...). They are not associated with a gem in the bundle, and `rbs collection install` resolves them to the signatures that ship with the rbs gem instead of copying them into the collection directory, so they can never be matched by a gem lookup. RbsCollection#stdlib_names exposes them and External loads them with Collection::Stdlib, which restores e.g. `Date#xmlschema -> String`. Also guards External#rbs_collection_lockfile against a nil directory, which previously short-circuited before the collection was touched.
Gem mapping without YARD globbed only a gem's require_paths, so code
an engine autoloads from app/ was never mapped. turbo-rails defines
Turbo::Broadcastable in app/models/concerns/, which left methods like
ActiveRecord::Base#broadcast_append unresolved where YARD-based
mapping (default file set {lib,app}/**/*.rb) found them.
Map app/**/*.rb alongside the require paths. Among installed gems,
only engines ship .rb files under app/ (actionmailbox, actiontext,
activestorage, devise, importmap-rails, solid_*, turbo-rails).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EhUSLUimEYJyCZv8NdQGKb
"Autoload" read as Ruby's Module#autoload; the directories matter because Rails loads them through Zeitwerk, not require. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EhUSLUimEYJyCZv8NdQGKb
Mapping app/ for every gem was Rails knowledge hard-coded in Collection::Gem, and it also mapped app/ in gems that are not engines. Behaviour outside the core language belongs in conventions. Add Convention::Base#gem_directories, empty by default, which Collection::Gem maps alongside a gem's require paths when it maps the gem from source. Convention::RailsEngine, registered like ActiveSupportConcern, returns Rails::Engine::Configuration's default autoload roots (app/* and app/*/concerns without assets and javascript, plus test/mailers/previews) for a gem whose require paths subclass Rails::Engine. Paths an engine adds through config.autoload_paths or paths.add are not read: they are Ruby expressions, usually built from __dir__, and the default roots cover the engines measured. The roots are globbed from an absolute path rather than with base:, because Dir.glob(pattern, base: dir) infers as Array<String>, nil at strong level (the block overload is not ruled out), while the same call without base: infers Array<String>. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EhUSLUimEYJyCZv8NdQGKb
Solargraph keeps only the generic Convention#gem_directories hook; solargraph-rails' convention supplies engine autoload roots. The RailsEngine convention, its spec and its engine-only fixtures go with it, and the Collection::Gem spec now exercises the hook through a convention registered for the example. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EhUSLUimEYJyCZv8NdQGKb
"gem_directories" read as directories holding one subdirectory per gem, like GEM_PATH. The hook returns paths inside one gem, relative to its root, to map in addition to its require_paths. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EhUSLUimEYJyCZv8NdQGKb
Metagem is too new to expose to plugins, and conventions need only the gem root and its require paths. Keyword arguments plus ** let Solargraph pass more later without breaking plugins. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EhUSLUimEYJyCZv8NdQGKb
Retarget onto master now that gem-without-yard landed via castwide#1378. Resolve the Collection::Gem#without_yard conflict in favor of this branch, which adds Convention.extra_source_paths to the globbed dirs. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SEntZKsZwQHhzqcwG7MTqn
This was referenced Oct 19, 2026
This was referenced Oct 21, 2026
apiology
added a commit
to iftheshoefritz/solargraph-rails
that referenced
this pull request
Nov 11, 2026
turbo-rails includes Turbo::Native::Navigation into controllers from an ActiveSupport.on_load hook, which no released Solargraph applies to a gem, so its controller helpers are missing everywhere. Include it from an annotation on Solargraph before 0.62.2. Solargraph 0.62 maps only a gem's require_paths, so turbo-rails' app/ modules, Turbo::Broadcastable and Turbo::Native::Navigation, are missing there; older releases find them through YARD. Stub their public methods for 0.62.0 and 0.62.1 only, untyped like the YARD pins. castwide/solargraph#1404 makes both unnecessary. With turbo-rails in the Rails 7 app, the Broadcastable methods exist on Rails 7 too, so drop their added_in: 8.0. Drop every skip of these 43 entries. Solargraph-scoped annotation directories now check the version on Solargraph before 0.53 too, so the 0.62-only stubs stay out there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LTpguHxFEQL9KJ7MGedKby
apiology
added a commit
to iftheshoefritz/solargraph-rails
that referenced
this pull request
Nov 11, 2026
* Add turbo-rails to the Rails 7 test app actioncontroller.yml expects turbo-rails' controller helpers, such as hotwire_native_app? and recede_or_redirect_to, but only the Rails 8 app bundles turbo-rails, so on Rails 7 they can never be found and stay skipped on every Solargraph version. `rails new` adds turbo-rails on Rails 7 as well. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LTpguHxFEQL9KJ7MGedKby * Stub turbo-rails helpers Solargraph cannot find turbo-rails includes Turbo::Native::Navigation into controllers from an ActiveSupport.on_load hook, which no released Solargraph applies to a gem, so its controller helpers are missing everywhere. Include it from an annotation on Solargraph before 0.62.2. Solargraph 0.62 maps only a gem's require_paths, so turbo-rails' app/ modules, Turbo::Broadcastable and Turbo::Native::Navigation, are missing there; older releases find them through YARD. Stub their public methods for 0.62.0 and 0.62.1 only, untyped like the YARD pins. castwide/solargraph#1404 makes both unnecessary. With turbo-rails in the Rails 7 app, the Broadcastable methods exist on Rails 7 too, so drop their added_in: 8.0. Drop every skip of these 43 entries. Solargraph-scoped annotation directories now check the version on Solargraph before 0.53 too, so the 0.62-only stubs stay out there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LTpguHxFEQL9KJ7MGedKby * Type the scope check of version-scoped annotations On castwide master, Solargraph reports "Unresolved call to gem_name" for a call on a destructured block parameter; a method with @PARAM tags types it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LTpguHxFEQL9KJ7MGedKby * Give the turbo-rails stubs their real return types The 0.62 stubs for Turbo::Broadcastable and Turbo::Native::Navigation had no return types, so the definition specs expected undefined. Type each from what turbo-rails' method body returns: the *_later methods return the enqueued job, false or nil; broadcasts that reach ActionCable directly, the callback macros and the redirect helpers return values that vary by adapter or Rails version, so they are void. Declare the two job classes those types name, which live in turbo-rails' app/jobs and are missing on 0.62 too, and add the four methods the definition specs lacked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LTpguHxFEQL9KJ7MGedKby * Type suppressed_turbo_broadcasts? as boolish It returns the thread_mattr_accessor value, which is nil until suppressing_turbo_broadcasts sets it, so it is boolish, not Boolean. Document every parameter of the turbo-rails stubs, so each @PARAM list matches the method and the RBS for turbo-rails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LTpguHxFEQL9KJ7MGedKby * Skip typed turbo-rails specs before Solargraph 0.62 Solargraph 0.48 through 0.61 read turbo-rails from YARD, which has no return types, so 45 of the typed entries come back undefined (or Boolean, for suppressed_turbo_broadcasts?) there on every Rails version CI runs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LTpguHxFEQL9KJ7MGedKby * Type the broadcast_*_later stubs as void turbo-rails documents no return value for the broadcast_*_later methods, so code should not rely on the job they happen to return. Drop the job class declarations only those types used. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LTpguHxFEQL9KJ7MGedKby * Leave broadcast_target_default untyped Its value feeds default broadcast targets, and turbo-rails accepts any target: convert_to_turbo_stream_dom_id passes a dom_id-compatible record, class or [record, prefix] to dom_id and renders anything else with to_s, so no type narrower than untyped covers every target. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LTpguHxFEQL9KJ7MGedKby * Load the typed turbo-rails stubs before Solargraph 0.62.2 Solargraph 0.48 through 0.61 find Turbo::Broadcastable and Turbo::Native::Navigation through YARD, but untyped, so their definition specs skipped those versions. Load the typed stubs on every Solargraph before 0.62.2 instead of only 0.62.x, moving them into solargraph_before_0_62_2, and drop the 44 skip lists. Nothing is scoped to a version range any more, so RailsApi goes back to main's single-requirement scope check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LTpguHxFEQL9KJ7MGedKby * Type turbo-rails from the RBS collection from 0.53 ruby/gem_rbs_collection now has turbo-rails 2.0 signatures, including the includes into ActiveRecord::Base and ActionController::Base, so bump the test apps to that revision and load the turbo-rails stubs only on Solargraph before 0.53, which reads no gem RBS. There, suppressing_turbo_broadcasts stays undefined before 0.52, and suppressed_turbo_broadcasts? reports the Boolean Solargraph infers for the YARD pin of a ? method instead of the stub's boolish, so skip both on those versions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LTpguHxFEQL9KJ7MGedKby * Skip suppressed_turbo_broadcasts? on Solargraph 0.57-0.58 Those releases keep the YARD pin beside the RBS one and report the Boolean they infer for a ? method instead of the collection's boolish. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LTpguHxFEQL9KJ7MGedKby * Expect boolish from suppressed_turbo_broadcasts? The definition YAML can now name RBS aliases, so state the boolish the stub and the RBS collection declare instead of the BasicObject Solargraph renders it as. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LTpguHxFEQL9KJ7MGedKby * Skip suppressed_turbo_broadcasts? where YARD wins Solargraph 0.48 through 0.52 and 0.57 through 0.58 keep turbo-rails' YARD pin and report the Boolean they infer for a ? method, not boolish. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LTpguHxFEQL9KJ7MGedKby --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claude: This PR was written by Claude Code on behalf of @apiology.
Regressed in: 0.62.0, by castwide/solargraph#1378, Map gems without YARD
Problem:
Plugins cannot add a gem's non-require directories to its source mapping:
Rails engines (turbo-rails, activestorage, actiontext, devise, solid_queue) load
app/through Zeitwerk, notrequire, so mapping only a gem'srequire_pathsdrops their concerns, models and jobs.Solution: Add a
Convention::Base#extra_source_paths(root:, require_paths:, **)hook, defaulting to[]: paths inside one gem, relative to its root, thatCollection::Gemmaps beyond itsrequire_paths. It takes keywords rather than aMetagem, which is too new to expose to plugins, and**lets Solargraph pass more later without breaking them. solargraph-rails supplies the engine autoload roots: iftheshoefritz/solargraph-rails#228Plugin output lands in gem caches, so the language server also needs #1407, which loads plugins in the
solargraph cachesubprocess and adds them to the cache key.