Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

codeintel: Make codenav results more consistent#54410

Merged
efritz merged 8 commits into
mainfrom
ef/expose-codenav-wip
Aug 9, 2023
Merged

codeintel: Make codenav results more consistent#54410
efritz merged 8 commits into
mainfrom
ef/expose-codenav-wip

Conversation

@efritz

@efritz efritz commented Jun 28, 2023

Copy link
Copy Markdown
Contributor

Expose new methods from #53710 in GraphQL layer. This should make prototype/implementation operations more consistent with how we resolve definitions and references, and should in the process actually return correct results.

Test plan

Updated integration tests.

@efritz efritz added team/graph Graph Team (previously Code Intel/Language Tools/Language Platform) team/language-platform labels Jun 28, 2023
@efritz efritz self-assigned this Jun 28, 2023
@cla-bot cla-bot Bot added the cla-signed label Jun 28, 2023
@efritz efritz changed the title Ef/expose codenav wip codeintel: Expose new codenav Jun 28, 2023
@efritz efritz changed the title codeintel: Expose new codenav codeintel: Expose new codenav service methods Jun 28, 2023
Base automatically changed from ef/codenav-wip to main June 28, 2023 23:16
@efritz efritz requested review from Strum355 and cesrjimenez June 29, 2023 00:29
@efritz efritz marked this pull request as ready for review June 29, 2023 00:29
@sourcegraph-bot

sourcegraph-bot commented Jun 29, 2023

Copy link
Copy Markdown
Contributor

Codenotify: Notifying subscribers in CODENOTIFY files for diff a59fd1e...1efc145.

Notify File(s)
@Strum355 internal/codeintel/codenav/internal/lsifstore/locations_by_position.go
internal/codeintel/codenav/internal/lsifstore/locations_by_position_test.go
internal/codeintel/codenav/service_new.go
internal/codeintel/codenav/service_new_test.go
internal/codeintel/codenav/transport/graphql/iface.go
internal/codeintel/codenav/transport/graphql/mocks_test.go
internal/codeintel/codenav/transport/graphql/root_resolver_definitions.go
internal/codeintel/codenav/transport/graphql/root_resolver_implementations.go
internal/codeintel/codenav/transport/graphql/root_resolver_references.go
internal/codeintel/codenav/transport/graphql/root_resolver_test.go

@sourcegraph-bot

sourcegraph-bot commented Jun 29, 2023

Copy link
Copy Markdown
Contributor

Codenotify: Notifying subscribers in OWNERS files for diff a59fd1e...1efc145.

No notifications.

Comment thread dev/codeintel-qa/cmd/query/state.go

@Strum355 Strum355 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fixes a bug with implementations/prototypes i found with scip-go :shipit:

@Strum355

Copy link
Copy Markdown
Contributor

@olafurpg could you test whether this branch fixes https://github.com/sourcegraph/sourcegraph/issues/50927 ?

@efritz efritz force-pushed the ef/expose-codenav-wip branch from a712289 to de6aeb8 Compare July 24, 2023 15:28
@olafurpg

Copy link
Copy Markdown
Contributor

Confirming that this https://github.com/sourcegraph/sourcegraph/issues/52132 is fixed by this PR

@olafurpg

Copy link
Copy Markdown
Contributor

I'm able to reproduce the following unexpected behavior where "Implementations" and "Prototypes" show the same symbol

CleanShot 2023-07-25 at 14 50 47@2x

I ran scip snapshot on the index and there are no relationships to semanticdb maven minimized/SubClasses#abstractInterfaceMethod()., there are only implementation and reference relationships from that symbol
CleanShot 2023-07-25 at 14 51 06@2x

CleanShot 2023-07-25 at 14 51 09@2x

To reproduce, open URL https://sourcegraph.test:3443/github.com/sourcegraph/scip-java@a6a169f3012131c4b4b7242f1e72982fee669a48/-/blob/tests/minimized/src/main/java/minimized/SubClasses.java?L6:17-6:39#tab=implementations_java

I built the index with scip-java index --build-tool=sbt --index-semanticdb.emit-inverse-relationships=false using scip-java 0.8.25

I can reproduce the same behavior with scip-typescript in the sourcegraph/sourcegraph repository at the URL https://sourcegraph.test:3443/github.com/sourcegraph/sourcegraph@de6aeb8b9f3092a9b5c205e169e5ca1e9ca577a2/-/blob/client/web/src/fuzzyFinder/CaseInsensitiveFuzzySearch.ts?L32:12-32:18#tab=implementations_typescript

CleanShot 2023-07-25 at 14 55 48@2x

I suspect the underlying reason is because these symbols have is_reference and is_implementation relationships because I can only reproduce it for method symbols (not classes)

@efritz

efritz commented Jul 25, 2023

Copy link
Copy Markdown
Contributor Author

@olafurpg Pushed a fix to implementations - can you take another look?

Comment thread testing/BUILD.bazel
Comment on lines -160 to -162
tags = [
"manual",
],

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

cc @jhchabran and/or @sourcegraph/dev-experience What is the proper way to turn this test back on? This should solve the flakiness we have been seeing and should re-enable it.

Being practical I'd also like an escape switch to pull to put it back to warn or silent mode in case something else is the real/another culprit.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We have been running it on main explicitly. Removing the manual tag here would make it run as part of //... ie. all targets (excluding manual) and therefore on main and PRs.

I think we should keep the tag and perhaps remove flaky = True. From Bazel docs

If set, executes the test up to three times, marking it as failed only if it fails each time. By default, this attribute is set to False and the test is executed only once. Note, that use of this attribute is generally discouraged - tests should pass reliably when their assertions are upheld.

@olafurpg

Copy link
Copy Markdown
Contributor

@efritz I can confirm the issue I reported has been fixed. I ran a few more tests and didn't identify any surprising behavior. This PR is a huge improvement. Thank you for fixing this! 🙏🏻

@varungandhi-src

Copy link
Copy Markdown
Contributor

Hmm, I'm not having success with this PR with commit b9bfe15. With this PR:

image

On Sourcegraph.com below:

image


The correct result should be 100+ implementations (subclasses) and 0 prototypes (superclasses)

Index information:

   repo: github.com/llvm/llvm-project
   commit: 867f2d9e5c9a736eb97fe5a51aa2850abfd02a96
   root: .
   file: 3.scip
   indexer: scip-clang
   indexerVersion: 0.2.3

Compressed index file: https://drive.google.com/file/d/16j76Qiigsb_mZ5u4s4Bd-XoFP4412B92/view?usp=sharing

@varungandhi-src

Copy link
Copy Markdown
Contributor

Also, can you perhaps tweak the PR title and/or the information in the description? Right now, as it stands, it's very non-obvious that this PR is meant to fix a bunch of bugs related to Find Implementations.

@efritz efritz changed the title codeintel: Expose new codenav service methods codeintel: Make codenav results more consistent Jul 27, 2023
@efritz

efritz commented Jul 27, 2023

Copy link
Copy Markdown
Contributor Author

@varungandhi-src Running locally I got this:

image

🤔🤔🤔

@varungandhi-src

varungandhi-src commented Jul 28, 2023

Copy link
Copy Markdown
Contributor

@efritz Along with the index uploaded earlier, also upload this index at an older commit: https://drive.google.com/file/d/1EtLCtzPw3ur95BpQ2sfjpfIGA3wI8AHp/view?usp=sharing

Invocation:

src code-intel upload -repo=github.com/llvm/llvm-project -commit=e0f3110b854a476c16cce7b44472cd7838d344e9 -root=. -file=2.scip

It looks like the implementations at the newer commit (867f2d9e5c9a736eb97fe5a51aa2850abfd02a96) go missing when both indexes are present. If I delete the index for e0f3110b854a476c16cce7b44472cd7838d344e9, I'm able to reproduce what you're seeing.

@efritz efritz enabled auto-merge (squash) August 9, 2023 00:17
@efritz efritz merged commit 0889c89 into main Aug 9, 2023
@efritz efritz deleted the ef/expose-codenav-wip branch August 9, 2023 00:30
@github-actions

github-actions Bot commented Aug 9, 2023

Copy link
Copy Markdown
Contributor

The backport to 5.1 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-5.1 5.1
# Navigate to the new working tree
cd .worktrees/backport-5.1
# Create a new branch
git switch --create backport-54410-to-5.1
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 0889c891dbb49f176e5f8f51c832a91dabfbd95d
# Push it to GitHub
git push --set-upstream origin backport-54410-to-5.1
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-5.1

Then, create a pull request where the base branch is 5.1 and the compare/head branch is backport-54410-to-5.1.

@github-actions github-actions Bot added backports failed-backport-to-5.1 release-blocker Prevents us from releasing: https://about.sourcegraph.com/handbook/engineering/releases labels Aug 9, 2023
efritz added a commit that referenced this pull request Aug 9, 2023
camdencheek pushed a commit that referenced this pull request Aug 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

backports cla-signed cody-intel release-blocker Prevents us from releasing: https://about.sourcegraph.com/handbook/engineering/releases team/graph Graph Team (previously Code Intel/Language Tools/Language Platform)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants