From 39c345ec5c5846b6d485a6ff93bc8c14842761c8 Mon Sep 17 00:00:00 2001 From: Dotta <34892728+cryppadotta@users.noreply.github.com> Date: Sun, 18 Oct 2026 00:09:00 -0500 Subject: [PATCH] test(runner): bind Copilot pack fixture to a supported target (#16697) Scope the Copilot candidate registry fixture to the supported Linux x64 target and restore both process property descriptors. Preserve every existing assertion and production provider pin. The five-case focused treatment and current PR CI passed; fresh review is 5/5. Co-Authored-By: Paperclip --- .../scripts/candidate-provider-pack.test.mjs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/packages/paperclip-runner/scripts/candidate-provider-pack.test.mjs b/packages/paperclip-runner/scripts/candidate-provider-pack.test.mjs index c11110babae..64660c61bd8 100644 --- a/packages/paperclip-runner/scripts/candidate-provider-pack.test.mjs +++ b/packages/paperclip-runner/scripts/candidate-provider-pack.test.mjs @@ -2,6 +2,20 @@ import test from "node:test"; import assert from "node:assert/strict"; import { parseProviderPackArguments, materializeCandidateProviderPack, providerPackProviders, providerPackManifestFields } from "./candidate-provider-pack.mjs"; +async function withCopilotTestPlatform(run) { + const platformDescriptor = Object.getOwnPropertyDescriptor(process, "platform"); + const archDescriptor = Object.getOwnPropertyDescriptor(process, "arch"); + if (!platformDescriptor || !archDescriptor) throw new Error("Missing process platform descriptors"); + try { + Object.defineProperty(process, "platform", { ...platformDescriptor, value: "linux" }); + Object.defineProperty(process, "arch", { ...archDescriptor, value: "x64" }); + return await run(); + } finally { + try { Object.defineProperty(process, "platform", platformDescriptor); } + finally { Object.defineProperty(process, "arch", archDescriptor); } + } +} + test("candidate options stay explicit and supported native assets are included by default", () => { assert.deepEqual(parseProviderPackArguments(["--", "/pack"]), { output: "/pack", candidates: [] }); assert.deepEqual(parseProviderPackArguments(["/pack", "--candidate-providers=pi,cursor"]), { output: "/pack", candidates: ["pi", "cursor"] }); @@ -30,7 +44,7 @@ test("candidate builder cannot admit unknown providers, options or duplicate ass await assert.rejects(materializeCandidateProviderPack({ provider: "arbitrary", outputRoot: "/tmp/unused" }), /Unknown candidate/); }); -test("Copilot pack selection reaches only the pinned native archive builder", async t => { +test("Copilot pack selection reaches only the pinned native archive builder", t => withCopilotTestPlatform(async () => { const requests = []; t.mock.method(globalThis, "fetch", async (url, options) => { requests.push({ url, redirect: options.redirect, credentials: options.credentials }); @@ -40,7 +54,7 @@ test("Copilot pack selection reaches only the pinned native archive builder", as assert.equal(requests.length, 1); assert.match(requests[0].url, /^https:\/\/registry\.npmjs\.org\/@github\/copilot-(darwin-(arm64|x64)|linux-x64)\/-\/copilot-.*-1\.0\.88\.tgz$/); assert.deepEqual({ redirect: requests[0].redirect, credentials: requests[0].credentials }, { redirect: "error", credentials: "omit" }); -}); +})); test("Pi pack selection reaches its pinned builder and rejects unsafe output before downloading", async t => { let requests = 0;