diff --git a/text10.txt b/text10.txt index 48cdaec..799fa50 100644 --- a/text10.txt +++ b/text10.txt @@ -1540,6 +1540,72 @@ browser_interp_smoke=ok 抽取为纯 helper 并接入 `verify_ui_node_smokes.sh`;保持 helper 只描述 host/runtime 边界, 不扩展 CNC 语义。 +二十四、2026-06-14 继续执行记录:INI panel machine file summary helper + +本轮继续沿 OPFS/session/UI boundary 推进,把 INI panel 的 machine text file save/load +日志构造收敛为纯 helper,并接入 UI Node smoke。 + +完成内容: + +- 新增 `wasm-port/runtime/ui/ini-panel/machine-file-summary.js`; +- 导出: + - `createMachineFileSaveSummary(paths, gcodePath)`; + - `machineFileSaveLogLines(summary)`; + - `createMachineFileLoadSummary(files)`; + - `machineFileLoadLogLines(summary)`; +- helper 只聚合 OPFS/staging boundary facts: + - INI/tool/parameter/G-code OPFS path; + - INI/tool/parameter loaded text length; +- `wasm-port/runtime/ui/ini-panel/app.js` 的 `Save Machine Files` 和 `Load Machine Files` + 日志改为复用该 helper; +- 新增 `wasm-port/tests/ui/node/verify_ini_panel_machine_file_summary.mjs` 和 shell wrapper; +- `wasm-port/tests/ui/node/verify_ui_node_smokes.sh` 现在覆盖 run/session/machine-file + 三组 UI helper; +- 未改变 UI runtime、OPFS bridge、interpreter run API、G-code 文本、canonical-event 输出 + 或 LinuxCNC-owned runtime semantics。 + +验证已通过: + +```bash +git diff --check +wasm-port/tests/ui/node/verify_ini_panel_machine_file_summary.sh +wasm-port/tests/ui/node/verify_ui_node_smokes.sh +wasm-port/tools/verify_vendor_sync.sh +wasm-port/tools/verify_no_standalone_cnc_semantics.sh +SKIP_INTERP_BUILD=1 wasm-port/tests/wasm/node/verify_interp_wasm.sh +SKIP_INTERP_BUILD=1 wasm-port/tests/wasm/node/verify_sim_configs_inventory_wasm.sh +wasm-port/tests/opfs/node/verify_file_service.sh +SKIP_INI_BUILD=1 SKIP_INTERP_BUILD=1 wasm-port/tests/browser/verify_ini_panel_browser.sh +SKIP_INI_BUILD=1 SKIP_INTERP_BUILD=1 wasm-port/tests/browser/verify_interp_browser.sh +wasm-port/tests/host/verify_host_smokes.sh +``` + +关键输出: + +```text +ini_panel_machine_file_summary_node_smoke=ok +ini_panel_run_summary_node_smoke=ok +ini_panel_session_summary_node_smoke=ok +ui_node_smokes=ok +vendor sync up to date +standalone CNC semantics guard complete +interp_wasm_node_smoke=ok +sim_configs_wasm_node_inventory_executed=28 +sim_configs_wasm_node_inventory_passed=28 +sim_configs_wasm_node_inventory_skipped=131 +sim_configs_wasm_node_inventory_unexpected_fail=0 +opfs_file_service_node_smoke=ok +browser_ini_opfs_smoke=ok +browser_interp_smoke=ok +host_wasm_opfs_browser_smokes=ok +``` + +下一步建议: + +继续沿 OPFS/session/UI boundary 推进。优先把 machine file helper 补入 UI helper docs +索引或独立文档,确保新 helper 和 `verify_ui_node_smokes.sh` 的关系可发现;仍只做 +host/runtime boundary 文档和测试 glue,不扩展 CNC 语义。 + 二十二、2026-06-14 继续执行记录:INI panel session load summary helper 本轮继续沿 OPFS/session/UI boundary 推进,把 machine session load 的 OPFS/WASM 映射 diff --git a/wasm-port/runtime/ui/ini-panel/app.js b/wasm-port/runtime/ui/ini-panel/app.js index 5d74087..a09f24d 100644 --- a/wasm-port/runtime/ui/ini-panel/app.js +++ b/wasm-port/runtime/ui/ini-panel/app.js @@ -22,6 +22,12 @@ import { loadMachineSessionSnapshot, saveMachineSessionSnapshot, } from "../../opfs/snapshot-store.js"; +import { + createMachineFileLoadSummary, + createMachineFileSaveSummary, + machineFileLoadLogLines, + machineFileSaveLogLines, +} from "./machine-file-summary.js"; import { createRunSummary, summarizeRunResult, @@ -546,13 +552,11 @@ document.getElementById("save-machine-files").addEventListener("click", async () parameters: DEFAULT_PARAMETERS, }); const gcodePath = await saveGcodeProgram(UI_SESSION.defaultGcodeFilename, DEFAULT_GCODE); + const summary = createMachineFileSaveSummary(paths, gcodePath); setLog( [ "Saved machine text files to OPFS.", - `INI: ${paths.ini}`, - `Tool table: ${paths.toolTable}`, - `Parameters: ${paths.parameters}`, - `G-code: ${gcodePath}`, + ...machineFileSaveLogLines(summary), ].join("\n"), ); } catch (error) { @@ -765,12 +769,11 @@ document.getElementById("load-machine-files").addEventListener("click", async () try { const files = await loadMachineTextFiles(MACHINE_ID); editor.value = files.ini; + const summary = createMachineFileLoadSummary(files); setLog( [ "Loaded machine text files from OPFS.", - `INI bytes: ${files.ini.length}`, - `Tool table bytes: ${files.toolTable.length}`, - `Parameter bytes: ${files.parameters.length}`, + ...machineFileLoadLogLines(summary), ].join("\n"), ); } catch (error) { diff --git a/wasm-port/runtime/ui/ini-panel/machine-file-summary.js b/wasm-port/runtime/ui/ini-panel/machine-file-summary.js new file mode 100644 index 0000000..6259b30 --- /dev/null +++ b/wasm-port/runtime/ui/ini-panel/machine-file-summary.js @@ -0,0 +1,33 @@ +export function createMachineFileSaveSummary(paths, gcodePath = null) { + return { + iniOpfsPath: paths?.ini ?? null, + toolTableOpfsPath: paths?.toolTable ?? null, + parameterOpfsPath: paths?.parameters ?? null, + gcodeOpfsPath: gcodePath ?? null, + }; +} + +export function machineFileSaveLogLines(summary) { + return [ + `INI: ${summary.iniOpfsPath ?? "-"}`, + `Tool table: ${summary.toolTableOpfsPath ?? "-"}`, + `Parameters: ${summary.parameterOpfsPath ?? "-"}`, + `G-code: ${summary.gcodeOpfsPath ?? "-"}`, + ]; +} + +export function createMachineFileLoadSummary(files) { + return { + iniBytes: files?.ini?.length ?? 0, + toolTableBytes: files?.toolTable?.length ?? 0, + parameterBytes: files?.parameters?.length ?? 0, + }; +} + +export function machineFileLoadLogLines(summary) { + return [ + `INI bytes: ${summary.iniBytes}`, + `Tool table bytes: ${summary.toolTableBytes}`, + `Parameter bytes: ${summary.parameterBytes}`, + ]; +} diff --git a/wasm-port/tests/ui/node/verify_ini_panel_machine_file_summary.mjs b/wasm-port/tests/ui/node/verify_ini_panel_machine_file_summary.mjs new file mode 100644 index 0000000..b41ea58 --- /dev/null +++ b/wasm-port/tests/ui/node/verify_ini_panel_machine_file_summary.mjs @@ -0,0 +1,73 @@ +import assert from "node:assert/strict"; + +import { + createMachineFileLoadSummary, + createMachineFileSaveSummary, + machineFileLoadLogLines, + machineFileSaveLogLines, +} from "../../../runtime/ui/ini-panel/machine-file-summary.js"; + +const saveSummary = createMachineFileSaveSummary({ + ini: "linuxcnc/machines/xyzab-tdr/machine.ini", + toolTable: "linuxcnc/machines/xyzab-tdr/tool.tbl", + parameters: "linuxcnc/machines/xyzab-tdr/linuxcnc.var", +}, "linuxcnc/gcode/ui-session.ngc"); + +assert.deepEqual(saveSummary, { + iniOpfsPath: "linuxcnc/machines/xyzab-tdr/machine.ini", + toolTableOpfsPath: "linuxcnc/machines/xyzab-tdr/tool.tbl", + parameterOpfsPath: "linuxcnc/machines/xyzab-tdr/linuxcnc.var", + gcodeOpfsPath: "linuxcnc/gcode/ui-session.ngc", +}); + +assert.deepEqual( + machineFileSaveLogLines(saveSummary), + [ + "INI: linuxcnc/machines/xyzab-tdr/machine.ini", + "Tool table: linuxcnc/machines/xyzab-tdr/tool.tbl", + "Parameters: linuxcnc/machines/xyzab-tdr/linuxcnc.var", + "G-code: linuxcnc/gcode/ui-session.ngc", + ], +); + +const loadSummary = createMachineFileLoadSummary({ + ini: "[EMC]\nMACHINE = xyzab-tdr\n", + toolTable: "T2 P7 Z3.125\n", + parameters: "5220 1\n", +}); + +assert.deepEqual(loadSummary, { + iniBytes: 26, + toolTableBytes: 13, + parameterBytes: 7, +}); + +assert.deepEqual( + machineFileLoadLogLines(loadSummary), + [ + "INI bytes: 26", + "Tool table bytes: 13", + "Parameter bytes: 7", + ], +); + +assert.deepEqual( + createMachineFileSaveSummary(null), + { + iniOpfsPath: null, + toolTableOpfsPath: null, + parameterOpfsPath: null, + gcodeOpfsPath: null, + }, +); + +assert.deepEqual( + createMachineFileLoadSummary(null), + { + iniBytes: 0, + toolTableBytes: 0, + parameterBytes: 0, + }, +); + +console.log("ini_panel_machine_file_summary_node_smoke=ok"); diff --git a/wasm-port/tests/ui/node/verify_ini_panel_machine_file_summary.sh b/wasm-port/tests/ui/node/verify_ini_panel_machine_file_summary.sh new file mode 100755 index 0000000..2e60be9 --- /dev/null +++ b/wasm-port/tests/ui/node/verify_ini_panel_machine_file_summary.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +set -euo pipefail + +ROOT_DIR="$(cd "$(dirname "$0")/../../.." && pwd)" + +node "$ROOT_DIR/tests/ui/node/verify_ini_panel_machine_file_summary.mjs" diff --git a/wasm-port/tests/ui/node/verify_ui_node_smokes.sh b/wasm-port/tests/ui/node/verify_ui_node_smokes.sh index 7ae84f9..d6e78cf 100755 --- a/wasm-port/tests/ui/node/verify_ui_node_smokes.sh +++ b/wasm-port/tests/ui/node/verify_ui_node_smokes.sh @@ -5,5 +5,6 @@ ROOT_DIR="$(cd "$(dirname "$0")/../../.." && pwd)" "$ROOT_DIR/tests/ui/node/verify_ini_panel_run_summary.sh" "$ROOT_DIR/tests/ui/node/verify_ini_panel_session_summary.sh" +"$ROOT_DIR/tests/ui/node/verify_ini_panel_machine_file_summary.sh" echo "ui_node_smokes=ok"