Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a regression where the SCIP index contained invalid symbols #570

Merged
merged 1 commit into from
May 3, 2023

Conversation

olafurpg
Copy link
Member

@olafurpg olafurpg commented May 2, 2023

Uploading an index with scip-java v0.8.17 results in the following error in the Sourcegraph UI

codeNavSvc.GetImplementations: lsifStore.MonikersByPosition: reached end of symbol while parsing <scheme>, expected a ' ' character
minimized/Issue413Subclass#c.
_____________________________^

CleanShot 2023-05-02 at 13 43 46@2x

The problem is that this release introduced a regression where scip-java emitted invalid SCIP symbols. This PR fixes the issue, and adds new checks in the testing infrastructure to prevent this kind of regression from happening again.

Test plan

See updated snapshots.

Uploading an index with scip-java v0.8.17 results in the following
error in the Sourcegraph UI

```
codeNavSvc.GetImplementations: lsifStore.MonikersByPosition: reached end of symbol while parsing <scheme>, expected a ' ' character
minimized/Issue413Subclass#c.
_____________________________^
```
The problem is that this release introduced a regression where scip-java
emitted invalid SCIP symbols. This PR fixes the issue, and adds new
checks in the testing infrastructure to prevent this kind of regression
from happening again.
Comment on lines +22 to +36
scipSymbol.split(" ", 5) match {
case Array(
scheme,
packageManager,
packageName,
packageVersion,
descriptor
) =>
GlobalScipSymbol(
scheme,
packageManager,
packageName,
packageVersion,
parseDescriptors(descriptor)
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are targeting 2.13, I think you can use direct matching on a string here?

Suggested change
scipSymbol.split(" ", 5) match {
case Array(
scheme,
packageManager,
packageName,
packageVersion,
descriptor
) =>
GlobalScipSymbol(
scheme,
packageManager,
packageName,
packageVersion,
parseDescriptors(descriptor)
)
scipSymbol match {
case s"$scheme $packageManager $packageName $packageVersion $descriptor" =>
GlobalScipSymbol(
scheme,
packageManager,
packageName,
packageVersion,
parseDescriptors(descriptor)
)

I would check but my local is broken again. It's ridiculous.

Copy link
Contributor

@keynmol keynmol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good as a stop gap solution, but IMO we should do some light refactoring and separate symbols properly: #573

@olafurpg olafurpg merged commit 7561f5a into main May 3, 2023
@olafurpg olafurpg deleted the olafurpg/regression branch May 3, 2023 11:21
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