Skip to content

Fix crash in solargraph gems core - #1346

Open
apiology wants to merge 2 commits into
castwide:masterfrom
apiology:fix-gems-core
Open

Fix crash in solargraph gems core#1346
apiology wants to merge 2 commits into
castwide:masterfrom
apiology:fix-gems-core

Conversation

@apiology

@apiology apiology commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Problem: solargraph gems core crashes instead of caching core pins.

$ solargraph gems core
lib/solargraph/shell.rb:193:in `block in gems': undefined method `cache_core'
  for Solargraph::PinCache:Module (NoMethodError)

cache_core is an instance method on RbsMap::CoreMap; nothing defines it, or core?, on PinCache. The @sg-ignore above the call asserting that both are dynamically defined is simply wrong, so the marker was suppressing a genuine error rather than a tooling gap.

Solution: Call RbsMap::CoreMap.new.cache_core and drop the false marker.

🤖 Generated with Claude Code

Shell#gems called PinCache.cache_core, which does not exist, so
`solargraph gems core` died with a NoMethodError before caching
anything. cache_core is defined on RbsMap::CoreMap, so call it there.
PinCache only computes cache paths and serializes, and RbsMap::CoreMap
already depends on it, so delegating from PinCache would make that
dependency circular.

The @sg-ignore above the call claimed cache_core and core? were
dynamically defined. pin_cache.rb has no method_missing or
define_method, and core? exists nowhere, so the comment and the
commented-out `if !PinCache.core?` guard go with it.

The "caches core without erroring out" example sat under `describe
'gems'` but called shell.cache('core'), which takes the gem-lookup
path and never reached this line. It now calls shell.gems('core')
with RbsMap::CoreMap stubbed.
The previous commit rewrote `caches core without erroring out` rather than
adding to it, dropping the coverage it gave `uncache core` and
`cache core`. Put that example back as it was and keep the new assertion
as its own example.

Only the new one depends on the fix: reverting the lib change leaves the
restored example passing and fails just `caches core pins from the gems
command`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant