From e2b1994484c0801220db82633ef2320b1c7deda9 Mon Sep 17 00:00:00 2001 From: luvs01 <27862058+luvs01@users.noreply.github.com> Date: Thu, 3 Sep 2026 12:34:19 +0900 Subject: [PATCH 1/3] test: isolate route scanner probe temp file --- tests/management-route-registry.test.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/management-route-registry.test.ts b/tests/management-route-registry.test.ts index d5ccab6efe..dcea7f0fc0 100644 --- a/tests/management-route-registry.test.ts +++ b/tests/management-route-registry.test.ts @@ -1,5 +1,6 @@ import { describe, expect, test } from "bun:test"; -import { existsSync, readFileSync, readdirSync } from "node:fs"; +import { existsSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; import { dirname, join, resolve } from "node:path"; import { fileURLToPath } from "node:url"; import { MANAGEMENT_ROUTES } from "../src/server/management/route-registry"; @@ -122,7 +123,8 @@ describe("management route registry reconciliation", () => { // Drives the fail-loud path red on purpose: without this, a scanner that silently // defaulted to GET would satisfy every other test in this file while producing a // route table nobody could trust. - const tmp = join(repoRoot, ".tmp-scanner-probe.ts"); + const tempDir = mkdtempSync(join(tmpdir(), "ocx-route-scanner-")); + const tmp = join(tempDir, "scanner-probe.ts"); const source = [ "export async function handleProbe(ctx: any): Promise {", " const { url, req } = ctx;", @@ -133,13 +135,13 @@ describe("management route registry reconciliation", () => { " return null;", "}", ].join("\n"); - require("node:fs").writeFileSync(tmp, source); + writeFileSync(tmp, source); try { const { unresolved } = distinctRoutes(scanRoutes(tmp)); expect(unresolved.map(r => r.path)).toEqual(["/api/probe/unknowable"]); expect(unresolved[0]?.method).toBeNull(); } finally { - require("node:fs").rmSync(tmp, { force: true }); + rmSync(tempDir, { recursive: true, force: true }); } }); From 0facdae6990716c49b793df5e237ea26354262c1 Mon Sep 17 00:00:00 2001 From: luvs01 <27862058+luvs01@users.noreply.github.com> Date: Thu, 3 Sep 2026 14:08:21 +0900 Subject: [PATCH 2/3] test: clean up route scanner temp dir on write failure --- tests/management-route-registry.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/management-route-registry.test.ts b/tests/management-route-registry.test.ts index dcea7f0fc0..5d6fd61d2c 100644 --- a/tests/management-route-registry.test.ts +++ b/tests/management-route-registry.test.ts @@ -135,8 +135,8 @@ describe("management route registry reconciliation", () => { " return null;", "}", ].join("\n"); - writeFileSync(tmp, source); try { + writeFileSync(tmp, source); const { unresolved } = distinctRoutes(scanRoutes(tmp)); expect(unresolved.map(r => r.path)).toEqual(["/api/probe/unknowable"]); expect(unresolved[0]?.method).toBeNull(); From cc599fb7923894aac1d67244a2f3700a6fb7bc44 Mon Sep 17 00:00:00 2001 From: jun Date: Sat, 5 Sep 2026 07:39:09 +0900 Subject: [PATCH 3/3] chore: carry #3323 onto current dev Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>