fix(staging): allow model catalog bootstrap
This commit is contained in:
@@ -27,7 +27,7 @@ async function jyotishApiCheck(): Promise<Check> {
|
||||
signal: controller.signal,
|
||||
});
|
||||
return {
|
||||
status: response.ok ? "ok" : "degraded",
|
||||
status: response.ok ? "ok" : "blocked",
|
||||
message: response.ok ? undefined : `http:${response.status}`,
|
||||
latencyMs: Date.now() - started,
|
||||
};
|
||||
@@ -45,9 +45,11 @@ async function jyotishApiCheck(): Promise<Check> {
|
||||
async function modelCatalogCheck(): Promise<Check> {
|
||||
const catalog = await loadLanguageModelCatalog();
|
||||
const defaults = catalog.models.filter((model) => model.isDefault && model.id === catalog.defaultModelId);
|
||||
return defaults.length === 1
|
||||
? { status: "ok" }
|
||||
: { status: "blocked", message: catalog.issues[0] ?? "default_model_unavailable" };
|
||||
if (defaults.length === 1) return { status: "ok" };
|
||||
const message = catalog.issues[0] ?? "default_model_unavailable";
|
||||
return message === "database_model_catalog_unavailable"
|
||||
? { status: "blocked", message }
|
||||
: { status: "degraded", message };
|
||||
}
|
||||
|
||||
function aggregate(checks: Record<string, Check>) {
|
||||
@@ -94,6 +96,6 @@ export async function GET() {
|
||||
truthSource: truthSourceIdentity,
|
||||
checks,
|
||||
},
|
||||
{ status: status === "ok" ? 200 : 503 },
|
||||
{ status: status === "blocked" ? 503 : 200 },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -66,6 +66,10 @@ test("health endpoint exposes deployment identity for production verification",
|
||||
assert.match(source, /const defaults = catalog\.models\.filter/);
|
||||
assert.match(source, /defaults\.length === 1/);
|
||||
assert.match(source, /default_model_unavailable/);
|
||||
assert.match(source, /message === "database_model_catalog_unavailable"/);
|
||||
assert.match(source, /: \{ status: "degraded", message \}/);
|
||||
assert.match(source, /status: response\.ok \? "ok" : "blocked"/);
|
||||
assert.match(source, /status === "blocked" \? 503 : 200/);
|
||||
assert.doesNotMatch(source, /anyEnvCheck\(\["LLM_MODELS_JSON"|OPENAI_API_KEY|DEEPSEEK_API_KEY|LLM_API_KEY/);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user