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

fix: Correctly filter uploads with commit and path existence checks#62415

Merged
varungandhi-src merged 3 commits into
mainfrom
vg/fix-candidates-bug
May 8, 2024
Merged

fix: Correctly filter uploads with commit and path existence checks#62415
varungandhi-src merged 3 commits into
mainfrom
vg/fix-candidates-bug

Conversation

@varungandhi-src

@varungandhi-src varungandhi-src commented May 3, 2024

Copy link
Copy Markdown
Contributor

Fixes GRAPH-563

The upload filtering code previously did checks whether:

  • The commit corresponding to the upload actually existing on gitserver
  • The path of interest had an associated SCIP document in that upload.

However, the second code path incorrectly only handled the case when
the first operation was a no-op. Consequently, it was possible to have
the following:

  • Some uploads were filtered out due to the path not existing in the
    wrong upload (not itself)
  • Some uploads were not filtered out due to the path existing in the
    wrong upload (not itself)

This PR is broken up into three commits.

  • The first commits adds a negative test for the bug (I've triggered CI)
  • The second commit simply adds comments related to aliasing to help
    reason with the code and better understand the bug.
  • The third commit removes all micro-optimization related to in-place filtering,
    the aliasing comments, fixes the bug, and updates the test.

Test plan

  • Added regression tests

@cla-bot cla-bot Bot added the cla-signed label May 3, 2024
@github-actions github-actions Bot added team/graph Graph Team (previously Code Intel/Language Tools/Language Platform) team/product-platform labels May 3, 2024
@varungandhi-src varungandhi-src changed the title fix: Avoid locating incorrect uploads during filtering fix: Correctly filter uploads with commit and path existence checks May 3, 2024
@varungandhi-src varungandhi-src force-pushed the vg/fix-candidates-bug branch from 811977c to f5ec27c Compare May 3, 2024 10:00
The upload filtering code previously did a check whether:
- The commit corresponding to the upload actually existing on gitserver
- The path of interest had an associated SCIP document in that upload.

However, the second code path incorrectly only handled the case when
the first operation was a no-op. In case some uploads were filtered
out due to the path existing (or not) in the wrong upload, and the
final result could still have uploads for which the commit no longer
existed on gitserver.
@varungandhi-src varungandhi-src force-pushed the vg/fix-candidates-bug branch from f5ec27c to f060d6e Compare May 7, 2024 13:57
@varungandhi-src varungandhi-src requested a review from keynmol May 7, 2024 13:58
@varungandhi-src varungandhi-src force-pushed the vg/fix-candidates-bug branch from f060d6e to 7447ea8 Compare May 7, 2024 14:08
Comment thread internal/codeintel/codenav/service.go Outdated

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.

Can you please clarify (in GH comment) what was the copying for and why you no longer need it?

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.

The copying was purely defensive. The earlier filtering function modified the slice in-place, so presumably this was to allow looking at the before/after while debugging the code.

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.

Comment thread internal/codeintel/codenav/service_closest_uploads_test.go Outdated
@varungandhi-src varungandhi-src force-pushed the vg/fix-candidates-bug branch from 7447ea8 to 61a9565 Compare May 8, 2024 02:16
@varungandhi-src varungandhi-src requested a review from keynmol May 8, 2024 02:50
@varungandhi-src varungandhi-src force-pushed the vg/fix-candidates-bug branch from 61a9565 to afe0070 Compare May 8, 2024 04:00
@varungandhi-src varungandhi-src merged commit ff3226d into main May 8, 2024
@varungandhi-src varungandhi-src deleted the vg/fix-candidates-bug branch May 8, 2024 10:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla-signed team/graph Graph Team (previously Code Intel/Language Tools/Language Platform) team/product-platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants