推进 INI 面板 launch API manifest focused gate

This commit is contained in:
2026-06-15 06:32:38 +08:00
parent 7d906f1809
commit 4d471a3555
4 changed files with 161 additions and 0 deletions

View File

@@ -1142,3 +1142,69 @@ host_wasm_opfs_browser_smokes=ok
`verify_ini_panel_launch_api_manifest.sh`,直接校验 manifest shape、entries 深拷贝、target page
映射和 control-page API methods避免这些能力只被大 smoke 间接覆盖;仍保持只读,不新增控制
按钮,不解析 G-code。
十四、2026-06-15 继续执行记录INI panel launch API manifest focused gate
本轮按“第一原则:加快实质性推进”继续推进 browser/UI workflow为 launch API manifest 增加
focused Node gate直接校验 manifest shape、entries 深拷贝、target page 映射和 control-page
API methods避免这些能力只被大 smoke 间接覆盖。
完成内容:
- 新增 `wasm-port/tests/ui/node/verify_ini_panel_launch_api_manifest.mjs`
- 新增 `wasm-port/tests/ui/node/verify_ini_panel_launch_api_manifest.sh`
- `verify_ini_panel_launch_api_manifest.mjs` 覆盖:
- `apiName`
- `methods`
- `visibleEntries`
- `targetPages`
- `controlPageApiMethods`
- manifest 深拷贝行为;
- custom entries 的 target page 映射;
- `launch.html` 暴露 `linuxCncIniPanelLaunchApi.getLaunchApiManifest()`
- `ui-shell.js` 暴露 `createIniPanelLaunchApiManifest()`
- `verify_ui_node_smokes.sh` 接入 launch API manifest focused gate
- 未新增控制按钮;
- 未解析 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_launch_api_manifest.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_launch_api_manifest_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
```
下一步建议:
继续推进 OPFS/session persistence。下一批建议为 launch API manifest 加入 `persistenceCapabilities`
或等价只读字段,明确 launch 入口可发现的 OPFS/session workflow 能力(如 machine files、
session snapshot、readonly status并由 focused Node gate 与 browser launch smoke 双向校验;
仍保持只读,不新增控制按钮,不解析 G-code。

View File

@@ -0,0 +1,88 @@
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import {
INI_PANEL_ENTRIES,
createControlPageBrowserApiMethods,
createIniPanelLaunchApiManifest,
createIniPanelShellViewModel,
getVisibleIniPanelEntries,
} from "../../../runtime/ui/ini-panel/ui-shell.js";
const __dirname = dirname(fileURLToPath(import.meta.url));
const root = resolve(__dirname, "../../..");
const launchText = readFileSync(resolve(root, "runtime/ui/ini-panel/launch.html"), "utf8");
const shellText = readFileSync(resolve(root, "runtime/ui/ini-panel/ui-shell.js"), "utf8");
const manifest = createIniPanelLaunchApiManifest();
assert.deepEqual(manifest, {
apiName: "ini-panel-launch",
methods: [
"getLaunchApiManifest",
"getLauncherLinks",
"getControlPageApiMethods",
],
visibleEntries: [
{
id: "edit-run",
href: "./index.html",
title: "Open edit and run panel",
},
{
id: "control-view",
href: "./control-page.html",
title: "Open read-only control view",
},
],
targetPages: [
{
entryId: "edit-run",
href: "./index.html",
},
{
entryId: "control-view",
href: "./control-page.html",
},
],
controlPageApiMethods: createControlPageBrowserApiMethods(),
});
assert.deepEqual(createIniPanelShellViewModel().launchApiManifest, manifest);
assert.deepEqual(getVisibleIniPanelEntries(), INI_PANEL_ENTRIES);
manifest.visibleEntries[0].title = "changed";
manifest.targetPages[0].href = "./changed.html";
manifest.controlPageApiMethods.push("changedMethod");
assert.equal(INI_PANEL_ENTRIES[0].title, "Open edit and run panel");
assert.equal(createIniPanelLaunchApiManifest().targetPages[0].href, "./index.html");
assert.deepEqual(createIniPanelLaunchApiManifest().controlPageApiMethods, createControlPageBrowserApiMethods());
const customManifest = createIniPanelLaunchApiManifest([
{
id: "custom",
href: "./custom.html",
title: "Custom entry",
},
]);
assert.deepEqual(customManifest.visibleEntries, [
{
id: "custom",
href: "./custom.html",
title: "Custom entry",
},
]);
assert.deepEqual(customManifest.targetPages, [
{
entryId: "custom",
href: "./custom.html",
},
]);
assert.match(shellText, /\bexport function createIniPanelLaunchApiManifest\b/);
assert.match(launchText, /\bgetLaunchApiManifest\b/);
assert.match(launchText, /\blinuxCncIniPanelLaunchApi\b/);
console.log("ini_panel_launch_api_manifest_node_smoke=ok");

View 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_launch_api_manifest.mjs"

View File

@@ -14,6 +14,7 @@ ROOT_DIR="$(cd "$(dirname "$0")/../../.." && pwd)"
"$ROOT_DIR/tests/ui/node/verify_ini_panel_control_page_session_workflow.sh"
"$ROOT_DIR/tests/ui/node/verify_ini_panel_readonly_status_api.sh"
"$ROOT_DIR/tests/ui/node/verify_ini_panel_entry_manifest.sh"
"$ROOT_DIR/tests/ui/node/verify_ini_panel_launch_api_manifest.sh"
"$ROOT_DIR/tests/ui/node/verify_ini_panel_ui_shell.sh"
"$ROOT_DIR/tests/ui/node/verify_ini_panel_shell_control_page_contract.sh"
"$ROOT_DIR/tests/ui/node/verify_ini_panel_entry_docs.sh"