fix: preserve hwlab refresh render evidence

This commit is contained in:
Codex
2026-07-04 03:42:47 +00:00
parent 779274b26f
commit e8bf83821a
7 changed files with 391 additions and 7 deletions
+40
View File
@@ -264,6 +264,27 @@ function evidenceRowsForFollower(item: Record<string, unknown>): unknown[][] {
: `${shortSha(stringOrNull(refresh.sourceCommit))}/${boolMatch(refresh.pipelineRefMatches)}/${boolMatch(refresh.pipelineSpecMatches)}`,
refresh === null ? "-" : stringOrNull(refresh.pipeline) ?? "-",
]);
const refreshRender = asOptionalRecord(refresh?.render);
const refreshRenderRuntimeReady = asOptionalRecord(refreshRender?.runtimeReadyTask);
if (refreshRender !== null) {
rows.push([
item.id,
"refresh-render",
refreshRenderRuntimeReady?.present === true ? "runtime-ready-present" : refreshRenderRuntimeReady?.present === false ? "runtime-ready-absent" : "-",
whenSummary(arrayRecords(refreshRenderRuntimeReady?.when)[0]),
stringOrNull(refreshRender.pipelineName) ?? "-",
]);
}
const refreshApply = asOptionalRecord(refresh?.apply);
if (refreshApply !== null) {
rows.push([
item.id,
"refresh-apply",
stringOrNull(refreshApply.resourceVersion) ?? stringOrNull(refreshApply.degradedReason) ?? "-",
applyMetadataSummary(refreshApply),
stringOrNull(refreshApply.pipelineName) ?? "-",
]);
}
return rows;
}
@@ -313,6 +334,25 @@ function boolMatch(value: unknown): string {
return value === true ? "match" : value === false ? "mismatch" : "-";
}
function whenSummary(value: Record<string, unknown> | undefined): string {
if (value === undefined) return "-";
const values = arrayText(value.values);
return `${stringOrNull(value.input) ?? "-"} ${stringOrNull(value.operator) ?? "-"} ${values || "-"}`;
}
function applyMetadataSummary(value: Record<string, unknown>): string {
const annotations = asOptionalRecord(value.annotations);
const labels = asOptionalRecord(value.labels);
const annotation = annotations === null ? "-" : `${firstEntry(annotations)}`;
const label = labels === null ? "-" : `${firstEntry(labels)}`;
return `ann:${annotation} label:${label}`;
}
function firstEntry(value: Record<string, unknown>): string {
const [key, item] = Object.entries(value)[0] ?? [];
return key === undefined ? "-" : `${key}=${stringOrNull(item) ?? "-"}`;
}
function asOptionalRecord(value: unknown): Record<string, unknown> | null {
return typeof value === "object" && value !== null && !Array.isArray(value) ? value as Record<string, unknown> : null;
}