推进 UI run summary 文档一致性 guard

This commit is contained in:
2026-06-14 18:10:02 +08:00
parent b989de23ae
commit b2b8bd6b4f
3 changed files with 76 additions and 3 deletions

View File

@@ -1411,3 +1411,63 @@ browser_interp_smoke=ok
运行时实际调用点再做一次一致性检查,确保 `run-summary.js` 的导出与文档同步,之后再把
同类 helper 模式推广到其他 UI panel仍只做 host/runtime boundary 文档化,不扩展 CNC
语义。
二十、2026-06-14 继续执行记录UI run summary docs consistency guard
本轮继续沿 OPFS/session/UI boundary 推进,对 run summary helper 文档、纯函数实现和
实际调用点做一致性检查,并补强 `snapshotLabel` 优先级说明与测试。
完成内容:
- 检查 `wasm-port/docs/ui-run-summary-helpers.md`、`run-summary.js` 和
`app.js` 调用点的一致性;
- 明确文档中 `snapshotLabel` 优先级:
- 优先使用 `runtime.snapshotLabel`
- 其次使用 `snapshot.metadata.snapshotLabel`
- 最后回落为 `null`
- 扩展 `wasm-port/tests/ui/node/verify_ini_panel_run_summary.mjs`
- 将 runtime snapshot label override 从单字段断言升级为完整 summary 对象断言;
- 同时确认 workflow 仍来自 snapshot metadata
- 确认未提供 runtime result 字段时计数默认仍为 0
- 未改变 `run-summary.js` runtime 行为、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_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_run_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 推进。优先扫描 INI panel 中是否还有类似
“日志文本/DOM 状态/机器可读状态”三份并行维护的 host-boundary 数据,如果有,选择一个
小型候选提取为纯 helper 并接入 `verify_ui_node_smokes.sh`;仍不触碰 interpreter、OPFS
bridge 或 LinuxCNC-owned runtime semantics。

View File

@@ -37,6 +37,9 @@ vendored LinuxCNC runtime.
`snapshot` is the optional machine session snapshot loaded by the UI. The helper
reads only snapshot metadata such as `workflow` and `snapshotLabel`.
When `runtime.snapshotLabel` is present, it is used as the returned
`snapshotLabel`; otherwise the helper falls back to `snapshot.metadata.snapshotLabel`
and then `null`.
The returned summary has this shape:

View File

@@ -57,11 +57,21 @@ assert.deepEqual(
},
);
assert.equal(
assert.deepEqual(
createRunSummary(program, {
snapshotLabel: "override-session/override.json",
}, snapshot).snapshotLabel,
"override-session/override.json",
}, snapshot),
{
runStatus: "ok",
programSource: "snapshot",
snapshotLabel: "override-session/override.json",
workflow: "save-session-snapshot",
programOpfsPath: "linuxcnc/gcode/ui-session.ngc",
programWasmPath: "/work/ui-session.ngc",
iniWasmPath: null,
canonicalEventCount: 0,
motionSnapshotCount: 0,
},
);
assert.deepEqual(