Guard browser OPFS parameter staging
This commit is contained in:
71
text7.txt
71
text7.txt
@@ -1221,3 +1221,74 @@ guard,不改变 parameter、INI 或 session runtime semantics。
|
|||||||
```bash
|
```bash
|
||||||
git status --short && git log -5 --oneline && tail -n 120 text7.txt && awk '/^[一二三四五六七八九十百]+、/ {print}' text7.txt | sort | uniq -d
|
git status --short && git log -5 --oneline && tail -n 120 text7.txt && awk '/^[一二三四五六七八九十百]+、/ {print}' text7.txt | sort | uniq -d
|
||||||
```
|
```
|
||||||
|
|
||||||
|
二十二、2026-06-13 继续执行记录:browser OPFS parameter staging guard
|
||||||
|
|
||||||
|
1. 本批目标。
|
||||||
|
|
||||||
|
继续 staged path guard inventory 第十七轮,处理 browser OPFS/session parameter
|
||||||
|
boundary path:
|
||||||
|
|
||||||
|
```text
|
||||||
|
/work/browser-linuxcnc.var
|
||||||
|
/work/browser-random-linuxcnc.var
|
||||||
|
/work/browser-custom.var
|
||||||
|
/work/browser-explicit.var
|
||||||
|
```
|
||||||
|
|
||||||
|
2. 已完成改动。
|
||||||
|
|
||||||
|
- browser 侧新增 `assertOpfsParameterStaging(...)`;
|
||||||
|
- 默认 machine session 的 restore/save parameter 均检查 OPFS path 与 WASM path;
|
||||||
|
- 默认 save parameter 同步检查 `.bak` OPFS path;
|
||||||
|
- random toolchanger session 的 restore parameter 检查 OPFS path 与 WASM path;
|
||||||
|
- INI `PARAMETER_FILE` 命名 session 的 restore/save parameter 均检查 OPFS path 与
|
||||||
|
WASM path,并检查 `.bak` OPFS path;
|
||||||
|
- explicit override session 的 restore/save parameter 均检查 OPFS path 与 WASM path,
|
||||||
|
并检查 `.bak` OPFS path;
|
||||||
|
- 复用 `generatedParameterPath(...)` 校验 WASM staged path;
|
||||||
|
- 未修改 OPFS 存储内容、parameter 内容、INI 解析、backup 写入或 session runtime
|
||||||
|
semantics。
|
||||||
|
|
||||||
|
涉及文件:
|
||||||
|
|
||||||
|
```text
|
||||||
|
wasm-port/tests/browser/interp_smoke.html
|
||||||
|
```
|
||||||
|
|
||||||
|
3. 已完成的目标验证。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git diff --check
|
||||||
|
SKIP_INI_BUILD=1 SKIP_INTERP_BUILD=1 wasm-port/tests/browser/verify_interp_browser.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
4. 本批剩余建议验证。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
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
|
||||||
|
Guard browser OPFS parameter staging
|
||||||
|
```
|
||||||
|
|
||||||
|
5. 下一步工作建议。
|
||||||
|
|
||||||
|
继续 staged path guard inventory 第十八轮,优先处理 browser OPFS/session INI path
|
||||||
|
guard,例如 `/work/browser-machine.ini`、`/work/browser-random-machine.ini`、
|
||||||
|
`/work/browser-ini-file-session.ini`、`/work/browser-ini-override-session.ini`;仍只加
|
||||||
|
filesystem/OPFS path guard,不改变 INI parsing、parameter/tool table 或 session
|
||||||
|
runtime semantics。
|
||||||
|
|
||||||
|
下一轮第一条命令仍保持:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git status --short && git log -5 --oneline && tail -n 120 text7.txt && awk '/^[一二三四五六七八九十百]+、/ {print}' text7.txt | sort | uniq -d
|
||||||
|
```
|
||||||
|
|||||||
@@ -4459,6 +4459,16 @@
|
|||||||
return checkedPath;
|
return checkedPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function assertOpfsParameterStaging(label, parameters, expectedOpfsPath, expectedWasmPath, expectedBackupOpfsPath = undefined) {
|
||||||
|
if (parameters.opfsPath !== expectedOpfsPath) {
|
||||||
|
throw new Error(`${label}: unexpected parameter OPFS path ${parameters.opfsPath}`);
|
||||||
|
}
|
||||||
|
generatedParameterPath(parameters.wasmPath, expectedWasmPath);
|
||||||
|
if (expectedBackupOpfsPath !== undefined && parameters.backupOpfsPath !== expectedBackupOpfsPath) {
|
||||||
|
throw new Error(`${label}: unexpected parameter backup OPFS path ${parameters.backupOpfsPath}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function generatedToolTablePath(wasmPath, expectedWasmPath) {
|
function generatedToolTablePath(wasmPath, expectedWasmPath) {
|
||||||
if (wasmPath !== expectedWasmPath) {
|
if (wasmPath !== expectedWasmPath) {
|
||||||
throw new Error(`browser_tool_table_fixture_${expectedWasmPath}: path drift`);
|
throw new Error(`browser_tool_table_fixture_${expectedWasmPath}: path drift`);
|
||||||
@@ -8990,6 +9000,12 @@
|
|||||||
"linuxcnc/machines/browser-interp/tool.tbl",
|
"linuxcnc/machines/browser-interp/tool.tbl",
|
||||||
"/work/browser-tool.tbl",
|
"/work/browser-tool.tbl",
|
||||||
);
|
);
|
||||||
|
assertOpfsParameterStaging(
|
||||||
|
"opfs_restore_parameters_staging",
|
||||||
|
loadedSession.parameters,
|
||||||
|
"linuxcnc/machines/browser-interp/linuxcnc.var",
|
||||||
|
"/work/browser-linuxcnc.var",
|
||||||
|
);
|
||||||
verifyExpectedOutput(
|
verifyExpectedOutput(
|
||||||
"opfs_restore_parameters",
|
"opfs_restore_parameters",
|
||||||
loadedSession.parameters.result,
|
loadedSession.parameters.result,
|
||||||
@@ -9029,6 +9045,13 @@
|
|||||||
},
|
},
|
||||||
{ wasmPath: "/work/browser-linuxcnc.var" },
|
{ wasmPath: "/work/browser-linuxcnc.var" },
|
||||||
);
|
);
|
||||||
|
assertOpfsParameterStaging(
|
||||||
|
"opfs_save_parameters_staging",
|
||||||
|
savedParameters,
|
||||||
|
"linuxcnc/machines/browser-interp/linuxcnc.var",
|
||||||
|
"/work/browser-linuxcnc.var",
|
||||||
|
"linuxcnc/machines/browser-interp/linuxcnc.var.bak",
|
||||||
|
);
|
||||||
verifyExpectedOutput(
|
verifyExpectedOutput(
|
||||||
"opfs_save_parameters",
|
"opfs_save_parameters",
|
||||||
savedParameters.result,
|
savedParameters.result,
|
||||||
@@ -9052,12 +9075,6 @@
|
|||||||
"absent=<_named_param>",
|
"absent=<_named_param>",
|
||||||
].join("\n"),
|
].join("\n"),
|
||||||
);
|
);
|
||||||
if (
|
|
||||||
savedParameters.backupOpfsPath !==
|
|
||||||
"linuxcnc/machines/browser-interp/linuxcnc.var.bak"
|
|
||||||
) {
|
|
||||||
throw new Error(`unexpected parameter backup path: ${savedParameters.backupOpfsPath}`);
|
|
||||||
}
|
|
||||||
verifyExpectedOutput(
|
verifyExpectedOutput(
|
||||||
"opfs_saved_parameter_backup_text",
|
"opfs_saved_parameter_backup_text",
|
||||||
await loadTextFile(savedParameters.backupOpfsPath),
|
await loadTextFile(savedParameters.backupOpfsPath),
|
||||||
@@ -9144,12 +9161,12 @@
|
|||||||
"linuxcnc/machines/browser-random-toolchanger/tool.tbl",
|
"linuxcnc/machines/browser-random-toolchanger/tool.tbl",
|
||||||
"/work/browser-random-tool.tbl",
|
"/work/browser-random-tool.tbl",
|
||||||
);
|
);
|
||||||
if (
|
assertOpfsParameterStaging(
|
||||||
loadedRandomSession.parameters.opfsPath !==
|
"opfs_load_random_parameters_staging",
|
||||||
"linuxcnc/machines/browser-random-toolchanger/linuxcnc.var"
|
loadedRandomSession.parameters,
|
||||||
) {
|
"linuxcnc/machines/browser-random-toolchanger/linuxcnc.var",
|
||||||
throw new Error(`unexpected default parameter path: ${loadedRandomSession.parameters.opfsPath}`);
|
"/work/browser-random-linuxcnc.var",
|
||||||
}
|
);
|
||||||
verifyExpectedOutput(
|
verifyExpectedOutput(
|
||||||
"opfs_load_random_tool_table",
|
"opfs_load_random_tool_table",
|
||||||
loadedRandomSession.toolTable.result,
|
loadedRandomSession.toolTable.result,
|
||||||
@@ -9249,12 +9266,12 @@
|
|||||||
"linuxcnc/machines/browser-ini-file-session/browser-custom-tool.tbl",
|
"linuxcnc/machines/browser-ini-file-session/browser-custom-tool.tbl",
|
||||||
"/work/browser-custom-tool.tbl",
|
"/work/browser-custom-tool.tbl",
|
||||||
);
|
);
|
||||||
if (
|
assertOpfsParameterStaging(
|
||||||
loadedIniFileSession.parameters.opfsPath !==
|
"opfs_load_ini_named_parameters_staging",
|
||||||
"linuxcnc/machines/browser-ini-file-session/browser-custom.var"
|
loadedIniFileSession.parameters,
|
||||||
) {
|
"linuxcnc/machines/browser-ini-file-session/browser-custom.var",
|
||||||
throw new Error(`unexpected custom parameter path: ${loadedIniFileSession.parameters.opfsPath}`);
|
"/work/browser-custom.var",
|
||||||
}
|
);
|
||||||
verifyExpectedOutput(
|
verifyExpectedOutput(
|
||||||
"opfs_load_ini_named_parameter_file",
|
"opfs_load_ini_named_parameter_file",
|
||||||
loadedIniFileSession.parameters.result,
|
loadedIniFileSession.parameters.result,
|
||||||
@@ -9281,18 +9298,13 @@
|
|||||||
wasmPath: loadedIniFileSession.parameters.wasmPath,
|
wasmPath: loadedIniFileSession.parameters.wasmPath,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (
|
assertOpfsParameterStaging(
|
||||||
savedIniNamedParameters.opfsPath !==
|
"opfs_save_ini_named_parameters_staging",
|
||||||
"linuxcnc/machines/browser-ini-file-session/browser-custom.var"
|
savedIniNamedParameters,
|
||||||
) {
|
"linuxcnc/machines/browser-ini-file-session/browser-custom.var",
|
||||||
throw new Error(`unexpected custom saved parameter path: ${savedIniNamedParameters.opfsPath}`);
|
"/work/browser-custom.var",
|
||||||
}
|
"linuxcnc/machines/browser-ini-file-session/browser-custom.var.bak",
|
||||||
if (
|
);
|
||||||
savedIniNamedParameters.backupOpfsPath !==
|
|
||||||
"linuxcnc/machines/browser-ini-file-session/browser-custom.var.bak"
|
|
||||||
) {
|
|
||||||
throw new Error(`unexpected custom parameter backup path: ${savedIniNamedParameters.backupOpfsPath}`);
|
|
||||||
}
|
|
||||||
verifyExpectedOutput(
|
verifyExpectedOutput(
|
||||||
"opfs_save_ini_named_parameter_file",
|
"opfs_save_ini_named_parameter_file",
|
||||||
savedIniNamedParameters.result,
|
savedIniNamedParameters.result,
|
||||||
@@ -9417,12 +9429,12 @@
|
|||||||
"linuxcnc/machines/browser-ini-override-session/browser-explicit-tool.tbl",
|
"linuxcnc/machines/browser-ini-override-session/browser-explicit-tool.tbl",
|
||||||
"/work/browser-explicit-tool.tbl",
|
"/work/browser-explicit-tool.tbl",
|
||||||
);
|
);
|
||||||
if (
|
assertOpfsParameterStaging(
|
||||||
loadedIniOverrideSession.parameters.opfsPath !==
|
"opfs_load_explicit_parameters_staging",
|
||||||
"linuxcnc/machines/browser-ini-override-session/browser-explicit.var"
|
loadedIniOverrideSession.parameters,
|
||||||
) {
|
"linuxcnc/machines/browser-ini-override-session/browser-explicit.var",
|
||||||
throw new Error(`unexpected explicit parameter path: ${loadedIniOverrideSession.parameters.opfsPath}`);
|
"/work/browser-explicit.var",
|
||||||
}
|
);
|
||||||
verifyExpectedOutput(
|
verifyExpectedOutput(
|
||||||
"opfs_load_explicit_parameter_file",
|
"opfs_load_explicit_parameter_file",
|
||||||
loadedIniOverrideSession.parameters.result,
|
loadedIniOverrideSession.parameters.result,
|
||||||
@@ -9461,18 +9473,13 @@
|
|||||||
wasmPath: loadedIniOverrideSession.parameters.wasmPath,
|
wasmPath: loadedIniOverrideSession.parameters.wasmPath,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (
|
assertOpfsParameterStaging(
|
||||||
savedExplicitParameters.opfsPath !==
|
"opfs_save_explicit_parameters_staging",
|
||||||
"linuxcnc/machines/browser-ini-override-session/browser-explicit.var"
|
savedExplicitParameters,
|
||||||
) {
|
"linuxcnc/machines/browser-ini-override-session/browser-explicit.var",
|
||||||
throw new Error(`unexpected explicit saved parameter path: ${savedExplicitParameters.opfsPath}`);
|
"/work/browser-explicit.var",
|
||||||
}
|
"linuxcnc/machines/browser-ini-override-session/browser-explicit.var.bak",
|
||||||
if (
|
);
|
||||||
savedExplicitParameters.backupOpfsPath !==
|
|
||||||
"linuxcnc/machines/browser-ini-override-session/browser-explicit.var.bak"
|
|
||||||
) {
|
|
||||||
throw new Error(`unexpected explicit backup path: ${savedExplicitParameters.backupOpfsPath}`);
|
|
||||||
}
|
|
||||||
verifyExpectedOutput(
|
verifyExpectedOutput(
|
||||||
"opfs_save_explicit_parameter_file",
|
"opfs_save_explicit_parameter_file",
|
||||||
savedExplicitParameters.result,
|
savedExplicitParameters.result,
|
||||||
|
|||||||
Reference in New Issue
Block a user