From 39f83904d55f570776c8a562d669d30648b8da38 Mon Sep 17 00:00:00 2001 From: chee Date: Fri, 3 Jul 2026 20:07:11 +0100 Subject: [PATCH 1/2] also test on windows --- .github/workflows/ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3ca3620..0b0dcbd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,11 @@ on: jobs: test: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest] permissions: contents: read steps: From 7855d04ccd59328091adfa3078e1874b6b1ca1cb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 3 Jul 2026 19:24:53 +0000 Subject: [PATCH 2/2] fix windows test execution and repo shutdown flushing --- src/repo.ts | 28 +++++++++++++++++++++------- test/integration/local.test.ts | 3 ++- test/integration/pushwork.test.ts | 3 ++- test/integration/shard.test.ts | 3 ++- 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/src/repo.ts b/src/repo.ts index e588169..9d421ac 100644 --- a/src/repo.ts +++ b/src/repo.ts @@ -20,6 +20,18 @@ export const legacyUrl = () => export const subductionUrl = () => process.env.PUSHWORK_SUBDUCTION_SERVER || DEFAULT_SUBDUCTION; +function withFlushingShutdown(repo: Repo): Repo { + const shutdown = repo.shutdown.bind(repo); + repo.shutdown = async () => { + try { + await repo.flush(); + } finally { + await shutdown(); + } + }; + return repo; +} + export async function openRepo( backend: Backend, storageDir: string, @@ -29,7 +41,7 @@ export async function openRepo( await initSubduction(); const storage = new NodeFSStorageAdapter(storageDir); if (opts.offline) { - return new Repo({ storage, network: [] }); + return withFlushingShutdown(new Repo({ storage, network: [] })); } if (backend === "legacy") { const endpoint = legacyUrl(); @@ -37,15 +49,17 @@ export async function openRepo( const adapter = new WebSocketClientAdapter( endpoint, ) as unknown as NetworkAdapterInterface; - return new Repo({ storage, network: [adapter] }); + return withFlushingShutdown(new Repo({ storage, network: [adapter] })); } const endpoint = subductionUrl(); dlog("subduction ws endpoint=%s", endpoint); - return new Repo({ - storage, - network: [], - subductionWebsocketEndpoints: [endpoint], - }); + return withFlushingShutdown( + new Repo({ + storage, + network: [], + subductionWebsocketEndpoints: [endpoint], + }), + ); } const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms)); diff --git a/test/integration/local.test.ts b/test/integration/local.test.ts index 089963c..0a89da1 100644 --- a/test/integration/local.test.ts +++ b/test/integration/local.test.ts @@ -14,6 +14,7 @@ import { promisify } from "util"; const execFileP = promisify(execFile); const CLI = path.join(__dirname, "..", "..", "dist", "cli.js"); +const PNPM = process.platform === "win32" ? "pnpm.cmd" : "pnpm"; const TEST_TIMEOUT = 60_000; @@ -46,7 +47,7 @@ async function readText(p: string): Promise { } beforeAll(async () => { - await execFileP("pnpm", ["build"], { + await execFileP(PNPM, ["build"], { cwd: path.join(__dirname, "..", ".."), timeout: 120_000, }); diff --git a/test/integration/pushwork.test.ts b/test/integration/pushwork.test.ts index 824d814..ba82576 100644 --- a/test/integration/pushwork.test.ts +++ b/test/integration/pushwork.test.ts @@ -23,6 +23,7 @@ import { promisify } from "util"; const execFileP = promisify(execFile); const CLI = path.join(__dirname, "..", "..", "dist", "cli.js"); +const PNPM = process.platform === "win32" ? "pnpm.cmd" : "pnpm"; const TEST_TIMEOUT = 120_000; @@ -125,7 +126,7 @@ async function syncUntilConverged( beforeAll(async () => { // Build once for the entire suite. - await execFileP("pnpm", ["build"], { + await execFileP(PNPM, ["build"], { cwd: path.join(__dirname, "..", ".."), timeout: 120_000, }); diff --git a/test/integration/shard.test.ts b/test/integration/shard.test.ts index 78b6f7a..44e660f 100644 --- a/test/integration/shard.test.ts +++ b/test/integration/shard.test.ts @@ -16,9 +16,10 @@ import { promisify } from "util"; const execFileP = promisify(execFile); const REPO_ROOT = path.join(__dirname, "..", ".."); const FIXTURE = path.join(__dirname, "fixtures", "shard-roundtrip.ts"); +const PNPM = process.platform === "win32" ? "pnpm.cmd" : "pnpm"; beforeAll(async () => { - await execFileP("pnpm", ["build"], { cwd: REPO_ROOT, timeout: 120_000 }); + await execFileP(PNPM, ["build"], { cwd: REPO_ROOT, timeout: 120_000 }); }, 120_000); describe("shard parallel ingest/clone", () => {