强化发布 readiness artifact gate evidence 校验

This commit is contained in:
2026-06-16 11:01:37 +08:00
parent 9abca15d60
commit ce2c145374
10 changed files with 442 additions and 40 deletions

View File

@@ -223,7 +223,9 @@ load that JSON with `parseProjectReleaseReadinessArtifactJson()` and validate
it with `createProjectReleaseReadinessArtifactValidation()` without copying the
host test assertions. The validation result includes `expectedGateCount` and
`expectedGateIds` so external callers can compare an artifact against the
current manifest.
current manifest, plus `gateManifestReady`, `gateResultMatrixReady`, and
`gateActionPlanReady` so stale artifacts that omit the embedded gate evidence
chain fail the same executable gate.
## OPFS/session persistence exports

View File

@@ -332,10 +332,33 @@ export function createProjectReleaseReadinessArtifactValidation(artifact = {}) {
const artifactObject = objectOrEmpty(artifact);
const releaseGate = objectOrEmpty(artifactObject.releaseGate);
const simConfigInventory = objectOrEmpty(artifactObject.simConfigInventory);
const gateManifest = objectOrEmpty(artifactObject.gateManifest);
const gateResultMatrix = objectOrEmpty(artifactObject.gateResultMatrix);
const gateActionPlan = objectOrEmpty(artifactObject.gateActionPlan);
const gates = arrayOrEmpty(artifactObject.gates);
const manifestGateIds = arrayOrEmpty(gateManifest.gateIds);
const matrixRows = arrayOrEmpty(gateResultMatrix.rows);
const actionPlanCommands = arrayOrEmpty(gateActionPlan.commands);
const rows = arrayOrEmpty(artifactObject.rows);
const expectedGateIds = createProjectReleaseGateManifest().gateIds;
const gateCountReady = gates.length === REQUIRED_RELEASE_GATES.length;
const gatesPassed = gateCountReady && gates.every(({ passed }) => passed === true);
const manifestReady = gateManifest.apiName === "project-release-gate-manifest"
&& gateManifest.manifestVersion === 1
&& gateManifest.gateCount === REQUIRED_RELEASE_GATES.length
&& manifestGateIds.join(",") === expectedGateIds.join(",");
const matrixReady = gateResultMatrix.apiName === "project-release-gate-result-matrix"
&& gateResultMatrix.matrixVersion === 1
&& gateResultMatrix.ready === true
&& gateResultMatrix.passedCount === REQUIRED_RELEASE_GATES.length
&& gateResultMatrix.unknownCount === 0
&& matrixRows.length === REQUIRED_RELEASE_GATES.length;
const actionPlanReady = gateActionPlan.apiName === "project-release-gate-action-plan"
&& gateActionPlan.planVersion === 1
&& gateActionPlan.ready === true
&& gateActionPlan.pendingCount === 0
&& gateActionPlan.nextCommand === null
&& actionPlanCommands.length === 0;
const missing = [
...(artifactObject.apiName === PROJECT_RELEASE_READINESS_ARTIFACT_API ? [] : ["apiName"]),
...(artifactObject.reportVersion === PROJECT_RELEASE_READINESS_ARTIFACT_VERSION ? [] : ["reportVersion"]),
@@ -353,6 +376,9 @@ export function createProjectReleaseReadinessArtifactValidation(artifact = {}) {
? []
: ["blockedRuntimeFamilies"]),
...(arrayOrEmpty(artifactObject.promotedBlockedFamilies).length === 0 ? [] : ["promotedBlockedFamilies"]),
...(manifestReady ? [] : ["gateManifest"]),
...(matrixReady ? [] : ["gateResultMatrix"]),
...(actionPlanReady ? [] : ["gateActionPlan"]),
...(gateCountReady ? [] : ["gates.length"]),
...(gatesPassed ? [] : ["gates.passed"]),
...(rows.find(({ id, value }) => id === "project-release-gate" && value === "passed")
@@ -370,7 +396,10 @@ export function createProjectReleaseReadinessArtifactValidation(artifact = {}) {
artifactVersion: artifactObject.reportVersion ?? null,
gateCount: gates.length,
expectedGateCount: REQUIRED_RELEASE_GATES.length,
expectedGateIds: createProjectReleaseGateManifest().gateIds,
expectedGateIds,
gateManifestReady: manifestReady,
gateResultMatrixReady: matrixReady,
gateActionPlanReady: actionPlanReady,
blockedRuntimeFamilies: arrayOrEmpty(artifactObject.blockedRuntimeFamilies),
rows: [
{
@@ -383,6 +412,21 @@ export function createProjectReleaseReadinessArtifactValidation(artifact = {}) {
label: "Project release gate",
value: releaseGate.passed === true ? "passed" : "missing",
},
{
id: "gate-manifest",
label: "Gate manifest",
value: manifestReady ? "ready" : "missing",
},
{
id: "gate-result-matrix",
label: "Gate result matrix",
value: matrixReady ? "ready" : "missing",
},
{
id: "gate-action-plan",
label: "Gate action plan",
value: actionPlanReady ? "ready" : "missing",
},
{
id: "validation",
label: "Artifact validation",