按建议,继续完成后续工作

结论:已将 INI 面板的 OPFS 文本文件读写抽为 host-side file-service,并新增 Node mock 验证,确认 OPFS 边界不进入 WASM core 且可覆盖保存、读取、缺失路径和非法路径行为。
This commit is contained in:
2026-06-08 00:19:52 +08:00
parent 0a8bf7d5e2
commit 9a9fb5d4c1
8 changed files with 180 additions and 47 deletions

View File

@@ -18,6 +18,12 @@ The current WASM smoke validation command is:
wasm-port/tests/wasm/node/verify_ini_wasm.sh
```
The current OPFS host-boundary validation command is:
```bash
wasm-port/tests/opfs/node/verify_file_service.sh
```
## Validation Chain
The native validation script runs these checks in order:
@@ -46,6 +52,11 @@ The WASM INI smoke script builds `runtime/ui/ini-panel/linuxcnc_ini.js` and
module in Node and verifies `lcini_get_string()` against an in-memory INI file
written to the Emscripten filesystem.
The OPFS host-boundary script validates the JavaScript file-service adapter
with a Node mock of the browser File System Access handles. It covers nested
directory creation, text save/load, missing file behavior, invalid relative
paths, and unavailable OPFS storage.
## Source Coverage
Every `.c` and `.cc` entry in `tools/source-manifest.txt` must have a
@@ -93,6 +104,7 @@ The validation fails if:
| Harness | Purpose |
| --- | --- |
| `tests/wasm/node/verify_ini_wasm.sh` | Validates the browser-facing INI WASM module can be built from vendored LinuxCNC `inifile.cc`, loaded in Node, and queried through the exported C ABI. |
| `tests/opfs/node/verify_file_service.sh` | Validates the host-owned OPFS text-file adapter used by the browser INI panel without moving file persistence into the WASM core. |
## Fixture Coverage
@@ -136,8 +148,9 @@ Negative fixtures currently cover:
## Validation Boundaries
Current full-core validation is native-only. WASM validation is limited to the
INI parser smoke harness. Browser, SDK, OPFS, and full machine-session
validation remain future work.
INI parser smoke harness. OPFS validation is limited to the JavaScript
host-boundary adapter. Browser, SDK, and full machine-session validation
remain future work.
The current fixture expectations validate standalone behavior against both the
vendored LinuxCNC source path and an upstream `rs274` side-by-side baseline for

View File

@@ -42,7 +42,7 @@ semantic rewrites:
| Kinematics component lifecycle | Kinematics modules are initialized through LinuxCNC module entry points where native runtime probes exist, while HAL component init/ready/exit, HAL pin allocation, and RTAPI module metadata are handled by standalone shims. |
| Go math C/C++ linkage | `genserkins` runtime probing compiles vendored `gomath.c` through a narrow C++ wrapper so LinuxCNC `genserfuncs.c` can link to the upstream Go math symbols without editing vendored source. |
| Switchkins iterative forward | `genhexkins` runtime probing follows LinuxCNC switchkins iterative-forward behavior, including the first-call warmup path before asserting roundtrip convergence. |
| Browser storage | OPFS remains outside the native core and is not yet connected. |
| Browser storage | OPFS remains outside the native core; `runtime/opfs/file-service.js` owns browser text-file persistence for host-managed INI content. |
## Enforced Non-Drift Rules
@@ -59,7 +59,8 @@ semantic rewrites:
- No browser/full-core WASM parity tests yet. The INI parser now has a Node
WASM smoke harness against vendored LinuxCNC `inifile.cc`.
- No JS SDK validation yet.
- No OPFS persistence validation yet.
- OPFS validation is currently limited to a Node mock of the browser
file-service adapter; browser-level OPFS validation is not yet established.
- Identity/trivial, `5axiskins`, TRT `xyzac`/`xyzbc`, delta, SCARA, PUMA,
serial, hexapod, pentapod, and related kinematics sources now have native
source-probe coverage.

View File

@@ -51,7 +51,7 @@ Current validation is intentionally mechanical:
| Dependency | LinuxCNC files that expose it | Standalone treatment |
| --- | --- | --- |
| Native file IO | `inifile.cc`, `rs274ngc_pre.cc`, parameter file paths | Allowed in native probes; browser OPFS remains a host-side future adapter |
| Native file IO | `inifile.cc`, `rs274ngc_pre.cc`, parameter file paths | Allowed in native probes; browser OPFS remains a host-side adapter under `runtime/opfs/` |
| RTAPI | `rtapi_*.h`, TP, posemath, motion headers | Minimal standalone shim in `runtime/core/shims/rtapi.h` |
| NML transport | `emc.hh`, motion/NML type headers | Transport is not ported; only the status/type edges needed by vendored compute code are exposed through standalone shims and probes |
| HAL runtime | named parameter lookup, kinematics component lifecycle, and runtime status edges | Standalone HAL adapter under `runtime/core/linuxcnc_wrap/` |
@@ -70,6 +70,7 @@ Current validation is intentionally mechanical:
fixture-covered through vendored `interp_convert.cc` and `interp_queue.cc`.
- Browser/WASM C ABI and JS SDK layers are not yet built for the full
interpreter/planner core. The INI parser has a Node WASM smoke harness.
- OPFS persistence is not yet connected to INI, tool table, parameter file, or
G-code program loading.
- OPFS persistence is connected to the INI panel through the host-side
`runtime/opfs/file-service.js` adapter; tool table, parameter file, G-code
program loading, and browser-level OPFS validation remain future work.
- Native LinuxCNC GUI code remains out of scope for implementation.