Skip to content

Commit 2b4fa0d

Browse files
committed
Remove automodel-related functionality
1 parent 5f4522d commit 2b4fa0d

File tree

60 files changed

+137
-2191
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+137
-2191
lines changed

extensions/ql-vscode/src/common/interface-types.ts

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -560,16 +560,6 @@ interface SetModifiedMethodsMessage {
560560
methodSignatures: string[];
561561
}
562562

563-
interface SetInProgressMethodsMessage {
564-
t: "setInProgressMethods";
565-
methods: string[];
566-
}
567-
568-
interface SetProcessedByAutoModelMethodsMessage {
569-
t: "setProcessedByAutoModelMethods";
570-
methods: string[];
571-
}
572-
573563
interface SwitchModeMessage {
574564
t: "switchMode";
575565
mode: Mode;
@@ -601,17 +591,6 @@ interface GenerateMethodMessage {
601591
t: "generateMethod";
602592
}
603593

604-
interface GenerateMethodsFromLlmMessage {
605-
t: "generateMethodsFromLlm";
606-
packageName: string;
607-
methodSignatures: string[];
608-
}
609-
610-
interface StopGeneratingMethodsFromLlmMessage {
611-
t: "stopGeneratingMethodsFromLlm";
612-
packageName: string;
613-
}
614-
615594
interface StartModelEvaluationMessage {
616595
t: "startModelEvaluation";
617596
}
@@ -649,16 +628,6 @@ interface SetInModelingModeMessage {
649628
inModelingMode: boolean;
650629
}
651630

652-
interface SetInProgressMessage {
653-
t: "setInProgress";
654-
inProgress: boolean;
655-
}
656-
657-
interface SetProcessedByAutoModelMessage {
658-
t: "setProcessedByAutoModel";
659-
processedByAutoModel: boolean;
660-
}
661-
662631
interface RevealMethodMessage {
663632
t: "revealMethod";
664633
methodSignature: string;
@@ -679,8 +648,6 @@ export type ToModelEditorMessage =
679648
| SetMethodsMessage
680649
| SetModeledAndModifiedMethodsMessage
681650
| SetModifiedMethodsMessage
682-
| SetInProgressMethodsMessage
683-
| SetProcessedByAutoModelMethodsMessage
684651
| RevealMethodMessage
685652
| SetAccessPathSuggestionsMessage
686653
| SetModelEvaluationRunMessage;
@@ -694,8 +661,6 @@ export type FromModelEditorMessage =
694661
| JumpToMethodMessage
695662
| SaveModeledMethods
696663
| GenerateMethodMessage
697-
| GenerateMethodsFromLlmMessage
698-
| StopGeneratingMethodsFromLlmMessage
699664
| ModelDependencyMessage
700665
| HideModeledMethodsMessage
701666
| SetMultipleModeledMethodsMessage
@@ -738,8 +703,6 @@ interface SetSelectedMethodMessage {
738703
method: Method;
739704
modeledMethods: ModeledMethod[];
740705
isModified: boolean;
741-
isInProgress: boolean;
742-
processedByAutoModel: boolean;
743706
}
744707

745708
export type ToMethodModelingMessage =
@@ -748,9 +711,7 @@ export type ToMethodModelingMessage =
748711
| SetMethodModifiedMessage
749712
| SetNoMethodSelectedMessage
750713
| SetSelectedMethodMessage
751-
| SetInModelingModeMessage
752-
| SetInProgressMessage
753-
| SetProcessedByAutoModelMessage;
714+
| SetInModelingModeMessage;
754715

755716
interface SetModelAlertsViewStateMessage {
756717
t: "setModelAlertsViewState";

extensions/ql-vscode/src/common/mock-gh-api/gh-api-request.ts

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export enum RequestKind {
1414
GetVariantAnalysisRepo = "getVariantAnalysisRepo",
1515
GetVariantAnalysisRepoResult = "getVariantAnalysisRepoResult",
1616
CodeSearch = "codeSearch",
17-
AutoModel = "autoModel",
1817
}
1918

2019
export interface BasicErrorResponse {
@@ -92,31 +91,13 @@ interface CodeSearchRequest {
9291
};
9392
}
9493

95-
export interface AutoModelResponse {
96-
models: string;
97-
}
98-
99-
interface AutoModelRequest {
100-
request: {
101-
kind: RequestKind.AutoModel;
102-
body?: {
103-
candidates: string;
104-
};
105-
};
106-
response: {
107-
status: number;
108-
body?: AutoModelResponse | BasicErrorResponse;
109-
};
110-
}
111-
11294
export type GitHubApiRequest =
11395
| GetRepoRequest
11496
| SubmitVariantAnalysisRequest
11597
| GetVariantAnalysisRequest
11698
| GetVariantAnalysisRepoRequest
11799
| GetVariantAnalysisRepoResultRequest
118-
| CodeSearchRequest
119-
| AutoModelRequest;
100+
| CodeSearchRequest;
120101

121102
export const isGetRepoRequest = (
122103
request: GitHubApiRequest,
@@ -146,8 +127,3 @@ export const isCodeSearchRequest = (
146127
request: GitHubApiRequest,
147128
): request is CodeSearchRequest =>
148129
request.request.kind === RequestKind.CodeSearch;
149-
150-
export const isAutoModelRequest = (
151-
request: GitHubApiRequest,
152-
): request is AutoModelRequest =>
153-
request.request.kind === RequestKind.AutoModel;

extensions/ql-vscode/src/common/mock-gh-api/recorder.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { DisposableObject } from "../disposable-object";
88
import { gzipDecode } from "../zlib";
99

1010
import type {
11-
AutoModelResponse,
1211
BasicErrorResponse,
1312
CodeSearchResponse,
1413
GetVariantAnalysisRepoResultRequest,
@@ -265,23 +264,6 @@ async function createGitHubApiRequest(
265264
};
266265
}
267266

268-
const autoModelMatch = url.match(
269-
/\/repos\/github\/codeql\/code-scanning\/codeql\/auto-model/,
270-
);
271-
if (autoModelMatch) {
272-
return {
273-
request: {
274-
kind: RequestKind.AutoModel,
275-
},
276-
response: {
277-
status,
278-
body: await jsonResponseBody<
279-
BasicErrorResponse | AutoModelResponse | undefined
280-
>(response),
281-
},
282-
};
283-
}
284-
285267
return undefined;
286268
}
287269

extensions/ql-vscode/src/common/mock-gh-api/request-handlers.ts

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import type { RequestHandler } from "msw";
44
import { http } from "msw";
55
import type { GitHubApiRequest } from "./gh-api-request";
66
import {
7-
isAutoModelRequest,
87
isCodeSearchRequest,
98
isGetRepoRequest,
109
isGetVariantAnalysisRepoRequest,
@@ -41,7 +40,6 @@ export async function createRequestHandlers(
4140
createGetVariantAnalysisRepoRequestHandler(requests),
4241
createGetVariantAnalysisRepoResultRequestHandler(requests),
4342
createCodeSearchRequestHandler(requests),
44-
createAutoModelRequestHandler(requests),
4543
];
4644

4745
return handlers;
@@ -230,29 +228,3 @@ function createCodeSearchRequestHandler(
230228
});
231229
});
232230
}
233-
234-
function createAutoModelRequestHandler(
235-
requests: GitHubApiRequest[],
236-
): RequestHandler {
237-
const autoModelRequests = requests.filter(isAutoModelRequest);
238-
let requestIndex = 0;
239-
240-
// During automodeling there can be multiple API requests for each batch
241-
// of candidates we want to model. We need to return different responses for each request,
242-
// so keep an index of the request and return the appropriate response.
243-
return http.post(
244-
`${baseUrl}/repos/github/codeql/code-scanning/codeql/auto-model`,
245-
() => {
246-
const request = autoModelRequests[requestIndex];
247-
248-
if (requestIndex < autoModelRequests.length - 1) {
249-
// If there are more requests to come, increment the index.
250-
requestIndex++;
251-
}
252-
253-
return jsonResponse(request.response.body, {
254-
status: request.response.status,
255-
});
256-
},
257-
);
258-
}

extensions/ql-vscode/src/common/mock-gh-api/scenarios/auto-model-success/0-autoModel.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

extensions/ql-vscode/src/common/mock-gh-api/scenarios/auto-model-success/1-autoModel.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

extensions/ql-vscode/src/common/mock-gh-api/scenarios/auto-model-success/README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

extensions/ql-vscode/src/common/zlib.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
import { promisify } from "util";
2-
import { gzip, gunzip } from "zlib";
3-
4-
/**
5-
* Promisified version of zlib.gzip
6-
*/
7-
export const gzipEncode = promisify(gzip);
2+
import { gunzip } from "zlib";
83

94
/**
105
* Promisified version of zlib.gunzip

extensions/ql-vscode/src/config.ts

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -828,15 +828,6 @@ export async function setAutogenerateQlPacks(choice: AutogenerateQLPacks) {
828828

829829
const MODEL_SETTING = new Setting("model", ROOT_SETTING);
830830
const FLOW_GENERATION = new Setting("flowGeneration", MODEL_SETTING);
831-
const LLM_GENERATION = new Setting("llmGeneration", MODEL_SETTING);
832-
const LLM_GENERATION_BATCH_SIZE = new Setting(
833-
"llmGenerationBatchSize",
834-
MODEL_SETTING,
835-
);
836-
const LLM_GENERATION_DEV_ENDPOINT = new Setting(
837-
"llmGenerationDevEndpoint",
838-
MODEL_SETTING,
839-
);
840831
const MODEL_EVALUATION = new Setting("evaluation", MODEL_SETTING);
841832
const MODEL_PACK_LOCATION = new Setting("packLocation", MODEL_SETTING);
842833
const MODEL_PACK_NAME = new Setting("packName", MODEL_SETTING);
@@ -850,7 +841,6 @@ export type ModelConfigPackVariables = {
850841

851842
export interface ModelConfig {
852843
flowGeneration: boolean;
853-
llmGeneration: boolean;
854844
getPackLocation(
855845
languageId: string,
856846
variables: ModelConfigPackVariables,
@@ -870,26 +860,6 @@ export class ModelConfigListener extends ConfigListener implements ModelConfig {
870860
return !!FLOW_GENERATION.getValue<boolean>();
871861
}
872862

873-
public get llmGeneration(): boolean {
874-
return !!LLM_GENERATION.getValue<boolean>() && !hasEnterpriseUri();
875-
}
876-
877-
/**
878-
* Limits the number of candidates we send to the model in each request to avoid long requests.
879-
* Note that the model may return fewer than this number of candidates.
880-
*/
881-
public get llmGenerationBatchSize(): number {
882-
return LLM_GENERATION_BATCH_SIZE.getValue<number | null>() || 5;
883-
}
884-
885-
/**
886-
* The URL of the endpoint to use for LLM generation. This should only be set
887-
* if you want to test against a dev server.
888-
*/
889-
public get llmGenerationDevEndpoint(): string | undefined {
890-
return LLM_GENERATION_DEV_ENDPOINT.getValue<string | undefined>();
891-
}
892-
893863
public get modelEvaluation(): boolean {
894864
return !!MODEL_EVALUATION.getValue<boolean>();
895865
}

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

Lines changed: 0 additions & 65 deletions
This file was deleted.

0 commit comments

Comments
 (0)