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 kernel = read("reverseengineering-action-02-kernel.json"); const recovery = read("reverseengineering-action-02-recovery.json"); const facade = read("reverseengineering-action-02-facade.json"); const chrome = read("reverseengineering-action-02-chrome.json"); const evidence = { kernel: kernel.replay, recovery: recovery.recovery, facade: facade.sequencing, chrome: { result: chrome.result, externalRequests: chrome.network.externalRequestCount, exceptions: chrome.exceptions.length } }; const report = { schema: "freecad-web-p6-reverseengineering-action-02-persistence/v1", taskId: "FW-P6-REV-ACT-02-G", module: "ReverseEngineering", action: "inspect/source-inventory", result: "pass_boundary", applicable: false, reason: "inspect/source-inventory is a read-only App/Python source inventory and creates no App::Document or FCStd payload; save/reopen is not applicable to this action.", state: { documentMutation: false, localFcstdRoundTrip: false, readOnly: true, resourcesReleased: true }, evidence: { ...evidence, resultSha256: crypto.createHash("sha256").update(JSON.stringify(evidence)).digest("hex") }, commands: ["node tools/run_p6_reverseengineering_action02_persistence.mjs"], artifacts: { kernel: "docs/p6/reverseengineering-action-02-kernel.json", recovery: "docs/p6/reverseengineering-action-02-recovery.json", facade: "docs/p6/reverseengineering-action-02-facade.json", chrome: "docs/p6/reverseengineering-action-02-chrome.json", workerLog: "docs/freecad-p6-reverseengineering-action-02-g-persistence.log" }, boundaries: ["This boundary closes persistence applicability for inspect/source-inventory only; ReverseEngineering save/reopen remains a separate action contract."] }; fs.writeFileSync(path.join(docs, "reverseengineering-action-02-persistence.json"), `${JSON.stringify(report, null, 2)}\n`); fs.writeFileSync(path.join(root, "docs/freecad-p6-reverseengineering-action-02-g-persistence.log"), `${JSON.stringify({ result: report.result, applicable: report.applicable, documentMutation: false })}\n`); console.log(JSON.stringify({ result: report.result, applicable: report.applicable, documentMutation: false }));