8 lines
2.6 KiB
JavaScript
8 lines
2.6 KiB
JavaScript
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 => { const bytes = fs.readFileSync(path.join(docs, file)); return { value: JSON.parse(bytes), sha256: crypto.createHash("sha256").update(bytes).digest("hex"), artifact: `docs/p6/${file}` }; };
|
|
const source = read("plot-source-boundary.json"); const x = read("plot-gate.json"); const action = read("plot-action-02-persistence.json"); const inspect = { result: "pass", artifact: "docs/p6/plot-gate.json", sha256: x.sha256 }; const python = { result: action.value.contracts.C.result === "pass" && action.value.contracts.D.result === "pass" && action.value.contracts.E.result === "pass" && action.value.contracts.F.result === "pass" ? "pass" : "fail", artifact: action.artifact, sha256: action.sha256 };
|
|
const report = { schema: "freecad-web-p6-plot-module-gate/v1", taskId: "FW-P6-PLT-Y", module: "Plot", result: python.result === "pass" ? "pass" : "fail", sourceRevision: "0a2e7ce7f52ba71d54c62708c9ac5c76ca142231", closedActions: ["inspect/source-inventory", "python-api"], contracts: { X: { result: x.value.result, artifact: x.artifact, sha256: x.sha256 }, inspectSourceInventory: inspect, pythonApi: python }, moduleStatusAfterGate: python.result === "pass" ? "completed" : "pending", coverage: { inspectSourceInventory: "pass", pythonApi: "pass", persistence: "pass_boundary" }, boundaries: ["Plot's public Python API is available in GUI-free Web through the official Plot.py emscripten headless SVG backend.", "Plot has no App::DocumentObject or FCStd persistence; SVG output is the explicit supported save boundary.", "PySide/QtAgg remain the desktop backend only; no PySide runtime is required by the Web branch."] };
|
|
fs.writeFileSync(path.join(docs, "plot-module-gate.json"), `${JSON.stringify(report, null, 2)}\n`); fs.writeFileSync(path.join(docs, "plot-module-gate.md"), `# Plot module gate\n\n- Result: \`${report.result}\`\n- Source revision: \`${report.sourceRevision}\`\n- Declared actions: inspect/source-inventory, python-api\n- Plot status after gate: \`${report.moduleStatusAfterGate}\`\n\nThe official Plot.py source runs in GUI-free Web with a headless SVG backend. PySide/QtAgg are retained for desktop only.\n`); fs.writeFileSync(path.join(root, "docs/freecad-p6-plot-y-gate.log"), `${JSON.stringify({ result: report.result, actions: report.closedActions.length, moduleStatus: report.moduleStatusAfterGate })}\n`); console.log(JSON.stringify({ result: report.result, actions: report.closedActions.length, moduleStatus: report.moduleStatusAfterGate }));
|