diff --git a/text10.txt b/text10.txt index c8daa58..cebb0f8 100644 --- a/text10.txt +++ b/text10.txt @@ -1596,6 +1596,77 @@ host_wasm_opfs_browser_smokes=ok 抽取为纯 helper 并接入 `verify_ui_node_smokes.sh`;保持 helper 只描述 host/runtime 边界, 不扩展 CNC 语义。 +二十六、2026-06-14 继续执行记录:INI panel state summary helper + +本轮继续沿 OPFS/session/UI boundary 推进,把 INI panel 已观察到的 badge、machine、 +machine file、session、run 和 five-axis remap 状态聚合为纯 helper,方便浏览器测试或后续 +UI 消费者读取机器可读状态,而不是解析临时 DOM 文本。 + +完成内容: + +- 新增 `wasm-port/runtime/ui/ini-panel/panel-state-summary.js`; +- 导出 `createIniPanelStateSummary(input)`; +- helper 只打包已有 host/runtime boundary summary: + - INI/interp/OPFS badge 文本; + - machine summary; + - machine file summary; + - session snapshot summary; + - session load summary; + - run summary; + - five-axis remap 状态; +- 缺省 badge 和可选分组规范化为 `null`; +- 新增 `wasm-port/docs/ui-panel-state-summary.md`,记录输入、输出和边界规则; +- 在 `wasm-port/docs/compatibility-validation.md` 的 UI helper docs 索引中加入该文档; +- 新增 `wasm-port/tests/ui/node/verify_ini_panel_state_summary.mjs` 和 + `verify_ini_panel_state_summary.sh`; +- `wasm-port/tests/ui/node/verify_ui_node_smokes.sh` 纳入 state summary 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_state_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 +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_state_summary_node_smoke=ok +ini_panel_run_summary_node_smoke=ok +ini_panel_session_summary_node_smoke=ok +ini_panel_machine_file_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 +browser_interp_smoke=ok +host_wasm_opfs_browser_smokes=ok +``` + +下一步建议: + +回到本文件第一候选批次,继续小批量 browser test glue guard。优先扫描 +`wasm-port/tests/browser/interp_smoke.html` 的 explicit session saved readback path groups, +看是否能像 ini-named session 一样局部常量化 +`loadedIniOverrideSession.parameters.opfsPath`、 +`savedExplicitParameters.backupOpfsPath` 和 +`loadedIniOverrideSession.toolTable.opfsPath`。只处理 browser/OPFS test glue,不改变 +参数值、tool-table 值、INI 内容、OPFS/WASM path 字符串、file-service、path-model、SDK +planner、interpreter、INI、tool、parameter 或 LinuxCNC-owned runtime semantics。 + 二十四、2026-06-14 继续执行记录:INI panel machine file summary helper 本轮继续沿 OPFS/session/UI boundary 推进,把 INI panel 的 machine text file save/load diff --git a/wasm-port/docs/compatibility-validation.md b/wasm-port/docs/compatibility-validation.md index d427a35..fa646de 100644 --- a/wasm-port/docs/compatibility-validation.md +++ b/wasm-port/docs/compatibility-validation.md @@ -71,6 +71,7 @@ UI helper docs: - `wasm-port/docs/ui-run-summary-helpers.md` - `wasm-port/docs/ui-session-summary-helpers.md` - `wasm-port/docs/ui-machine-file-helpers.md` +- `wasm-port/docs/ui-panel-state-summary.md` The current browser smoke validation command is: diff --git a/wasm-port/docs/ui-panel-state-summary.md b/wasm-port/docs/ui-panel-state-summary.md new file mode 100644 index 0000000..7587f1f --- /dev/null +++ b/wasm-port/docs/ui-panel-state-summary.md @@ -0,0 +1,46 @@ +# UI Panel State Summary + +## Purpose + +`runtime/ui/ini-panel/panel-state-summary.js` contains a pure helper for +bundling the already-observed host/runtime boundary state of the INI panel into +a single machine-readable snapshot. + +The helper does not implement CNC behavior. It only packages the summary +objects produced by the run/session/machine-file helpers and the visible badge +state so browser tests or future UI consumers can compare panel state without +reading ad hoc DOM text. + +## `createIniPanelStateSummary(input)` + +`input` may contain: + +```js +{ + badges: { ini: "INI WASM: ready", interp: "Interpreter WASM: ready", opfs: "OPFS: ready" }, + machine: { machine: "xyzab-tdr", kinematics: "trivkins" }, + machineFiles: { iniOpfsPath: "...", toolTableOpfsPath: "...", parameterOpfsPath: "...", gcodeOpfsPath: "..." }, + sessionSnapshot: { snapshotLabel: "...", workflow: "save-session-snapshot" }, + sessionLoad: { iniOpfsPath: "...", iniWasmPath: "..." }, + run: { runStatus: "ok", programSource: "snapshot" }, + fiveaxisRemap: "ok" +} +``` + +The returned snapshot preserves those nested objects and normalizes missing +badge entries to `null`. + +## Boundary Rules + +- Do not parse G-code text in this helper. +- Do not infer CNC semantics from the nested summaries. +- Keep the helper as a bundling layer over already-observed UI boundary state. + +## Validation + +The helper is covered by: + +```bash +wasm-port/tests/ui/node/verify_ini_panel_state_summary.sh +wasm-port/tests/ui/node/verify_ui_node_smokes.sh +``` diff --git a/wasm-port/runtime/ui/ini-panel/panel-state-summary.js b/wasm-port/runtime/ui/ini-panel/panel-state-summary.js new file mode 100644 index 0000000..56f6818 --- /dev/null +++ b/wasm-port/runtime/ui/ini-panel/panel-state-summary.js @@ -0,0 +1,23 @@ +export function createIniPanelStateSummary({ + badges = {}, + machine = null, + machineFiles = null, + sessionSnapshot = null, + sessionLoad = null, + run = null, + fiveaxisRemap = null, +} = {}) { + return { + badges: { + ini: badges.ini ?? null, + interp: badges.interp ?? null, + opfs: badges.opfs ?? null, + }, + machine, + machineFiles, + sessionSnapshot, + sessionLoad, + run, + fiveaxisRemap: fiveaxisRemap ?? null, + }; +} diff --git a/wasm-port/tests/ui/node/verify_ini_panel_state_summary.mjs b/wasm-port/tests/ui/node/verify_ini_panel_state_summary.mjs new file mode 100644 index 0000000..93c7efa --- /dev/null +++ b/wasm-port/tests/ui/node/verify_ini_panel_state_summary.mjs @@ -0,0 +1,84 @@ +import assert from "node:assert/strict"; + +import { createIniPanelStateSummary } from "../../../runtime/ui/ini-panel/panel-state-summary.js"; + +const summary = createIniPanelStateSummary({ + badges: { + ini: "INI WASM: ready", + interp: "Interpreter WASM: ready", + opfs: "OPFS: ready", + }, + machine: { + machine: "xyzab-tdr", + kinematics: "trivkins", + }, + machineFiles: { + 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", + }, + sessionSnapshot: { + snapshotLabel: "ui-machine-session/ui-machine-session.json", + workflow: "save-session-snapshot", + }, + sessionLoad: { + iniOpfsPath: "linuxcnc/machines/xyzab-tdr/machine.ini", + iniWasmPath: "/work/session-machine.ini", + }, + run: { + runStatus: "ok", + programSource: "snapshot", + }, + fiveaxisRemap: "ok", +}); + +assert.deepEqual(summary, { + badges: { + ini: "INI WASM: ready", + interp: "Interpreter WASM: ready", + opfs: "OPFS: ready", + }, + machine: { + machine: "xyzab-tdr", + kinematics: "trivkins", + }, + machineFiles: { + 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", + }, + sessionSnapshot: { + snapshotLabel: "ui-machine-session/ui-machine-session.json", + workflow: "save-session-snapshot", + }, + sessionLoad: { + iniOpfsPath: "linuxcnc/machines/xyzab-tdr/machine.ini", + iniWasmPath: "/work/session-machine.ini", + }, + run: { + runStatus: "ok", + programSource: "snapshot", + }, + fiveaxisRemap: "ok", +}); + +assert.deepEqual( + createIniPanelStateSummary(), + { + badges: { + ini: null, + interp: null, + opfs: null, + }, + machine: null, + machineFiles: null, + sessionSnapshot: null, + sessionLoad: null, + run: null, + fiveaxisRemap: null, + }, +); + +console.log("ini_panel_state_summary_node_smoke=ok"); diff --git a/wasm-port/tests/ui/node/verify_ini_panel_state_summary.sh b/wasm-port/tests/ui/node/verify_ini_panel_state_summary.sh new file mode 100755 index 0000000..dad69d5 --- /dev/null +++ b/wasm-port/tests/ui/node/verify_ini_panel_state_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_state_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 d6e78cf..3fc0ff3 100755 --- a/wasm-port/tests/ui/node/verify_ui_node_smokes.sh +++ b/wasm-port/tests/ui/node/verify_ui_node_smokes.sh @@ -6,5 +6,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" +"$ROOT_DIR/tests/ui/node/verify_ini_panel_state_summary.sh" echo "ui_node_smokes=ok"