推进 INI 面板浏览器 readonly status 快照

This commit is contained in:
2026-06-15 06:08:47 +08:00
parent 37b79c1d1a
commit b5d36cf2a4
5 changed files with 103 additions and 0 deletions

View File

@@ -863,3 +863,68 @@ host_wasm_opfs_browser_smokes=ok
snapshot smoke直接通过 `linuxCncIniPanelControlPageApi` 读取 `readStatus()` 或等价只读状态, snapshot smoke直接通过 `linuxCncIniPanelControlPageApi` 读取 `readStatus()` 或等价只读状态,
并校验 save/load session 后的 `stateBundle`、`workflowStatus`、`controlView` 一致暴露;仍保持 并校验 save/load session 后的 `stateBundle`、`workflowStatus`、`controlView` 一致暴露;仍保持
只读,不新增控制按钮,不解析 G-code不解释 canonical events。 只读,不新增控制按钮,不解析 G-code不解释 canonical events。
十、2026-06-15 继续执行记录INI panel browser readonly status snapshot
本轮按“第一原则:加快实质性推进”继续推进 OPFS/session persistence 和 browser/UI workflow
让真实 browser control-page API 暴露只读状态 snapshot并在 save/load session 与 run workflow
后校验 `stateBundle`、`workflowStatus`、`controlView` 一致可读。
完成内容:
- `wasm-port/runtime/ui/ini-panel/control-page.js` 在
`window.linuxCncIniPanelControlPageApi` 新增 `readControlPageStatus()`
- `ini_panel_control_page_smoke.html` 在真实 control-page iframe 中校验:
- 初始 readonly status last action
- load-session 后 `stateBundle.report.readiness.parameterFile`
- load-session 后 `workflowStatus.lastAction`
- load-session 后 `controlView.status.lastAction`
- load-session 后 `session.parameterFile`
- run-gcode 后 readonly status `lastAction` 与 `runStatus`
- run-gcode 后 `workflowStatus` 与 `controlView` 一致暴露;
- `docs/panel-entry.md` 记录
`linuxCncIniPanelControlPageApi.readControlPageStatus()` browser API
- `verify_ini_panel_entry_docs.mjs` 覆盖 browser readonly status API 文档与源码入口;
- 未新增控制按钮;
- 未解析 G-code
- 未解释 canonical events
- 未改变 LinuxCNC interpreter、tool、parameter、planner 或 LinuxCNC-owned runtime semantics。
验证已通过:
```bash
git diff --check
wasm-port/tests/ui/node/verify_ini_panel_entry_docs.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_entry_docs_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
host_wasm_opfs_browser_smokes=ok
```
下一步建议:
继续推进 SDK/API surface。下一批建议为 browser control-page API 增加一个轻量 manifest 或
`getControlPageApiMethods()`,明确 `getControlPageContract()`、`readControlPageStatus()`、
`loadControlPageSessionState()`、`refreshControlPage()`、`renderControlPage()` 的 browser-exposed
方法清单,并由 Node/browser gate 双向校验;仍保持只读,不新增控制按钮,不解析 G-code。

View File

@@ -71,6 +71,9 @@ contract lists readonly status fields for `stateBundle`, `workflowStatus`,
The browser control page also exposes this contract through The browser control page also exposes this contract through
`linuxCncIniPanelControlPageApi.getControlPageContract()`, so real iframe-based `linuxCncIniPanelControlPageApi.getControlPageContract()`, so real iframe-based
smokes can verify the same API shape before reading the embedded panel state. smokes can verify the same API shape before reading the embedded panel state.
Use `linuxCncIniPanelControlPageApi.readControlPageStatus()` when a browser
outer page needs the same readonly status snapshot from the real embedded
control page after save/load session workflows.
The control-page refresh workflow lives in The control-page refresh workflow lives in
`runtime/ui/ini-panel/control-page-refresh-workflow.js`. Use `runtime/ui/ini-panel/control-page-refresh-workflow.js`. Use

View File

@@ -26,6 +26,7 @@ window.linuxCncIniPanelControlPageApi = {
getControlPageContract: createIniPanelShellControlPageContract, getControlPageContract: createIniPanelShellControlPageContract,
getPanelApi: controller.getPanelApi, getPanelApi: controller.getPanelApi,
loadControlPageSessionState: controller.loadSessionState, loadControlPageSessionState: controller.loadSessionState,
readControlPageStatus: controller.readStatus,
refreshControlPage: controller.refresh, refreshControlPage: controller.refresh,
renderControlPage: controller.render, renderControlPage: controller.render,
}; };

View File

@@ -66,6 +66,7 @@ TOOL_TABLE = browser-tool.tbl
!controlPageApi?.getControlPageContract || !controlPageApi?.getControlPageContract ||
!controlPageApi?.getPanelApi || !controlPageApi?.getPanelApi ||
!controlPageApi?.loadControlPageSessionState || !controlPageApi?.loadControlPageSessionState ||
!controlPageApi?.readControlPageStatus ||
!controlPageApi?.refreshControlPage || !controlPageApi?.refreshControlPage ||
!controlPageApi?.renderControlPage !controlPageApi?.renderControlPage
) { ) {
@@ -122,6 +123,11 @@ TOOL_TABLE = browser-tool.tbl
"ready", "ready",
"control page session load phase", "control page session load phase",
); );
assertEqual(
controlPageApi.readControlPageStatus().status.lastAction,
null,
"control page initial readonly status last action",
);
panelDoc.getElementById("ini-editor").value = iniText; panelDoc.getElementById("ini-editor").value = iniText;
panelDoc.getElementById("query").click(); panelDoc.getElementById("query").click();
@@ -141,6 +147,27 @@ TOOL_TABLE = browser-tool.tbl
() => panelDoc.getElementById("log")?.textContent.includes("Loaded machine session"), () => panelDoc.getElementById("log")?.textContent.includes("Loaded machine session"),
"control page load session", "control page load session",
); );
const loadedStatus = controlPageApi.readControlPageStatus();
assertEqual(
loadedStatus.stateBundle.report.readiness.parameterFile,
"browser-linuxcnc.var",
"control page readonly status state bundle parameter file",
);
assertEqual(
loadedStatus.workflowStatus.lastAction,
"load-session",
"control page readonly status workflow last action after load",
);
assertEqual(
loadedStatus.controlView.status.lastAction,
"load-session",
"control page readonly status control view after load",
);
assertEqual(
loadedStatus.session.parameterFile,
"browser-linuxcnc.var",
"control page readonly status session parameter file",
);
panelDoc.getElementById("save-session-snapshot").click(); panelDoc.getElementById("save-session-snapshot").click();
await waitFor( await waitFor(
@@ -159,8 +186,13 @@ TOOL_TABLE = browser-tool.tbl
); );
const controlView = controlPageApi.getControlView(); const controlView = controlPageApi.getControlView();
const runStatus = controlPageApi.readControlPageStatus();
assertEqual(controlView.status.lastAction, "run-gcode", "control page last action"); assertEqual(controlView.status.lastAction, "run-gcode", "control page last action");
assertEqual(controlView.status.runStatus, "ok", "control page run status"); assertEqual(controlView.status.runStatus, "ok", "control page run status");
assertEqual(runStatus.status.lastAction, "run-gcode", "control page readonly status last action");
assertEqual(runStatus.status.runStatus, "ok", "control page readonly status run status");
assertEqual(runStatus.workflowStatus.lastAction, "run-gcode", "control page readonly workflow last action");
assertEqual(runStatus.controlView.status.runStatus, "ok", "control page readonly control view run status");
assertEqual(controlView.sections.length, 3, "control page section count"); assertEqual(controlView.sections.length, 3, "control page section count");
assertEqual( assertEqual(
controlView.sections[1].rows[1].value, controlView.sections[1].rows[1].value,

View File

@@ -121,8 +121,10 @@ assert.equal(createIniPanelShellViewModel().controlPage.readStatus, readMachineS
assert.equal(createIniPanelShellViewModel().controlPage.refresh, refreshMachineSessionControlPage); assert.equal(createIniPanelShellViewModel().controlPage.refresh, refreshMachineSessionControlPage);
assert.equal(typeof createIniPanelShellViewModel().controlPage.renderView, "function"); assert.equal(typeof createIniPanelShellViewModel().controlPage.renderView, "function");
assert.match(controlPageText, /\bgetControlPageContract\b/); assert.match(controlPageText, /\bgetControlPageContract\b/);
assert.match(controlPageText, /\breadControlPageStatus\b/);
assert.match(controlPageText, /\bcreateIniPanelShellControlPageContract\b/); assert.match(controlPageText, /\bcreateIniPanelShellControlPageContract\b/);
assert.match(docText, /\blinuxCncIniPanelControlPageApi\.getControlPageContract\b/); assert.match(docText, /\blinuxCncIniPanelControlPageApi\.getControlPageContract\b/);
assert.match(docText, /\blinuxCncIniPanelControlPageApi\.readControlPageStatus\b/);
for (const entry of INI_PANEL_ENTRIES) { for (const entry of INI_PANEL_ENTRIES) {
const escapedHref = entry.href.replace(".", "\\."); const escapedHref = entry.href.replace(".", "\\.");