From c35b8bba9e836ad2087e7eb629dc2ffd8b342c5d Mon Sep 17 00:00:00 2001 From: wangdequan Date: Sun, 14 Jun 2026 00:24:45 +0800 Subject: [PATCH] Guard browser OPFS machine file readback helper --- text7.txt | 55 +++++++++++++++++++++++ wasm-port/tests/browser/interp_smoke.html | 25 ++++++----- 2 files changed, 69 insertions(+), 11 deletions(-) diff --git a/text7.txt b/text7.txt index d9e149d..157f8d2 100644 --- a/text7.txt +++ b/text7.txt @@ -2683,3 +2683,58 @@ guard,不改变 LinuxCNC-owned interpreter、INI、tool、parameter 或 runtim ```bash git status --short && git log -5 --oneline && tail -n 120 text7.txt && awk '/^[一二三四五六七八九十百]+、/ {print}' text7.txt | sort | uniq -d ``` + +四十六、2026-06-14 继续执行记录:browser OPFS machine file readback helper guard + +1. 本批目标。 + +继续 staged path guard inventory 第四十一轮,收敛 OPFS saved machine-file readback +的重复 `loadMachineTextFiles(...)` + `verifyExpectedOutput(...)` 形态。 + +2. 已完成改动。 + +- browser smoke 新增 `verifyOpfsMachineFileReadback(...)`; +- ordinary session saved parameter text readback 改为走 helper; +- ordinary session saved tool-table text readback 改为走 helper; +- random toolchanger saved tool-table text readback 改为走 helper; +- custom session 的 direct OPFS readback 仍保留 `verifyOpfsReadback(...)`; +- 未修改 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 machine file readback helper +``` + +4. 下一步工作建议。 + +继续 staged path guard inventory 第四十二轮,优先扫描 OPFS saved parameter/tool-table +readback expected text 是否还存在可安全收敛的 fixture text helper;如果收益不明显, +转向 OPFS save result `verifyExpectedOutput(...)` 的重复 result verification 小批收敛; +仍只加 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 +``` diff --git a/wasm-port/tests/browser/interp_smoke.html b/wasm-port/tests/browser/interp_smoke.html index e0b8d9e..184e754 100644 --- a/wasm-port/tests/browser/interp_smoke.html +++ b/wasm-port/tests/browser/interp_smoke.html @@ -4539,6 +4539,11 @@ verifyExpectedOutput(label, await loadTextFile(opfsPath), expectedText); } + async function verifyOpfsMachineFileReadback(label, machineId, fileKey, expectedText) { + const machineFiles = await loadMachineTextFiles(machineId); + verifyExpectedOutput(label, machineFiles[fileKey], expectedText); + } + async function writeOpfsMachineFile(machineId, filename, text) { const opfsPath = opfsMachineFilePath(machineId, filename); await saveTextFile(opfsPath, text); @@ -9237,10 +9242,10 @@ "parameter_5399=66.6", ].join("\n"), ); - const machineFiles = await loadMachineTextFiles(browserInterpMachineId); - verifyExpectedOutput( + await verifyOpfsMachineFileReadback( "opfs_saved_parameter_text", - machineFiles.parameters, + browserInterpMachineId, + "parameters", [ "5161\t12.340000", "5162\t56.780000", @@ -9281,10 +9286,10 @@ "tool_1.pocketno=7", ].join("\n"), ); - const savedMachineFiles = await loadMachineTextFiles(browserInterpMachineId); - verifyExpectedOutput( + await verifyOpfsMachineFileReadback( "opfs_saved_tool_table_text", - savedMachineFiles.toolTable, + browserInterpMachineId, + "toolTable", [ "T2", "P7", @@ -9391,12 +9396,10 @@ "tool_pocket_9.toolno=5", ].join("\n"), ); - const savedRandomMachineFiles = await loadMachineTextFiles( - browserRandomMachineId, - ); - verifyExpectedOutput( + await verifyOpfsMachineFileReadback( "opfs_saved_random_tool_table_text", - savedRandomMachineFiles.toolTable, + browserRandomMachineId, + "toolTable", [ "T2", "P7",