From 96f8a7aae984d6504486e1e5f02900d73d9d28fa Mon Sep 17 00:00:00 2001 From: JSONbored <49853598+JSONbored@users.noreply.github.com> Date: Thu, 16 Jul 2026 03:48:36 -0700 Subject: [PATCH] fix(test): stop repair diagnostics test racing a live manifest fetch The installation-repair test's first request had no fetch stub, so loadRepoFocusManifest hit the real raw.githubusercontent.com endpoint. Worse, its target repo matches the default LOOPOVER_DRIFT_ISSUE_REPO test env value, so on any fetcher miss the loader's self-repo fallback injected the live repo's autonomy:auto block anyway, making the test fail deterministically regardless of network outcome. Stub fetch and point the env at an unrelated repo name so neither path fires. --- test/integration/api.test.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/integration/api.test.ts b/test/integration/api.test.ts index e982f5b802..3c8086fce5 100644 --- a/test/integration/api.test.ts +++ b/test/integration/api.test.ts @@ -2146,8 +2146,12 @@ describe("api routes", () => { }); it("serves installation repair diagnostics and refreshes installation health", async () => { + // Deterministic manifest fetch: avoids racing a real network call before the first /repair request below. + vi.stubGlobal("fetch", async () => new Response("not found", { status: 404 })); const app = createApp(); - const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); + // Must differ from the default self-repo name (test/helpers/d1.ts), or loadRepoFocusManifest's self-repo + // fallback still injects the live repo's autonomy:auto block despite the stub above. + const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem(), LOOPOVER_DRIFT_ISSUE_REPO: "unrelated-org/unrelated-repo" }); const repoPayload = { name: "gittensory", full_name: "JSONbored/gittensory", private: true, default_branch: "main", owner: { login: "JSONbored" } }; await upsertInstallation(env, { installation: {