Skip to content

Commit ddaabfa

Browse files
committed
Merge remote-tracking branch 'origin/main' into koesie10/type-model
2 parents 557110d + f9e0654 commit ddaabfa

File tree

27 files changed

+230
-184
lines changed

27 files changed

+230
-184
lines changed

docs/releasing.md

Lines changed: 35 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,62 @@
11
# Releasing (write access required)
22

3-
1. Run the ["Run CLI tests" workflow](https://github.com/github/vscode-codeql/actions/workflows/cli-test.yml) and make sure the tests are green. If there were no merges between the time the workflow ran (it runs daily), and the release, you can skip this step.
3+
1. Determine the new version number. We default to increasing the patch version number, but make our own judgement about whether a change is big enough to warrant a minor version bump. Common reasons for a minor bump could include:
4+
* Making substantial new features available to all users. This can include lifting a feature flag.
5+
* Breakage in compatibility with recent versions of the CLI.
6+
* Minimum required version of VS Code is increased.
7+
* New telemetry events are added.
8+
* Deprecation or removal of commands.
9+
* Accumulation of many changes, none of which are individually big enough to warrant a minor bump, but which together are. This does not include changes which are purely internal to the extension, such as refactoring, or which are only available behind a feature flag.
10+
1. Create a release branch named after the new version (e.g. `v1.3.6`):
11+
* For a regular scheduled release this branch will be based on latest `main`.
12+
* Make sure your local copy of `main` is up to date so you are including all changes.
13+
* To do a minimal bug-fix release, base the release branch on the tag from the most recent release and then add only the changes you want to release.
14+
* Choose this option if you want to release a specific set of changes (e.g. a bug fix) and don't want to incur extra risk by including other changes that have been merged to the `main` branch.
15+
16+
```bash
17+
git checkout -b <new_release_branch> <previous_release_tag>
18+
```
19+
20+
1. Run the ["Run CLI tests" workflow](https://github.com/github/vscode-codeql/actions/workflows/cli-test.yml) and make sure the tests are green.
21+
* You can skip this step if you are releasing from `main` and there were no merges since the most recent daily scheduled run of this workflow.
422
1. Double-check the `CHANGELOG.md` contains all desired change comments and has the version to be released with date at the top.
5-
* Go through all recent PRs and make sure they are properly accounted for.
23+
* Go through PRs that have been merged since the previous release and make sure they are properly accounted for.
624
* Make sure all changelog entries have links back to their PR(s) if appropriate.
7-
* For picking the new version number, we default to increasing the patch version number, but make our own judgement about whether a change is big enough to warrant a minor version bump. Common reasons for a minor bump could include:
8-
* Making substantial new features available to all users. This can include lifting a feature flag.
9-
* Breakage in compatibility with recent versions of the CLI.
10-
* Minimum required version of VS Code is increased.
11-
* New telemetry events are added.
12-
* Deprecation or removal of commands.
13-
* Accumulation of many changes, none of which are individually big enough to warrant a minor bump, but which together are. This does not include changes which are purely internal to the extension, such as refactoring, or which are only available behind a feature flag.
14-
1. Double-check that the node version we're using matches the one used for VS Code. See the [Node.js version instructions](./node-version.md) for more information.
1525
1. Double-check that the extension `package.json` and `package-lock.json` have the version you intend to release. If you are doing a patch release (as opposed to minor or major version) this should already be correct.
16-
1. Create a PR for this release:
17-
* This PR will contain any missing bits from steps 1, 2 and 3. Most of the time, this will just be updating `CHANGELOG.md` with today's date.
18-
* Create a new branch for the release named after the new version. For example: `v1.3.6`
19-
* Create a new commit with a message the same as the branch name.
20-
* Create a PR for this branch.
21-
* Wait for the PR to be merged into `main`
22-
1. Switch to `main` branch and pull latest changes
23-
1. Lock the `main` branch.
24-
* Go to the [branch protection rules for the `main` branch](https://github.com/github/vscode-codeql/settings/branch_protection_rules/16447115)
25-
* Select "Lock branch"
26-
* Click "Save changes"
27-
1. Ensure that no PRs have been merged since the release PR that you merged. If there were, you might need to unlock `main` temporarily and update the CHANGELOG again.
28-
1. Build the extension `npm run build` and install it on your VS Code using "Install from VSIX".
26+
1. Commit any changes made during steps 4 and 5 with a commit message the same as the branch name (e.g. `v1.3.6`).
27+
1. Open a PR for this release.
28+
* The PR diff should contain:
29+
* Any missing bits from steps 4 and 5. Most of the time, this will just be updating `CHANGELOG.md` with today's date.
30+
* If releasing from a branch other than `main`, this PR will also contain the extension changes being released.
31+
1. Build the extension using `npm run build` and install it on your VS Code using "Install from VSIX".
2932
1. Go through [our test plan](./test-plan.md) to ensure that the extension is working as expected.
30-
1. Switch to `main` and add a new tag on the `main` branch with your new version (named after the release), e.g.
33+
1. Create a new tag on the release branch with your new version (named after the release), e.g.
3134
3235
```bash
33-
git checkout main
3436
git tag v1.3.6
3537
```
3638
37-
If you've accidentally created a badly named tag, you can delete it via
38-
39-
```bash
40-
git tag -d badly-named-tag
41-
```
42-
43-
1. Unlock the main branch
44-
* Go to the [branch protection rules for the `main` branch](https://github.com/github/vscode-codeql/settings/branch_protection_rules/16447115)
45-
* Deselect "Lock branch"
46-
* Click "Save changes"
39+
1. Merge the release PR into `main`.
40+
* If there are conflicts in the changelog, make sure to place any new changelog entries at the top, above the section for the current release, as these new entries are not part of the current release and should be placed in the "unreleased" section.
41+
* The release PR must be merged before pushing the tag to ensure that we always release a commit that is present on the `main` branch. It's not required that the commit is the head of the `main` branch, but there should be no chance of a future release accidentally not including changes from this release.
4742
1. Push the new tag up:
4843

49-
a. If you're using a fork of the repo:
50-
51-
```bash
52-
git push upstream refs/tags/v1.3.6
53-
```
54-
55-
b. If you're working straight in this repo:
56-
5744
```bash
5845
git push origin refs/tags/v1.3.6
5946
```
6047

61-
This will trigger [a release build](https://github.com/github/vscode-codeql/releases) on Actions.
62-
63-
* **IMPORTANT** Make sure you are on the `main` branch and your local checkout is fully updated when you add the tag.
64-
* If you accidentally add the tag to the wrong ref, you can just force push it to the right one later.
65-
1. Monitor the status of the release build in the `Release` workflow in the Actions tab.
48+
1. Find the [Release](https://github.com/github/vscode-codeql/actions?query=workflow%3ARelease) workflow run that was just triggered by pushing the tag, and monitor the status of the release build.
6649
* DO NOT approve the "publish" stages of the workflow yet.
6750
1. Download the VSIX from the draft GitHub release at the top of [the releases page](https://github.com/github/vscode-codeql/releases) that is created when the release build finishes.
6851
1. Unzip the `.vsix` and inspect its `package.json` to make sure the version is what you expect,
6952
or look at the source if there's any doubt the right code is being shipped.
7053
1. Install the `.vsix` file into your vscode IDE and ensure the extension can load properly. Run a single command (like run query, or add database).
71-
1. Go to the actions tab of the vscode-codeql repository and select the [Release workflow](https://github.com/github/vscode-codeql/actions?query=workflow%3ARelease).
54+
1. Approve the deployments of the [Release](https://github.com/github/vscode-codeql/actions?query=workflow%3ARelease) workflow run. This will automatically publish to Open VSX and VS Code Marketplace.
7255
* If there is an authentication failure when publishing, be sure to check that the authentication keys haven't expired. See below.
73-
1. Approve the deployments of the correct Release workflow. This will automatically publish to Open VSX and VS Code Marketplace.
74-
1. Go to the draft GitHub release in [the releases tab of the repository](https://github.com/github/vscode-codeql/releases), click 'Edit', add some summary description, and publish it.
75-
1. Confirm the new release is marked as the latest release at <https://github.com/github/vscode-codeql/releases>.
56+
1. Go to the draft GitHub release in [the releases page](https://github.com/github/vscode-codeql/releases), click 'Edit', add some summary description, and publish it.
57+
1. Confirm the new release is marked as the latest release.
7658
1. If documentation changes need to be published, notify documentation team that release has been made.
77-
1. Review and merge the version bump PR that is automatically created by Actions.
59+
1. Review and merge the version bump PR that is automatically created by the Release workflow.
7860

7961
## Secrets and authentication for publishing
8062

extensions/ql-vscode/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
## [UNRELEASED]
44

5+
- The "Sort by Language" action in the databases view now sorts by name within each language. [#3055](https://github.com/github/vscode-codeql/pull/3055)
6+
7+
## 1.9.4 - 6 November 2023
8+
9+
No user facing changes.
10+
511
## 1.9.3 - 26 October 2023
612

713
- Sorted result set filenames now include a hash of the result set name instead of the full name. [#2955](https://github.com/github/vscode-codeql/pull/2955)

extensions/ql-vscode/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

extensions/ql-vscode/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "CodeQL for Visual Studio Code",
55
"author": "GitHub",
66
"private": true,
7-
"version": "1.9.4",
7+
"version": "1.9.5",
88
"publisher": "GitHub",
99
"license": "MIT",
1010
"icon": "media/VS-marketplace-CodeQL-icon.png",

extensions/ql-vscode/src/databases/local-databases-ui.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,17 @@ class DatabaseTreeDataProvider
158158
case SortOrder.NameDesc:
159159
return db2.name.localeCompare(db1.name, env.language);
160160
case SortOrder.LanguageAsc:
161-
return db1.language.localeCompare(db2.language, env.language);
161+
return (
162+
db1.language.localeCompare(db2.language, env.language) ||
163+
// If the languages are the same, sort by name
164+
db1.name.localeCompare(db2.name, env.language)
165+
);
162166
case SortOrder.LanguageDesc:
163-
return db2.language.localeCompare(db1.language, env.language);
167+
return (
168+
db2.language.localeCompare(db1.language, env.language) ||
169+
// If the languages are the same, sort by name
170+
db2.name.localeCompare(db1.name, env.language)
171+
);
164172
case SortOrder.DateAddedAsc:
165173
return (db1.dateAdded || 0) - (db2.dateAdded || 0);
166174
case SortOrder.DateAddedDesc:

extensions/ql-vscode/src/log-insights/join-order.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,19 @@ function makeKey(
4040
const DEPENDENT_PREDICATES_REGEXP = (() => {
4141
const regexps = [
4242
// SCAN id
43-
String.raw`SCAN\s+([0-9a-zA-Z:#_]+)\s`,
43+
String.raw`SCAN\s+([0-9a-zA-Z:#_]+|\`[^\`\r\n]*\`)\s`,
4444
// JOIN id WITH id
45-
String.raw`JOIN\s+([0-9a-zA-Z:#_]+)\s+WITH\s+([0-9a-zA-Z:#_]+)\s`,
45+
String.raw`JOIN\s+([0-9a-zA-Z:#_]+|\`[^\`\r\n]*\`)\s+WITH\s+([0-9a-zA-Z:#_]+|\`[^\`\r\n]*\`)\s`,
4646
// AGGREGATE id, id
47-
String.raw`AGGREGATE\s+([0-9a-zA-Z:#_]+)\s*,\s+([0-9a-zA-Z:#_]+)`,
47+
String.raw`AGGREGATE\s+([0-9a-zA-Z:#_]+|\`[^\`\r\n]*\`)\s*,\s+([0-9a-zA-Z:#_]+|\`[^\`\r\n]*\`)`,
4848
// id AND NOT id
49-
String.raw`([0-9a-zA-Z:#_]+)\s+AND\s+NOT\s+([0-9a-zA-Z:#_]+)`,
49+
String.raw`([0-9a-zA-Z:#_]+|\`[^\`\r\n]*\`)\s+AND\s+NOT\s+([0-9a-zA-Z:#_]+|\`[^\`\r\n]*\`)`,
5050
// INVOKE HIGHER-ORDER RELATION rel ON <id, ..., id>
51-
String.raw`INVOKE\s+HIGHER-ORDER\s+RELATION\s[^\s]+\sON\s+<([0-9a-zA-Z:#_<>]+)((?:,[0-9a-zA-Z:#_<>]+)*)>`,
51+
String.raw`INVOKE\s+HIGHER-ORDER\s+RELATION\s[^\s]+\sON\s+<([0-9a-zA-Z:#_<>]+|\`[^\`\r\n]*\`)((?:,[0-9a-zA-Z:#_<>]+|,\`[^\`\r\n]*\`)*)>`,
5252
// SELECT id
53-
String.raw`SELECT\s+([0-9a-zA-Z:#_]+)`,
53+
String.raw`SELECT\s+([0-9a-zA-Z:#_]+|\`[^\`\r\n]*\`)`,
54+
// REWRITE id WITH
55+
String.raw`REWRITE\s+([0-9a-zA-Z:#_]+|\`[^\`\r\n]*\`)\s+WITH\s`,
5456
];
5557
return new RegExp(
5658
`${String.raw`\{[0-9]+\}\s+[0-9a-zA-Z]+\s=\s(?:` + regexps.join("|")})`,
@@ -65,7 +67,12 @@ function getDependentPredicates(operations: string[]): I.List<string> {
6567
.rest() // Skip the first group as it's just the entire string
6668
.filter((x) => !!x && !x.match("r[0-9]+|PRIMITIVE")) // Only keep the references to predicates.
6769
.flatMap((x) => x.split(",")) // Group 2 in the INVOKE HIGHER_ORDER RELATION case is a comma-separated list of identifiers.
68-
.filter((x) => !!x); // Remove empty strings
70+
.filter((x) => !!x) // Remove empty strings
71+
.map((x) =>
72+
x.startsWith("`") && x.endsWith("`")
73+
? x.substring(1, x.length - 1)
74+
: x,
75+
); // Remove quotes from quoted identifiers
6976
} else {
7077
return I.List();
7178
}

extensions/ql-vscode/src/model-editor/auto-modeler.ts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -208,27 +208,6 @@ export class AutoModeler {
208208
return;
209209
}
210210

211-
// Any candidate that was part of the response is a negative result
212-
// meaning that the canidate is not a sink for the kinds that the LLM is checking for.
213-
// For now we model this as a sink neutral method, however this is subject
214-
// to discussion.
215-
for (const candidate of candidateMethods) {
216-
if (!(candidate.signature in loadedMethods)) {
217-
loadedMethods[candidate.signature] = [
218-
{
219-
type: "neutral",
220-
kind: "sink",
221-
provenance: "ai-generated",
222-
signature: candidate.signature,
223-
packageName: candidate.packageName,
224-
typeName: candidate.typeName,
225-
methodName: candidate.methodName,
226-
methodParameters: candidate.methodParameters,
227-
},
228-
];
229-
}
230-
}
231-
232211
await this.addModeledMethods(loadedMethods);
233212
}
234213

extensions/ql-vscode/src/model-editor/languages/models-as-data.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { MethodDefinition } from "../method";
1+
import { MethodArgument, MethodDefinition } from "../method";
22
import {
33
ModeledMethod,
44
NeutralModeledMethod,
@@ -47,6 +47,11 @@ export type ModelsAsDataLanguagePredicates = {
4747
type?: ModelsAsDataLanguagePredicate<TypeModeledMethod>;
4848
};
4949

50+
export type MethodArgumentOptions = {
51+
options: MethodArgument[];
52+
defaultArgumentPath: string;
53+
};
54+
5055
export type ModelsAsDataLanguage = {
5156
/**
5257
* The modes that are available for this language. If not specified, all
@@ -56,4 +61,9 @@ export type ModelsAsDataLanguage = {
5661
createMethodSignature: (method: MethodDefinition) => string;
5762
predicates: ModelsAsDataLanguagePredicates;
5863
modelGeneration?: ModelsAsDataLanguageModelGeneration;
64+
/**
65+
* Returns the list of valid arguments that can be selected for the given method.
66+
* @param method The method to get the valid arguments for.
67+
*/
68+
getArgumentOptions: (method: MethodDefinition) => MethodArgumentOptions;
5969
};

extensions/ql-vscode/src/model-editor/languages/ruby/index.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { ModelsAsDataLanguage } from "../models-as-data";
22
import { sharedExtensiblePredicates, sharedKinds } from "../shared";
33
import { Mode } from "../../shared/mode";
44
import { parseGenerateModelResults } from "./generate";
5+
import { getArgumentsList, MethodArgument } from "../../method";
56

67
function parseRubyMethodFromPath(path: string): string {
78
const match = path.match(/Method\[([^\]]+)].*/);
@@ -181,4 +182,34 @@ export const ruby: ModelsAsDataLanguage = {
181182
},
182183
parseResults: parseGenerateModelResults,
183184
},
185+
getArgumentOptions: (method) => {
186+
const argumentsList = getArgumentsList(method.methodParameters).map(
187+
(argument, index): MethodArgument => {
188+
if (argument.endsWith(":")) {
189+
return {
190+
path: `Argument[${argument}]`,
191+
label: `Argument[${argument}]`,
192+
};
193+
}
194+
195+
return {
196+
path: `Argument[${index}]`,
197+
label: `Argument[${index}]: ${argument}`,
198+
};
199+
},
200+
);
201+
202+
return {
203+
options: [
204+
{
205+
path: "Argument[self]",
206+
label: "Argument[self]",
207+
},
208+
...argumentsList,
209+
],
210+
// If there are no arguments, we will default to "Argument[self]"
211+
defaultArgumentPath:
212+
argumentsList.length > 0 ? argumentsList[0].path : "Argument[self]",
213+
};
214+
},
184215
};

extensions/ql-vscode/src/model-editor/languages/static/index.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Provenance } from "../../modeled-method";
33
import { DataTuple } from "../../model-extension-file";
44
import { sharedExtensiblePredicates, sharedKinds } from "../shared";
55
import { filterFlowModelQueries, parseFlowModelResults } from "./generate";
6+
import { getArgumentsList, MethodArgument } from "../../method";
67

78
function readRowToMethod(row: DataTuple[]): string {
89
return `${row[0]}.${row[1]}#${row[3]}${row[4]}`;
@@ -145,4 +146,25 @@ export const staticLanguage: ModelsAsDataLanguage = {
145146
filterQueries: filterFlowModelQueries,
146147
parseResults: parseFlowModelResults,
147148
},
149+
getArgumentOptions: (method) => {
150+
const argumentsList = getArgumentsList(method.methodParameters).map(
151+
(argument, index): MethodArgument => ({
152+
path: `Argument[${index}]`,
153+
label: `Argument[${index}]: ${argument}`,
154+
}),
155+
);
156+
157+
return {
158+
options: [
159+
{
160+
path: "Argument[this]",
161+
label: "Argument[this]",
162+
},
163+
...argumentsList,
164+
],
165+
// If there are no arguments, we will default to "Argument[this]"
166+
defaultArgumentPath:
167+
argumentsList.length > 0 ? argumentsList[0].path : "Argument[this]",
168+
};
169+
},
148170
};

0 commit comments

Comments
 (0)