diff --git a/text12.txt b/text12.txt index 847bad7..a5ca4c5 100644 --- a/text12.txt +++ b/text12.txt @@ -370,3 +370,67 @@ host_wasm_opfs_browser_smokes=ok 继续推进 OPFS/session persistence 的实质链路。下一批建议将 `restore-load-session` 路径改为复用 `loadMachineSessionIntoWasmWorkflow()`,避免 restore+load 与单独 load 的 field/log 状态模型 分叉;仍保持由 LinuxCNC/OPFS bridge 执行实际语义,不在 JS 中解释 CNC 行为。 + +三、2026-06-15 继续执行记录:INI panel restore-load workflow 复用 load-session helper + +本轮按“第一原则:加快实质性推进”继续推进 OPFS/session persistence 主链路,将 +`restore-load-session` 路径收敛到已存在的 `loadMachineSessionIntoWasmWorkflow()`,让单独 +load 与 restore+load 共享同一套 load summary、field state 和 log lines 模型。 + +完成内容: + +- `restoreMachineSessionSnapshotWorkflow()` 的 restore+load 分支改为调用 + `loadMachineSessionIntoWasmWorkflow({ loadSession })`; +- restore+load 返回的 `loadedSession`、`loadSummary` 和 INI/parameter/tool-table field state + 直接来自 load workflow; +- restore+load 日志纳入 load workflow 的统一首行: + `Loaded machine session into the interpreter WASM filesystem.`; +- 删除 `app.js` 中已不再使用的 `sessionSnapshotSummaryLogLines` import; +- `verify_ini_panel_session_workflow.mjs` 增加 restore+load 复用断言,确认 + `loadSummary` 与单独 load workflow 一致,且 `loadedSession` 保持 loader 返回对象; +- `ui-session-summary-helpers.md` 同步说明 restore-load 复用 load workflow; +- 未新增控制按钮; +- 未解析 G-code; +- 未解释 canonical events; +- 未改变 OPFS/session persistence、LinuxCNC interpreter、tool、parameter、planner 或 + LinuxCNC-owned runtime semantics。 + +验证已通过: + +```bash +git diff --check +wasm-port/tests/ui/node/verify_ini_panel_session_workflow.sh +wasm-port/tests/ui/node/verify_ui_node_smokes.sh +SKIP_INI_BUILD=1 SKIP_INTERP_BUILD=1 wasm-port/tests/browser/verify_ini_panel_browser.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/host/verify_host_smokes.sh +``` + +关键输出: + +```text +ini_panel_session_workflow_node_smoke=ok +ui_node_smokes=ok +browser_ini_opfs_smoke=ok +browser_ini_control_page_smoke=ok +browser_ini_launch_smoke=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 +``` + +下一步建议: + +继续推进 OPFS/session persistence 的实质链路。下一批建议抽出 `run-session` 首帧 readiness +或 run 前置状态 helper,把“已加载 session、已选择/恢复 snapshot、默认 G-code 路径、run +按钮可执行条件”统一成可复用状态模型;仍保持只描述 UI/host boundary facts,不在 JS 中解释 +G-code、canonical events 或 CNC 运行语义。 diff --git a/wasm-port/docs/ui-session-summary-helpers.md b/wasm-port/docs/ui-session-summary-helpers.md index 03399d3..5b98dcf 100644 --- a/wasm-port/docs/ui-session-summary-helpers.md +++ b/wasm-port/docs/ui-session-summary-helpers.md @@ -9,8 +9,8 @@ for machine-session load state. These helpers are pure so browser UI panels, SDK-facing wrappers, and Node smoke tests can share the same data shape without parsing log text. `runtime/ui/ini-panel/session-workflow.js` contains the reusable UI workflows -for saving, restoring, and restore-loading a machine session snapshot as -host-boundary operations. +for saving, restoring, loading, and restore-loading a machine session snapshot +as host-boundary operations. The helpers do not implement CNC behavior. G-code execution, canonical events, tool handling, parameters, kinematics, and planner behavior remain owned by the @@ -76,7 +76,10 @@ The persistence functions are injected by the caller: The workflow loads the machine session snapshot, loads the persisted machine text files so the editor can be restored, and optionally loads the machine -session into the interpreter WASM filesystem. +session into the interpreter WASM filesystem. The optional restore-load path +reuses `loadMachineSessionIntoWasmWorkflow()` so standalone load and +restore-load consumers share the same load summary, field state, and load log +line model. When `loadSession` is omitted, the returned `fields` contain the OPFS snapshot paths. When `loadSession` is supplied, the returned `fields` contain the loaded @@ -101,7 +104,8 @@ The returned object has this shape: loadedSession: { ... }, logLines: [ "Snapshot: ui-machine-session/ui-machine-session.json", - "Workflow: save-session-snapshot" + "Workflow: save-session-snapshot", + "Loaded machine session into the interpreter WASM filesystem." ] } ``` diff --git a/wasm-port/runtime/ui/ini-panel/app.js b/wasm-port/runtime/ui/ini-panel/app.js index 0ff5cfc..0d167c3 100644 --- a/wasm-port/runtime/ui/ini-panel/app.js +++ b/wasm-port/runtime/ui/ini-panel/app.js @@ -34,9 +34,6 @@ import { import { runGcodeSessionWorkflow, } from "./run-workflow.js"; -import { - sessionSnapshotSummaryLogLines, -} from "./session-summary.js"; import { loadMachineSessionIntoWasmWorkflow, restoreMachineSessionSnapshotWorkflow, diff --git a/wasm-port/runtime/ui/ini-panel/session-workflow.js b/wasm-port/runtime/ui/ini-panel/session-workflow.js index e8f6af8..4c15bc4 100644 --- a/wasm-port/runtime/ui/ini-panel/session-workflow.js +++ b/wasm-port/runtime/ui/ini-panel/session-workflow.js @@ -134,20 +134,17 @@ export async function restoreMachineSessionSnapshotWorkflow({ logLines: sessionSnapshotRestoreLogLines(summary), }; if (loadSession) { - const loadedSession = await loadSession(); - const loadSummary = createMachineSessionLoadSummary(loadedSession); - result.loadedSession = loadedSession; - result.loadSummary = loadSummary; + const loadWorkflow = await loadMachineSessionIntoWasmWorkflow({ loadSession }); + result.loadedSession = loadWorkflow.loadedSession; + result.loadSummary = loadWorkflow.loadSummary; result.fields = { ...fields, - sessionIni: loadSummary.iniWasmPath, - sessionParameters: loadSummary.parameterWasmPath, - sessionToolTable: loadSummary.toolTableWasmPath, + ...loadWorkflow.fields, sessionGcode: summary.gcodeOpfsPath, }; result.logLines = [ ...sessionSnapshotSummaryLogLines(summary), - ...machineSessionLoadLogLines(loadSummary), + ...loadWorkflow.logLines, `G-code: ${summary.gcodeOpfsPath ?? "-"}`, ]; } diff --git a/wasm-port/tests/ui/node/verify_ini_panel_session_workflow.mjs b/wasm-port/tests/ui/node/verify_ini_panel_session_workflow.mjs index 7e1df4e..2617da8 100644 --- a/wasm-port/tests/ui/node/verify_ini_panel_session_workflow.mjs +++ b/wasm-port/tests/ui/node/verify_ini_panel_session_workflow.mjs @@ -279,11 +279,14 @@ assert.deepEqual(restoreLoadWorkflow.fields, { sessionGcode: "linuxcnc/gcode/ui-session.ngc", sessionSnapshot: "ui-machine-session/ui-machine-session.json", }); +assert.deepEqual(restoreLoadWorkflow.loadSummary, loadWorkflow.loadSummary); +assert.equal(restoreLoadWorkflow.loadedSession, loadedSessionFixture); assert.deepEqual(restoreLoadWorkflow.logLines, [ "Snapshot: ui-machine-session/ui-machine-session.json", "Workflow: save-session-snapshot", "Default G-code: linuxcnc/gcode/ui-session.ngc", + "Loaded machine session into the interpreter WASM filesystem.", "INI: linuxcnc/machines/xyzab-tdr/machine.ini -> /work/session-machine.ini", "Parameter file: linuxcnc/machines/xyzab-tdr/linuxcnc.var -> /work/session-linuxcnc.var", "Parameters: restore_parameters=0",