diff --git a/wasm-port/docs/compatibility-validation.md b/wasm-port/docs/compatibility-validation.md index f36f0b5..356a6c8 100644 --- a/wasm-port/docs/compatibility-validation.md +++ b/wasm-port/docs/compatibility-validation.md @@ -75,7 +75,7 @@ round-trip store without defining CNC machine-state semantics. The browser smoke script serves `wasm-port/` over localhost and runs Chromium headless against a test page that imports the JS SDK, loads the INI WASM module, queries vendored LinuxCNC INI parsing through the SDK, and performs an -OPFS text-file round trip. +OPFS text-file and generic session snapshot round trip. The aggregate host smoke script builds the INI WASM artifact once, then runs the Node WASM smoke, the Node OPFS mock smoke, and the Chromium browser smoke. @@ -128,7 +128,7 @@ The validation fails if: | --- | --- | | `tests/wasm/node/verify_ini_wasm.sh` | Validates the browser-facing INI WASM module can be built from vendored LinuxCNC `inifile.cc`, loaded through the JS SDK in Node, and queried through the exported C ABI. | | `tests/opfs/node/verify_file_service.sh` | Validates the host-owned OPFS text-file adapter, path model, and session snapshot store used by the browser INI panel without moving file persistence into the WASM core. | -| `tests/browser/verify_ini_panel_browser.sh` | Validates the INI SDK, WASM module loading, and OPFS text-file round trip in a real browser runtime. | +| `tests/browser/verify_ini_panel_browser.sh` | Validates the INI SDK, WASM module loading, OPFS text-file round trip, and generic session snapshot round trip in a real browser runtime. | | `tests/host/verify_host_smokes.sh` | Runs the current host-side Node, WASM, OPFS, and browser smoke validation with a single INI WASM build. | ## Fixture Coverage diff --git a/wasm-port/docs/drift-report.md b/wasm-port/docs/drift-report.md index 381a647..ead9574 100644 --- a/wasm-port/docs/drift-report.md +++ b/wasm-port/docs/drift-report.md @@ -62,7 +62,7 @@ semantic rewrites: vendored LinuxCNC `inifile.cc`. - OPFS validation covers a Node mock of the file-service adapter, the host-side path model, generic session snapshot storage, and a Chromium - localhost round trip for INI text-file persistence. + localhost round trip for INI text-file and session snapshot persistence. - Host-side smoke validation is aggregated by `tests/host/verify_host_smokes.sh` so Node, WASM, OPFS, and browser checks run from one command. diff --git a/wasm-port/tests/browser/ini_panel_smoke.html b/wasm-port/tests/browser/ini_panel_smoke.html index 192b8ab..5e99015 100644 --- a/wasm-port/tests/browser/ini_panel_smoke.html +++ b/wasm-port/tests/browser/ini_panel_smoke.html @@ -10,6 +10,10 @@ import { createLinuxCncIniSdk } from "../../runtime/sdk/src/linuxcnc-ini.js"; import { loadTextFile, saveTextFile } from "../../runtime/opfs/file-service.js"; import { machineIniPath } from "../../runtime/opfs/path-model.js"; + import { + loadSessionSnapshot, + saveSessionSnapshot, + } from "../../runtime/opfs/snapshot-store.js"; const status = document.getElementById("status"); @@ -51,6 +55,23 @@ JOINTS = 3 await saveTextFile(opfsPath, iniText); assertEqual(await loadTextFile(opfsPath), iniText, "opfs roundtrip"); + const snapshotPayload = { files: { ini: opfsPath } }; + const savedSnapshot = await saveSessionSnapshot( + "browser-session", + snapshotPayload, + { + createdAt: "2026-06-08T00:00:00.000Z", + metadata: { source: "browser-smoke" }, + }, + ); + const loadedSnapshot = await loadSessionSnapshot("browser-session"); + assertEqual(loadedSnapshot.format, "linuxcnc-wasm-session-snapshot", "snapshot format"); + assertEqual(loadedSnapshot.version, 1, "snapshot version"); + assertEqual(loadedSnapshot.sessionId, "browser-session", "snapshot session"); + assertEqual(loadedSnapshot.createdAt, savedSnapshot.createdAt, "snapshot timestamp"); + assertEqual(loadedSnapshot.payload.files.ini, opfsPath, "snapshot payload"); + assertEqual(loadedSnapshot.metadata.source, "browser-smoke", "snapshot metadata"); + status.textContent = "browser_ini_opfs_smoke=ok"; } catch (error) { status.textContent = `browser_ini_opfs_smoke=fail ${error.stack || error.message}`;