From 6242b415ff3ec57946b4caf7de3aaf9541a1edbb Mon Sep 17 00:00:00 2001 From: wangdequan Date: Sun, 14 Jun 2026 17:12:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A8=E8=BF=9B=20INI=20=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E5=BF=AB=E7=85=A7=E4=B8=8A=E4=B8=8B=E6=96=87?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- text10.txt | 59 ++++++++++++++++++++ wasm-port/runtime/ui/ini-panel/app.js | 12 +++- wasm-port/tests/browser/ini_panel_smoke.html | 10 +++- 3 files changed, 77 insertions(+), 4 deletions(-) diff --git a/text10.txt b/text10.txt index 3da0d46..5422b3a 100644 --- a/text10.txt +++ b/text10.txt @@ -969,3 +969,62 @@ host_wasm_opfs_browser_smokes=ok 也带入 `Run G-code` 成功日志,例如显示 `Snapshot`、`Program source`、`Workflow`, 让用户能从一次运行日志中确认程序来源与会话来源;并在 browser smoke 中验证 snapshot run 与 default fallback run 的日志差异。仍不解析或改写任何 CNC 语义。 + +十三、2026-06-14 继续执行记录:INI panel run snapshot context log + +本轮继续沿 OPFS/session/UI boundary 推进,把 machine session snapshot 的上下文摘要 +带入 `Run G-code` 成功日志,便于用户从一次运行记录中审计程序来源与会话来源。 + +完成内容: + +- 在 `wasm-port/runtime/ui/ini-panel/app.js` 新增 `runSessionContextLogLines(...)`; +- `Run G-code` 成功日志现在统一显示: + - `Program: -> `; + - `Program source: default|snapshot`; + - `Snapshot: /` 或 `-`; + - `Workflow` 与 `Default G-code` metadata 摘要; +- default fallback run 明确显示没有 snapshot context; +- snapshot run 显示 `ui-machine-session/ui-machine-session.json`、 + `save-session-snapshot` 与默认 G-code OPFS path; +- browser INI panel smoke 验证 fallback run 与 snapshot run 的日志差异; +- 未改变 snapshot envelope、payload 文件清单、metadata JSON 内容、OPFS path model、 + G-code 文本内容、interpreter run API、canonical-event 输出或 LinuxCNC-owned runtime + semantics。 + +验证已通过: + +```bash +git diff --check +SKIP_INI_BUILD=1 SKIP_INTERP_BUILD=1 wasm-port/tests/browser/verify_ini_panel_browser.sh +wasm-port/tests/opfs/node/verify_file_service.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 +browser_ini_opfs_smoke=ok +opfs_file_service_node_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/UI boundary 推进。优先让 `Run G-code` 日志中的 session context +同步落到一个可复用的 UI 状态字段或机器可读 run summary,例如保存最近一次 run 的 +`programSource`、`snapshotLabel`、`workflow`、`programOpfsPath`、`programWasmPath`, +供后续 SDK/API 或 UI panel 读取;先只做 UI/测试边界,不改变 interpreter、OPFS bridge +或 LinuxCNC-owned runtime semantics。 diff --git a/wasm-port/runtime/ui/ini-panel/app.js b/wasm-port/runtime/ui/ini-panel/app.js index 1164283..ca37329 100644 --- a/wasm-port/runtime/ui/ini-panel/app.js +++ b/wasm-port/runtime/ui/ini-panel/app.js @@ -341,6 +341,15 @@ function sessionMetadataLogLines(metadata = {}) { ]; } +function runSessionContextLogLines(program, snapshot = restoredSessionSnapshot) { + return [ + `Program: ${program.opfsPath} -> ${program.wasmPath}`, + `Program source: ${program.source}`, + `Snapshot: ${snapshot ? sessionSnapshotLabel(snapshot.sessionId) : "-"}`, + ...sessionMetadataLogLines(snapshot?.metadata), + ]; +} + async function loadSelectedGcodeProgram() { const opfsPath = restoredSessionSnapshot?.payload?.files?.gcode; let filename = UI_SESSION.defaultGcodeFilename; @@ -628,8 +637,7 @@ document.getElementById("run-gcode").addEventListener("click", async () => { setLog( [ "Ran G-code through LinuxCNC interpreter WASM.", - `Program: ${program.opfsPath} -> ${program.wasmPath}`, - `Program source: ${program.source}`, + ...runSessionContextLogLines(program), `INI: ${loadedSession.ini.wasmPath}`, result.trim(), ].join("\n"), diff --git a/wasm-port/tests/browser/ini_panel_smoke.html b/wasm-port/tests/browser/ini_panel_smoke.html index 6e89ff5..051a639 100644 --- a/wasm-port/tests/browser/ini_panel_smoke.html +++ b/wasm-port/tests/browser/ini_panel_smoke.html @@ -404,6 +404,9 @@ TOOL_TABLE = browser-tool.tbl if ( !fallbackRunLog.includes("Program: linuxcnc/gcode/ui-session.ngc -> /work/ui-session.ngc") || !fallbackRunLog.includes("Program source: default") || + !fallbackRunLog.includes("Snapshot: -") || + !fallbackRunLog.includes("Workflow: -") || + !fallbackRunLog.includes("Default G-code: -") || !fallbackRunLog.includes("canon_event=STRAIGHT_FEED") ) { throw new Error(`UI fallback G-code run did not use default OPFS program path: ${fallbackRunLog}`); @@ -532,9 +535,12 @@ TOOL_TABLE = browser-tool.tbl const runLog = uiDocument.getElementById("log").textContent; if ( !runLog.includes("Program: linuxcnc/gcode/ui-session.ngc -> /work/ui-session.ngc") || - !runLog.includes("Program source: snapshot") + !runLog.includes("Program source: snapshot") || + !runLog.includes("Snapshot: ui-machine-session/ui-machine-session.json") || + !runLog.includes("Workflow: save-session-snapshot") || + !runLog.includes("Default G-code: linuxcnc/gcode/ui-session.ngc") ) { - throw new Error(`UI G-code run did not use snapshot OPFS program path: ${runLog}`); + throw new Error(`UI G-code run missing snapshot session context: ${runLog}`); } if ( !runLog.includes("canon_event=STRAIGHT_TRAVERSE") ||