diff --git a/text7.txt b/text7.txt index 5ff4d3c..0141fd9 100644 --- a/text7.txt +++ b/text7.txt @@ -1559,3 +1559,70 @@ semantics。 ```bash git status --short && git log -5 --oneline && tail -n 120 text7.txt && awk '/^[一二三四五六七八九十百]+、/ {print}' text7.txt | sort | uniq -d ``` + +二十七、2026-06-13 继续执行记录:OPFS snapshot staging guard + +1. 本批目标。 + +继续 staged path guard inventory 第二十二轮,处理 OPFS session snapshot storage +path: + +```text +linuxcnc/sessions/session-1/snapshot.json +linuxcnc/sessions/session-1/custom-snapshot.json +``` + +2. 已完成改动。 + +- Node OPFS smoke 新增 `assertSessionSnapshotStoragePath(...)`; +- `sessionSnapshotPath(...)` 的默认 snapshot 与 custom snapshot 路径改为走专用 path + guard; +- `saveSessionSnapshot(...)` 的默认 snapshot 与 custom snapshot 后增加 path guard; +- `loadSessionSnapshot(...)` 的 snapshot 内容验证保持不变; +- invalid snapshot filename、bad JSON、bad format/version/session-id rejection 验证保持 + 不变; +- 未修改 OPFS file-service、snapshot schema、snapshot-store、path-model 或 session + runtime semantics。 + +涉及文件: + +```text +wasm-port/tests/opfs/node/verify_file_service.mjs +``` + +3. 已完成的目标验证。 + +```bash +git diff --check +wasm-port/tests/opfs/node/verify_file_service.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 +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 +Guard OPFS snapshot staging +``` + +5. 下一步工作建议。 + +继续 staged path guard inventory 第二十三轮,优先扫描 OPFS preview-cache path 边界, +例如 `previewCachePath(...)` 与 `linuxcnc/preview-cache//preview.json` 或 custom +preview filename 对账;仍只加 filesystem/OPFS path guard,不改变 preview cache、 +file-service 或 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/opfs/node/verify_file_service.mjs b/wasm-port/tests/opfs/node/verify_file_service.mjs index 34eb24d..42beb2a 100644 --- a/wasm-port/tests/opfs/node/verify_file_service.mjs +++ b/wasm-port/tests/opfs/node/verify_file_service.mjs @@ -103,6 +103,14 @@ function assertGcodeProgramStoragePath(filename, path) { ); } +function assertSessionSnapshotStoragePath(sessionId, path, filename = "snapshot.json") { + assert.equal( + path, + `linuxcnc/sessions/${sessionId}/${filename}`, + `${sessionId}/${filename} session snapshot OPFS path drift`, + ); +} + assert.equal(await getOpfsRoot(storage), root); assert.equal(normalizeOpfsPath("linuxcnc/machines/xyzab.ini"), "linuxcnc/machines/xyzab.ini"); @@ -115,10 +123,14 @@ assertGcodeProgramStoragePath( gcodeProgramPath("custom-fixture.ngc"), ); assert.equal(previewCachePath("fixture"), "linuxcnc/preview-cache/fixture/preview.json"); -assert.equal(sessionSnapshotPath("session-1"), "linuxcnc/sessions/session-1/snapshot.json"); -assert.equal( +assertSessionSnapshotStoragePath( + "session-1", + sessionSnapshotPath("session-1"), +); +assertSessionSnapshotStoragePath( + "session-1", sessionSnapshotPath("session-1", "custom-snapshot.json"), - "linuxcnc/sessions/session-1/custom-snapshot.json", + "custom-snapshot.json", ); assert.deepEqual(defaultMachinePaths("xyzab-tdr"), { ini: "linuxcnc/machines/xyzab-tdr/machine.ini", @@ -182,6 +194,10 @@ await saveSessionSnapshot("session-1", snapshotPayload, { createdAt: "2026-06-08T00:00:00.000Z", metadata: { source: "node-smoke" }, }); +assertSessionSnapshotStoragePath( + "session-1", + sessionSnapshotPath("session-1"), +); assert.deepEqual(await loadSessionSnapshot("session-1", { storage }), snapshot); const customSnapshot = await saveSessionSnapshot("session-1", snapshotPayload, { storage, @@ -189,6 +205,11 @@ const customSnapshot = await saveSessionSnapshot("session-1", snapshotPayload, { createdAt: "2026-06-08T00:00:00.000Z", metadata: { source: "node-smoke-custom" }, }); +assertSessionSnapshotStoragePath( + "session-1", + sessionSnapshotPath("session-1", "custom-snapshot.json"), + "custom-snapshot.json", +); assert.equal( customSnapshot.metadata.source, "node-smoke-custom",