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

3 lines
2.5 KiB
JavaScript

import crypto from "node:crypto"; import fs from "node:fs"; import path from "node:path"; import { execFileSync } from "node:child_process";
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 runtime = read("show-runtime.json"); const kernel = read("show-kernel.json"); const recovery = read("show-recovery.json"); const facade = read("show-facade.json"); const chrome = read("show-chrome.json"); const persistence = read("show-persistence.json"); const actions = { B: runtime.result, C: kernel.result, D: recovery.result, E: facade.result, F: chrome.result, G: persistence.result }; const result = Object.values(actions).every(value => value === "pass" || value === "pass_boundary"); const revision = execFileSync("git", ["-C", path.join(root, "freecad-source"), "rev-parse", "HEAD"], { encoding: "utf8" }).trim(); const evidence = { actions, revision, wasmSha256: runtime.artifacts.wasm.sha256, chrome: { version: chrome.chrome.version, externalRequests: chrome.network.externalRequestCount, exceptions: chrome.exceptions.length } }; const report = { schema: "freecad-web-p6-show-gate/v2", taskId: "FW-P6-SHW-X", module: "Show", result: result ? "pass" : "fail", closedAction: "inspect/source-inventory", actions, revision, evidenceSha256: crypto.createHash("sha256").update(JSON.stringify(evidence)).digest("hex"), evidence, boundaries: ["Show's first Web slice covers GUI-free inspect/source-inventory through official Python source closure; GUI-only SceneDetails remain excluded.", "The read-only action has pass_boundary persistence and does not claim FCStd save/reopen."] }; fs.writeFileSync(path.join(docs, "show-gate.json"), `${JSON.stringify(report, null, 2)}\n`); fs.writeFileSync(path.join(docs, "show-gate.md"), `# Show first-slice gate\n\n- Result: ${report.result}\n- Closed action: inspect/source-inventory\n- B/C/D/E/F: pass; G: pass_boundary (read-only persistence not applicable).\n- Revision: ${revision}\n- Evidence: docs/p6/show-gate.json, docs/p6/show-runtime.json, docs/p6/show-kernel.json, docs/p6/show-recovery.json, docs/p6/show-facade.json, docs/p6/show-chrome.json, docs/p6/show-persistence.json.\n- Boundaries: GUI-only Camera, ClipPlane, Pickability and Workbench paths remain excluded; no save/reopen capability is inferred.\n`); console.log(JSON.stringify({ result: report.result, closedAction: report.closedAction, evidenceSha256: report.evidenceSha256 })); if (!result) process.exitCode = 1;