暴露项目发布 gate manifest API

This commit is contained in:
2026-06-16 10:31:50 +08:00
parent 6c087499fd
commit 343ad0acd6
12 changed files with 188 additions and 19 deletions

View File

@@ -35,15 +35,17 @@ continuation records are in `../text14.txt`.
machine-readable session readiness phase and missing reasons. The workflow
overview exposes the API surface inventory as a read-only summary row.
- CI dashboards and external SDK callers can use
`createProjectReleaseReadinessReport()` for a machine-readable release
readiness report covering required gate commands, expected smoke outputs, the
sim-config inventory baseline, and blocked runtime families. The helper is
evidence driven and only reports `ready: true` when the caller supplies
release gate evidence such as `project_release_gate=ok`. The project release
gate writes the same report to `build/project-release-readiness.json` and
validates it with `verify_project_release_readiness_artifact.sh`. External
tools can load that artifact with `parseProjectReleaseReadinessArtifactJson()`
and validate it with `createProjectReleaseReadinessArtifactValidation()`.
`createProjectReleaseGateManifest()` to discover required gate commands and
expected smoke outputs, and `createProjectReleaseReadinessReport()` for a
machine-readable release readiness report covering the same manifest, the
sim-config inventory baseline, and blocked runtime families. The report
helper is evidence driven and only reports `ready: true` when the caller
supplies release gate evidence such as `project_release_gate=ok`. The project
release gate writes the same report to `build/project-release-readiness.json`
and validates it with `verify_project_release_readiness_artifact.sh`.
External tools can load that artifact with
`parseProjectReleaseReadinessArtifactJson()` and validate it with
`createProjectReleaseReadinessArtifactValidation()`.
Browser shells can also pass the JSON to
`linuxCncIniPanelWorkflowOverviewApi.validateWorkflowOverviewReleaseReadinessArtifactJson()`
through the workflow overview iframe and receive stable validation rows. They

View File

@@ -51,6 +51,7 @@ import {
createMachineSessionPersistenceRenderState,
createMachineSessionPersistenceSummary,
createMachineSessionSnapshotPayload,
createProjectReleaseGateManifest,
createProjectReleaseReadinessArtifactValidation,
createProjectReleaseReadinessReport,
createSessionSnapshot,
@@ -189,12 +190,14 @@ It does not implement or reinterpret LinuxCNC error semantics.
## Project release readiness export
`createProjectReleaseReadinessReport()` returns a machine-readable release
readiness report for CI dashboards and external SDK callers. The report lists
the required project release gate command, expected smoke outputs, the current
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.
`createProjectReleaseGateManifest()` returns the required release gate IDs,
commands, expected smoke outputs, and gate count for CI dashboards and external
SDK callers. `createProjectReleaseReadinessReport()` returns a
machine-readable release readiness report that embeds the same manifest beside
the current gate results, 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.
This helper does not execute shell commands and does not inspect or implement
CNC behavior. It only packages project-level release evidence and blocked
@@ -207,7 +210,9 @@ validates that artifact with
`tests/host/verify_project_release_readiness_artifact.sh`. External tools can
load that JSON with `parseProjectReleaseReadinessArtifactJson()` and validate
it with `createProjectReleaseReadinessArtifactValidation()` without copying the
host test assertions.
host test assertions. The validation result includes `expectedGateCount` and
`expectedGateIds` so external callers can compare an artifact against the
current manifest.
## OPFS/session persistence exports

View File

@@ -1,6 +1,7 @@
export { createLinuxCncIniSdk } from "./linuxcnc-ini.js";
export { createLinuxCncInterpSdk } from "./linuxcnc-interp.js";
export {
createProjectReleaseGateManifest,
createProjectReleaseReadinessArtifactValidation,
createProjectReleaseReadinessReport,
parseProjectReleaseReadinessArtifactJson,

View File

@@ -98,6 +98,21 @@ function arrayOrEmpty(value) {
return Array.isArray(value) ? value : [];
}
export function createProjectReleaseGateManifest() {
return {
apiName: "project-release-gate-manifest",
manifestVersion: 1,
gateCount: REQUIRED_RELEASE_GATES.length,
gateIds: REQUIRED_RELEASE_GATES.map(({ id }) => id),
gates: REQUIRED_RELEASE_GATES.map((gate) => ({
id: gate.id,
label: gate.label,
command: gate.command,
expectedOutput: gate.expectedOutput ?? null,
})),
};
}
export function createProjectReleaseReadinessReport({
gateResults = {},
observedOutputs = [],
@@ -106,7 +121,8 @@ export function createProjectReleaseReadinessReport({
promotedRuntimeFamilies = [],
} = {}) {
const outputs = Array.isArray(observedOutputs) ? observedOutputs : [];
const gateRows = REQUIRED_RELEASE_GATES.map((gate) => {
const gateManifest = createProjectReleaseGateManifest();
const gateRows = gateManifest.gates.map((gate) => {
const passed = readGatePassed({ gate, gateResults, observedOutputs: outputs });
return {
id: gate.id,
@@ -149,6 +165,7 @@ export function createProjectReleaseReadinessReport({
blockedRuntimeFamilies: blockedFamilies,
promotedRuntimeFamilies: promotedFamilies,
promotedBlockedFamilies,
gateManifest,
gates: gateRows,
rows: [
{
@@ -215,6 +232,8 @@ export function createProjectReleaseReadinessArtifactValidation(artifact = {}) {
artifactApiName: artifactObject.apiName ?? null,
artifactVersion: artifactObject.reportVersion ?? null,
gateCount: gates.length,
expectedGateCount: REQUIRED_RELEASE_GATES.length,
expectedGateIds: createProjectReleaseGateManifest().gateIds,
blockedRuntimeFamilies: arrayOrEmpty(artifactObject.blockedRuntimeFamilies),
rows: [
{

View File

@@ -31,6 +31,7 @@ for (const phrase of [
"docs/drift-report.md",
"PROJECT_COMPLETION_TRACKER.md",
"runtime/sdk/src/index.js",
"createProjectReleaseGateManifest()",
"createProjectReleaseReadinessReport()",
"parseProjectReleaseReadinessArtifactJson()",
"createProjectReleaseReadinessArtifactValidation()",
@@ -96,6 +97,7 @@ for (const phrase of [
for (const phrase of [
"OPFS/session persistence exports",
"Project release readiness export",
"createProjectReleaseGateManifest()",
"createProjectReleaseReadinessReport()",
"parseProjectReleaseReadinessArtifactJson()",
"createProjectReleaseReadinessArtifactValidation()",

View File

@@ -21,5 +21,18 @@ assert.deepEqual(validation.missing, []);
assert.equal(validation.artifactApiName, "project-release-readiness-report");
assert.equal(validation.artifactVersion, 1);
assert.equal(validation.gateCount, 10);
assert.equal(validation.expectedGateCount, 10);
assert.deepEqual(validation.expectedGateIds, [
"diff-check",
"vendor-sync",
"standalone-cnc-semantics",
"interp-wasm",
"sim-config-inventory",
"ini-panel-browser",
"release-artifact-url-browser",
"ui-node-smokes",
"host-smokes",
"project-release-gate",
]);
console.log("project_release_readiness_artifact_node_smoke=ok");

View File

@@ -0,0 +1,52 @@
import assert from "node:assert/strict";
import {
createProjectReleaseGateManifest,
createProjectReleaseReadinessReport,
} from "../../../runtime/sdk/src/index.js";
const manifest = createProjectReleaseGateManifest();
assert.equal(manifest.apiName, "project-release-gate-manifest");
assert.equal(manifest.manifestVersion, 1);
assert.equal(manifest.gateCount, 10);
assert.deepEqual(manifest.gateIds, [
"diff-check",
"vendor-sync",
"standalone-cnc-semantics",
"interp-wasm",
"sim-config-inventory",
"ini-panel-browser",
"release-artifact-url-browser",
"ui-node-smokes",
"host-smokes",
"project-release-gate",
]);
assert.deepEqual(
manifest.gates.map(({ expectedOutput }) => expectedOutput),
[
null,
"vendor sync up to date",
"standalone CNC semantics guard complete",
"interp_wasm_node_smoke=ok",
"sim_configs_wasm_node_inventory_unexpected_fail=0",
"browser_ini_shell_integration_workflow_smoke=ok",
"browser_release_artifact_url_workflow_smoke=ok",
"ui_node_smokes=ok",
"host_wasm_opfs_browser_smokes=ok",
"project_release_gate=ok",
],
);
assert.equal(
manifest.gates.find(({ id }) => id === "release-artifact-url-browser")?.command,
"SKIP_INI_BUILD=1 SKIP_INTERP_BUILD=1 wasm-port/tests/browser/verify_release_artifact_url_workflow_browser.sh",
);
const report = createProjectReleaseReadinessReport({
gateResults: Object.fromEntries(manifest.gateIds.map((id) => [id, true])),
});
assert.deepEqual(report.gateManifest, manifest);
assert.deepEqual(report.gates.map(({ id }) => id), manifest.gateIds);
assert.equal(report.gates.length, manifest.gateCount);
console.log("project_release_gate_manifest_node_smoke=ok");

View File

@@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "$0")/../../.." && pwd)"
node "$ROOT_DIR/tests/sdk/node/verify_project_release_gate_manifest.mjs"

View File

@@ -32,6 +32,7 @@ import {
createMachineSessionPersistenceDisplayViewModel,
createMachineSessionPersistenceRenderState,
createMachineSessionPersistenceSummary,
createProjectReleaseGateManifest,
createProjectReleaseReadinessArtifactValidation,
createProjectReleaseReadinessReport,
parseProjectReleaseReadinessArtifactJson,
@@ -83,6 +84,7 @@ const trackerText = readFileSync(resolve(root, "../PROJECT_COMPLETION_TRACKER.md
const requiredExports = [
["createLinuxCncIniSdk", createLinuxCncIniSdk],
["createLinuxCncInterpSdk", createLinuxCncInterpSdk],
["createProjectReleaseGateManifest", createProjectReleaseGateManifest],
["createProjectReleaseReadinessArtifactValidation", createProjectReleaseReadinessArtifactValidation],
["createProjectReleaseReadinessReport", createProjectReleaseReadinessReport],
["parseProjectReleaseReadinessArtifactJson", parseProjectReleaseReadinessArtifactJson],
@@ -214,6 +216,7 @@ const releaseReadinessReady = createProjectReleaseReadinessReport({
});
assert.equal(releaseReadinessReady.ready, true);
assert.equal(releaseReadinessReady.releaseGate.passed, true);
assert.deepEqual(releaseReadinessReady.gateManifest, createProjectReleaseGateManifest());
const releaseReadinessArtifact = parseProjectReleaseReadinessArtifactJson(JSON.stringify(createProjectReleaseReadinessReport({
gateResults: {
"diff-check": true,
@@ -238,6 +241,8 @@ assert.deepEqual(createProjectReleaseReadinessArtifactValidation(releaseReadines
artifactApiName: "project-release-readiness-report",
artifactVersion: 1,
gateCount: 10,
expectedGateCount: 10,
expectedGateIds: createProjectReleaseGateManifest().gateIds,
blockedRuntimeFamilies: [
"L4-USER-M-PROCESS",
"L4-TOOL-DB",

View File

@@ -4,3 +4,4 @@ set -euo pipefail
ROOT_DIR="$(cd "$(dirname "$0")/../../.." && pwd)"
node "$ROOT_DIR/tests/sdk/node/verify_sdk_surface.mjs"
"$ROOT_DIR/tests/sdk/node/verify_project_release_gate_manifest.sh"