Guard browser OPFS invalid session staging
This commit is contained in:
59
text7.txt
59
text7.txt
@@ -2011,3 +2011,62 @@ parameter 或 runtime semantics。
|
||||
```bash
|
||||
git status --short && git log -5 --oneline && tail -n 120 text7.txt && awk '/^[一二三四五六七八九十百]+、/ {print}' text7.txt | sort | uniq -d
|
||||
```
|
||||
|
||||
三十四、2026-06-13 继续执行记录:browser OPFS invalid session staging guard
|
||||
|
||||
1. 本批目标。
|
||||
|
||||
继续 staged path guard inventory 第二十九轮,收敛 browser OPFS smoke 中 invalid INI
|
||||
parameter/tool-table rejection 的重复 staging guard:
|
||||
|
||||
```text
|
||||
browser-invalid-param-file-session
|
||||
browser-invalid-tool-file-session
|
||||
```
|
||||
|
||||
2. 已完成改动。
|
||||
|
||||
- browser smoke 新增 `verifyOpfsInvalidIniSessionRejects(...)`;
|
||||
- invalid parameter-file session 改为通过 helper 保存 machine text、校验默认 OPFS
|
||||
machine text paths、校验 INI staging path,再验证 expected rejection;
|
||||
- invalid tool-table session 改为通过同一 helper 走相同 staging/rejection guard;
|
||||
- 保留 LinuxCNC-owned INI filename validation 的错误期望,不改变 OPFS bridge behavior、
|
||||
file-service、path-model、SDK planner、interpreter 或 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
|
||||
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 invalid session staging
|
||||
```
|
||||
|
||||
4. 下一步工作建议。
|
||||
|
||||
继续 staged path guard inventory 第三十轮,优先扫描 browser OPFS smoke 中 save
|
||||
parameter/tool-table 后的 explicit `assertOpfsParameterStaging(...)`、
|
||||
`assertOpfsToolTableStaging(...)` 是否还能按 save-operation helper 小批收敛;仍只加
|
||||
browser/OPFS boundary guard,不改变 LinuxCNC-owned interpreter、INI、tool、parameter
|
||||
或 runtime semantics。
|
||||
|
||||
下一轮第一条命令仍保持:
|
||||
|
||||
```bash
|
||||
git status --short && git log -5 --oneline && tail -n 120 text7.txt && awk '/^[一二三四五六七八九十百]+、/ {print}' text7.txt | sort | uniq -d
|
||||
```
|
||||
|
||||
@@ -4541,6 +4541,32 @@
|
||||
);
|
||||
}
|
||||
|
||||
async function verifyOpfsInvalidIniSessionRejects(label, interp, iniSdk, machineId, iniLines, expectedPattern) {
|
||||
const machineTextPaths = await saveMachineTextFiles(machineId, {
|
||||
ini: iniLines.join("\n"),
|
||||
});
|
||||
assertMachineTextStorePaths(`${label}_machine_text_files_staging`, machineTextPaths, machineId);
|
||||
|
||||
const sessionOptions = {
|
||||
iniSdk,
|
||||
iniWasmPath: `/work/${machineId}.ini`,
|
||||
};
|
||||
assertOpfsIniStaging(
|
||||
`${label}_ini_staging`,
|
||||
{
|
||||
opfsPath: `linuxcnc/machines/${machineId}/machine.ini`,
|
||||
wasmPath: sessionOptions.iniWasmPath,
|
||||
},
|
||||
`linuxcnc/machines/${machineId}/machine.ini`,
|
||||
`/work/${machineId}.ini`,
|
||||
);
|
||||
await verifyRejects(
|
||||
label,
|
||||
() => loadMachineSessionFromOpfs(interp, machineId, sessionOptions),
|
||||
expectedPattern,
|
||||
);
|
||||
}
|
||||
|
||||
function assertSimConfigStagingPlan(machineRel, plan, expectedWasmDir) {
|
||||
if (plan.wasmDir !== expectedWasmDir) {
|
||||
throw new Error(`${machineRel}: browser sim staging root drift`);
|
||||
@@ -9657,79 +9683,35 @@
|
||||
].join("\n"),
|
||||
);
|
||||
|
||||
const invalidParamFileTextPaths = await saveMachineTextFiles("browser-invalid-param-file-session", {
|
||||
ini: [
|
||||
await verifyOpfsInvalidIniSessionRejects(
|
||||
"opfs_reject_invalid_ini_parameter_file",
|
||||
interp,
|
||||
ini,
|
||||
"browser-invalid-param-file-session",
|
||||
[
|
||||
"[EMC]",
|
||||
"MACHINE = browser-invalid-param-file-session",
|
||||
"",
|
||||
"[RS274NGC]",
|
||||
"PARAMETER_FILE = ../escape.var",
|
||||
"",
|
||||
].join("\n"),
|
||||
});
|
||||
assertMachineTextStorePaths(
|
||||
"opfs_save_invalid_param_machine_text_files_staging",
|
||||
invalidParamFileTextPaths,
|
||||
"browser-invalid-param-file-session",
|
||||
);
|
||||
const invalidParamFileSessionOptions = {
|
||||
iniSdk: ini,
|
||||
iniWasmPath: "/work/browser-invalid-param-file-session.ini",
|
||||
};
|
||||
assertOpfsIniStaging(
|
||||
"opfs_reject_invalid_ini_parameter_file_staging",
|
||||
{
|
||||
opfsPath: "linuxcnc/machines/browser-invalid-param-file-session/machine.ini",
|
||||
wasmPath: invalidParamFileSessionOptions.iniWasmPath,
|
||||
},
|
||||
"linuxcnc/machines/browser-invalid-param-file-session/machine.ini",
|
||||
"/work/browser-invalid-param-file-session.ini",
|
||||
);
|
||||
await verifyRejects(
|
||||
"opfs_reject_invalid_ini_parameter_file",
|
||||
() => loadMachineSessionFromOpfs(
|
||||
interp,
|
||||
"browser-invalid-param-file-session",
|
||||
invalidParamFileSessionOptions,
|
||||
),
|
||||
],
|
||||
/Invalid parameter filename/,
|
||||
);
|
||||
|
||||
const invalidToolFileTextPaths = await saveMachineTextFiles("browser-invalid-tool-file-session", {
|
||||
ini: [
|
||||
await verifyOpfsInvalidIniSessionRejects(
|
||||
"opfs_reject_invalid_ini_tool_table",
|
||||
interp,
|
||||
ini,
|
||||
"browser-invalid-tool-file-session",
|
||||
[
|
||||
"[EMC]",
|
||||
"MACHINE = browser-invalid-tool-file-session",
|
||||
"",
|
||||
"[EMCIO]",
|
||||
"TOOL_TABLE = nested/tool.tbl",
|
||||
"",
|
||||
].join("\n"),
|
||||
});
|
||||
assertMachineTextStorePaths(
|
||||
"opfs_save_invalid_tool_machine_text_files_staging",
|
||||
invalidToolFileTextPaths,
|
||||
"browser-invalid-tool-file-session",
|
||||
);
|
||||
const invalidToolFileSessionOptions = {
|
||||
iniSdk: ini,
|
||||
iniWasmPath: "/work/browser-invalid-tool-file-session.ini",
|
||||
};
|
||||
assertOpfsIniStaging(
|
||||
"opfs_reject_invalid_ini_tool_table_staging",
|
||||
{
|
||||
opfsPath: "linuxcnc/machines/browser-invalid-tool-file-session/machine.ini",
|
||||
wasmPath: invalidToolFileSessionOptions.iniWasmPath,
|
||||
},
|
||||
"linuxcnc/machines/browser-invalid-tool-file-session/machine.ini",
|
||||
"/work/browser-invalid-tool-file-session.ini",
|
||||
);
|
||||
await verifyRejects(
|
||||
"opfs_reject_invalid_ini_tool_table",
|
||||
() => loadMachineSessionFromOpfs(
|
||||
interp,
|
||||
"browser-invalid-tool-file-session",
|
||||
invalidToolFileSessionOptions,
|
||||
),
|
||||
],
|
||||
/Invalid tool table filename/,
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user