-
Notifications
You must be signed in to change notification settings - Fork 190
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
Draft PR showcasing how to use filtered queries in the extension. #2661
Conversation
import { extLogger } from "../common/logging/vscode"; | ||
import { dir } from "tmp-promise"; | ||
import { writeFile, outputFile } from "fs-extra"; | ||
import { autoPickExtensionsDirectory } from "./extensions-workspace-folder"; |
Check notice
Code scanning / CodeQL
Unused variable, import, function or class
import { dir } from "tmp-promise"; | ||
import { writeFile, outputFile } from "fs-extra"; | ||
import { autoPickExtensionsDirectory } from "./extensions-workspace-folder"; | ||
import { sign } from "crypto"; |
Check notice
Code scanning / CodeQL
Unused variable, import, function or class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. I think this is reasonable.
@@ -380,13 +385,54 @@ export class DataExtensionsEditorView extends AbstractWebview< | |||
let predictedModeledMethods: Record<string, ModeledMethod>; | |||
|
|||
if (useLlmGenerationV2()) { | |||
// Generate a qlpack with a filter that only includes the usages we want to model. | |||
const packDir = (await dir({ unsafeCleanup: true })).path; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This dir will be cleaned when vscode exits?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should make sure it does. I am working on the actual PR right now, this was mostly to a showcase to show how we could use the queries.
const syntheticConfigPack = { | ||
name: "codeql/automodel-filter", | ||
version: "0.0.0", | ||
library: true, | ||
extensionTargets: { | ||
[`codeql/${this.databaseItem.language}-all`]: "*", | ||
}, | ||
dataExtensions: ["filter.yml"], | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice
const usages = await runAutoModelQueries({ | ||
mode: this.mode, | ||
cliServer: this.cliServer, | ||
queryRunner: this.queryRunner, | ||
queryStorageDir: this.queryStorageDir, | ||
databaseItem: this.databaseItem, | ||
progress: (update) => progress({ ...update, maxStep }), | ||
extraExtensionPacks: [packDir], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was expecting to see the name of the extension pack here. I haven't looked at the entire implementation, so you may already be doing this properly. The --extension-packs
argument must be the name (and optional version) of the extension/model pack you want to use. And this pack must be available either in the package cache or from addtional-packs or from the workspace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I refactored this slightly in my other PR. I moved package generation to auto-model-codeml-queries.ts
. That means we can just do:
const additionalPacks = [...getOnDiskWorkspaceFolders(), filterPackDir];
const extensionPacks = Object.keys(
await cliServer.resolveQlpacks(additionalPacks, true),
);
and pass those directly to the run method:
const candidates = await runAutoModelQuery({
...
additionalPacks,
extensionPacks,
...
});
Closing in favor of #2670 |
This is draft/WIP example on how to use an
extensible
predicate in the extraction queries, it showcases and relies on using the queries from github/codeql#13852.Checklist
ready-for-doc-review
label there.