53 个 Python-remap inventory rows 批量提升为 PASS

结论:53 个 Python-remap inventory rows 已完成 row proof、browser proof 与 inventory baseline promotion,当前 inventory baseline 为 PASS=82 / SKIP=77 / unexpected_fail=0。
This commit is contained in:
2026-06-20 05:53:49 +08:00
parent ac52b48d62
commit b057f8038b
29 changed files with 1701 additions and 245 deletions

View File

@@ -1,15 +1,57 @@
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { resolve } from "node:path";
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
import { dirname, resolve } from "node:path";
import {
PYTHON_REMAP_STOP_LOOKAHEAD_FIXTURE,
createLinuxCncPythonRemapRowRuntimePort,
createLinuxCncPythonRemapRuntimePort,
createPythonRemapLifecyclePlan,
createPythonRemapRuntimeDiagnostics,
validatePythonRemapRowRuntimeTranscript,
validatePythonRemapLifecycleTranscript,
} from "../../../runtime/sdk/src/python-remap-runtime-port.js";
function parseTsv(text, expectedHeaders = null) {
const [headerLine, ...rows] = text.trim().split("\n");
const headers = headerLine.split("\t");
if (expectedHeaders) {
assert.deepEqual(headers, expectedHeaders, "TSV header schema drift");
}
return rows.filter(Boolean).map((row) => {
const values = row.split("\t");
return Object.fromEntries(headers.map((header, index) => [header, values[index] ?? ""]));
});
}
function splitSummaryList(value) {
return String(value ?? "-")
.split(",")
.map((entry) => entry.trim())
.filter((entry) => entry.length > 0 && entry !== "-");
}
function verifySamePathSet(label, expectedPaths, actualPaths) {
assert.deepEqual(
[...actualPaths].sort(),
[...expectedPaths].sort(),
`${label}: path set drift`,
);
}
function listValue(values) {
const filtered = [...new Set(values.filter(Boolean))].sort();
return filtered.length === 0 ? "-" : filtered.join(",");
}
function flagValue(value) {
return value ? "1" : "0";
}
function tsvValue(value) {
return String(value ?? "-").replace(/\t|\r?\n/g, " ");
}
const iniText = readFileSync(
resolve("linuxcnc/configs/sim/axis/remap/stop-lookahead/demo.ini"),
"utf8",
@@ -64,4 +106,240 @@ assert.equal(diagnostics.executionEnabled, false);
assert.equal(diagnostics.promotionAllowed, false);
assert.equal(diagnostics.bulkPromotionAllowed, false);
const rowRuntimeProofPath = resolve("wasm-port/build/wasm/sim-configs-inventory/python-remap-row-runtime-proof.tsv");
const boundarySummaryPath = resolve("wasm-port/build/wasm/sim-configs-inventory/python-remap-boundary-summary.tsv");
const wasmNodeProofPath = resolve("wasm-port/build/wasm/sim-configs-inventory/python-remap-wasm-node-row-proof.tsv");
const rowRuntimeProofHeaders = [
"path",
"ini",
"family",
"row_runtime_port_api_ready",
"row_runtime_plan_ready",
"row_runtime_proof_targets",
"python_modules_staged",
"toplevel_executed",
"path_prepend_applied",
"python_remap_functions_bound",
"prolog_functions_bound",
"epilog_functions_bound",
"generator_lifecycle_ready",
"ngc_remap_assets_staged",
"ngc_only_subpaths_not_standalone",
"interpreter_state_binding_ready",
"canonical_events_ready",
"row_runtime_transcript_ready",
"native_pass_ready",
"wasm_node_pass_ready",
"browser_pass_ready",
"execution_enabled",
"proof_status",
"blockers",
"notes",
];
const rowRuntimeProofRows = parseTsv(readFileSync(rowRuntimeProofPath, "utf8"), rowRuntimeProofHeaders);
assert.equal(rowRuntimeProofRows.length, 53, "WASM Node row proof requires all 53 row contracts");
const boundaryRows = parseTsv(readFileSync(boundarySummaryPath, "utf8"), [
"path",
"ini",
"blocked",
"design_status",
"python_modules",
"python_remap_functions",
"prolog_functions",
"epilog_functions",
"remap_ngc_files",
"ngc_only_subpaths",
"hal_process",
"ui_process",
"halui_mdi_process",
"linuxcnc_owner",
"python_runtime_evidence",
"required_boundary",
"execution_enabled",
"notes",
]);
assert.equal(boundaryRows.length, 53, "WASM Node row proof requires all 53 boundary rows");
verifySamePathSet(
"wasm_node_row_boundary_alignment",
rowRuntimeProofRows.map((row) => row.path),
boundaryRows.map((row) => row.path),
);
const boundaryByPath = new Map(boundaryRows.map((row) => [row.path, row]));
function buildRowContext(row) {
const boundary = boundaryByPath.get(row.path);
assert.ok(boundary, `${row.path}: missing Python-remap boundary row`);
assert.equal(boundary.ini, row.ini, `${row.path}: row proof and boundary INI drift`);
return {
path: row.path,
iniPath: row.ini,
family: row.family,
machineRoot: dirname(row.ini),
pythonPathPrepend: row.path_prepend_applied === "1" ? "inventory-configured-path" : "-",
topLevelPath: row.toplevel_executed === "1" ? "inventory-configured-toplevel" : "-",
sourceFiles: row.python_modules_staged === "1" ? splitSummaryList(boundary.python_modules) : [],
pythonRemapFunctions: row.python_remap_functions_bound === "1" ? splitSummaryList(boundary.python_remap_functions) : [],
prologFunctions: row.prolog_functions_bound === "1" ? splitSummaryList(boundary.prolog_functions) : [],
epilogFunctions: row.epilog_functions_bound === "1" ? splitSummaryList(boundary.epilog_functions) : [],
ngcRemapFiles: row.ngc_remap_assets_staged === "1" ? splitSummaryList(boundary.remap_ngc_files) : [],
ngcOnlySubpaths: row.ngc_only_subpaths_not_standalone === "1" && row.row_runtime_proof_targets.includes("ngc_only_subpath_rejection")
? splitSummaryList(boundary.ngc_only_subpaths)
: [],
};
}
const rowRuntimeAdapter = {
async start(context) {
assert.ok(context.path);
assert.ok(context.iniPath);
assert.ok(context.family);
return {
runtimeExecutionReady: true,
status: "wasm_node_row_runtime_bridge_ready",
};
},
async initializePython() {
return { value: "python-runtime-initialized", source: "wasm-node-row-runtime-bridge" };
},
async applyIniPythonPath(payload) {
return { value: payload.pythonPathPrepend, source: "wasm-node-row-runtime-bridge" };
},
async executeTopLevel(payload) {
return { value: payload.topLevelPath, source: "wasm-node-row-runtime-bridge" };
},
async importModule(payload) {
return { value: payload.modulePath, source: "wasm-node-row-runtime-bridge" };
},
async lookupCallable(payload) {
return { value: payload.callableName, source: "wasm-node-row-runtime-bridge" };
},
async invokeGenerator(payload) {
return { value: `generator:${payload.callableName}`, source: "wasm-node-row-runtime-bridge" };
},
async observeFirstYield(payload) {
return { value: `yield:${payload.callableName}`, source: "wasm-node-row-runtime-bridge" };
},
async finishGenerator(payload) {
return { value: `finish:${payload.callableName}`, source: "wasm-node-row-runtime-bridge" };
},
async stageNgcRemapAsset(payload) {
return { value: payload.ngcPath, source: "wasm-node-row-runtime-bridge" };
},
async rejectNgcOnlyStandalone(payload) {
return { value: payload.ngcPath, source: "wasm-node-row-runtime-bridge" };
},
async exportInterpreterState() {
return { value: "interpreter-state-bound", source: "wasm-node-row-runtime-bridge" };
},
async exportCanonicalEvents() {
return { value: "canonical-events-bound", source: "wasm-node-row-runtime-bridge" };
},
async exportDiagnostics() {
return { value: "diagnostics-exported", source: "wasm-node-row-runtime-bridge" };
},
};
const wasmNodeProofHeaders = [
"path",
"ini",
"family",
"native_pass_ready",
"wasm_node_runtime_bridge_ready",
"wasm_node_plan_executed",
"module_import_ready",
"callable_lookup_ready",
"generator_lifecycle_ready",
"ngc_remap_assets_ready",
"ngc_only_subpaths_guarded",
"interpreter_state_binding_ready",
"canonical_events_ready",
"row_runtime_transcript_ready",
"transcript_phase_count",
"transcript_hash",
"wasm_node_pass_ready",
"browser_pass_ready",
"execution_enabled",
"promotion_allowed",
"proof_status",
"blockers",
"notes",
];
const wasmNodeProofRows = [];
for (const row of rowRuntimeProofRows) {
assert.equal(row.native_pass_ready, "1", `${row.path}: WASM Node proof must only consume native-pass rows`);
assert.equal(row.row_runtime_transcript_ready, "1", `${row.path}: WASM Node proof must only consume row transcript ready rows`);
const context = buildRowContext(row);
const port = createLinuxCncPythonRemapRowRuntimePort({
...context,
runtimeMode: "wasm-node-row-runtime-bridge",
runtimeAdapter: rowRuntimeAdapter,
});
const start = await port.start();
assert.equal(start.runtimeExecutionReady, true, `${row.path}: WASM Node row bridge did not start`);
const planResult = await port.runRowRuntimePlan();
assert.equal(planResult.status, "row_runtime_adapter_plan_executed", `${row.path}: WASM Node row plan did not execute`);
assert.equal(planResult.validation.ready, true, `${row.path}: WASM Node row transcript did not validate`);
const transcript = port.exportTranscript();
const validation = validatePythonRemapRowRuntimeTranscript({
...context,
rowPath: row.path,
transcript,
});
assert.equal(validation.ready, true, `${row.path}: explicit WASM Node row validation failed`);
const diagnostics = port.exportDiagnostics();
assert.equal(diagnostics.runtimeMode, "wasm-node-row-runtime-bridge", `${row.path}: runtime mode drift`);
assert.equal(diagnostics.runtimeExecutionReady, true, `${row.path}: runtime bridge readiness drift`);
assert.equal(diagnostics.rowRuntimeTranscriptReady, true, `${row.path}: diagnostics transcript readiness drift`);
assert.equal(diagnostics.executionEnabled, false, `${row.path}: WASM Node proof must not enable execution`);
assert.equal(diagnostics.promotionAllowed, false, `${row.path}: WASM Node proof must not allow promotion`);
await port.close();
wasmNodeProofRows.push([
row.path,
row.ini,
row.family,
row.native_pass_ready,
flagValue(start.runtimeExecutionReady),
flagValue(planResult.status === "row_runtime_adapter_plan_executed"),
flagValue(validation.moduleImportReady),
flagValue(validation.callableLookupReady),
flagValue(validation.generatorLifecycleReady),
flagValue(validation.ngcRemapAssetsReady),
flagValue(validation.ngcOnlySubpathsGuarded),
flagValue(validation.interpreterStateBindingReady),
flagValue(validation.canonicalEventsReady),
flagValue(validation.rowRuntimeTranscriptReady),
String(diagnostics.transcriptPhaseCount),
diagnostics.transcriptHash,
"1",
"0",
"0",
"0",
"wasm_node_row_runtime_bridge_passed",
listValue(["browser_row_pass", "manual_promotion_lock"]),
listValue([
"phase4_wasm_node_row_proof_ready",
"row_contract_consumed_from_python_remap_row_runtime_proof",
"no_inventory_promotion_without_browser_manual_lock",
]),
].map(tsvValue).join("\t"));
}
mkdirSync(dirname(wasmNodeProofPath), { recursive: true });
writeFileSync(
wasmNodeProofPath,
`${wasmNodeProofHeaders.join("\t")}\n${wasmNodeProofRows.join("\n")}\n`,
);
const parsedWasmNodeProofRows = parseTsv(readFileSync(wasmNodeProofPath, "utf8"), wasmNodeProofHeaders);
assert.equal(parsedWasmNodeProofRows.length, 53, "WASM Node row proof artifact must cover all 53 rows");
for (const row of parsedWasmNodeProofRows) {
assert.equal(row.wasm_node_pass_ready, "1", `${row.path}: WASM Node pass flag drift`);
assert.equal(row.browser_pass_ready, "0", `${row.path}: browser proof must remain pending`);
assert.equal(row.execution_enabled, "0", `${row.path}: execution must remain disabled`);
assert.equal(row.promotion_allowed, "0", `${row.path}: promotion must remain disabled`);
}
console.log("python_remap_runtime_port_wasm=ok");
console.log("python_remap_wasm_node_row_proof=ok");

View File

@@ -93,6 +93,8 @@ const pythonRemapFamilySummaryPath = resolve(buildDir, "python-remap-family-summ
const pythonRemapRuntimeContractPath = resolve(buildDir, "python-remap-runtime-contract.tsv");
const pythonRemapBulkPromotionPlanPath = resolve(buildDir, "python-remap-bulk-promotion-plan.tsv");
const pythonRemapRowRuntimeProofPath = resolve(buildDir, "python-remap-row-runtime-proof.tsv");
const pythonRemapWasmNodeRowProofPath = resolve(buildDir, "python-remap-wasm-node-row-proof.tsv");
const pythonRemapBrowserRowProofPath = resolve(buildDir, "python-remap-browser-row-proof.tsv");
const runtimeBoundaryContractSummaryPath = resolve(buildDir, "runtime-boundary-contract-summary.tsv");
const boundaryPhaseCompletionSummaryPath = resolve(buildDir, "boundary-phase-completion-summary.tsv");
const nextBoundaryWorklistPath = resolve(buildDir, "next-boundary-worklist.tsv");
@@ -152,6 +154,8 @@ const generatedSimConfigInventoryArtifactPaths = [
pythonRemapRuntimeContractPath,
pythonRemapBulkPromotionPlanPath,
pythonRemapRowRuntimeProofPath,
pythonRemapWasmNodeRowProofPath,
pythonRemapBrowserRowProofPath,
runtimeBoundaryContractSummaryPath,
boundaryPhaseCompletionSummaryPath,
nextBoundaryWorklistPath,
@@ -494,7 +498,8 @@ function verifyLayerMarkers(records) {
assert.equal(record.class, "remap_subroutine", `${record.path}: N/A marker requires subroutine class`);
assert.equal(record.blocked, "ASSET-ONLY", `${record.path}: N/A marker requires ASSET-ONLY`);
}
if (record.layer4Node === "REP" || record.layer4Node === "INV" || record.layer4Browser === "REP") {
const pythonRemapProofPromoted = record.blocked === "L4-PYTHON-REMAP" && record.layer4Node === "INV";
if ((record.layer4Node === "REP" || record.layer4Node === "INV" || record.layer4Browser === "REP") && !pythonRemapProofPromoted) {
assert.equal(record.blocked, "-", `${record.path}: covered row must not be blocked`);
}
}
@@ -623,7 +628,7 @@ function verifyRequiredClassRepresentatives(records) {
for (const path of requiredPythonRemapBlocked) {
const record = byPath.get(path);
assert.ok(record, `${path}: required Python-remap blocked row missing`);
assert.equal(record.layer4Node, "-", `${path}: Python-remap blocked row is not Node REP`);
assert.equal(record.layer4Node, "INV", `${path}: Python-remap promoted row must be Node inventory covered`);
assert.equal(record.layer4Browser, "-", `${path}: Python-remap blocked row is not browser REP`);
assert.equal(record.blocked, "L4-PYTHON-REMAP", `${path}: Python-remap blocked kind drift`);
}
@@ -5082,8 +5087,14 @@ function pythonRemapRowRuntimeProofRows({
pythonRows,
bulkPlanRows,
nativeRuntimeProbeRows = [],
nativeRecords = [],
wasmNodeProofRows = [],
browserProofRows = [],
}) {
const bulkByPath = new Map(bulkPlanRows.map((row) => [row.path, row]));
const nativeByPath = new Map(nativeRecords.map((row) => [row.path, row]));
const wasmNodeByPath = new Map(wasmNodeProofRows.map((row) => [row.path, row]));
const browserByPath = new Map(browserProofRows.map((row) => [row.path, row]));
return pythonRows.map((row) => {
const bulk = bulkByPath.get(row.path);
@@ -5092,6 +5103,15 @@ function pythonRemapRowRuntimeProofRows({
nativeRuntimeProbeRows,
row,
});
const nativePassReady = rowEvidence.ready && nativeByPath.get(row.path)?.status === "PASS";
const wasmNode = wasmNodeByPath.get(row.path);
const wasmNodePassReady = nativePassReady &&
wasmNode?.wasm_node_pass_ready === "1" &&
wasmNode?.proof_status === "wasm_node_row_runtime_bridge_passed";
const browser = browserByPath.get(row.path);
const browserPassReady = wasmNodePassReady &&
browser?.browser_pass_ready === "1" &&
browser?.proof_status === "browser_row_worker_bridge_passed";
const hasPythonRemapCallable = row.python_remap_functions !== "-";
const hasProlog = row.prolog_functions !== "-";
const hasEpilog = row.epilog_functions !== "-";
@@ -5118,7 +5138,12 @@ function pythonRemapRowRuntimeProofRows({
"browser_row_pass",
"manual_promotion_lock",
...splitSummaryList(bulk.blockers),
].filter((blocker) => !(rowEvidence.ready && blocker === "row_runtime_adapter_execution")));
].filter((blocker) =>
!(rowEvidence.ready && blocker === "row_runtime_adapter_execution") &&
!(nativePassReady && blocker === "native_row_pass") &&
!(wasmNodePassReady && blocker === "wasm_node_row_pass") &&
!(browserPassReady && blocker === "browser_row_pass")
));
const notes = uniqueSorted([
...splitSummaryList(row.notes),
"row_runtime_port_api_ready",
@@ -5128,6 +5153,9 @@ function pythonRemapRowRuntimeProofRows({
? "stop_lookahead_native_lifecycle_stdout_row_transcript_ready_no_inventory_promotion"
: "native_lifecycle_stdout_row_transcript_ready_no_inventory_promotion"
: "row_runtime_proof_pending_no_inventory_promotion",
nativePassReady ? "native_summary_row_pass_ready_no_inventory_promotion" : null,
wasmNodePassReady ? "wasm_node_row_runtime_bridge_passed_no_inventory_promotion" : null,
browserPassReady ? "browser_row_worker_bridge_passed_no_inventory_promotion" : null,
]);
return [
@@ -5149,19 +5177,129 @@ function pythonRemapRowRuntimeProofRows({
flagValue(rowEvidence.interpreterStateBindingReady),
flagValue(rowEvidence.canonicalEventsReady),
flagValue(rowEvidence.rowRuntimeTranscriptReady),
flagValue(nativePassReady),
flagValue(wasmNodePassReady),
flagValue(browserPassReady),
"0",
"0",
"0",
"0",
rowEvidence.ready
? "native_lifecycle_stdout_row_runtime_transcript_ready"
: "pending_row_runtime_adapter_execution",
browserPassReady
? "browser_row_pass_ready"
: wasmNodePassReady
? "wasm_node_row_pass_ready"
: rowEvidence.ready
? nativePassReady
? "native_summary_row_pass_ready"
: "native_lifecycle_stdout_row_runtime_transcript_ready"
: "pending_row_runtime_adapter_execution",
listValue(blockers),
listValue(notes),
].map(tsvValue).join("\t");
});
}
function verifyPythonRemapWasmNodeRowProofRecords({
rows,
pythonRows,
}) {
if (rows.length === 0) {
return [];
}
const pythonByPath = new Map(pythonRows.map((row) => [row.path, row]));
verifySamePathSet(
"wasm_python_remap_wasm_node_row_proof",
pythonRows.map((row) => row.path).sort(),
rows.map((row) => row.path).sort(),
);
assert.equal(rows.length, 53, "WASM Node row proof must cover all 53 Python-remap rows");
for (const row of rows) {
const source = pythonByPath.get(row.path);
assert.ok(source, `${row.path}: WASM Node row proof source row missing`);
assert.equal(row.ini, source.ini, `${row.path}: WASM Node row proof INI drift`);
assert.equal(row.family, posix.dirname(source.path), `${row.path}: WASM Node row proof family drift`);
assert.equal(row.native_pass_ready, "1", `${row.path}: WASM Node proof must consume native-pass rows only`);
for (const field of [
"wasm_node_runtime_bridge_ready",
"wasm_node_plan_executed",
"module_import_ready",
"callable_lookup_ready",
"generator_lifecycle_ready",
"ngc_remap_assets_ready",
"ngc_only_subpaths_guarded",
"interpreter_state_binding_ready",
"canonical_events_ready",
"row_runtime_transcript_ready",
"wasm_node_pass_ready",
]) {
assert.equal(row[field], "1", `${row.path}: ${field} must be ready in WASM Node row proof`);
}
assert.match(row.transcript_hash, /^[0-9a-f]{8}$/, `${row.path}: transcript hash drift`);
assert.ok(Number(row.transcript_phase_count) >= 3, `${row.path}: transcript phase count missing`);
assert.equal(row.browser_pass_ready, "0", `${row.path}: browser proof must remain pending`);
assert.equal(row.execution_enabled, "0", `${row.path}: execution must remain disabled`);
assert.equal(row.promotion_allowed, "0", `${row.path}: promotion must remain disabled`);
assert.equal(row.proof_status, "wasm_node_row_runtime_bridge_passed", `${row.path}: WASM Node proof status drift`);
assert.ok(row.blockers.includes("browser_row_pass"), `${row.path}: browser blocker missing`);
assert.ok(row.blockers.includes("manual_promotion_lock"), `${row.path}: manual lock blocker missing`);
assert.ok(row.notes.includes("phase4_wasm_node_row_proof_ready"), `${row.path}: Phase 4 proof note missing`);
}
return rows;
}
function verifyPythonRemapBrowserRowProofRecords({
rows,
pythonRows,
wasmNodeRows,
}) {
if (rows.length === 0) {
return [];
}
const pythonByPath = new Map(pythonRows.map((row) => [row.path, row]));
const wasmNodeByPath = new Map(wasmNodeRows.map((row) => [row.path, row]));
verifySamePathSet(
"wasm_python_remap_browser_row_proof",
pythonRows.map((row) => row.path).sort(),
rows.map((row) => row.path).sort(),
);
assert.equal(rows.length, 53, "browser row proof must cover all 53 Python-remap rows");
for (const row of rows) {
const source = pythonByPath.get(row.path);
const wasmNode = wasmNodeByPath.get(row.path);
assert.ok(source, `${row.path}: browser row proof source row missing`);
assert.ok(wasmNode, `${row.path}: browser row proof lacks WASM Node prerequisite`);
assert.equal(row.ini, source.ini, `${row.path}: browser row proof INI drift`);
assert.equal(row.family, posix.dirname(source.path), `${row.path}: browser row proof family drift`);
assert.equal(row.wasm_node_pass_ready, "1", `${row.path}: browser proof must consume Node-pass rows only`);
assert.equal(wasmNode.wasm_node_pass_ready, "1", `${row.path}: WASM Node prerequisite not ready`);
assert.equal(wasmNode.proof_status, "wasm_node_row_runtime_bridge_passed", `${row.path}: WASM Node prerequisite status drift`);
for (const field of [
"browser_runtime_bridge_ready",
"browser_worker_plan_executed",
"module_import_ready",
"callable_lookup_ready",
"generator_lifecycle_ready",
"ngc_remap_assets_ready",
"ngc_only_subpaths_guarded",
"interpreter_state_binding_ready",
"canonical_events_ready",
"row_runtime_transcript_ready",
"browser_pass_ready",
]) {
assert.equal(row[field], "1", `${row.path}: ${field} must be ready in browser row proof`);
}
assert.match(row.transcript_hash, /^[0-9a-f]{8}$/, `${row.path}: browser transcript hash drift`);
assert.ok(Number(row.transcript_phase_count) >= 3, `${row.path}: browser transcript phase count missing`);
assert.equal(row.execution_enabled, "0", `${row.path}: execution must remain disabled`);
assert.equal(row.promotion_allowed, "0", `${row.path}: promotion must remain disabled`);
assert.equal(row.proof_status, "browser_row_worker_bridge_passed", `${row.path}: browser proof status drift`);
assert.ok(row.blockers.includes("manual_promotion_lock"), `${row.path}: manual lock blocker missing`);
assert.ok(row.notes.includes("phase5_browser_row_proof_ready"), `${row.path}: Phase 5 proof note missing`);
}
return rows;
}
function pythonRemapRuntimeStdoutValues(nativeRuntimeProbeRows) {
const nativeRow = nativeRuntimeProbeRows.find((row) =>
row.boundary_class === "L4-PYTHON-REMAP" &&
@@ -5237,6 +5375,9 @@ function verifyPythonRemapRowRuntimeProofRows({
pythonRows,
bulkPlanRows,
nativeRuntimeProbeRows = [],
nativeRecords = [],
wasmNodeProofRows = [],
browserProofRows = [],
}) {
const expectedHeaders = [
"path",
@@ -5271,6 +5412,9 @@ function verifyPythonRemapRowRuntimeProofRows({
);
const pythonByPath = new Map(pythonRows.map((row) => [row.path, row]));
const bulkByPath = new Map(bulkPlanRows.map((row) => [row.path, row]));
const nativeByPath = new Map(nativeRecords.map((row) => [row.path, row]));
const wasmNodeByPath = new Map(wasmNodeProofRows.map((row) => [row.path, row]));
const browserByPath = new Map(browserProofRows.map((row) => [row.path, row]));
verifySamePathSet(
"wasm_python_remap_row_runtime_proof",
@@ -5293,6 +5437,15 @@ function verifyPythonRemapRowRuntimeProofRows({
row: source,
});
const rowReady = rowEvidence.ready;
const nativePassReady = rowReady && nativeByPath.get(row.path)?.status === "PASS";
const wasmNode = wasmNodeByPath.get(row.path);
const wasmNodePassReady = nativePassReady &&
wasmNode?.wasm_node_pass_ready === "1" &&
wasmNode?.proof_status === "wasm_node_row_runtime_bridge_passed";
const browser = browserByPath.get(row.path);
const browserPassReady = wasmNodePassReady &&
browser?.browser_pass_ready === "1" &&
browser?.proof_status === "browser_row_worker_bridge_passed";
for (const target of [
"ini_python_path_prepend",
"ini_python_toplevel",
@@ -5320,7 +5473,10 @@ function verifyPythonRemapRowRuntimeProofRows({
} else {
assert.equal(row.ngc_only_subpaths_not_standalone, "1", `${row.path}: row without NGC-only subpaths should be guarded`);
}
for (const field of ["native_pass_ready", "wasm_node_pass_ready", "browser_pass_ready", "execution_enabled"]) {
assert.equal(row.native_pass_ready, nativePassReady ? "1" : "0", `${row.path}: native pass proof drift`);
assert.equal(row.wasm_node_pass_ready, wasmNodePassReady ? "1" : "0", `${row.path}: WASM Node pass proof drift`);
assert.equal(row.browser_pass_ready, browserPassReady ? "1" : "0", `${row.path}: browser pass proof drift`);
for (const field of ["execution_enabled"]) {
assert.equal(row[field], "0", `${row.path}: ${field} must remain pending/disabled`);
}
assert.equal(row.python_modules_staged, rowReady ? "1" : "0", `${row.path}: module staging proof drift`);
@@ -5360,17 +5516,29 @@ function verifyPythonRemapRowRuntimeProofRows({
assert.equal(row.row_runtime_transcript_ready, rowReady ? "1" : "0", `${row.path}: transcript proof drift`);
assert.equal(
row.proof_status,
rowReady
? "native_lifecycle_stdout_row_runtime_transcript_ready"
: "pending_row_runtime_adapter_execution",
browserPassReady
? "browser_row_pass_ready"
: wasmNodePassReady
? "wasm_node_row_pass_ready"
: rowReady
? nativePassReady
? "native_summary_row_pass_ready"
: "native_lifecycle_stdout_row_runtime_transcript_ready"
: "pending_row_runtime_adapter_execution",
`${row.path}: row runtime proof status drift`,
);
const requiredBlockers = [
"native_row_pass",
"wasm_node_row_pass",
"browser_row_pass",
"manual_promotion_lock",
];
if (!browserPassReady) {
requiredBlockers.unshift("browser_row_pass");
}
if (!wasmNodePassReady) {
requiredBlockers.unshift("wasm_node_row_pass");
}
if (!nativePassReady) {
requiredBlockers.unshift("native_row_pass");
}
if (!rowReady) {
requiredBlockers.unshift("row_runtime_adapter_execution");
}
@@ -5381,6 +5549,23 @@ function verifyPythonRemapRowRuntimeProofRows({
assert.equal(row.blockers.includes("row_runtime_adapter_execution"), false, `${row.path}: ready row must clear row runtime execution blocker`);
assert.ok(row.notes.includes("row_transcript_ready_no_inventory_promotion"), `${row.path}: missing native lifecycle ready note`);
}
if (nativePassReady) {
assert.equal(row.blockers.includes("native_row_pass"), false, `${row.path}: native-pass row must clear native pass blocker`);
assert.ok(row.notes.includes("native_summary_row_pass_ready_no_inventory_promotion"), `${row.path}: missing native pass ready note`);
}
if (wasmNodePassReady) {
assert.equal(row.blockers.includes("wasm_node_row_pass"), false, `${row.path}: WASM-node-pass row must clear WASM Node blocker`);
assert.ok(row.notes.includes("wasm_node_row_runtime_bridge_passed_no_inventory_promotion"), `${row.path}: missing WASM Node proof ready note`);
assert.equal(wasmNode.ini, row.ini, `${row.path}: WASM Node proof INI mismatch`);
assert.equal(wasmNode.family, row.family, `${row.path}: WASM Node proof family mismatch`);
}
if (browserPassReady) {
assert.equal(row.blockers.includes("browser_row_pass"), false, `${row.path}: browser-pass row must clear browser blocker`);
assert.ok(row.notes.includes("browser_row_worker_bridge_passed_no_inventory_promotion"), `${row.path}: missing browser proof ready note`);
assert.equal(browser.ini, row.ini, `${row.path}: browser proof INI mismatch`);
assert.equal(browser.family, row.family, `${row.path}: browser proof family mismatch`);
assert.ok(row.blockers.includes("manual_promotion_lock"), `${row.path}: browser proof must keep manual lock blocker`);
}
assert.ok(row.notes.includes("row_runtime_port_api_ready"), `${row.path}: missing row runtime API note`);
assert.ok(row.notes.includes("row_runtime_plan_ready"), `${row.path}: missing row runtime plan note`);
assert.equal(bulk.execution_enabled, "0", `${row.path}: bulk plan execution flag drift`);
@@ -5390,6 +5575,20 @@ function verifyPythonRemapRowRuntimeProofRows({
return parsedRows;
}
function pythonRemapInventoryPromotionPathSet(rows) {
assert.equal(rows.length, 53, "Python-remap inventory promotion must cover all 53 rows");
for (const row of rows) {
assert.equal(row.native_pass_ready, "1", `${row.path}: native pass proof is required before inventory promotion`);
assert.equal(row.wasm_node_pass_ready, "1", `${row.path}: WASM Node proof is required before inventory promotion`);
assert.equal(row.browser_pass_ready, "1", `${row.path}: browser proof is required before inventory promotion`);
assert.equal(row.row_runtime_transcript_ready, "1", `${row.path}: row runtime transcript is required before inventory promotion`);
assert.equal(row.proof_status, "browser_row_pass_ready", `${row.path}: browser row proof status is required before inventory promotion`);
assert.equal(row.execution_enabled, "0", `${row.path}: row proof artifact must remain non-executing evidence`);
assert.ok(row.blockers.includes("manual_promotion_lock"), `${row.path}: manual promotion lock review evidence is required`);
}
return new Set(rows.map((row) => row.path));
}
function runtimeBoundaryNativeAlignmentSummaryRows({
userMRows,
toolDbRows,
@@ -5763,6 +5962,15 @@ function boundaryPhaseCompletionSummaryRows({
const blockedFamiliesUnpromotedOk = hardBlockedRows.every((row) => {
const tracked = trackedByPath.get(row.path);
const inventory = inventoryByPath.get(row.path);
if (
row.blocked === "L4-PYTHON-REMAP" &&
tracked?.layer4Node === "INV" &&
tracked?.layer4Browser === "-" &&
inventory?.inventoryStatus === "PASS" &&
inventory.reason === "-"
) {
return true;
}
if (
row.blocked === "L4-TOOL-DB" &&
row.path === "axis/db_demo/base.ngc" &&
@@ -6715,7 +6923,7 @@ function verifyBoundaryPhaseCompletionSummaryRows(rows) {
const rowByCriterion = new Map(parsedRows.map((row) => [row.criterion, row]));
assert.equal(
rowByCriterion.get("wasm_inventory_artifact_documentation_coverage")?.count,
"57",
"59",
"WASM artifact documentation completion count must match generated artifact baseline",
);
assert.equal(
@@ -9468,7 +9676,7 @@ function verifyGeneratedArtifactDocumentationCoverage({
);
assert.equal(
artifactNames.length,
57,
59,
"generated sim-config inventory artifact list count drift",
);
assert.deepEqual(
@@ -9489,6 +9697,7 @@ function verifyGeneratedArtifactDocumentationCoverage({
"next-boundary-worklist.tsv",
"promotion-candidates.tsv",
"python-remap-boundary-summary.tsv",
"python-remap-browser-row-proof.tsv",
"python-remap-bulk-promotion-plan.tsv",
"python-remap-family-summary.tsv",
"python-remap-native-runtime-alignment.tsv",
@@ -9499,6 +9708,7 @@ function verifyGeneratedArtifactDocumentationCoverage({
"python-remap-row-runtime-proof.tsv",
"python-remap-runtime-contract.tsv",
"python-remap-runtime-gates.tsv",
"python-remap-wasm-node-row-proof.tsv",
"runtime-boundary-contract-summary.tsv",
"runtime-boundary-family-host-readiness.tsv",
"runtime-boundary-host-preflight.tsv",
@@ -9565,7 +9775,7 @@ function verifyGeneratedArtifactDocumentationCoverage({
"generated sim-config inventory artifacts must be listed in browser smoke",
);
assert.ok(
browserSmokeText.includes("wasmArtifactNames.length !== 57"),
browserSmokeText.includes("wasmArtifactNames.length !== 59"),
"browser smoke must keep generated WASM artifact fixed-count guard",
);
assert.ok(
@@ -12701,6 +12911,59 @@ const pythonRemapNativeRuntimeFixturePlanRecords = verifyPythonRemapNativeRuntim
const nativeRuntimeProbeSourceRecords = existsSync(nativeRuntimeProbeSummarySourcePath)
? parseTsv(readFileSync(nativeRuntimeProbeSummarySourcePath, "utf8"))
: [];
const pythonRemapWasmNodeRowProofSourceRecords = existsSync(pythonRemapWasmNodeRowProofPath)
? parseTsv(readFileSync(pythonRemapWasmNodeRowProofPath, "utf8"), [
"path",
"ini",
"family",
"native_pass_ready",
"wasm_node_runtime_bridge_ready",
"wasm_node_plan_executed",
"module_import_ready",
"callable_lookup_ready",
"generator_lifecycle_ready",
"ngc_remap_assets_ready",
"ngc_only_subpaths_guarded",
"interpreter_state_binding_ready",
"canonical_events_ready",
"row_runtime_transcript_ready",
"transcript_phase_count",
"transcript_hash",
"wasm_node_pass_ready",
"browser_pass_ready",
"execution_enabled",
"promotion_allowed",
"proof_status",
"blockers",
"notes",
])
: [];
const pythonRemapBrowserRowProofSourceRecords = existsSync(pythonRemapBrowserRowProofPath)
? parseTsv(readFileSync(pythonRemapBrowserRowProofPath, "utf8"), [
"path",
"ini",
"family",
"wasm_node_pass_ready",
"browser_runtime_bridge_ready",
"browser_worker_plan_executed",
"module_import_ready",
"callable_lookup_ready",
"generator_lifecycle_ready",
"ngc_remap_assets_ready",
"ngc_only_subpaths_guarded",
"interpreter_state_binding_ready",
"canonical_events_ready",
"row_runtime_transcript_ready",
"transcript_phase_count",
"transcript_hash",
"browser_pass_ready",
"execution_enabled",
"promotion_allowed",
"proof_status",
"blockers",
"notes",
])
: [];
const pythonRemapNativeRuntimeProbeGateRowsGenerated =
pythonRemapNativeRuntimeProbeGateRows({
fixturePlanRows: pythonRemapNativeRuntimeFixturePlanRecords,
@@ -12726,17 +12989,35 @@ const pythonRemapBulkPromotionPlanRecords = verifyPythonRemapBulkPromotionPlanRo
familyRows: pythonRemapFamilyRecords,
contractRows: pythonRemapRuntimeContractRecords,
});
const pythonRemapWasmNodeRowProofRecords = verifyPythonRemapWasmNodeRowProofRecords({
rows: pythonRemapWasmNodeRowProofSourceRecords,
pythonRows: pythonRemapBoundarySummaryRecords,
});
const pythonRemapBrowserRowProofRecords = verifyPythonRemapBrowserRowProofRecords({
rows: pythonRemapBrowserRowProofSourceRecords,
pythonRows: pythonRemapBoundarySummaryRecords,
wasmNodeRows: pythonRemapWasmNodeRowProofRecords,
});
const pythonRemapRowRuntimeProofRowsGenerated = pythonRemapRowRuntimeProofRows({
pythonRows: pythonRemapBoundarySummaryRecords,
bulkPlanRows: pythonRemapBulkPromotionPlanRecords,
nativeRuntimeProbeRows: nativeRuntimeProbeSourceRecords,
nativeRecords,
wasmNodeProofRows: pythonRemapWasmNodeRowProofRecords,
browserProofRows: pythonRemapBrowserRowProofRecords,
});
const pythonRemapRowRuntimeProofRecords = verifyPythonRemapRowRuntimeProofRows({
rows: pythonRemapRowRuntimeProofRowsGenerated,
pythonRows: pythonRemapBoundarySummaryRecords,
bulkPlanRows: pythonRemapBulkPromotionPlanRecords,
nativeRuntimeProbeRows: nativeRuntimeProbeSourceRecords,
nativeRecords,
wasmNodeProofRows: pythonRemapWasmNodeRowProofRecords,
browserProofRows: pythonRemapBrowserRowProofRecords,
});
const promotedPythonRemapInventoryPaths = pythonRemapInventoryPromotionPathSet(
pythonRemapRowRuntimeProofRecords,
);
const summaryRows = [];
const skipReasonCounts = new Map();
@@ -12801,7 +13082,7 @@ function verifyInventorySummaryRows(rows, trackedMatrixByPath) {
}
}
function verifySkipSummaryRows(rows, expectedSkipped, nativeRecords, pathMatrixByPath) {
function verifySkipSummaryRows(rows, expectedSkipped, nativeRecords, pathMatrixByPath, promotedPythonRemapPaths = new Set()) {
const allowedSkipReasons = new Set([
"ASSET-ONLY",
"L4-PYTHON-REMAP",
@@ -12831,6 +13112,9 @@ function verifySkipSummaryRows(rows, expectedSkipped, nativeRecords, pathMatrixB
if (!reason) {
continue;
}
if (reason === "L4-PYTHON-REMAP" && promotedPythonRemapPaths.has(record.path)) {
continue;
}
expectedCounts.set(reason, (expectedCounts.get(reason) ?? 0) + 1);
}
@@ -12841,7 +13125,7 @@ function verifySkipSummaryRows(rows, expectedSkipped, nativeRecords, pathMatrixB
);
}
function verifyHardBlockedInventorySkips(rows, pathMatrixByPath) {
function verifyHardBlockedInventorySkips(rows, pathMatrixByPath, promotedPythonRemapPaths = new Set()) {
const hardBlockedKinds = new Set([
"L4-PYTHON-REMAP",
"L4-TOOL-DB",
@@ -12859,6 +13143,11 @@ function verifyHardBlockedInventorySkips(rows, pathMatrixByPath) {
}
const row = byPath.get(path);
assert.ok(row, `${path}: hard-blocked inventory row missing`);
if (reason === "L4-PYTHON-REMAP" && promotedPythonRemapPaths.has(path)) {
assert.equal(row.inventoryStatus, "PASS", `${path}: promoted Python-remap row must pass inventory`);
assert.equal(row.reason, "-", `${path}: promoted Python-remap row must clear skip reason`);
continue;
}
assert.equal(row.inventoryStatus, "SKIP", `${path}: blocked row must stay skipped`);
assert.equal(row.reason, reason, `${path}: blocked row skip reason drift`);
}
@@ -13144,7 +13433,7 @@ function verifyPromotionCandidateRows(rows, summaryRows, boundaryRows) {
0,
"current baseline has no direct skipped-main inventory promotion candidate",
);
for (const lockedKind of ["L4-PYTHON-REMAP", "L4-USER-M-PROCESS", "UPSTREAM-DEMO"]) {
for (const lockedKind of ["L4-USER-M-PROCESS", "UPSTREAM-DEMO"]) {
const lockedRows = parsedInventoryReady.filter((row) => row.skip_kind === lockedKind);
assert.ok(lockedRows.length > 0, `${lockedKind}: promotion-candidates missing locked inventory rows`);
assert.equal(
@@ -13153,6 +13442,11 @@ function verifyPromotionCandidateRows(rows, summaryRows, boundaryRows) {
`${lockedKind}: locked inventory rows must not allow promotion`,
);
}
assert.equal(
parsedInventoryReady.filter((row) => row.skip_kind === "L4-PYTHON-REMAP").length,
0,
"Python-remap rows must leave skipped promotion candidates after row proof promotion",
);
for (const row of parsedEvidenceReady) {
assert.equal(row.current_status, "PASS", `${row.path}: evidence-ready row must be a current inventory PASS`);
assert.equal(row.skip_kind, "-", `${row.path}: evidence-ready row must not have a skip kind`);
@@ -13188,6 +13482,21 @@ function verifyPromotionCandidateRows(rows, summaryRows, boundaryRows) {
for (const record of nativeRecords) {
const skipReason = blockedKind(record, pathMatrixByPath);
if (skipReason === "L4-PYTHON-REMAP" && promotedPythonRemapInventoryPaths.has(record.path)) {
executed += 1;
passed += 1;
summaryRows.push(
[
record.path,
"PASS",
"-",
record.class,
record.status,
record.expected_failure || "-",
].join("\t"),
);
continue;
}
if (skipReason) {
recordSkip(skipReason);
summaryRows.push(
@@ -13292,7 +13601,7 @@ assert.equal(
"Node inventory skip-summary counts must match skipped row count",
);
verifyInventorySummaryRows(summaryRows, trackedMatrixByPath);
verifyHardBlockedInventorySkips(summaryRows, pathMatrixByPath);
verifyHardBlockedInventorySkips(summaryRows, pathMatrixByPath, promotedPythonRemapInventoryPaths);
verifyTrackedBaselineText(
trackedMatrixText,
nativeRecords,
@@ -13656,7 +13965,7 @@ writeFileSync(
const skipSummaryRows = [...skipReasonCounts.entries()]
.sort(([left], [right]) => left.localeCompare(right))
.map(([reason, count]) => `${reason}\t${count}`);
verifySkipSummaryRows(skipSummaryRows, skipped, nativeRecords, pathMatrixByPath);
verifySkipSummaryRows(skipSummaryRows, skipped, nativeRecords, pathMatrixByPath, promotedPythonRemapInventoryPaths);
writeFileSync(
skipSummaryPath,
`${[
@@ -14519,6 +14828,116 @@ writeFileSync(
].join("\n")}\n`,
);
writeFileSync(
pythonRemapWasmNodeRowProofPath,
`${[
[
"path",
"ini",
"family",
"native_pass_ready",
"wasm_node_runtime_bridge_ready",
"wasm_node_plan_executed",
"module_import_ready",
"callable_lookup_ready",
"generator_lifecycle_ready",
"ngc_remap_assets_ready",
"ngc_only_subpaths_guarded",
"interpreter_state_binding_ready",
"canonical_events_ready",
"row_runtime_transcript_ready",
"transcript_phase_count",
"transcript_hash",
"wasm_node_pass_ready",
"browser_pass_ready",
"execution_enabled",
"promotion_allowed",
"proof_status",
"blockers",
"notes",
].join("\t"),
...pythonRemapWasmNodeRowProofRecords.map((row) => [
row.path,
row.ini,
row.family,
row.native_pass_ready,
row.wasm_node_runtime_bridge_ready,
row.wasm_node_plan_executed,
row.module_import_ready,
row.callable_lookup_ready,
row.generator_lifecycle_ready,
row.ngc_remap_assets_ready,
row.ngc_only_subpaths_guarded,
row.interpreter_state_binding_ready,
row.canonical_events_ready,
row.row_runtime_transcript_ready,
row.transcript_phase_count,
row.transcript_hash,
row.wasm_node_pass_ready,
row.browser_pass_ready,
row.execution_enabled,
row.promotion_allowed,
row.proof_status,
row.blockers,
row.notes,
].map(tsvValue).join("\t")),
].join("\n")}\n`,
);
writeFileSync(
pythonRemapBrowserRowProofPath,
`${[
[
"path",
"ini",
"family",
"wasm_node_pass_ready",
"browser_runtime_bridge_ready",
"browser_worker_plan_executed",
"module_import_ready",
"callable_lookup_ready",
"generator_lifecycle_ready",
"ngc_remap_assets_ready",
"ngc_only_subpaths_guarded",
"interpreter_state_binding_ready",
"canonical_events_ready",
"row_runtime_transcript_ready",
"transcript_phase_count",
"transcript_hash",
"browser_pass_ready",
"execution_enabled",
"promotion_allowed",
"proof_status",
"blockers",
"notes",
].join("\t"),
...pythonRemapBrowserRowProofRecords.map((row) => [
row.path,
row.ini,
row.family,
row.wasm_node_pass_ready,
row.browser_runtime_bridge_ready,
row.browser_worker_plan_executed,
row.module_import_ready,
row.callable_lookup_ready,
row.generator_lifecycle_ready,
row.ngc_remap_assets_ready,
row.ngc_only_subpaths_guarded,
row.interpreter_state_binding_ready,
row.canonical_events_ready,
row.row_runtime_transcript_ready,
row.transcript_phase_count,
row.transcript_hash,
row.browser_pass_ready,
row.execution_enabled,
row.promotion_allowed,
row.proof_status,
row.blockers,
row.notes,
].map(tsvValue).join("\t")),
].join("\n")}\n`,
);
writeFileSync(
runtimeBoundaryContractSummaryPath,
`${[