-
Notifications
You must be signed in to change notification settings - Fork 189
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
Add "CodeQL: Trim Cache" command that calls evaluation/trimCache
#2928
Conversation
evaluation/trimCache
evaluation/trimCache
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drive-by comment
Some high-level comments: Good software engineering practices consider code as not just something for computers to run but also something for people to read. We can take the same attitude to pull requests: they are not just instructions to Git but also a narrative for people of what is being changed and how. Therefore it is a good idea to shape your PR intentionally, instead of just as a series of commits that you made along the way. For example, I like it that you added commit descriptions as needed. In this case there is a lot of overlap with the PR description, but in general that is not necessarily the case. Now, different people have different opinions about how to structure a PR. Here is my take. A well structured PR should be free of noise. Which means that each commit—and each line of change in each commit—must carry its own weight. In this PR, there are two merges from It may be a good idea to include a merge commit in a PR review if the merge is particularly complicated. For example, a class that you use has undergone a significant restructuring. Even in that case, I would say that it is better to rebase your PR on top of the interfering change, so that the changes being reviewed closely resemble the code that will be merged. Force push to a PR branch that is already undergoing review is a somewhat contentious topic. But I don't think there is general objection to force pushes when a PR is still in draft mode. So there shouldn't be any merge commits when you first mark a PR ready for review. As for the remaining commits, I can accept that "Add CHANGELOG.md entry" carries its own weight. I don't think "Remove unused import" meets that bar. It really should have been folded into the previous commit. What about "Minimize changes to the legacy query server client"? A well structured PR should present a straightforward and understandable narrative. Right now the narrative presented by the PR is "I added new code into the legacy query server client and then decided that I do not want them anymore". Is it important for PR reviewers to see that plot twist? Sometimes I do change or add code in one commit that is removed in a later commit. But that needs to be an intentional decision: for example, the intermediate state may help PR reviewers see how we get from the beginning to the end. That would make those extra lines of change carry their own weight. In this PR, though, I don't think it is useful for PR reviewers to see the legacy query server client code you added and then took out. They should just not be in the PR. Would you like to try reworking the PR based on some of these suggestions? You can take the PR into draft mode and mark it as ready for review when you are done. |
Very useful and actionable feedback! Thanks @cklin :) I'll move this PR back into Draft, and implement your suggestions. |
f147e8d
to
712bc39
Compare
I think we should hold back merging this PR until the CLI component has been released. If not, VSCode users will see a new command and discover that it doesn't seem to do anything. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great 👍 Thank you for putting in the additional work on the PR!
If this is not really supported for older CLI versions, could we make this complete command only available if you are running a CLI version which supports this version? We do the same thing for the |
Good idea @koesie10. I've been looking into it. I think a more scalable option is to extract the feature flags exposed by the CLI under So I'll go ahead with this plan (independent steps):
Update: actually, to avoid snowballing this PR, I'll probably implement exactly what you suggest. |
The purpose of this change is to add a command that clears the cache except for predicates marked `cached`. In contrast, the existing "VSCode: Clear Cache" command clears everything (`--mode=brutal`). This calls into the query server's `evaluation/trimCache` method; however, its existing behaviour is to do a database cleanup with `--mode=gentle`. This is not well documented, and `--mode=normal` would give the desired behaviour. Accordingly, this approach is dependent on separately changing the backend behaviour to `--mode=normal`. Other possible amendments to this commit would be to not touch the legacy client (replacing required methods by failing promises, since the legacy server is fully deprecated already), or to have less duplication (by introducing more arguments — however, I'm applying the rule of thumb that >3 copy-pastes are required for the introduction of a deduplicating abstraction).
712bc39
to
b097804
Compare
FYI Within GitHub the phrase "feature flag" has a very specific meaning: https://thehub.github.com/epd/engineering/products-and-services/dotcom/features/feature-flags/ Even though we do not primarily work in dotcom (i.e., the |
Note, I've left out the additional version check at the entry point of the |
The purpose of this change is to add a command that clears the cache except for predicates marked
cached
.This is in contrast to the existing "VSCode: Clear Cache" command which clears everything (
--mode=brutal
).This calls into the query server's
evaluation/trimCache
method;however, its existing behaviour is to do a database cleanup with
--mode=gentle
.This is not well documented, and
--mode=normal
would give the desired behaviour.Accordingly, this approach is dependent on separately changing the backend behaviour to
--mode=normal
.Other possible amendments (comments welcome!) to this commit would be
Checklist
Issues have been created for any UI or other user-facing changes made by this pull request.[Maintainers only] If this pull request makes user-facing changes that require documentation changes, open a corresponding docs pull request in the github/codeql repo and add the(?)ready-for-doc-review
label there.