新增项目发布 gate result matrix API

This commit is contained in:
2026-06-16 10:37:57 +08:00
parent 343ad0acd6
commit 7f937bd56c
9 changed files with 160 additions and 21 deletions

View File

@@ -113,16 +113,14 @@ export function createProjectReleaseGateManifest() {
};
}
export function createProjectReleaseReadinessReport({
export function createProjectReleaseGateResultMatrix({
gateResults = {},
observedOutputs = [],
simConfigInventory = DEFAULT_SIM_CONFIG_INVENTORY_BASELINE,
blockedRuntimeFamilies = BLOCKED_RUNTIME_FAMILIES,
promotedRuntimeFamilies = [],
manifest = createProjectReleaseGateManifest(),
} = {}) {
const outputs = Array.isArray(observedOutputs) ? observedOutputs : [];
const gateManifest = createProjectReleaseGateManifest();
const gateRows = gateManifest.gates.map((gate) => {
const gates = Array.isArray(manifest?.gates) ? manifest.gates : [];
const rows = gates.map((gate) => {
const passed = readGatePassed({ gate, gateResults, observedOutputs: outputs });
return {
id: gate.id,
@@ -133,6 +131,34 @@ export function createProjectReleaseReadinessReport({
passed,
};
});
return {
apiName: "project-release-gate-result-matrix",
matrixVersion: 1,
phase: rows.every(({ passed }) => passed) ? "ready" : "waiting",
ready: rows.every(({ passed }) => passed),
gateCount: rows.length,
passedCount: rows.filter(({ passed }) => passed).length,
unknownCount: rows.filter(({ passed }) => !passed).length,
missingGateIds: rows.filter(({ passed }) => !passed).map(({ id }) => id),
manifest,
rows,
};
}
export function createProjectReleaseReadinessReport({
gateResults = {},
observedOutputs = [],
simConfigInventory = DEFAULT_SIM_CONFIG_INVENTORY_BASELINE,
blockedRuntimeFamilies = BLOCKED_RUNTIME_FAMILIES,
promotedRuntimeFamilies = [],
} = {}) {
const gateManifest = createProjectReleaseGateManifest();
const gateResultMatrix = createProjectReleaseGateResultMatrix({
gateResults,
observedOutputs,
manifest: gateManifest,
});
const gateRows = gateResultMatrix.rows;
const releaseGatePassed = gateRows.find(({ id }) => id === "project-release-gate")?.passed === true;
const inventory = {
...DEFAULT_SIM_CONFIG_INVENTORY_BASELINE,
@@ -166,6 +192,7 @@ export function createProjectReleaseReadinessReport({
promotedRuntimeFamilies: promotedFamilies,
promotedBlockedFamilies,
gateManifest,
gateResultMatrix,
gates: gateRows,
rows: [
{