Files
FreeCADWasmDev/tools/run_p6_jtreader_module_gate.mjs
wangdequan 9a7c4f0335 Save FreeCAD Web workspace sources and user validation evidence
IFC native binding remains incomplete; preserve accurate test results.
2026-09-15 22:01:58 +08:00

34 lines
2.5 KiB
JavaScript

#!/usr/bin/env node
import crypto from "node:crypto";
import fs from "node:fs";
import path from "node:path";
const root = path.resolve(path.dirname(new URL(import.meta.url).pathname), "..");
const docs = path.join(root, "docs/p6");
const read = (file) => JSON.parse(fs.readFileSync(path.join(docs, file), "utf8"));
const hash = (file) => crypto.createHash("sha256").update(fs.readFileSync(path.join(docs, file))).digest("hex");
const contracts = {
firstSlice: { taskId: "FW-P6-JTR-X", artifact: "jtreader-gate.json", result: read("jtreader-gate.json").result },
inspectSourceInventory: { taskId: "FW-P6-JTR-ACT-02", artifact: "jtreader-action-02-persistence.json", result: read("jtreader-action-02-persistence.json").result },
saveReopen: { taskId: "FW-P6-JTR-ACT-03", artifact: "jtreader-action-03-save-reopen.json", result: read("jtreader-action-03-save-reopen.json").result },
};
const status = Object.values(contracts).every((item) => item.result === "pass" || item.result === "pass_boundary") ? "pass" : "fail";
const report = {
schema: "freecad-web-p6-jtreader-module-gate/v1",
taskId: "FW-P6-JTR-Y",
module: "JtReader",
status,
sourceRevision: "4f4e9244e613ea2df06e70027074a562695048cb",
contracts: Object.fromEntries(Object.entries(contracts).map(([name, item]) => [name, { ...item, sha256: hash(item.artifact) }])),
moduleStatusAfterGate: status === "pass" ? "completed" : "pending",
boundaries: [
"The first slice, inspect/source-inventory, and save/reopen each have independent evidence.",
"Only the deterministic JtReader fixtures are covered; unsupported GUI and cross-version migration remain out of scope.",
"No release, legal, performance, or non-Chrome compatibility claim is made.",
],
};
fs.writeFileSync(path.join(docs, "jtreader-module-gate.json"), `${JSON.stringify(report, null, 2)}\n`);
fs.writeFileSync(path.join(docs, "jtreader-module-gate.md"), `# JtReader module gate\n\n- Result: \`${status}\`\n- Source revision: \`${report.sourceRevision}\`\n- Declared actions: create/recompute, inspect/source-inventory, save/reopen\n- JtReader status after gate: \`${report.moduleStatusAfterGate}\`\n\nAll declared JtReader actions have independent conclusions; read-only persistence boundaries are explicit.\n`);
fs.writeFileSync(path.join(root, "docs/freecad-p6-jtreader-y-gate.log"), `${JSON.stringify({ result: status, actions: Object.keys(contracts).length, moduleStatus: report.moduleStatusAfterGate })}\n`);
console.log(JSON.stringify({ result: status, actions: Object.keys(contracts).length, moduleStatus: report.moduleStatusAfterGate }));