fix: freeze dev ports and edge health

This commit is contained in:
lyon
2026-05-22 11:16:29 +08:00
parent b1f4e6e52d
commit 59bd0a36fa
42 changed files with 169 additions and 132 deletions
+28 -18
View File
@@ -3,7 +3,7 @@ import { constants as fsConstants } from "node:fs";
import { access, readFile, writeFile } from "node:fs/promises";
import { request as httpRequest } from "node:http";
import path from "node:path";
import { fileURLToPath, pathToFileURL } from "node:url";
import { fileURLToPath } from "node:url";
import { spawn } from "node:child_process";
import {
@@ -470,30 +470,40 @@ async function checkCloudApiDb(deploy, workloads, blockers) {
);
}
let health = null;
try {
const modulePath = pathToFileURL(path.join(repoRoot, "internal/cloud/server.mjs")).href;
const { buildHealthPayload } = await import(modulePath);
health = buildHealthPayload();
if (health.db?.ready !== true) {
addBlocker(
blockers,
"runtime_blocker",
"cloud-api-db",
`cloud-api health reports DB config blocked; missing ${health.db?.missingEnv?.join(", ") ?? "unknown DB env"}`
);
const configReady = missingManifest.length === 0 && missingK8s.length === 0 && missingSecretRefs.length === 0;
const health = {
status: configReady ? "degraded" : "blocked",
ready: false,
configReady,
connected: false,
connectionChecked: false,
fields: requiredEnv.map((env) => ({
name: env.name,
present: env.manifestPresent && env.k8sPresent && (!env.secretRef || env.secretRef.present),
redacted: env.redacted
})),
missingEnv: uniqueStrings([...missingManifest, ...missingK8s]),
secretRefs: requiredEnv
.filter((env) => env.secretRef)
.map((env) => ({
env: env.name,
secretName: env.secretRef.secretName,
secretKey: env.secretRef.secretKey,
present: env.secretRef.present,
redacted: true
})),
safety: {
liveDbEvidence: false
}
} catch (error) {
addBlocker(blockers, "observability_blocker", "cloud-api-health", `Cannot inspect cloud-api health payload: ${error.message}`);
}
};
return {
status: missingManifest.length === 0 && missingK8s.length === 0 && missingSecretRefs.length === 0 ? "contract-ready" : "contract-blocked",
status: configReady ? "contract-ready" : "contract-blocked",
requiredEnv,
missingManifest,
missingK8s,
missingSecretRefs,
runtimeHealth: health?.db ? summarizeDbContract(health.db) : null,
runtimeHealth: summarizeDbContract(health),
secretMaterialRead: false,
valuesRedacted: true,
liveDbEvidence: false,