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 pins are mapped from gem source and serialized, so a plugin's conventions shape what lands in the gem cache. The language server caches gems by running `solargraph cache` in a subprocess, which never loaded the workspace's plugins, so the cache it wrote could differ from the one an in-process typecheck builds. `cache` and `uncache` now require the plugins configured for the directory, through a Workspace::Config#require_plugins that Workspace also delegates to. Each loaded plugin and its gem version are recorded in CacheDir, and gem_dir includes them, so loading or upgrading a plugin rebuilds the gem cache instead of reusing pins made without it. The @sg-ignore in CacheDir.add_plugin records a typecheck defect: Hash#each_value.find types the block parameter as the value type unioned with the hash itself. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EhUSLUimEYJyCZv8NdQGKb
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SEntZKsZwQHhzqcwG7MTqn
apiology
marked this pull request as draft
October 29, 2026 15:00
Config#require_plugins and the private Shell helper have the side effect of requiring plugins and recording them in the gem cache key; the bang marks that. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LTpguHqALFufF4QdNagq1C
apiology
marked this pull request as ready for review
November 5, 2026 18:45
apiology
marked this pull request as draft
November 11, 2026 20:33
Master's library spec now has its own #cache_next_gemspec group, cache_next_gemspec no longer checks Yardoc.processing?, and unloaded_gems is a Set. Give the plugin example its own group name, drop the unused stub and return a Set. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LTpguHxFEQL9KJ7MGedKby
The language server passes the plugins its workspace loaded with --plugins. A plugin the subprocess could not load was only warned about and left out of the gem cache key, so the subprocess cached the gem where the server never reads it. Exit with an error instead. Plugins read from .solargraph.yml still only warn, as the workspace does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LTpguHxFEQL9KJ7MGedKby
When the cache subprocess succeeds but its gem cache key differs from the workspace's, the gem stays uncached and the server ran the same command again without end. Record it as a cache error, naming the directory it expected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LTpguHxFEQL9KJ7MGedKby
$/solargraph/documentGems ran the gems command with no --directory or --plugins, so it keyed the gem cache on the server's working directory instead of each workspace. Run it once per workspace with the plugins that workspace loaded, as the background gem caching does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LTpguHxFEQL9KJ7MGedKby
Cache a gem with a fixture plugin whose convention adds a pin to every mapped file, then read the cache for that plugin set: the pin is there, and absent from the cache built without the plugin. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LTpguHxFEQL9KJ7MGedKby
castwide#1400, merged in from master, stops flagging argument forwarding, so the castwide#1108 sg-ignores on the Collection::Gem.load and uncache calls report as unneeded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LTpguHxFEQL9KJ7MGedKby
The merge of load-plugins-when-caching-gems took the plain names, undoing its rename. Requiring plugins is still a side effect, so use require_plugins! again for Workspace, Workspace::Config (instance and class method) and the Shell helper. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LTpguHxFEQL9KJ7MGedKby
What .solargraph.yml lists under plugins was called paths and plugin_paths. Call it plugins: the require_plugins! parameter and Workspace#plugins, and document that each entry is a require path, usually the plugin gem's name. The hash of loaded plugin gem names and versions that keys the gem cache, formerly Workspace#plugins, becomes plugin_versions in Workspace, External, Collection::Gem, CacheDir.gem_dir and Shell. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LTpguHxFEQL9KJ7MGedKby
The plugin_versions YARD defined the term by itself. Say what the hash holds: Solargraph plugin gem name to version, nil when the plugin was not loaded from a gem, with the full definition on Workspace#plugin_versions. Rename DocumentGems#commands to commands_by_workspace and document that it returns one argv per workspace. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LTpguHxFEQL9KJ7MGedKby
Key gem caches on each workspace's plugins
apiology
marked this pull request as ready for review
November 12, 2026 18:59
A Workspace with no directory has no workspace config of its own to name plugins (where an empty directory loads no .solargraph.yml, its plugin_versions are empty), so its ApiMap read the plain gems cache directory even when the process had loaded a plugin by require. The solargraph gems command, run where .solargraph.yml lists that plugin, writes to the plugin-keyed directory, so solargraph-rspec specs found no cached gems and lost RSpec completions. Such a workspace now also keys on the gems that define the registered conventions (Convention.plugin_versions), which matches the key Config.require_plugins! gives the same plugin gem. Workspaces with a directory still key only on their configured plugins.
apiology
marked this pull request as draft
November 18, 2026 16:20
CI runs the suite with solargraph-rspec loaded, so a configless workspace also keys on it. Check only that the probe plugin is in the key.
castwide master added solargraph bundle, which caches every bundled gem but read and wrote the plain gems directory. A workspace whose .solargraph.yml lists plugins reads the plugin-keyed directory, so gems cached by solargraph bundle looked missing there, as in the solargraph-rspec plugin specs. Pass the plugins it requires to Collection::Gem.cached? and .load, as the cache command does.
Check that solargraph bundle prints and caches a bundled gem that is not cached yet, in the plugin-keyed gem cache directory.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LTpguFV8m5C72EvjeEFx96
Master removed External#rbs_collection_paths and #rbs_collection_config_path (unused), so the specs this branch added for the config path call a method that no longer exists.
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.
Problem:
plugins:list in.solargraph.yml) sometimes don't show up, in the editor or insolargraph typecheck.Causes:
plugins, whilesolargraph typecheckloads them; both write one cache, so whichever caches a gem first wins.Neither was a problem prior to #1378 (released in 0.62.0), which started using the
localSolargraph plugin hook on gems as well as workspace files.Solution:
The caching subprocess now loads the workspace's Solargraph plugin gems, and a gem's cache key includes those gems and their versions, so each workspace caches gems under its own set.