Skip to content

Commit 9490642

Browse files
authored
Merge pull request #2144 from github/charisk/mrva-public-beta
Prepare for MRVA public beta
2 parents 90b0911 + 643c106 commit 9490642

File tree

10 files changed

+30
-57
lines changed

10 files changed

+30
-57
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ To see what has changed in the last few versions of the extension, see the [Chan
1515
* Shows the flow of data through the results of path queries, which is essential for triaging security results.
1616
* Provides an easy way to run queries from the large, open source repository of [CodeQL security queries](https://github.com/github/codeql).
1717
* Adds IntelliSense to support you writing and editing your own CodeQL query and library files.
18+
* Supports you running CodeQL queries against thousands of repositories on GitHub using multi-repository variant analysis.
1819

1920
## Project goals and scope
2021

docs/test-plan.md

-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ choose to go through some of the Optional Test Cases.
1818

1919
## Required Test Cases
2020

21-
### Pre-requisites
22-
23-
- Flip the `codeQL.canary` flag. This will enable MRVA in the extension.
24-
2521
### Test Case 1: MRVA - Running a problem path query and viewing results
2622

2723
1. Open the [UnsafeJQueryPlugin query](https://github.com/github/codeql/blob/main/javascript/ql/src/Security/CWE-079/UnsafeJQueryPlugin.ql).

extensions/ql-vscode/CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
## [UNRELEASED]
44

55
- Send telemetry about unhandled errors happening within the extension. [#2125](https://github.com/github/vscode-codeql/pull/2125)
6+
- Enable multi-repository variant analysis. [#2121](https://github.com/github/vscode-codeql/pull/2121)
7+
- Enable collection of telemetry concerning interactions with UI elements, including buttons, links, and other inputs. [#2114](https://github.com/github/vscode-codeql/pull/2114)
68

79
## 1.7.11 - 1 March 2023
810

extensions/ql-vscode/package.json

+5-7
Original file line numberDiff line numberDiff line change
@@ -978,11 +978,10 @@
978978
},
979979
{
980980
"command": "codeQL.runVariantAnalysis",
981-
"when": "config.codeQL.canary && editorLangId == ql && resourceExtname == .ql"
981+
"when": "editorLangId == ql && resourceExtname == .ql"
982982
},
983983
{
984-
"command": "codeQL.exportSelectedVariantAnalysisResults",
985-
"when": "config.codeQL.canary"
984+
"command": "codeQL.exportSelectedVariantAnalysisResults"
986985
},
987986
{
988987
"command": "codeQL.runQueries",
@@ -1236,7 +1235,7 @@
12361235
},
12371236
{
12381237
"command": "codeQL.runVariantAnalysis",
1239-
"when": "config.codeQL.canary && editorLangId == ql && resourceExtname == .ql"
1238+
"when": "editorLangId == ql && resourceExtname == .ql"
12401239
},
12411240
{
12421241
"command": "codeQL.viewAst",
@@ -1281,8 +1280,7 @@
12811280
},
12821281
{
12831282
"id": "codeQLVariantAnalysisRepositories",
1284-
"name": "Variant Analysis Repositories",
1285-
"when": "config.codeQL.canary"
1283+
"name": "Variant Analysis Repositories"
12861284
},
12871285
{
12881286
"id": "codeQLQueryHistory",
@@ -1318,7 +1316,7 @@
13181316
},
13191317
{
13201318
"view": "codeQLVariantAnalysisRepositories",
1321-
"contents": "Set up a controller repository to start using variant analysis.\n[Set up controller repository](command:codeQLVariantAnalysisRepositories.setupControllerRepository)",
1319+
"contents": "Set up a controller repository to start using variant analysis. [Learn more](https://codeql.github.com/docs/codeql-for-visual-studio-code/running-codeql-queries-at-scale-with-mrva#controller-repository) about controller repositories. \n[Set up controller repository](command:codeQLVariantAnalysisRepositories.setupControllerRepository)",
13221320
"when": "!config.codeQL.variantAnalysis.controllerRepo"
13231321
}
13241322
]

extensions/ql-vscode/src/databases/db-module.ts

+6-19
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import { window } from "vscode";
2-
import { App, AppMode } from "../common/app";
2+
import { App } from "../common/app";
33
import { extLogger } from "../common";
44
import { DisposableObject } from "../pure/disposable-object";
55
import { DbConfigStore } from "./config/db-config-store";
66
import { DbManager } from "./db-manager";
77
import { DbPanel } from "./ui/db-panel";
88
import { DbSelectionDecorationProvider } from "./ui/db-selection-decoration-provider";
9-
import { isCanary } from "../config";
109

1110
export class DbModule extends DisposableObject {
1211
public readonly dbManager: DbManager;
@@ -19,24 +18,12 @@ export class DbModule extends DisposableObject {
1918
this.dbManager = new DbManager(app, this.dbConfigStore);
2019
}
2120

22-
public static async initialize(app: App): Promise<DbModule | undefined> {
23-
if (DbModule.shouldEnableModule(app.mode)) {
24-
const dbModule = new DbModule(app);
25-
app.subscriptions.push(dbModule);
21+
public static async initialize(app: App): Promise<DbModule> {
22+
const dbModule = new DbModule(app);
23+
app.subscriptions.push(dbModule);
2624

27-
await dbModule.initialize(app);
28-
return dbModule;
29-
}
30-
31-
return undefined;
32-
}
33-
34-
private static shouldEnableModule(app: AppMode): boolean {
35-
if (app === AppMode.Development || app === AppMode.Test) {
36-
return true;
37-
}
38-
39-
return isCanary();
25+
await dbModule.initialize(app);
26+
return dbModule;
4027
}
4128

4229
private async initialize(app: App): Promise<void> {

extensions/ql-vscode/src/extension.ts

+11-17
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ async function activateWithInstalledDistribution(
644644
cliServer,
645645
variantAnalysisStorageDir,
646646
variantAnalysisResultsManager,
647-
dbModule?.dbManager,
647+
dbModule.dbManager,
648648
);
649649
ctx.subscriptions.push(variantAnalysisManager);
650650
ctx.subscriptions.push(variantAnalysisResultsManager);
@@ -1134,23 +1134,17 @@ async function activateWithInstalledDistribution(
11341134
token: CancellationToken,
11351135
uri: Uri | undefined,
11361136
) => {
1137-
if (isCanary()) {
1138-
progress({
1139-
maxStep: 5,
1140-
step: 0,
1141-
message: "Getting credentials",
1142-
});
1137+
progress({
1138+
maxStep: 5,
1139+
step: 0,
1140+
message: "Getting credentials",
1141+
});
11431142

1144-
await variantAnalysisManager.runVariantAnalysis(
1145-
uri || window.activeTextEditor?.document.uri,
1146-
progress,
1147-
token,
1148-
);
1149-
} else {
1150-
throw new Error(
1151-
"Variant analysis requires the CodeQL Canary version to run.",
1152-
);
1153-
}
1143+
await variantAnalysisManager.runVariantAnalysis(
1144+
uri || window.activeTextEditor?.document.uri,
1145+
progress,
1146+
token,
1147+
);
11541148
},
11551149
{
11561150
title: "Run Variant Analysis",

extensions/ql-vscode/src/variant-analysis/repository-selection.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ export interface RepositorySelection {
1313
* @returns The user selection.
1414
*/
1515
export async function getRepositorySelection(
16-
dbManager?: DbManager,
16+
dbManager: DbManager,
1717
): Promise<RepositorySelection> {
18-
const selectedDbItem = dbManager?.getSelectedDbItem();
18+
const selectedDbItem = dbManager.getSelectedDbItem();
1919
if (selectedDbItem) {
2020
switch (selectedDbItem.kind) {
2121
case DbItemKind.LocalDatabase || DbItemKind.LocalList:

extensions/ql-vscode/src/variant-analysis/run-remote-query.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ export async function prepareRemoteQueryRun(
223223
uri: Uri | undefined,
224224
progress: ProgressCallback,
225225
token: CancellationToken,
226-
dbManager?: DbManager,
226+
dbManager: DbManager,
227227
): Promise<PreparedRemoteQuery> {
228228
if (!uri?.fsPath.endsWith(".ql")) {
229229
throw new UserCancellationException("Not a CodeQL query file.");

extensions/ql-vscode/src/variant-analysis/variant-analysis-manager.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export class VariantAnalysisManager
105105
private readonly cliServer: CodeQLCliServer,
106106
private readonly storagePath: string,
107107
private readonly variantAnalysisResultsManager: VariantAnalysisResultsManager,
108-
private readonly dbManager?: DbManager,
108+
private readonly dbManager: DbManager,
109109
) {
110110
super();
111111
this.variantAnalysisMonitor = this.push(

extensions/ql-vscode/test/vscode-tests/cli-integration/variant-analysis/variant-analysis-submission-integration.test.ts

+1-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { resolve } from "path";
33
import {
44
authentication,
55
commands,
6-
ConfigurationTarget,
76
extensions,
87
TextDocument,
98
window,
@@ -13,10 +12,7 @@ import {
1312
import { CodeQLExtensionInterface } from "../../../../src/extension";
1413
import { MockGitHubApiServer } from "../../../../src/mocks/mock-gh-api-server";
1514
import { mockedQuickPickItem } from "../../utils/mocking.helpers";
16-
import {
17-
CANARY_FEATURES,
18-
setRemoteControllerRepo,
19-
} from "../../../../src/config";
15+
import { setRemoteControllerRepo } from "../../../../src/config";
2016

2117
jest.setTimeout(30_000);
2218

@@ -39,7 +35,6 @@ describe("Variant Analysis Submission Integration", () => {
3935
let showErrorMessageSpy: jest.SpiedFunction<typeof window.showErrorMessage>;
4036

4137
beforeEach(async () => {
42-
await CANARY_FEATURES.updateValue(true, ConfigurationTarget.Global);
4338
await setRemoteControllerRepo("github/vscode-codeql");
4439

4540
jest.spyOn(authentication, "getSession").mockResolvedValue({

0 commit comments

Comments
 (0)