Guard OPFS preview-cache staging

This commit is contained in:
2026-06-13 18:00:29 +08:00
parent 422d9f42c7
commit c699c7769d
2 changed files with 75 additions and 1 deletions

View File

@@ -1626,3 +1626,64 @@ file-service 或 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 继续执行记录OPFS preview-cache staging guard
1. 本批目标。
继续 staged path guard inventory 第二十三轮,处理 OPFS preview-cache storage path
```text
linuxcnc/preview-cache/fixture/preview.json
linuxcnc/preview-cache/fixture/custom-preview.json
```
2. 已完成改动。
- Node OPFS smoke 新增 `assertPreviewCacheStoragePath(...)`
- `previewCachePath(...)` 的默认 preview filename 改为走专用 path guard
- `previewCachePath(...)` 增加 custom preview filename path guard
- 未修改 OPFS file-service、path-model、preview cache 内容或 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 preview-cache staging
```
5. 下一步工作建议。
继续 staged path guard inventory 第二十四轮,优先扫描 OPFS negative path guards 的
剩余散点,例如 `previewCachePath(...)` custom invalid filename、`machineFilePaths(...)`
或 bridge default path helpers仍只加 filesystem/OPFS path guard不改变 path-model、
file-service 或 runtime semantics。
下一轮第一条命令仍保持:
```bash
git status --short && git log -5 --oneline && tail -n 120 text7.txt && awk '/^[一二三四五六七八九十百]+、/ {print}' text7.txt | sort | uniq -d
```

View File

@@ -111,6 +111,14 @@ function assertSessionSnapshotStoragePath(sessionId, path, filename = "snapshot.
);
}
function assertPreviewCacheStoragePath(cacheKey, path, filename = "preview.json") {
assert.equal(
path,
`linuxcnc/preview-cache/${cacheKey}/${filename}`,
`${cacheKey}/${filename} preview cache OPFS path drift`,
);
}
assert.equal(await getOpfsRoot(storage), root);
assert.equal(normalizeOpfsPath("linuxcnc/machines/xyzab.ini"), "linuxcnc/machines/xyzab.ini");
@@ -122,7 +130,12 @@ assertGcodeProgramStoragePath(
"custom-fixture.ngc",
gcodeProgramPath("custom-fixture.ngc"),
);
assert.equal(previewCachePath("fixture"), "linuxcnc/preview-cache/fixture/preview.json");
assertPreviewCacheStoragePath("fixture", previewCachePath("fixture"));
assertPreviewCacheStoragePath(
"fixture",
previewCachePath("fixture", "custom-preview.json"),
"custom-preview.json",
);
assertSessionSnapshotStoragePath(
"session-1",
sessionSnapshotPath("session-1"),