Files
Jyotisha/frontend/tests/chart-choice-engine-timeout-2274.test.ts
T
ClaudeandClaude Opus 5.5 73a44dba38
Independent Staging Quality Gate / validate-frontend (push) Canceled after 0s
Independent Staging Quality Gate / publish (push) Canceled after 0s
Independent Staging Quality Gate / validate-python (push) Canceled after 22s
fix(prod): chart-choice waits 180 s for an adaptive scan; the private API's default limit is 3000/min, not one 120/min bucket for the whole site (BUG-2274)
Production 2-core host: adaptive packet scans measured 21-163 s cold, the web
side aborted at 8 s (BrokenPipe, 「排盘服务暂时没有响应」). The API's per-IP
limiter saw only the web container, so every user shared 120 calls a minute
(jyotish_api_429 on launch night). Frozen-file change limited to the limiter
default, owner-approved for production blockers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
2026-11-24 00:26:21 +08:00

15 lines
849 B
TypeScript

import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import test from "node:test";
const source = readFileSync(new URL("../src/lib/chart-choice/server.ts", import.meta.url), "utf8");
test("BUG-2274: chart-choice engine calls wait long enough for an adaptive scan on a 2-core host", () => {
// 原值 8000 / 20_000;新值 180_000;原因:自适应扫描冷启动实测 21–163 s,8 s 时网页先断开。
const normal = Number(/const ENGINE_TIMEOUT_MS = ([\d_]+);/u.exec(source)?.[1]?.replaceAll("_", ""));
const wide = Number(/const RESTORE_WIDE_RANGE_TIMEOUT_MS = ([\d_]+);/u.exec(source)?.[1]?.replaceAll("_", ""));
assert.ok(normal >= 180_000, `normal timeout ${normal}`);
assert.ok(wide >= normal, `wide timeout ${wide}`);
assert.match(source, /signal: AbortSignal\.timeout\(timeoutMs\)/u);
});