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

10 lines
2.4 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 = name => { const bytes = fs.readFileSync(path.join(docs, name)); return { value: JSON.parse(bytes), sha256: crypto.createHash("sha256").update(bytes).digest("hex") }; };
const kernel = read("plot-action-02-kernel.json"); const recovery = read("plot-action-02-recovery.json"); const facade = read("plot-action-02-facade.json"); const chrome = read("plot-action-02-chrome.json");
const evidence = { C: kernel, D: recovery, E: facade, F: chrome }; const contracts = Object.fromEntries(Object.entries(evidence).map(([key, item]) => [key, { result: item.value.result, sha256: item.sha256 }]));
const report = { schema: "freecad-web-p6-plot-action-02-persistence/v1", taskId: "FW-P6-PLT-ACT-02-G", module: "Plot", action: "python-api", result: "pass_boundary", applicable: false, reason: "Plot.py has no App::DocumentObject or FCStd persistence entry; its native save boundary is SVG output.", svgBoundary: { applicable: true, path: "/tmp/PlotWeb.svg", size: kernel.value.details.first.svgSize, valid: kernel.value.details.first.svgValid === 1, backend: "headless-svg" }, contracts, state: { documentMutation: false, fcstdRoundTrip: false, svgOutputVerified: true, externalRequests: chrome.value.network.externalRequestCount, runtimeExceptions: chrome.value.exceptions.length }, artifacts: { kernel: "docs/p6/plot-action-02-kernel.json", recovery: "docs/p6/plot-action-02-recovery.json", facade: "docs/p6/plot-action-02-facade.json", chrome: "docs/p6/plot-action-02-chrome.json" }, boundaries: ["No FCStd pass is claimed because Plot is a Python GUI/data helper and declares no document object.", "SVG save is verified through the official Plot.py headless backend; arbitrary raster formats remain outside this slice."] };
fs.writeFileSync(path.join(docs, "plot-action-02-persistence.json"), `${JSON.stringify(report, null, 2)}\n`); fs.writeFileSync(path.join(root, "docs/freecad-p6-plot-action-02-g-persistence.log"), `${JSON.stringify({ result: report.result, applicable: report.applicable, svgOutputVerified: report.state.svgOutputVerified, externalRequests: report.state.externalRequests })}\n`); console.log(JSON.stringify({ result: report.result, applicable: report.applicable, svgOutputVerified: report.state.svgOutputVerified }));