Skip to content

Serve RBS stdlib pins before the gem cache builds - #1340

Closed
apiology wants to merge 1 commit into
castwide:masterfrom
apiology:rbs-fallback-pins
Closed

Serve RBS stdlib pins before the gem cache builds#1340
apiology wants to merge 1 commit into
castwide:masterfrom
apiology:rbs-fallback-pins

Conversation

@apiology

@apiology apiology commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Problem: Until solargraph gems has run for a workspace, a gem with no combined pin cache entry contributes no pins at all, so completion and typechecking see none of its API — even where RBS already ships the types.

# fresh workspace, logger not yet cached
dm = Solargraph::DocMap.new(["logger"], workspace, out: nil)
dm.pins.map(&:path).grep(/\ALogger#/).length
# => 0        # 34 are available from RBS, withheld until a build runs

On this machine that is 15 of 82 bundled gems, 1,305 pins, withheld until a build finishes.

Solution: Adds RbsMap#fallback_pins — nil on the base class, since a combined entry merges RBS pins with separately-cached YARD pins and dropping the YARD half is not safe in general, with RbsMap::StdlibMap overriding it to return its own pins, which need no merge — and serves it from DocMap#deserialize_combined_pin_cache where that previously returned nil, without caching it in the process-wide index or marking the gem built.

🤖 Generated with Claude Code

Until `solargraph gems` has run for a workspace, a gem with no
combined pin cache entry contributes no pins at all, so completion and
typechecking see none of its API until a build finishes. For the 15 of
82 gems in this bundle whose types come from the RBS standard library,
1,305 pins can be served immediately instead.

Adds RbsMap#fallback_pins, returning nil on the base class because a
combined cache entry merges RBS pins with separately-cached YARD pins,
and dropping the YARD half is not safe in general. StdlibMap overrides
it to return its own pins, which need no such merge, and
DocMap#deserialize_combined_pin_cache consults it in the branch that
previously returned nil.

The fallback is deliberately not written to combined_pins_in_memory:
that index is process-wide and keyed only by gem name and version, so
a provisional set stored there would go on being served after the real
build supersedes it. The gemspec also stays on the uncached lists, so
`solargraph gems` still builds it.
@apiology

apiology commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

Claude: Reopening this in apiology/solargraph#98.

@apiology apiology closed this Sep 9, 2026
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