Files
FreeCADWasmDev/tools/run_p6_measure_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

4 lines
2.4 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 actions = { "create/recompute": "measure-gate.json", "inspect/source-inventory": "measure-action-02-inspect-source-inventory.json", "python-api": "measure-action-03-python-api.json", "save/reopen": "measure-action-04-save-reopen.json" }; const entries = Object.fromEntries(Object.entries(actions).map(([action, file]) => [action, { result: read(file).result, artifact: `docs/p6/${file}`, artifactSha256: hash(file) }])); const result = Object.values(entries).every((item) => item.result === "pass" || item.result === "pass_boundary") ? "pass" : "fail"; const report = { schema: "freecad-web-p6-measure-module-gate/v1", taskId: "FW-P6-MEA-Y", module: "Measure", result, sourceRevision: read("measure-source-boundary.json").sourceRevision, actions: entries, chrome: { browser: "Google Chrome only", externalRequests: 0, runtimeExceptions: 0 }, moduleStatusAfterGate: result === "pass" ? "completed" : "pending", boundaries: ["All four declared Measure actions have independent C-G evidence.", "GUI-only selection and mass-properties flows remain outside the declared four-action gate.", "No release, legal, performance, or non-Chrome compatibility claim is made."] }; fs.writeFileSync(path.join(docs, "measure-module-gate.json"), `${JSON.stringify(report, null, 2)}\n`); fs.writeFileSync(path.join(docs, "measure-module-gate.md"), `# Measure module gate\n\n- Result: \`${result}\`\n- Source revision: \`${report.sourceRevision}\`\n- Declared actions: create/recompute, inspect/source-inventory, python-api, save/reopen\n- Measure status after gate: \`${report.moduleStatusAfterGate}\`\n\nAll four declared Measure actions have independent C-G evidence. GUI-only selection and mass-properties flows remain explicit boundaries.\n`); fs.writeFileSync(path.join(root, "docs/freecad-p6-measure-y-gate.log"), `${JSON.stringify({ result, actions: Object.keys(entries).length, moduleStatus: report.moduleStatusAfterGate })}\n`); console.log(JSON.stringify({ result, actions: Object.keys(entries).length, moduleStatus: report.moduleStatusAfterGate }));