Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions extensions/ql-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1077,17 +1077,17 @@
{
"command": "codeQLQueryHistory.showEvalLog",
"group": "4_queryHistory@1",
"when": "codeql.supportsEvalLog && viewItem == rawResultsItem || codeql.supportsEvalLog && viewItem == interpretedResultsItem || codeql.supportsEvalLog && viewItem == cancelledResultsItem"
"when": "viewItem == rawResultsItem || viewItem == interpretedResultsItem || viewItem == cancelledResultsItem"
},
{
"command": "codeQLQueryHistory.showEvalLogSummary",
"group": "4_queryHistory@2",
"when": "codeql.supportsEvalLog && viewItem == rawResultsItem || codeql.supportsEvalLog && viewItem == interpretedResultsItem || codeql.supportsEvalLog && viewItem == cancelledResultsItem"
"when": "viewItem == rawResultsItem || viewItem == interpretedResultsItem || viewItem == cancelledResultsItem"
},
{
"command": "codeQLQueryHistory.showEvalLogViewer",
"group": "4_queryHistory@3",
"when": "config.codeQL.canary && codeql.supportsEvalLog && viewItem == rawResultsItem || config.codeQL.canary && codeql.supportsEvalLog && viewItem == interpretedResultsItem || config.codeQL.canary && codeql.supportsEvalLog && viewItem == cancelledResultsItem"
"when": "config.codeQL.canary && viewItem == rawResultsItem || config.codeQL.canary && viewItem == interpretedResultsItem || config.codeQL.canary && viewItem == cancelledResultsItem"
},
{
"command": "codeQLQueryHistory.showQueryText",
Expand Down
56 changes: 6 additions & 50 deletions extensions/ql-vscode/src/codeql-cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1428,21 +1428,13 @@ export class CodeQLCliServer implements Disposable {

async packPacklist(dir: string, includeQueries: boolean): Promise<string[]> {
const args = includeQueries ? [dir] : ["--no-include-queries", dir];
// since 2.7.1, packlist returns an object with a "paths" property that is a list of packs.
// previous versions return a list of packs.
const results: { paths: string[] } | string[] =
await this.runJsonCodeQlCliCommand(
["pack", "packlist"],
args,
"Generating the pack list",
);
const results: { paths: string[] } = await this.runJsonCodeQlCliCommand(
["pack", "packlist"],
args,
"Generating the pack list",
);

// Once we no longer need to support 2.7.0 or earlier, we can remove this and assume all versions return an object.
if ("paths" in results) {
return results.paths;
} else {
return results;
}
return results.paths;
}

async packResolveDependencies(
Expand Down Expand Up @@ -1476,13 +1468,6 @@ export class CodeQLCliServer implements Disposable {
);

// this._version is only undefined upon config change, so we reset CLI-based context key only when necessary.
await this.app.commands.execute(
"setContext",
"codeql.supportsEvalLog",
newVersion.compare(
CliVersionConstraint.CLI_VERSION_WITH_PER_QUERY_EVAL_LOG,
) >= 0,
);
await this.app.commands.execute(
"setContext",
"codeql.supportsQuickEvalCount",
Expand Down Expand Up @@ -1811,23 +1796,6 @@ export class CliVersionConstraint {
*/
public static CLI_VERSION_WITH_RESOLVE_EXTENSIONS = new SemVer("2.10.2");

/**
* CLI version where the `--evaluator-log` and related options to the query server were introduced,
* on a per-query server basis.
*/
public static CLI_VERSION_WITH_STRUCTURED_EVAL_LOG = new SemVer("2.8.2");

/**
* CLI version that supports rotating structured logs to produce one per query.
*
* Note that 2.8.4 supports generating the evaluation logs and summaries,
* but 2.9.0 includes a new option to produce the end-of-query summary logs to
* the query server console. For simplicity we gate all features behind 2.9.0,
* but if a user is tied to the 2.8 release, we can enable evaluator logs
* and summaries for them.
*/
public static CLI_VERSION_WITH_PER_QUERY_EVAL_LOG = new SemVer("2.9.0");

/**
* CLI version that supports the `--sourcemap` option for log generation.
*/
Expand Down Expand Up @@ -1893,18 +1861,6 @@ export class CliVersionConstraint {
);
}

async supportsStructuredEvalLog() {
return this.isVersionAtLeast(
CliVersionConstraint.CLI_VERSION_WITH_STRUCTURED_EVAL_LOG,
);
}

async supportsPerQueryEvalLog() {
return this.isVersionAtLeast(
CliVersionConstraint.CLI_VERSION_WITH_PER_QUERY_EVAL_LOG,
);
}

async supportsSourceMap() {
return this.isVersionAtLeast(
CliVersionConstraint.CLI_VERSION_WITH_SOURCEMAP,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import {
} from "./query-status";
import { readQueryHistoryFromFile, writeQueryHistoryToFile } from "./store";
import { pathExists } from "fs-extra";
import { CliVersionConstraint } from "../codeql-cli/cli";
import { HistoryItemLabelProvider } from "./history-item-label-provider";
import { ResultsView, WebviewReveal } from "../local-queries";
import { EvalLogTreeBuilder, EvalLogViewer } from "../query-evaluation-logging";
Expand Down Expand Up @@ -760,7 +759,7 @@ export class QueryHistoryManager extends DisposableObject {
private warnNoEvalLogs() {
void showAndLogWarningMessage(
this.app.logger,
`Evaluator log, summary, and viewer are not available for this run. Perhaps it failed before evaluation, or you are running with a version of CodeQL before ' + ${CliVersionConstraint.CLI_VERSION_WITH_PER_QUERY_EVAL_LOG}?`,
`Evaluator log, summary, and viewer are not available for this run. Perhaps it failed before evaluation?`,
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,22 +146,11 @@ export class QueryServerClient extends DisposableObject {

args.push("--require-db-registration");

if (!(await this.cliServer.cliConstraints.supportsPerQueryEvalLog())) {
args.push("--old-eval-stats");
}

if (await this.cliServer.cliConstraints.supportsStructuredEvalLog()) {
const structuredLogFile = `${this.opts.contextStoragePath}/structured-evaluator-log.json`;
await ensureFile(structuredLogFile);
const structuredLogFile = `${this.opts.contextStoragePath}/structured-evaluator-log.json`;
await ensureFile(structuredLogFile);

args.push("--evaluator-log");
args.push(structuredLogFile);

// We hard-code the verbosity level to 5 and minify to false.
// This will be the behavior of the per-query structured logging in the CLI after 2.8.3.
args.push("--evaluator-log-level");
args.push("5");
}
args.push("--evaluator-log");
args.push(structuredLogFile);

if (this.config.debug) {
args.push("--debug", "--tuple-counting");
Expand Down
10 changes: 2 additions & 8 deletions extensions/ql-vscode/src/query-server/legacy/run-queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,7 @@ async function runQuery(
dbDir: dbContents.datasetUri.fsPath,
workingSet: "default",
};
if (
generateEvalLog &&
(await qs.cliServer.cliConstraints.supportsPerQueryEvalLog())
) {
if (generateEvalLog) {
await qs.sendRequest(messages.startLog, {
db: dataset,
logPath: outputDir.evalLogPath,
Expand All @@ -149,10 +146,7 @@ async function runQuery(
await qs.sendRequest(messages.runQueries, params, token, progress);
} finally {
qs.unRegisterCallback(callbackId);
if (
generateEvalLog &&
(await qs.cliServer.cliConstraints.supportsPerQueryEvalLog())
) {
if (generateEvalLog) {
await qs.sendRequest(messages.endLog, {
db: dataset,
logPath: outputDir.evalLogPath,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,6 @@ export class QueryServerClient extends DisposableObject {
args.push("--evaluator-log");
args.push(structuredLogFile);

// We hard-code the verbosity level to 5 and minify to false.
// This will be the behavior of the per-query structured logging in the CLI after 2.8.3.
args.push("--evaluator-log-level");
args.push("5");

if (this.config.debug) {
args.push("--debug", "--tuple-counting");
}
Expand Down