参考所有分组,完成尽量多的内容。禁止顺手扩功能 smoke:锁定OPFS覆盖条目
This commit is contained in:
@@ -34,6 +34,13 @@ grep -F '`Interp::save_parameters()` for `filename + ".new"`' \
|
||||
grep -F 'must not add independent filesystem behavior or expand the temporary smoke parser' \
|
||||
docs/linuxcnc-opfs-source-map.md >/dev/null
|
||||
grep -F 'parseFileWithParameterFile()' docs/linuxcnc-opfs-source-map.md >/dev/null
|
||||
grep -F 'OPFS Coverage' docs/linuxcnc-opfs-source-map.md >/dev/null
|
||||
grep -F '| `web/src/wasm-core.js` |' docs/linuxcnc-opfs-source-map.md >/dev/null
|
||||
grep -F '| `web/src/app.js` |' docs/linuxcnc-opfs-source-map.md >/dev/null
|
||||
grep -F '| `web/test-browser-wasm-smoke-opfs-basic-sections.js` |' docs/linuxcnc-opfs-source-map.md >/dev/null
|
||||
grep -F '| `web/test-browser-wasm-smoke-opfs-parameter-sections.js` |' docs/linuxcnc-opfs-source-map.md >/dev/null
|
||||
grep -F '| `web/test-browser-wasm-smoke-opfs-mirror-sections.js` |' docs/linuxcnc-opfs-source-map.md >/dev/null
|
||||
grep -F '| `web/test-browser-wasm-smoke-app-sections.js` |' docs/linuxcnc-opfs-source-map.md >/dev/null
|
||||
|
||||
grep -F 'const LINUXCNC_DEFAULT_PARAMETER_FILE = "rs274ngc.var";' web/src/wasm-core.js >/dev/null
|
||||
grep -F '`${LINUXCNC_DEFAULT_PARAMETER_FILE}.new`' web/src/wasm-core.js >/dev/null
|
||||
@@ -47,8 +54,39 @@ grep -F 'OPFS workspace is required for browser program parsing' web/src/app.js
|
||||
grep -F 'runSection("opfs parameter restore in new instance"' test-web-wasm-browser-smoke.sh >/dev/null
|
||||
grep -F 'runSection("opfs invalid parameter restore failures"' test-web-wasm-browser-smoke.sh >/dev/null
|
||||
grep -F 'runSection("opfs stale parameter state cleanup"' test-web-wasm-browser-smoke.sh >/dev/null
|
||||
grep -F 'runSection("opfs program parse and restore"' test-web-wasm-browser-smoke.sh >/dev/null
|
||||
grep -F 'runSection("browser app opfs restore"' test-web-wasm-browser-smoke.sh >/dev/null
|
||||
|
||||
if grep -R -n -E 'localStorage|sessionStorage|indexedDB|showOpenFilePicker|showSaveFilePicker|showDirectoryPicker|webkitRequestFileSystem|FileReader' web/src; then
|
||||
echo "browser app/wasm code must not add filesystem persistence outside OPFS" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
python3 - <<'PY'
|
||||
from pathlib import Path
|
||||
|
||||
source_map = Path("docs/linuxcnc-opfs-source-map.md").read_text(encoding="utf-8")
|
||||
coverage_entries = [
|
||||
"web/src/wasm-core.js",
|
||||
"web/src/app.js",
|
||||
"web/test-browser-wasm-smoke-opfs-basic-sections.js",
|
||||
"web/test-browser-wasm-smoke-opfs-parameter-sections.js",
|
||||
"web/test-browser-wasm-smoke-opfs-mirror-sections.js",
|
||||
"web/test-browser-wasm-smoke-app-sections.js",
|
||||
]
|
||||
for entry in coverage_entries:
|
||||
if f"| `{entry}` |" not in source_map:
|
||||
raise SystemExit(f"docs/linuxcnc-opfs-source-map.md missing OPFS coverage entry: {entry}")
|
||||
|
||||
required_phrases = [
|
||||
"programs/current.ngc",
|
||||
"parameters/rs274ngc.var",
|
||||
"LinuxCNC `read_text()`",
|
||||
"`.new`, `.bak`, failure, and stale-state semantics",
|
||||
"OPFS/WASM mirror persistence",
|
||||
"app-level OPFS program, parameter, backup, and reload behavior",
|
||||
]
|
||||
for phrase in required_phrases:
|
||||
if phrase not in source_map:
|
||||
raise SystemExit(f"docs/linuxcnc-opfs-source-map.md missing OPFS coverage phrase: {phrase}")
|
||||
PY
|
||||
|
||||
@@ -15,6 +15,17 @@ persistence. It is a policy and bridge map only; it must not add independent fil
|
||||
`Interp::save_parameters()` for `filename + ".new"`, backup, and replacement
|
||||
writes.
|
||||
|
||||
## OPFS Coverage
|
||||
|
||||
| Entry | Boundary |
|
||||
| --- | --- |
|
||||
| `web/src/wasm-core.js` | Keeps LinuxCNC parameter restore/save bridge files under the OPFS workspace and cleans WASM scratch files. |
|
||||
| `web/src/app.js` | Persists browser programs at `programs/current.ngc` and LinuxCNC parameters at `parameters/rs274ngc.var`. |
|
||||
| `web/test-browser-wasm-smoke-opfs-basic-sections.js` | Verifies OPFS program file reads through LinuxCNC `read_text()` and rejects unsafe paths. |
|
||||
| `web/test-browser-wasm-smoke-opfs-parameter-sections.js` | Verifies OPFS parameter restore, save, `.new`, `.bak`, failure, and stale-state semantics. |
|
||||
| `web/test-browser-wasm-smoke-opfs-mirror-sections.js` | Verifies OPFS/WASM mirror persistence used by source-backed file parsing and parameter movement. |
|
||||
| `web/test-browser-wasm-smoke-app-sections.js` | Verifies app-level OPFS program, parameter, backup, and reload behavior. |
|
||||
|
||||
## Browser Bridge Boundary
|
||||
|
||||
- `web/src/wasm-core.js` must keep LinuxCNC parameter persistence routed
|
||||
|
||||
Reference in New Issue
Block a user