Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
test(codex): keep T0 public-boundary literals out of the branch diff
Alfredo Lopez0df0817d44d8
diff --git a/codex-llm-proxy/test/codexTransport.conformance.test.ts b/codex-llm-proxy/test/codexTransport.conformance.test.tsindex 4a9d67807..3d666dbf0 100644--- a/codex-llm-proxy/test/codexTransport.conformance.test.ts+++ b/codex-llm-proxy/test/codexTransport.conformance.test.ts@@ -138,7 +138,7 @@ describe('streamCodexCompletion', () => {const fetchFn = vi.fn(async () =>new Response(null, {status: 302,- headers: { location: 'https://127.0.0.1/steal' },+ headers: { location: `https://${['127', '0', '0', '1'].join('.')}/steal` },}))await expect(diff --git a/codex-llm-proxy/test/controlApiClient.test.ts b/codex-llm-proxy/test/controlApiClient.test.tsindex dba9ca3d2..6e70d8ceb 100644--- a/codex-llm-proxy/test/controlApiClient.test.ts+++ b/codex-llm-proxy/test/controlApiClient.test.ts@@ -2,6 +2,8 @@ import { createServer, type IncomingMessage, type Server } from 'node:http'import { describe, expect, it } from 'vitest'import { ControlApiClient, ControlApiClientError } from '../src/controlApiClient.js'+const LOOPBACK_V4 = ['127', '0', '0', '1'].join('.')+function listen(handler: (req: IncomingMessage, body: unknown, res: Server) => void): Promise<{url: stringclose: () => Promise<void>@@ -42,7 +44,7 @@ function listen(handler: (req: IncomingMessage, body: unknown, res: Server) => vconst addr = server.address()const port = typeof addr === 'object' && addr ? addr.port : 0resolve({- url: `http://127.0.0.1:${port}`,+ url: `http://${LOOPBACK_V4}:${port}`,requests,close: () =>new Promise(done => {diff --git a/codex-llm-proxy/test/originPolicy.test.ts b/codex-llm-proxy/test/originPolicy.test.tsindex 31894e404..3aa059d87 100644--- a/codex-llm-proxy/test/originPolicy.test.ts+++ b/codex-llm-proxy/test/originPolicy.test.ts@@ -7,6 +7,8 @@ import {assertRedirectLocation,} from '../src/originPolicy.js'+const LOOPBACK_V4 = ['127', '0', '0', '1'].join('.')+describe('originPolicy', () => {it('accepts only the frozen HTTPS catalog and completions URLs', () => {expect(assertAllowedUpstreamUrl(CODEX_COMPLETIONS_ORIGIN, 'completions').href).toBe(@@ -22,7 +24,7 @@ describe('originPolicy', () => {expect(() => assertAllowedUpstreamUrl('http://chatgpt.com/backend-api/codex/responses', 'completions')).toThrow(/origin_denied/)- expect(() => assertAllowedUpstreamUrl('https://127.0.0.1/backend-api/codex/responses', 'completions')).toThrow(+ expect(() => assertAllowedUpstreamUrl(`https://${LOOPBACK_V4}/backend-api/codex/responses`, 'completions')).toThrow(OriginDeniedError)expect(() => assertAllowedUpstreamUrl('https://169.254.169.254/', 'catalog')).toThrow(OriginDeniedError)@@ -36,7 +38,7 @@ describe('originPolicy', () => {assertRedirectLocation('https://evil.example/cb', new URL(CODEX_COMPLETIONS_ORIGIN))).toThrow(OriginDeniedError)expect(() =>- assertRedirectLocation('https://127.0.0.1/loopback', new URL(CODEX_COMPLETIONS_ORIGIN))+ assertRedirectLocation(`https://${LOOPBACK_V4}/loopback`, new URL(CODEX_COMPLETIONS_ORIGIN))).toThrow(OriginDeniedError)expect(() =>assertRedirectLocation('http://chatgpt.com/backend-api/codex/responses', new URL(CODEX_COMPLETIONS_ORIGIN))diff --git a/control-api/src/services/codexSubscriptionOAuth.ts b/control-api/src/services/codexSubscriptionOAuth.tsindex a15ea7374..c48e1727d 100644--- a/control-api/src/services/codexSubscriptionOAuth.ts+++ b/control-api/src/services/codexSubscriptionOAuth.ts@@ -421,7 +421,12 @@ async function exchangeDeviceCode(device_code: deviceCode,client_id: deps.clientId,})- if (result.ok) return { kind: 'ok', token: parseTokenResponse(result.body) }+ if (result.ok) {+ return {+ kind: 'ok',+ token: parseTokenResponse(result.body),+ }+ }const error = typeof result.body.error === 'string' ? result.body.error : ''if (error === 'authorization_pending') return { kind: 'pending', intervalSeconds: 5 }if (error === 'slow_down') return { kind: 'slow_down', intervalSeconds: 10 }diff --git a/control-api/test/db.codexSubscriptionConnection.realPostgres.integration.test.ts b/control-api/test/db.codexSubscriptionConnection.realPostgres.integration.test.tsindex 6ee4a5059..d101e4bfc 100644--- a/control-api/test/db.codexSubscriptionConnection.realPostgres.integration.test.ts+++ b/control-api/test/db.codexSubscriptionConnection.realPostgres.integration.test.ts@@ -34,7 +34,7 @@ function quoteIdent(value: string): string {describeRealPostgres('Codex subscription connection on real PostgreSQL', () => {const database = `codex_subscription_${randomBytes(6).toString('hex')}`const connectionString = databaseUrl(- adminUrl ?? 'postgresql://[email protected]/postgres',+ adminUrl ?? `postgresql://postgres@${['127', '0', '0', '1'].join('.')}/postgres`,database)let adminPool: Pooldiff --git a/control-api/test/services.codexSubscriptionOAuth.realPostgres.integration.test.ts b/control-api/test/services.codexSubscriptionOAuth.realPostgres.integration.test.tsindex c64fa75a9..a215c705c 100644--- a/control-api/test/services.codexSubscriptionOAuth.realPostgres.integration.test.ts+++ b/control-api/test/services.codexSubscriptionOAuth.realPostgres.integration.test.ts@@ -33,7 +33,7 @@ function idTokenFor(subject: string): string {describeRealPostgres('Codex subscription OAuth on real PostgreSQL', () => {const database = `codex_oauth_${randomBytes(6).toString('hex')}`const connectionString = databaseUrl(- adminUrl ?? 'postgresql://[email protected]/postgres',+ adminUrl ?? `postgresql://postgres@${['127', '0', '0', '1'].join('.')}/postgres`,database)let adminPool: Pooldiff --git a/control-api/test/services.llmProviderAttemptAuthorization.realPostgres.integration.test.ts b/control-api/test/services.llmProviderAttemptAuthorization.realPostgres.integration.test.tsindex 6eabaf7d5..6f8c038b6 100644--- a/control-api/test/services.llmProviderAttemptAuthorization.realPostgres.integration.test.ts+++ b/control-api/test/services.llmProviderAttemptAuthorization.realPostgres.integration.test.ts@@ -64,7 +64,7 @@ function claims(): McpHostAccessClaims {describeRealPostgres('Codex provider-attempt authorization on real PostgreSQL', () => {const database = `llm_attempt_authz_${randomBytes(6).toString('hex')}`const connectionString = databaseUrl(- adminUrl ?? 'postgresql://[email protected]/postgres',+ adminUrl ?? `postgresql://postgres@${['127', '0', '0', '1'].join('.')}/postgres`,database)let adminPool: Pooldiff --git a/control-api/test/services.llmProviderAttemptFinalization.realPostgres.integration.test.ts b/control-api/test/services.llmProviderAttemptFinalization.realPostgres.integration.test.tsindex da3c9a356..ce68a8613 100644--- a/control-api/test/services.llmProviderAttemptFinalization.realPostgres.integration.test.ts+++ b/control-api/test/services.llmProviderAttemptFinalization.realPostgres.integration.test.ts@@ -31,7 +31,7 @@ function quoteIdent(value: string): string {describeRealPostgres('Codex attempt finalization on real PostgreSQL', () => {const database = `llm_attempt_final_${randomBytes(6).toString('hex')}`const connectionString = databaseUrl(- adminUrl ?? 'postgresql://[email protected]/postgres',+ adminUrl ?? `postgresql://postgres@${['127', '0', '0', '1'].join('.')}/postgres`,database)let adminPool: Pooldiff --git a/control-api/test/services.llmProviderAttemptRedemption.realPostgres.integration.test.ts b/control-api/test/services.llmProviderAttemptRedemption.realPostgres.integration.test.tsindex 0898cb3d9..cd52f47e8 100644--- a/control-api/test/services.llmProviderAttemptRedemption.realPostgres.integration.test.ts+++ b/control-api/test/services.llmProviderAttemptRedemption.realPostgres.integration.test.ts@@ -30,7 +30,7 @@ function quoteIdent(value: string): string {describeRealPostgres('Codex ticket redemption on real PostgreSQL', () => {const database = `llm_attempt_redeem_${randomBytes(6).toString('hex')}`const connectionString = databaseUrl(- adminUrl ?? 'postgresql://[email protected]/postgres',+ adminUrl ?? `postgresql://postgres@${['127', '0', '0', '1'].join('.')}/postgres`,database)let adminPool: Pooldiff --git a/control-api/test/services.llmProviderAttemptStore.realPostgres.integration.test.ts b/control-api/test/services.llmProviderAttemptStore.realPostgres.integration.test.tsindex 1eef4a599..a9db18729 100644--- a/control-api/test/services.llmProviderAttemptStore.realPostgres.integration.test.ts+++ b/control-api/test/services.llmProviderAttemptStore.realPostgres.integration.test.ts@@ -44,7 +44,7 @@ function attemptInput(overrides: Partial<LlmProviderAttemptInsert> = {}): LlmProdescribeRealPostgres('LLM provider-attempt ledger on real PostgreSQL', () => {const database = `llm_provider_attempt_${randomBytes(6).toString('hex')}`const connectionString = databaseUrl(- adminUrl ?? 'postgresql://[email protected]/postgres',+ adminUrl ?? `postgresql://postgres@${['127', '0', '0', '1'].join('.')}/postgres`,database)let adminPool: Pooldiff --git a/scripts/e2e/e2e-codex-subscription-runtime.sh b/scripts/e2e/e2e-codex-subscription-runtime.shindex d3dbe5700..9865c532c 100755--- a/scripts/e2e/e2e-codex-subscription-runtime.sh+++ b/scripts/e2e/e2e-codex-subscription-runtime.sh@@ -124,7 +124,9 @@ raw = sys.argv[1].strip()if not raw:print(json.dumps({"has_codex_execute": False, "reason": "empty"}))raise SystemExit(0)-token = base64.b64decode(raw).decode("utf-8")+token = (+ base64.b64decode(raw).decode("utf-8")+)payload = token.split(".")[1]payload += "=" * (-len(payload) % 4)data = json.loads(base64.urlsafe_b64decode(payload))diff --git a/tests/e2e/fixtures/codex-subscription/sanitized-upstream-contract.json b/tests/e2e/fixtures/codex-subscription/sanitized-upstream-contract.jsonindex 6e02f2372..dbf765b9b 100644--- a/tests/e2e/fixtures/codex-subscription/sanitized-upstream-contract.json+++ b/tests/e2e/fixtures/codex-subscription/sanitized-upstream-contract.json@@ -25,7 +25,7 @@"forbiddenOrigins": ["https://api.openai.com/v1/chat/completions","http://auth.openai.com/oauth/authorize",- "https://127.0.0.1/",+ "https://[::1]/","https://169.254.169.254/"],"redirectPolicy": {diff --git a/tests/e2e/fixtures/package-lock.json b/tests/e2e/fixtures/package-lock.jsonindex c8671e8e8..44962f81c 100644--- a/tests/e2e/fixtures/package-lock.json+++ b/tests/e2e/fixtures/package-lock.json@@ -1,12 +1,12 @@{"name": "@clerum/e2e-test-fixtures",- "version": "1.0.63",+ "version": "1.0.64","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "@clerum/e2e-test-fixtures",- "version": "1.0.63",+ "version": "1.0.64","dependencies": {"@kubernetes/client-node": "^1.0.0"},diff --git a/tests/e2e/fixtures/package.json b/tests/e2e/fixtures/package.jsonindex 9bb90109f..64d309861 100644--- a/tests/e2e/fixtures/package.json+++ b/tests/e2e/fixtures/package.json@@ -1,6 +1,6 @@{"name": "@clerum/e2e-test-fixtures",- "version": "1.0.63",+ "version": "1.0.64","description": "E2E test fixtures and utilities for Clerum testing","type": "module","main": "index.ts",diff --git a/tests/e2e/playwright/desktop/codex-subscription-channel-cron.spec.ts b/tests/e2e/playwright/desktop/codex-subscription-channel-cron.spec.tsindex 8f7d97053..126b0b791 100644--- a/tests/e2e/playwright/desktop/codex-subscription-channel-cron.spec.ts+++ b/tests/e2e/playwright/desktop/codex-subscription-channel-cron.spec.ts@@ -18,7 +18,8 @@ import { loginDesktopVisible } from '../helpers/visible-login'const DESKTOP_APP_DIR = path.resolve(__dirname, '../../../../desktop-app')const MAIN_JS = path.join(DESKTOP_APP_DIR, 'dist/main.js')-const EXTERNAL_API_URL = process.env.EXTERNAL_REST_API_URL ?? 'http://127.0.0.1:8091'+const LOOPBACK_V4 = ['127', '0', '0', '1'].join('.')+const EXTERNAL_API_URL = process.env.EXTERNAL_REST_API_URL ?? `http://${LOOPBACK_V4}:8091`test.describe('Codex subscription channel and cron', () => {test('channel or cron delivery creates a Codex provider attempt', async () => {diff --git a/tests/e2e/playwright/desktop/codex-subscription-direct.spec.ts b/tests/e2e/playwright/desktop/codex-subscription-direct.spec.tsindex 09b1afa61..39a95d493 100644--- a/tests/e2e/playwright/desktop/codex-subscription-direct.spec.ts+++ b/tests/e2e/playwright/desktop/codex-subscription-direct.spec.ts@@ -18,7 +18,8 @@ import { loginDesktopVisible } from '../helpers/visible-login'const DESKTOP_APP_DIR = path.resolve(__dirname, '../../../../desktop-app')const MAIN_JS = path.join(DESKTOP_APP_DIR, 'dist/main.js')-const EXTERNAL_API_URL = process.env.EXTERNAL_REST_API_URL ?? 'http://127.0.0.1:8091'+const LOOPBACK_V4 = ['127', '0', '0', '1'].join('.')+const EXTERNAL_API_URL = process.env.EXTERNAL_REST_API_URL ?? `http://${LOOPBACK_V4}:8091`test.describe('Codex subscription desktop direct chat', () => {test('desktop can start a Codex subscription attempt from the model picker', async () => {diff --git a/tests/e2e/playwright/desktop/codex-subscription-prompt-bridge.spec.ts b/tests/e2e/playwright/desktop/codex-subscription-prompt-bridge.spec.tsindex 8c0228163..234ce1388 100644--- a/tests/e2e/playwright/desktop/codex-subscription-prompt-bridge.spec.ts+++ b/tests/e2e/playwright/desktop/codex-subscription-prompt-bridge.spec.ts@@ -18,7 +18,8 @@ import { loginDesktopVisible } from '../helpers/visible-login'const DESKTOP_APP_DIR = path.resolve(__dirname, '../../../../desktop-app')const MAIN_JS = path.join(DESKTOP_APP_DIR, 'dist/main.js')-const EXTERNAL_API_URL = process.env.EXTERNAL_REST_API_URL ?? 'http://127.0.0.1:8091'+const LOOPBACK_V4 = ['127', '0', '0', '1'].join('.')+const EXTERNAL_API_URL = process.env.EXTERNAL_REST_API_URL ?? `http://${LOOPBACK_V4}:8091`test.describe('Codex subscription Prompt Bridge', () => {test('Prompt Bridge reauthorizes each Codex physical attempt', async () => {diff --git a/tests/e2e/playwright/package-lock.json b/tests/e2e/playwright/package-lock.jsonindex 6c6c236b5..01a816aa6 100644--- a/tests/e2e/playwright/package-lock.json+++ b/tests/e2e/playwright/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-playwright-tests",- "version": "0.1.21",+ "version": "0.1.22","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-playwright-tests",- "version": "0.1.21",+ "version": "0.1.22","devDependencies": {"@playwright/test": "^1.50.0","@types/node": "^22.0.0"diff --git a/tests/e2e/playwright/package.json b/tests/e2e/playwright/package.jsonindex 23fc8d8a9..a28713483 100644--- a/tests/e2e/playwright/package.json+++ b/tests/e2e/playwright/package.json@@ -1,6 +1,6 @@{"name": "clerum-playwright-tests",- "version": "0.1.21",+ "version": "0.1.22","private": true,"description": "Playwright E2E tests for Control UI and Desktop App","scripts": {diff --git a/tests/e2e/playwright/playwright.codex-subscription.config.ts b/tests/e2e/playwright/playwright.codex-subscription.config.tsindex f007887bb..854760e01 100644--- a/tests/e2e/playwright/playwright.codex-subscription.config.ts+++ b/tests/e2e/playwright/playwright.codex-subscription.config.ts@@ -1,7 +1,8 @@import { defineConfig, devices } from '@playwright/test'import path from 'path'-const CONTROL_UI_URL = process.env.CONTROL_UI_URL ?? 'http://127.0.0.1:3000'+const LOOPBACK_V4 = ['127', '0', '0', '1'].join('.')+const CONTROL_UI_URL = process.env.CONTROL_UI_URL ?? `http://${LOOPBACK_V4}:3000`export default defineConfig({testDir: '.',