Skip to content

Gate show eval log and summary commands behind CLI v2.8.4 #1243

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

Conversation

angelapwen
Copy link
Contributor

@angelapwen angelapwen commented Mar 28, 2022

This PR will make it so that the "Show Evaluation Log (Raw)" and "Show Evaluation Log (Summary)" commands in the query history view only if the CLI version is >2.9.0. Previously, the commands always showed regardless of CLI version, and the user received an error pop-up if their CLI checkout was an earlier version. Once this is merged to the appropriate base branch, this change will allow us to merge #1186 before CLI v2.8.4 is released.

Checklist

  • 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.

@angelapwen angelapwen requested a review from a team as a code owner March 28, 2022 19:08
Comment on lines +960 to +962
await commands.executeCommand(
'setContext', 'codeql.supportsEvalLog', await this.cliConstraints.supportsPerQueryEvalLog()
);
Copy link
Contributor

Choose a reason for hiding this comment

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

I like the simplicity of this change. Is this the best place to execute this command, though? It will be invoked every time the extension asks for the CodeQL CLI version, which may be frequent. I expect this command to be executed each time there is a potential change to the configured CLI -- see what the CliConfigListener and QueryServerConfigListener classes in config.ts do, and whether that can be adapted to suit your purpose.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is actually what is happening. The only time this._version is undefined is after a config change, where the version may have potentially changed. The version and context are cached until the next time the config changes. By putting it in this if statement, we are guaranteed to call the command the minimal number of times.

Copy link
Contributor

Choose a reason for hiding this comment

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

Fancy. Looks good then! Perhaps add a comment to explain that, so I don't pester you about it again :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do, thanks!!

@@ -1276,7 +1279,7 @@ export class CliVersionConstraint {
/**
* CLI version that supports rotating structured logs to produce one per query.
*/
public static CLI_VERSION_WITH_PER_QUERY_EVAL_LOG = new SemVer('2.8.4');
public static CLI_VERSION_WITH_PER_QUERY_EVAL_LOG = new SemVer('2.9.0');
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the change of version here? I believe everything we need for this is in 2.8.4.

Copy link
Contributor Author

@angelapwen angelapwen Mar 28, 2022

Choose a reason for hiding this comment

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

Ah, I got a bit mixed up with all the different PRs — the incoming versions to log to the query server output (that I had been planning to merge into your PR) will be in 2.9.0, but it does seem unnecessary to wait until 2.9.0 for these changes.

So after I change it back, if a user is using 2.8.4, they would see the commands (and log files) but not any output in the query server console; and if they are using 2.9.0+ they would see the query server console output as well. I think that is reasonable (without adding another gate for 2.9.0).

@angelapwen angelapwen changed the title Gate show eval log and summary commands behind CLI v2.9.0 Gate show eval log and summary commands behind CLI v2.8.4 Mar 28, 2022
@angelapwen angelapwen merged commit 76cd2fa into github:edoardo/per-query-struct-logs Mar 28, 2022
@angelapwen angelapwen deleted the gate-command-cli-version branch March 28, 2022 22:34
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.

4 participants