라우터 7 동기 갱신 복구와 E2E 격리 수정, 검증 기록 동기화
Some checks failed
API contract / OpenAPI type drift (push) Failing after 3m30s
Some checks failed
API contract / OpenAPI type drift (push) Failing after 3m30s
This commit is contained in:
parent
d801a1619d
commit
b0ff44a1d4
9 changed files with 236 additions and 154 deletions
|
|
@ -4,7 +4,13 @@ import { randomUUID } from "node:crypto";
|
|||
import { existsSync } from "node:fs";
|
||||
import http, { type IncomingMessage, type ServerResponse } from "node:http";
|
||||
import net from "node:net";
|
||||
import { completeAlliancePreCheckpoint } from "./support";
|
||||
import {
|
||||
acquireGlobalEngineConfigLock,
|
||||
completeAlliancePreCheckpoint,
|
||||
installControlledEngineConfig,
|
||||
readEngineConfigSnapshot,
|
||||
restoreEngineConfig,
|
||||
} from "./support";
|
||||
|
||||
interface TestServer {
|
||||
url: string;
|
||||
|
|
@ -203,54 +209,77 @@ async function startApi({
|
|||
process.env.E2E_PYTHON ??
|
||||
process.env.PYTHON311 ??
|
||||
(localPython311 && existsSync(localPython311) ? localPython311 : (process.env.PYTHON ?? "python"));
|
||||
const proc = spawn(
|
||||
python,
|
||||
[
|
||||
"-m",
|
||||
"uvicorn",
|
||||
"app.main:app",
|
||||
"--host",
|
||||
"127.0.0.1",
|
||||
"--port",
|
||||
String(port),
|
||||
"--log-level",
|
||||
"debug",
|
||||
],
|
||||
{
|
||||
cwd: "../api",
|
||||
env: {
|
||||
...process.env,
|
||||
PYTHONUNBUFFERED: "1",
|
||||
ENVIRONMENT: "dev",
|
||||
AUTH_DEV_LOGIN_ENABLED: "true",
|
||||
AUTH_ALLOWED_EMAIL_DOMAINS: '["hs.ac.kr","twentyoz.kr"]',
|
||||
ALLOW_SEED_PERSONA_FALLBACK: "true",
|
||||
DB_POOL_MIN_SIZE: "1",
|
||||
DB_COMMAND_TIMEOUT: "10",
|
||||
ENGINE_URL: engineURL,
|
||||
ENGINE_MODE: "claude_api",
|
||||
ENGINE_TIMEOUT: "10",
|
||||
ENGINE_CONNECT_TIMEOUT: "2",
|
||||
OPENAI_API_KEY: "e2e-fake-key",
|
||||
OPENAI_BASE_URL: `${openAIBaseURL}/v1`,
|
||||
VIGNETTE_VOICE_POC_SAMPLE_TTS: "false",
|
||||
FRONTEND_BASE_URL: frontendBaseURL,
|
||||
CORS_ORIGINS: JSON.stringify([frontendBaseURL]),
|
||||
},
|
||||
windowsHide: true,
|
||||
},
|
||||
);
|
||||
// 공유 개발 DB의 admin_engine_config 행(claude_cli 게이트웨이)이 기동 시 env의
|
||||
// 가짜 엔진 설정을 덮어쓴다. 락을 잡고 가짜 엔진으로 일시 교체한 뒤, 기동된 API가
|
||||
// 그 설정을 읽었는지 /health로 확인하고 즉시 원복한다(controlled providers 전제 보호).
|
||||
const releaseEngineConfigLock = await acquireGlobalEngineConfigLock("voice-success:startApi");
|
||||
const engineConfigSnapshot = readEngineConfigSnapshot();
|
||||
let proc: ChildProcessWithoutNullStreams;
|
||||
let logs = "";
|
||||
proc.stdout.on("data", (chunk) => {
|
||||
logs += String(chunk).slice(-4000);
|
||||
});
|
||||
proc.stderr.on("data", (chunk) => {
|
||||
logs += String(chunk).slice(-4000);
|
||||
});
|
||||
await waitForApi(baseURL, proc).catch((err) => {
|
||||
proc.kill();
|
||||
throw new Error(`${err instanceof Error ? err.message : String(err)}\n${logs}`);
|
||||
});
|
||||
try {
|
||||
installControlledEngineConfig({
|
||||
engineUrl: engineURL,
|
||||
model: "voice-success-controlled",
|
||||
reasoningEffort: "medium",
|
||||
updatedBy: "voice-success-e2e",
|
||||
});
|
||||
proc = spawn(
|
||||
python,
|
||||
[
|
||||
"-m",
|
||||
"uvicorn",
|
||||
"app.main:app",
|
||||
"--host",
|
||||
"127.0.0.1",
|
||||
"--port",
|
||||
String(port),
|
||||
"--log-level",
|
||||
"debug",
|
||||
],
|
||||
{
|
||||
cwd: "../api",
|
||||
env: {
|
||||
...process.env,
|
||||
PYTHONUNBUFFERED: "1",
|
||||
ENVIRONMENT: "dev",
|
||||
AUTH_DEV_LOGIN_ENABLED: "true",
|
||||
AUTH_ALLOWED_EMAIL_DOMAINS: '["hs.ac.kr","twentyoz.kr"]',
|
||||
ALLOW_SEED_PERSONA_FALLBACK: "true",
|
||||
DB_POOL_MIN_SIZE: "1",
|
||||
DB_COMMAND_TIMEOUT: "10",
|
||||
ENGINE_URL: engineURL,
|
||||
ENGINE_MODE: "claude_api",
|
||||
VIGNETTE_LIVE_CLIENT_PROVIDER: "claude_api",
|
||||
VIGNETTE_CLIENT_AFFECT_PROVIDER: "legacy",
|
||||
ENGINE_TIMEOUT: "10",
|
||||
ENGINE_CONNECT_TIMEOUT: "2",
|
||||
OPENAI_API_KEY: "e2e-fake-key",
|
||||
OPENAI_BASE_URL: `${openAIBaseURL}/v1`,
|
||||
VIGNETTE_VOICE_POC_SAMPLE_TTS: "false",
|
||||
FRONTEND_BASE_URL: frontendBaseURL,
|
||||
CORS_ORIGINS: JSON.stringify([frontendBaseURL]),
|
||||
},
|
||||
windowsHide: true,
|
||||
},
|
||||
);
|
||||
proc.stdout.on("data", (chunk) => {
|
||||
logs += String(chunk).slice(-4000);
|
||||
});
|
||||
proc.stderr.on("data", (chunk) => {
|
||||
logs += String(chunk).slice(-4000);
|
||||
});
|
||||
await waitForApi(baseURL, proc).catch((err) => {
|
||||
proc.kill();
|
||||
throw new Error(`${err instanceof Error ? err.message : String(err)}\n${logs}`);
|
||||
});
|
||||
const health = await fetch(`${baseURL}/health`);
|
||||
const healthBody = (await health.json()) as { engine_mode?: string };
|
||||
if (healthBody.engine_mode !== "claude_api") proc.kill();
|
||||
expect(healthBody.engine_mode, logs).toBe("claude_api");
|
||||
} finally {
|
||||
restoreEngineConfig(engineConfigSnapshot);
|
||||
await releaseEngineConfigLock();
|
||||
}
|
||||
return {
|
||||
baseURL,
|
||||
logs: () => logs,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue