新增项目发布 readiness summary view model

This commit is contained in:
2026-06-16 10:43:18 +08:00
parent 7f937bd56c
commit 1d383b475c
9 changed files with 177 additions and 7 deletions

View File

@@ -55,6 +55,7 @@ import {
createProjectReleaseGateResultMatrix,
createProjectReleaseReadinessArtifactValidation,
createProjectReleaseReadinessReport,
createProjectReleaseReadinessSummaryViewModel,
createSessionSnapshot,
defaultMachinePaths,
gcodeFilenameFromProgramPath,
@@ -200,6 +201,9 @@ readiness report that embeds the same manifest and result matrix beside the
sim-config inventory baseline and blocked runtime families. It is evidence
driven: the default report is `ready: false` until the caller supplies observed
gate output such as `project_release_gate=ok` or explicit gate results.
`createProjectReleaseReadinessSummaryViewModel()` turns the report into stable
status text, a status line, and display rows for dashboards without executing
any gate.
This helper does not execute shell commands and does not inspect or implement
CNC behavior. It only packages project-level release evidence and blocked

View File

@@ -5,6 +5,7 @@ export {
createProjectReleaseGateResultMatrix,
createProjectReleaseReadinessArtifactValidation,
createProjectReleaseReadinessReport,
createProjectReleaseReadinessSummaryViewModel,
parseProjectReleaseReadinessArtifactJson,
} from "./project-release-readiness.js";
export {

View File

@@ -214,6 +214,58 @@ export function createProjectReleaseReadinessReport({
};
}
export function createProjectReleaseReadinessSummaryViewModel(
report = createProjectReleaseReadinessReport(),
) {
const missing = Array.isArray(report?.missing) ? report.missing : [];
const gateResultMatrix = objectOrEmpty(report?.gateResultMatrix);
const simConfigInventory = objectOrEmpty(report?.simConfigInventory);
const blockedRuntimeFamilies = arrayOrEmpty(report?.blockedRuntimeFamilies);
const promotedBlockedFamilies = arrayOrEmpty(report?.promotedBlockedFamilies);
const ready = report?.ready === true;
const statusText = ready ? "Ready" : "Waiting";
const detailText = ready ? "No blocking reasons" : (missing.length > 0 ? missing.join(", ") : "release evidence missing");
return {
apiName: "project-release-readiness-summary-view-model",
viewModelVersion: 1,
phase: ready ? "ready" : "waiting",
ready,
title: "Project release readiness",
statusText,
detailText,
statusLine: `${statusText}: ${detailText}`,
rows: [
{
id: "gate-results",
label: "Release gates",
value: `${gateResultMatrix.passedCount ?? 0}/${gateResultMatrix.gateCount ?? 0} passed`,
},
{
id: "unknown-gates",
label: "Unknown gates",
value: `${gateResultMatrix.unknownCount ?? 0}`,
},
{
id: "sim-config-inventory",
label: "Sim config inventory",
value: `unexpected_fail=${simConfigInventory.unexpectedFail ?? "unknown"}`,
},
{
id: "blocked-runtime-families",
label: "Blocked runtime families",
value: promotedBlockedFamilies.length > 0
? `promoted: ${promotedBlockedFamilies.join(", ")}`
: (blockedRuntimeFamilies.join(", ") || "none"),
},
{
id: "missing",
label: "Missing readiness",
value: missing.length > 0 ? missing.join(", ") : "none",
},
],
};
}
export function parseProjectReleaseReadinessArtifactJson(text) {
return JSON.parse(String(text));
}