fix: gate sentinel publish on health endpoint

This commit is contained in:
Codex
2026-07-01 02:11:33 +00:00
parent fbcf6c02bf
commit ee0c3d19f3
4 changed files with 92 additions and 63 deletions
+22
View File
@@ -198,6 +198,28 @@ export function runSentinelValidate(state: SentinelCicdState, options: Extract<W
return rendered(ok, command, renderValidateResult(result));
}
export function probeSentinelRuntimeHealthEndpoint(state: SentinelCicdState, timeoutSeconds: number): Record<string, unknown> {
const endpoint = stringAt(state.runtime, "healthPath");
const serviceProbeTimeoutSeconds = Math.min(timeoutSeconds, 20);
const health = callSentinelService(state, "GET", endpoint, null, serviceProbeTimeoutSeconds);
const publicHealth = health.ok ? null : probePublicSentinelService(state, endpoint, serviceProbeTimeoutSeconds);
const effectiveHealth = health.ok ? health : record(publicHealth).ok === true ? record(publicHealth) : health;
const bodyJson = record(effectiveHealth.bodyJson);
const ok = effectiveHealth.ok === true && bodyJson.ok === true;
return {
ok,
endpoint,
health: effectiveHealth,
internalHealth: health,
publicHealth,
httpStatus: effectiveHealth.httpStatus ?? null,
publicUrl: effectiveHealth.publicUrl ?? null,
internalUrl: effectiveHealth.internalUrl ?? null,
degradedReason: ok ? null : "sentinel-runtime-health-endpoint-failed",
valuesRedacted: true,
};
}
export function runSentinelReport(state: SentinelCicdState, options: Extract<WebProbeSentinelOptions, { kind: "report" }>): RenderedCliResult {
const command = `web-probe sentinel report ${options.latest ? "--latest " : ""}--view ${options.view}`;
const query = new URLSearchParams({ view: options.view });