From 9fa832abf54badebcf04ab6cdda3ad2e534d3656 Mon Sep 17 00:00:00 2001 From: reprewindai-dev Date: Thu, 13 Aug 2026 19:29:11 -0400 Subject: [PATCH 1/2] test(registry): keep production build type-safe --- .../api/v1/registry/register/route.test.ts | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/app/api/v1/registry/register/route.test.ts b/src/app/api/v1/registry/register/route.test.ts index fc8a2f2..e3138c3 100644 --- a/src/app/api/v1/registry/register/route.test.ts +++ b/src/app/api/v1/registry/register/route.test.ts @@ -15,19 +15,20 @@ function post(url: string, body: unknown, headers: Record = {}) const REGISTER_URL = "http://localhost/api/v1/registry/register"; const ORIGINAL_NODE_ENV = process.env.NODE_ENV; +const mutableEnv = process.env as Record; afterEach(() => { delete process.env.CAPI_REGISTRY_TOKEN; if (ORIGINAL_NODE_ENV === undefined) { - delete process.env.NODE_ENV; + delete mutableEnv.NODE_ENV; } else { - process.env.NODE_ENV = ORIGINAL_NODE_ENV; + mutableEnv.NODE_ENV = ORIGINAL_NODE_ENV; } }); describe("POST /api/v1/registry/register", () => { it("registers a service, mirrors executable capabilities, and records declared-only names", async () => { - process.env.NODE_ENV = "test"; + mutableEnv.NODE_ENV = "test"; const res = await register( post(REGISTER_URL, { service_name: "lockerphycer-test-a", @@ -62,7 +63,7 @@ describe("POST /api/v1/registry/register", () => { }); it("rejects an invalid body", async () => { - process.env.NODE_ENV = "test"; + mutableEnv.NODE_ENV = "test"; const res = await register(post(REGISTER_URL, { capabilities: ["x"] })); expect(res.status).toBe(400); }); @@ -71,9 +72,9 @@ describe("POST /api/v1/registry/register", () => { "fails closed without registry authentication when NODE_ENV=%s", async (environment) => { if (environment === undefined) { - delete process.env.NODE_ENV; + delete mutableEnv.NODE_ENV; } else { - process.env.NODE_ENV = environment; + mutableEnv.NODE_ENV = environment; } delete process.env.CAPI_REGISTRY_TOKEN; const serviceName = `svc-missing-token-${environment ?? "unset"}`; @@ -90,7 +91,7 @@ describe("POST /api/v1/registry/register", () => { it.each(["local", "development", "test"])( "permits explicitly unauthenticated registration in %s only", async (environment) => { - process.env.NODE_ENV = environment; + mutableEnv.NODE_ENV = environment; delete process.env.CAPI_REGISTRY_TOKEN; const res = await register(post(REGISTER_URL, { service_name: `svc-${environment}` })); @@ -100,7 +101,7 @@ describe("POST /api/v1/registry/register", () => { ); it("enforces the registry token when configured and requires Bearer", async () => { - process.env.NODE_ENV = "production"; + mutableEnv.NODE_ENV = "production"; process.env.CAPI_REGISTRY_TOKEN = "s3cret-token"; const denied = await register( @@ -121,7 +122,7 @@ describe("POST /api/v1/registry/register", () => { }); it("heartbeat refreshes a known service and 404s an unknown one", async () => { - process.env.NODE_ENV = "test"; + mutableEnv.NODE_ENV = "test"; await register(post(REGISTER_URL, { service_name: "svc-hb" })); const ok = await heartbeat(post("http://localhost/api/v1/registry/heartbeat", { service_name: "svc-hb" })); @@ -132,4 +133,4 @@ describe("POST /api/v1/registry/register", () => { ); expect(missing.status).toBe(404); }); -}); \ No newline at end of file +}); From 8da804dce0babf7a17c43226305435ab4012ed7f Mon Sep 17 00:00:00 2001 From: reprewindai-dev Date: Fri, 14 Aug 2026 10:44:12 -0400 Subject: [PATCH 2/2] fix(health): probe canonical BYOS liveness route --- src/app/health/dependencies/route.test.ts | 2 +- src/app/health/dependencies/route.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/health/dependencies/route.test.ts b/src/app/health/dependencies/route.test.ts index 5f87398..beeaeb5 100644 --- a/src/app/health/dependencies/route.test.ts +++ b/src/app/health/dependencies/route.test.ts @@ -63,7 +63,7 @@ describe('GET /health/dependencies', () => { await GET(); const fallback = fetchMock.mock.calls.find(([url]) => - String(url) === 'http://byos:8088/api/v1/health', + String(url) === 'http://byos:8088/health', ); expect(fallback).toBeDefined(); expect(new Headers(fallback?.[1]?.headers).get('host')).toBe('api.veklom.com'); diff --git a/src/app/health/dependencies/route.ts b/src/app/health/dependencies/route.ts index a59f757..bcb74e1 100644 --- a/src/app/health/dependencies/route.ts +++ b/src/app/health/dependencies/route.ts @@ -62,7 +62,7 @@ async function probe( let fallbackPath = '/protocol.json'; let fallbackHost = configured; if (configured.includes('/api/v1/mcp/gateway')) { - fallbackPath = '/api/v1/health'; + fallbackPath = '/health'; fallbackHost = configured.replace('/api/v1/mcp/gateway', ''); }