Skip to content

fix: skip SCIP generation of occurrences with empty locations - #254

Open
emidoots wants to merge 2 commits into
scip-ruby/masterfrom
emi/fix-segfault
Open

fix: skip SCIP generation of occurrences with empty locations#254
emidoots wants to merge 2 commits into
scip-ruby/masterfrom
emi/fix-segfault

Conversation

@emidoots

@emidoots emidoots commented Sep 3, 2026

Copy link
Copy Markdown
Member

In prod we observed a segfault / failing assertion SCIPIndexer.cc:122 enforced condition !baseLoc.empty(); this PR fixes that:

Sorbet can assign empty locations to synthesized AST nodes, including Minitest before hooks inside test_each. Passing these locations to trimColonColonPrefix triggers an assertion in debug builds and can segfault in release builds as we've seen in prod.

This PR fixes it by skipping definitions and references with empty locations before converting them to SCIP ranges.

Test plan

The first commit of this PR adds a regression test which fails with the same error seen in prod, the second commit fixes it.

I also did a basic index of Homebrew/brew and stripe/stripe-ruby repositories, and both resulting SCIP indexes appear valid.

…Loc.empty()" segfault

Signed-off-by: Emi <emi@sourcegraph.com>
Sorbet can assign empty locations to synthesized AST nodes, including
Minitest `before` hooks inside `test_each`. Passing these locations to
`trimColonColonPrefix` triggers an assertion in debug builds and can
segfault in release builds as we've seen in production.

Skip definitions and references with empty locations before converting
them to SCIP ranges, and add a regression test for the Minitest case.

Signed-off-by: Emi <emi@sourcegraph.com>
@emidoots
emidoots marked this pull request as ready for review September 3, 2026 02:01
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.

2 participants