From b76a50304a4c99944e6cba3c57a12bb3a406c4be Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 3 Feb 2025 22:21:46 -0800 Subject: [PATCH 1/4] skip llm tests on forks --- .github/workflows/pr_checks.yaml | 1 + core/llm/llm.test.ts | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index 6cf26a4f1..61990db33 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -285,6 +285,7 @@ jobs: cd core npm test env: + IGNORE_API_KEY_TESTS: ${{ github.event.pull_request.head.repo.fork }} OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} diff --git a/core/llm/llm.test.ts b/core/llm/llm.test.ts index 4831cf800..53729022a 100644 --- a/core/llm/llm.test.ts +++ b/core/llm/llm.test.ts @@ -178,6 +178,15 @@ function testLLM( } describe("LLM", () => { + if (process.env.IGNORE_API_KEY_TESTS === "true") { + test("Skipping API key tests", () => { + console.log( + "Skipping API key tests due to IGNORE_API_KEY_TESTS being set", + ); + }); + return; + } + testLLM( new Anthropic({ model: "claude-3-5-sonnet-latest", From bff0118d01d8231aeaaa02096344caf3f284731f Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 3 Feb 2025 22:46:12 -0800 Subject: [PATCH 2/4] skip ssh tests for forks --- .github/workflows/pr_checks.yaml | 3 ++- extensions/vscode/e2e/tests/SSH.test.ts | 18 ++++++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index 61990db33..578e0974b 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -444,6 +444,7 @@ jobs: chmod 600 ~/.ssh/id_rsa ssh-keyscan -H "$SSH_HOST" >> ~/.ssh/known_hosts echo -e "Host ssh-test-container\n\tHostName $SSH_HOST\n\tUser ec2-user\n\tIdentityFile ~/.ssh/id_rsa" >> ~/.ssh/config + if: ${{ github.event.pull_request.head.repo.fork == false }} - name: Set up Xvfb run: | @@ -453,7 +454,7 @@ jobs: - name: Run e2e tests run: | cd extensions/vscode - TEST_FILE="${{ matrix.test_file }}" npm run ${{ matrix.command }} + IGNORE_SSH_TESTS="${{ github.event.pull_request.head.repo.fork }}" TEST_FILE="${{ matrix.test_file }}" npm run ${{ matrix.command }} env: DISPLAY: :99 diff --git a/extensions/vscode/e2e/tests/SSH.test.ts b/extensions/vscode/e2e/tests/SSH.test.ts index 8683a35d3..f6b924b8e 100644 --- a/extensions/vscode/e2e/tests/SSH.test.ts +++ b/extensions/vscode/e2e/tests/SSH.test.ts @@ -1,18 +1,24 @@ import { EditorView, - TextEditor, InputBox, - Workbench, Key, - VSBrowser, + TextEditor, + Workbench, } from "vscode-extension-tester"; -import { DEFAULT_TIMEOUT } from "../constants"; -import { TestUtils } from "../TestUtils"; -import { SSHSelectors } from "../selectors/SSH.selectors"; import { AutocompleteActions } from "../actions/Autocomplete.actions"; +import { DEFAULT_TIMEOUT } from "../constants"; +import { SSHSelectors } from "../selectors/SSH.selectors"; +import { TestUtils } from "../TestUtils"; describe("SSH", function () { + if (process.env.IGNORE_SSH_TESTS === "true") { + it("Skipping SSH tests", () => { + console.log("Skipping SSH tests due to IGNORE_SSH_TESTS being set"); + }); + return; + } + it("Should display completions", async () => { await TestUtils.waitForSuccess(async () => { await new Workbench().executeCommand( From 889d7f91a1897ea43501fb62c8762e6dadc72e8d Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 4 Feb 2025 11:16:13 -0800 Subject: [PATCH 3/4] add numLines to autocomplete dev data --- core/autocomplete/CompletionProvider.ts | 1 + core/autocomplete/util/types.ts | 9 ++------- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/core/autocomplete/CompletionProvider.ts b/core/autocomplete/CompletionProvider.ts index 77aadbdf5..32e8a4127 100644 --- a/core/autocomplete/CompletionProvider.ts +++ b/core/autocomplete/CompletionProvider.ts @@ -246,6 +246,7 @@ export class CompletionProvider { completionOptions, cacheHit, filepath: helper.filepath, + numLines: completion.split("\n").length, completionId: helper.input.completionId, gitRepo: await this.ide.getRepoName(helper.filepath), uniqueId: await this.ide.getUniqueId(), diff --git a/core/autocomplete/util/types.ts b/core/autocomplete/util/types.ts index b6379dd61..3959bff9c 100644 --- a/core/autocomplete/util/types.ts +++ b/core/autocomplete/util/types.ts @@ -1,10 +1,4 @@ -import { - Position, - Range, - RangeInFile, - RangeInFileWithContents, - TabAutocompleteOptions, -} from "../.."; +import { Position, Range, RangeInFile, TabAutocompleteOptions } from "../.."; import { AutocompleteCodeSnippet } from "../snippets/types"; export type RecentlyEditedRange = RangeInFile & { @@ -42,6 +36,7 @@ export interface AutocompleteOutcome extends TabAutocompleteOptions { modelName: string; completionOptions: any; cacheHit: boolean; + numLines: number; filepath: string; gitRepo?: string; completionId: string; From 2111874e6ce4d88f3703dbdf2b8692313dbb7e08 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 4 Feb 2025 11:20:09 -0800 Subject: [PATCH 4/4] increase timeout, better log --- core/indexing/docs/crawlers/DefaultCrawler.ts | 2 +- core/indexing/docs/crawlers/DocsCrawler.test.ts | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/core/indexing/docs/crawlers/DefaultCrawler.ts b/core/indexing/docs/crawlers/DefaultCrawler.ts index 0f0d9e593..d5e717fc0 100644 --- a/core/indexing/docs/crawlers/DefaultCrawler.ts +++ b/core/indexing/docs/crawlers/DefaultCrawler.ts @@ -26,7 +26,7 @@ export class DefaultCrawler { }); if (!resp.ok) { const text = await resp.text(); - throw new Error(`Failed to crawl site: ${text}`); + throw new Error(`Failed to crawl site (${resp.status}): ${text}`); } const json = (await resp.json()) as PageData[]; return json; diff --git a/core/indexing/docs/crawlers/DocsCrawler.test.ts b/core/indexing/docs/crawlers/DocsCrawler.test.ts index d3a246cf9..96c6dc24d 100644 --- a/core/indexing/docs/crawlers/DocsCrawler.test.ts +++ b/core/indexing/docs/crawlers/DocsCrawler.test.ts @@ -152,11 +152,15 @@ describe("DocsCrawler", () => { ); commonDocsSites.forEach((url) => { - test(`Default crawler common site: ${url}`, async () => { - const { pages, crawler } = await runCrawl(url); - expect(pages.length).toBeGreaterThanOrEqual(1); - expect(crawler).toEqual("default"); - }); + test( + `Default crawler common site: ${url}`, + async () => { + const { pages, crawler } = await runCrawl(url); + expect(pages.length).toBeGreaterThanOrEqual(1); + expect(crawler).toEqual("default"); + }, + TIMEOUT_MS, + ); }); });