推进 INI 面板运行摘要 helper
This commit is contained in:
68
text10.txt
68
text10.txt
@@ -1158,3 +1158,71 @@ host_wasm_opfs_browser_smokes=ok
|
||||
收敛为一个可导出的纯 helper,例如 `createRunSummary(program, runtime, snapshot)`,
|
||||
并补 Node/browser 侧轻量测试,方便后续 SDK/API 或其他 UI panel 复用;保持 helper 只聚合
|
||||
host/runtime 边界数据,不解析 G-code、tool、parameter、planner 等 CNC 语义。
|
||||
|
||||
十六、2026-06-14 继续执行记录:INI panel run summary helper
|
||||
|
||||
本轮继续沿 OPFS/session/UI boundary 推进,把 `linuxCncIniPanelLastRunSummary` 的生成
|
||||
收敛为可导出的纯 helper,方便后续 SDK/API 或其他 UI panel 复用。
|
||||
|
||||
完成内容:
|
||||
|
||||
- 新增 `wasm-port/runtime/ui/ini-panel/run-summary.js`;
|
||||
- 导出 `createRunSummary(program, runtime, snapshot)`;
|
||||
- helper 只聚合 host/runtime 边界数据:
|
||||
- run status;
|
||||
- program source;
|
||||
- snapshot label;
|
||||
- workflow;
|
||||
- OPFS/WASM program path;
|
||||
- INI WASM path;
|
||||
- canonical event count;
|
||||
- motion snapshot count;
|
||||
- `wasm-port/runtime/ui/ini-panel/app.js` 的 `setLastRunSummary(...)` 改为调用
|
||||
`createRunSummary(...)`,DOM 字段同步仍留在 UI 层;
|
||||
- 新增 `wasm-port/tests/ui/node/verify_ini_panel_run_summary.mjs` 和 shell wrapper;
|
||||
- Node smoke 覆盖:
|
||||
- snapshot run summary;
|
||||
- default fallback summary;
|
||||
- UI 层 snapshot label override;
|
||||
- browser INI panel smoke 继续覆盖真实 UI run summary round trip;
|
||||
- 未改变 OPFS path model、snapshot envelope、G-code 文本、interpreter run API、
|
||||
canonical-event 文本输出、motion playback 行为或 LinuxCNC-owned runtime semantics。
|
||||
|
||||
验证已通过:
|
||||
|
||||
```bash
|
||||
git diff --check
|
||||
wasm-port/tests/ui/node/verify_ini_panel_run_summary.sh
|
||||
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
|
||||
ini_panel_run_summary_node_smoke=ok
|
||||
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 推进。优先把 `countCanonicalEvents(...)` 这类 runtime
|
||||
result 轻量统计也收敛到可导出的 helper,例如 `summarizeRunResult(resultText, snapshots)`,
|
||||
并补 Node 侧纯函数测试;保持只统计 LinuxCNC-owned runtime 输出行和 UI 已解析 motion
|
||||
snapshot 数量,不解释或改写 G-code、tool、parameter、planner 等 CNC 语义。
|
||||
|
||||
@@ -22,6 +22,9 @@ import {
|
||||
loadMachineSessionSnapshot,
|
||||
saveMachineSessionSnapshot,
|
||||
} from "../../opfs/snapshot-store.js";
|
||||
import {
|
||||
createRunSummary,
|
||||
} from "./run-summary.js";
|
||||
|
||||
const SAMPLE_PATH =
|
||||
"../../../vendor/linuxcnc/configs/sim/axis/vismach/5axis/table-dual-rotary/xyzab-tdr.ini";
|
||||
@@ -368,19 +371,14 @@ function clearLastRunSummary() {
|
||||
}
|
||||
|
||||
function setLastRunSummary(program, runtime = {}, snapshot = restoredSessionSnapshot) {
|
||||
const snapshotLabel = snapshot ? sessionSnapshotLabel(snapshot.sessionId) : null;
|
||||
const metadata = snapshot?.metadata ?? {};
|
||||
const summary = {
|
||||
runStatus: runtime.runStatus ?? "ok",
|
||||
programSource: program.source,
|
||||
snapshotLabel,
|
||||
workflow: metadata.workflow ?? null,
|
||||
programOpfsPath: program.opfsPath,
|
||||
programWasmPath: program.wasmPath,
|
||||
iniWasmPath: runtime.iniWasmPath ?? null,
|
||||
canonicalEventCount: runtime.canonicalEventCount ?? 0,
|
||||
motionSnapshotCount: runtime.motionSnapshotCount ?? 0,
|
||||
};
|
||||
const summary = createRunSummary(
|
||||
program,
|
||||
{
|
||||
...runtime,
|
||||
snapshotLabel: snapshot ? sessionSnapshotLabel(snapshot.sessionId) : null,
|
||||
},
|
||||
snapshot,
|
||||
);
|
||||
window.linuxCncIniPanelLastRunSummary = summary;
|
||||
setField("runSource", summary.programSource);
|
||||
setField("runSnapshot", summary.snapshotLabel ?? "-");
|
||||
|
||||
14
wasm-port/runtime/ui/ini-panel/run-summary.js
Normal file
14
wasm-port/runtime/ui/ini-panel/run-summary.js
Normal file
@@ -0,0 +1,14 @@
|
||||
export function createRunSummary(program, runtime = {}, snapshot = null) {
|
||||
const metadata = snapshot?.metadata ?? {};
|
||||
return {
|
||||
runStatus: runtime.runStatus ?? "ok",
|
||||
programSource: program.source,
|
||||
snapshotLabel: runtime.snapshotLabel ?? metadata.snapshotLabel ?? null,
|
||||
workflow: metadata.workflow ?? null,
|
||||
programOpfsPath: program.opfsPath,
|
||||
programWasmPath: program.wasmPath,
|
||||
iniWasmPath: runtime.iniWasmPath ?? null,
|
||||
canonicalEventCount: runtime.canonicalEventCount ?? 0,
|
||||
motionSnapshotCount: runtime.motionSnapshotCount ?? 0,
|
||||
};
|
||||
}
|
||||
66
wasm-port/tests/ui/node/verify_ini_panel_run_summary.mjs
Normal file
66
wasm-port/tests/ui/node/verify_ini_panel_run_summary.mjs
Normal file
@@ -0,0 +1,66 @@
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
import {
|
||||
createRunSummary,
|
||||
} from "../../../runtime/ui/ini-panel/run-summary.js";
|
||||
|
||||
const program = {
|
||||
source: "snapshot",
|
||||
opfsPath: "linuxcnc/gcode/ui-session.ngc",
|
||||
wasmPath: "/work/ui-session.ngc",
|
||||
};
|
||||
const snapshot = {
|
||||
sessionId: "ui-machine-session",
|
||||
metadata: {
|
||||
workflow: "save-session-snapshot",
|
||||
snapshotLabel: "ui-machine-session/ui-machine-session.json",
|
||||
},
|
||||
};
|
||||
|
||||
assert.deepEqual(
|
||||
createRunSummary(program, {
|
||||
runStatus: "ok",
|
||||
iniWasmPath: "/work/session-machine.ini",
|
||||
canonicalEventCount: 2,
|
||||
motionSnapshotCount: 2,
|
||||
}, snapshot),
|
||||
{
|
||||
runStatus: "ok",
|
||||
programSource: "snapshot",
|
||||
snapshotLabel: "ui-machine-session/ui-machine-session.json",
|
||||
workflow: "save-session-snapshot",
|
||||
programOpfsPath: "linuxcnc/gcode/ui-session.ngc",
|
||||
programWasmPath: "/work/ui-session.ngc",
|
||||
iniWasmPath: "/work/session-machine.ini",
|
||||
canonicalEventCount: 2,
|
||||
motionSnapshotCount: 2,
|
||||
},
|
||||
);
|
||||
|
||||
assert.deepEqual(
|
||||
createRunSummary({
|
||||
source: "default",
|
||||
opfsPath: "linuxcnc/gcode/ui-session.ngc",
|
||||
wasmPath: "/work/ui-session.ngc",
|
||||
}),
|
||||
{
|
||||
runStatus: "ok",
|
||||
programSource: "default",
|
||||
snapshotLabel: null,
|
||||
workflow: null,
|
||||
programOpfsPath: "linuxcnc/gcode/ui-session.ngc",
|
||||
programWasmPath: "/work/ui-session.ngc",
|
||||
iniWasmPath: null,
|
||||
canonicalEventCount: 0,
|
||||
motionSnapshotCount: 0,
|
||||
},
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
createRunSummary(program, {
|
||||
snapshotLabel: "override-session/override.json",
|
||||
}, snapshot).snapshotLabel,
|
||||
"override-session/override.json",
|
||||
);
|
||||
|
||||
console.log("ini_panel_run_summary_node_smoke=ok");
|
||||
6
wasm-port/tests/ui/node/verify_ini_panel_run_summary.sh
Executable file
6
wasm-port/tests/ui/node/verify_ini_panel_run_summary.sh
Executable file
@@ -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_run_summary.mjs"
|
||||
Reference in New Issue
Block a user