Guard browser OPFS default machine path helper

This commit is contained in:
2026-06-14 01:12:10 +08:00
parent 1bf920bc27
commit febab4c20e
2 changed files with 55 additions and 6 deletions

View File

@@ -515,3 +515,52 @@ host_wasm_opfs_browser_smokes=ok
`interp_smoke.html` 中 OPFS custom session helpers 周边是否还有硬编码 `interp_smoke.html` 中 OPFS custom session helpers 周边是否还有硬编码
`machine.ini`、`linuxcnc.var`、`tool.tbl` default path literal 可安全接入既有 `machine.ini`、`linuxcnc.var`、`tool.tbl` default path literal 可安全接入既有
path helper只改测试胶水不改变 path model 或 runtime bridge。 path helper只改测试胶水不改变 path model 或 runtime bridge。
十三、2026-06-14 继续执行记录browser OPFS default machine path helper guard
本轮按上一条下一步建议继续扫描 OPFS custom/default session helper 周边的 default
machine file path literal范围仍只触及 `wasm-port/tests/browser/interp_smoke.html`
的 browser/OPFS test glue。
完成内容:
- 在 `assertMachineTextStorePaths(...)` 中复用 `opfsMachineFilePath(...)` 生成默认
`machine.ini`、`tool.tbl`、`linuxcnc.var` expected OPFS paths
- 在 `assertOpfsSessionStaging(...)` 中复用同一 helper 生成默认 INI、parameter、
tool-table OPFS paths
- custom session override 仍通过 `expectedPaths.opfs` 显式覆盖,路径模型行为未改;
- 未改变 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。优先扫描 OPFS default filename
`machine.ini`、`linuxcnc.var`、`tool.tbl` 是否值得抽成局部常量,只限
`interp_smoke.html` test glue如果收益不明显转向其它 browser staging path
literal guard。

View File

@@ -4480,9 +4480,9 @@
function assertMachineTextStorePaths(label, paths, machineId) { function assertMachineTextStorePaths(label, paths, machineId) {
const expectedPaths = { const expectedPaths = {
ini: `linuxcnc/machines/${machineId}/machine.ini`, ini: opfsMachineFilePath(machineId, "machine.ini"),
toolTable: `linuxcnc/machines/${machineId}/tool.tbl`, toolTable: opfsMachineFilePath(machineId, "tool.tbl"),
parameters: `linuxcnc/machines/${machineId}/linuxcnc.var`, parameters: opfsMachineFilePath(machineId, "linuxcnc.var"),
}; };
for (const [name, expectedPath] of Object.entries(expectedPaths)) { for (const [name, expectedPath] of Object.entries(expectedPaths)) {
if (paths[name] !== expectedPath) { if (paths[name] !== expectedPath) {
@@ -4591,9 +4591,9 @@
throw new Error(`${label}: unexpected machine id ${session.machineId}`); throw new Error(`${label}: unexpected machine id ${session.machineId}`);
} }
const expectedOpfsPaths = { const expectedOpfsPaths = {
ini: `linuxcnc/machines/${machineId}/machine.ini`, ini: opfsMachineFilePath(machineId, "machine.ini"),
parameters: `linuxcnc/machines/${machineId}/linuxcnc.var`, parameters: opfsMachineFilePath(machineId, "linuxcnc.var"),
toolTable: `linuxcnc/machines/${machineId}/tool.tbl`, toolTable: opfsMachineFilePath(machineId, "tool.tbl"),
...(expectedPaths.opfs ?? {}), ...(expectedPaths.opfs ?? {}),
}; };
assertOpfsIniStaging( assertOpfsIniStaging(