Guard browser OPFS saved text expected lines

This commit is contained in:
2026-06-14 00:58:12 +08:00
parent 09855d37f7
commit f1106c4328
2 changed files with 65 additions and 16 deletions

View File

@@ -371,3 +371,52 @@ host_wasm_opfs_browser_smokes=ok
继续沿 browser/OPFS boundary guard 方向推进,但进入更细一层的 load/save 对称收敛审视:
检查 `opfs_saved_*_text` 与 `opfs_load_*` 附近是否还能抽出更小的 pair helper前提是
不让 helper 掩盖 expected text 或改变 direct-file 与 machine-file 的边界。
十、2026-06-14 继续执行记录browser OPFS saved text expected lines guard
本轮按上一条下一步建议审视 load/save pair helper。结论是暂不抽更大的 pair helper
避免掩盖 parameter/tool-table、direct-file/machine-file 的边界;改为继续小范围收敛
saved text 校验胶水。
完成内容:
- 将 `verifyOpfsSavedText(...)`、`verifyOpfsReadback(...)`、
`verifyOpfsMachineFileReadback(...)` 统一为接收 expected lines 数组;
- 移除 10 个 saved text/readback 调用点上的重复 `join("\n")` 胶水;
- expected output 行内容仍全部外显direct OPFS readback 与 machine-file readback
helper 边界保持不变;
- 未改变 OPFS bridge behavior、file-service、path-model、SDK planner、interpreter、
INI、tool、parameter 或 LinuxCNC-owned runtime semantics。
验证已通过:
```bash
git diff --check
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
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
```
下一步建议:
继续保持小批量 browser/OPFS boundary guard。优先扫描 `interp_smoke.html` 中
OPFS invalid INI session rejection helper 周边,确认是否还有重复的 invalid filename
fixture 构造或 path guard 可收敛;只处理 browser test glue不改变错误语义或
runtime bridge。

View File

@@ -4543,19 +4543,19 @@
verifyExpectedOutput(label, loadResult.result, expectedLines.join("\n"));
}
async function verifyOpfsSavedText(label, loadActualText, expectedText) {
verifyExpectedOutput(label, await loadActualText(), expectedText);
async function verifyOpfsSavedText(label, loadActualText, expectedLines) {
verifyExpectedOutput(label, await loadActualText(), expectedLines.join("\n"));
}
async function verifyOpfsReadback(label, opfsPath, expectedText) {
await verifyOpfsSavedText(label, () => loadTextFile(opfsPath), expectedText);
async function verifyOpfsReadback(label, opfsPath, expectedLines) {
await verifyOpfsSavedText(label, () => loadTextFile(opfsPath), expectedLines);
}
async function verifyOpfsMachineFileReadback(label, machineId, fileKey, expectedText) {
async function verifyOpfsMachineFileReadback(label, machineId, fileKey, expectedLines) {
await verifyOpfsSavedText(label, async () => {
const machineFiles = await loadMachineTextFiles(machineId);
return machineFiles[fileKey];
}, expectedText);
}, expectedLines);
}
async function writeOpfsMachineFile(machineId, filename, text) {
@@ -9266,7 +9266,7 @@
"5221\t9.870000",
"5399\t66.600000",
"absent=<_named_param>",
].join("\n"),
],
);
await verifyOpfsReadback(
"opfs_saved_parameter_backup_text",
@@ -9277,7 +9277,7 @@
"5221 2.25",
"5399 44",
"<_named_param> 123",
].join("\n"),
],
);
const savedToolTable = await saveMachineToolTableToOpfs(
interp,
@@ -9313,7 +9313,7 @@
"J+34.000000",
"Q4",
";browser finish tool",
].join("\n"),
],
);
const browserRandomMachineId = "browser-random-toolchanger";
@@ -9421,7 +9421,7 @@
"T5",
"P9",
";browser random rough tool",
].join("\n"),
],
);
const iniFileMachineId = "browser-ini-file-session";
@@ -9536,7 +9536,7 @@
"5162\t67.500000",
"5221\t5.250000",
"5399\t199.000000",
].join("\n"),
],
);
await verifyOpfsSavedText(
"opfs_saved_ini_named_parameter_backup_text",
@@ -9546,7 +9546,7 @@
"5162 62.5",
"5221 4.5",
"5399 99",
].join("\n"),
],
);
verifyOpfsLoadResult(
"opfs_load_ini_named_tool_table",
@@ -9593,7 +9593,7 @@
"Z+4.500000",
"D+0.500000",
";browser custom tool",
].join("\n"),
],
);
const iniOverrideMachineId = "browser-ini-override-session";
@@ -9722,7 +9722,7 @@
"5162\t102.500000",
"5221\t7.500000",
"5399\t202.000000",
].join("\n"),
],
);
await verifyOpfsSavedText(
"opfs_saved_explicit_parameter_backup_text",
@@ -9732,7 +9732,7 @@
"5162 82.5",
"5221 6.5",
"5399 101",
].join("\n"),
],
);
const savedExplicitToolTable = await saveMachineToolTableToOpfs(
interp,
@@ -9767,7 +9767,7 @@
"Z+5.500000",
"D+0.625000",
";browser explicit tool",
].join("\n"),
],
);
await verifyOpfsInvalidIniSessionRejects(