Guard browser OPFS readback staging

This commit is contained in:
2026-06-13 23:18:29 +08:00
parent 0ab3bd4096
commit 54eb7e0ef4
2 changed files with 73 additions and 14 deletions

View File

@@ -2127,3 +2127,58 @@ guard不改变 LinuxCNC-owned interpreter、INI、tool、parameter 或 runtim
```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 readback staging guard
1. 本批目标。
继续 staged path guard inventory 第三十一轮,收敛 browser OPFS smoke 中 saved
parameter/tool-table readback 的重复 `loadTextFile(...)` 验证。
2. 已完成改动。
- browser smoke 新增 `verifyOpfsReadback(...)`
- saved parameter backup、INI-derived parameter text、INI-derived parameter backup、INI-derived
tool-table text、explicit parameter text、explicit parameter backup、explicit tool-table text
的读回验证改为走 readback helper
- helper 只包装 `loadTextFile(...)` + `verifyExpectedOutput(...)`,不改变 readback 语义;
- 未修改 OPFS bridge behavior、file-service、path-model、SDK planner、interpreter 或
LinuxCNC-owned 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 readback staging
```
4. 下一步工作建议。
继续 staged path guard inventory 第三十二轮,优先扫描 browser OPFS smoke 中
saved backup path 的 explicit variable names、backup file naming、以及 file-content text
fixture 的 inline path 重复,挑选仍可收敛为更小的 readback/path 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
```

View File

@@ -4535,6 +4535,10 @@
); );
} }
async function verifyOpfsReadback(label, opfsPath, expectedText) {
verifyExpectedOutput(label, await loadTextFile(opfsPath), expectedText);
}
function assertOpfsSessionStaging(label, session, machineId, expectedPaths) { function assertOpfsSessionStaging(label, session, machineId, expectedPaths) {
if (session.machineId !== machineId) { if (session.machineId !== machineId) {
throw new Error(`${label}: unexpected machine id ${session.machineId}`); throw new Error(`${label}: unexpected machine id ${session.machineId}`);
@@ -9213,9 +9217,9 @@
"absent=<_named_param>", "absent=<_named_param>",
].join("\n"), ].join("\n"),
); );
verifyExpectedOutput( await verifyOpfsReadback(
"opfs_saved_parameter_backup_text", "opfs_saved_parameter_backup_text",
await loadTextFile(savedParameters.backupOpfsPath), savedParameters.backupOpfsPath,
[ [
"5161 10.5", "5161 10.5",
"5162 20.25", "5162 20.25",
@@ -9470,9 +9474,9 @@
"parameter_5399=199", "parameter_5399=199",
].join("\n"), ].join("\n"),
); );
verifyExpectedOutput( await verifyOpfsReadback(
"opfs_saved_ini_named_parameter_text", "opfs_saved_ini_named_parameter_text",
await loadTextFile(loadedIniFileSession.parameters.opfsPath), loadedIniFileSession.parameters.opfsPath,
[ [
"5161\t33.750000", "5161\t33.750000",
"5162\t67.500000", "5162\t67.500000",
@@ -9480,9 +9484,9 @@
"5399\t199.000000", "5399\t199.000000",
].join("\n"), ].join("\n"),
); );
verifyExpectedOutput( await verifyOpfsReadback(
"opfs_saved_ini_named_parameter_backup_text", "opfs_saved_ini_named_parameter_backup_text",
await loadTextFile(savedIniNamedParameters.backupOpfsPath), savedIniNamedParameters.backupOpfsPath,
[ [
"5161 31.25", "5161 31.25",
"5162 62.5", "5162 62.5",
@@ -9526,9 +9530,9 @@
"tool_1.pocketno=8", "tool_1.pocketno=8",
].join("\n"), ].join("\n"),
); );
verifyExpectedOutput( await verifyOpfsReadback(
"opfs_saved_ini_named_tool_table_text", "opfs_saved_ini_named_tool_table_text",
await loadTextFile(loadedIniFileSession.toolTable.opfsPath), loadedIniFileSession.toolTable.opfsPath,
[ [
"T8", "T8",
"P8", "P8",
@@ -9655,9 +9659,9 @@
"parameter_5399=202", "parameter_5399=202",
].join("\n"), ].join("\n"),
); );
verifyExpectedOutput( await verifyOpfsReadback(
"opfs_saved_explicit_parameter_text", "opfs_saved_explicit_parameter_text",
await loadTextFile(loadedIniOverrideSession.parameters.opfsPath), loadedIniOverrideSession.parameters.opfsPath,
[ [
"5161\t51.250000", "5161\t51.250000",
"5162\t102.500000", "5162\t102.500000",
@@ -9665,9 +9669,9 @@
"5399\t202.000000", "5399\t202.000000",
].join("\n"), ].join("\n"),
); );
verifyExpectedOutput( await verifyOpfsReadback(
"opfs_saved_explicit_parameter_backup_text", "opfs_saved_explicit_parameter_backup_text",
await loadTextFile(savedExplicitParameters.backupOpfsPath), savedExplicitParameters.backupOpfsPath,
[ [
"5161 41.25", "5161 41.25",
"5162 82.5", "5162 82.5",
@@ -9699,9 +9703,9 @@
"tool_1.pocketno=9", "tool_1.pocketno=9",
].join("\n"), ].join("\n"),
); );
verifyExpectedOutput( await verifyOpfsReadback(
"opfs_saved_explicit_tool_table_text", "opfs_saved_explicit_tool_table_text",
await loadTextFile(loadedIniOverrideSession.toolTable.opfsPath), loadedIniOverrideSession.toolTable.opfsPath,
[ [
"T9", "T9",
"P9", "P9",