修复 dev:all 端口段与前端就绪判定
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 2m2s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m24s
Project CI / Backend tests (pull_request) Failing after 20s
Project CI / Frontend tests (pull_request) Successful in 2m38s
Project CI / Repository checks (pull_request) Failing after 17s
Project CI / AI game creator shell web tests (pull_request) Successful in 1m46s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 9m35s
Project CI / Native shell tests (pull_request) Successful in 6m31s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 11m5s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 2m2s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m24s
Project CI / Backend tests (pull_request) Failing after 20s
Project CI / Frontend tests (pull_request) Successful in 2m38s
Project CI / Repository checks (pull_request) Failing after 17s
Project CI / AI game creator shell web tests (pull_request) Successful in 1m46s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 9m35s
Project CI / Native shell tests (pull_request) Successful in 6m31s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 11m5s
将 CLI port-range 同步到 AGC 端口解析环境。 将主站和后台 HTTP readiness 限制为 2xx。 补充真实 HTTP 状态码与端口段传递测试。
This commit is contained in:
+20
-3
@@ -91,6 +91,20 @@ function buildRootDevArgs(argv = []) {
|
||||
];
|
||||
}
|
||||
|
||||
function buildDevAllBaseEnvironment(argv = [], baseEnv = process.env) {
|
||||
let portRange;
|
||||
for (let index = 0; index < argv.length; index += 1) {
|
||||
if (argv[index] === '--port-range') {
|
||||
portRange = argv[index + 1];
|
||||
index += 1;
|
||||
}
|
||||
}
|
||||
|
||||
return portRange
|
||||
? { ...baseEnv, GENARRATIVE_DEV_PORT_RANGE: portRange }
|
||||
: { ...baseEnv };
|
||||
}
|
||||
|
||||
function buildDevAllEnvironment(baseEnv = process.env, agcVitePort) {
|
||||
if (!Number.isInteger(agcVitePort) || agcVitePort < 1024) {
|
||||
throw new Error(`AGC Vite 端口无效: ${agcVitePort}`);
|
||||
@@ -120,7 +134,7 @@ async function isHttpReady(url, timeoutMs = 1_000) {
|
||||
const timeout = setTimeout(() => controller.abort(), timeoutMs);
|
||||
try {
|
||||
const response = await fetch(url, { signal: controller.signal });
|
||||
return response.status >= 200 && response.status < 500;
|
||||
return response.status >= 200 && response.status < 300;
|
||||
} catch {
|
||||
return false;
|
||||
} finally {
|
||||
@@ -511,11 +525,12 @@ async function runDevAll(argv = process.argv.slice(2), dependencies = {}) {
|
||||
}
|
||||
|
||||
try {
|
||||
const baseEnv = buildDevAllBaseEnvironment(argv);
|
||||
const endpoint = await resolveEndpoint({
|
||||
env: process.env,
|
||||
env: baseEnv,
|
||||
strictConfigured: true,
|
||||
});
|
||||
const env = buildDevAllEnvironment(process.env, endpoint.port);
|
||||
const env = buildDevAllEnvironment(baseEnv, endpoint.port);
|
||||
const rootArgs = buildRootDevArgs(argv);
|
||||
|
||||
console.log(
|
||||
@@ -589,10 +604,12 @@ async function runDevAll(argv = process.argv.slice(2), dependencies = {}) {
|
||||
export {
|
||||
agcDatabase,
|
||||
agcDataDir,
|
||||
buildDevAllBaseEnvironment,
|
||||
buildDevAllEnvironment,
|
||||
buildManagedSpawnOptions,
|
||||
buildRootDevArgs,
|
||||
buildStartupSummary,
|
||||
isHttpReady,
|
||||
isSharedRootStackReady,
|
||||
readDevStackState,
|
||||
renderStartupTable,
|
||||
|
||||
Reference in New Issue
Block a user