Skip to content

Clean up variant analyses from query history#2118

Merged
charisk merged 2 commits intomainfrom
charisk/variant-analysis-scrubbing
Mar 2, 2023
Merged

Clean up variant analyses from query history#2118
charisk merged 2 commits intomainfrom
charisk/variant-analysis-scrubbing

Conversation

@charisk
Copy link
Copy Markdown
Contributor

@charisk charisk commented Feb 27, 2023

Updated query history clean up logic to also clean up variant analyses.

This required some minor refactoring - see individual commits.

Checklist

N/A:

  • CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • 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.

@charisk charisk added the secexp label Feb 27, 2023
@charisk charisk requested a review from a team as a code owner February 27, 2023 16:29
);
return;
}
if (!(await pathExists(queryHistoryDirs.variantAnalysesDirPath))) {
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.

I think this is ok to do since https://github.com/github/vscode-codeql/blob/main/extensions/ql-vscode/src/extension.ts#L628 is not checking for canary flags.

@charisk charisk changed the title Charisk/variant analysis scrubbing Clean up variant analyses from query history Feb 27, 2023
Copy link
Copy Markdown
Contributor

@robertbrignull robertbrignull left a comment

Choose a reason for hiding this comment

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

One question, but I think this is fine as is. It took me a while to understand what's going on, and the tests are still a bit daunting. So if you're also not too confident you may want to get a second review. I leave it up to you.

void extLogger.log(
`Cannot clean up query history directories. Local queries directory does not exist: ${queryHistoryDirs.localQueriesDirPath}`,
);
return;
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.

Do we want to return here? If the local query history directory doesn't exist we can still clean up the variant analysis directory. I suppose we do expect both dirs to exist, so this is still an unexpected error, but do we want to abort fully or try to continue.

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.

I thought that since this is an exceptional case then it's okay to abort. I don't have a strong opinion though - happy to change it to be more resilient.

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.

You're right it should be an exceptional case that doesn't happen in practice. Also it's not like one of local or remote queries is a more central part of the extension, so it's not like a user would want to only use one and therefore want to run without one of the directories existing. And we recreate the directories on extension startup. So if this does happen it hopefully won't be a long term problem and will be fixed by restarting.

That's a lot of words, but in short I think it's fine as it is. Feel free to abort if any of the directories don't exist and keep the code simple.

@charisk
Copy link
Copy Markdown
Contributor Author

charisk commented Feb 28, 2023

I'll leave this open until tomorrow in case @aeisenberg wants to have a look (no pressure though).

@charisk charisk force-pushed the charisk/variant-analysis-scrubbing branch from 1f7c890 to 06463a2 Compare February 28, 2023 13:02
@charisk charisk closed this Mar 1, 2023
@charisk charisk reopened this Mar 1, 2023
@charisk charisk merged commit 5555fca into main Mar 2, 2023
@charisk charisk deleted the charisk/variant-analysis-scrubbing branch March 2, 2023 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants