Add OPFS G-code staging and browser simulation checks

This commit is contained in:
2026-06-22 10:56:21 +08:00
parent 8321055934
commit 61e2fe8441
19 changed files with 1869 additions and 35 deletions

View File

@@ -294,10 +294,27 @@ toolAxisVector
rtcpState
rtcpFrame.apiName
preview.selectedView
programExecution.motion
programExecutionTiming.samples
programRuntimeFeedback
```
browser smoke 已检查 canvas nonblank、scene objects、path points、RTCP on/off 同步和 STEP 后 TCP pose 更新。
当前 M20 已补齐真实程序显示质量 gate
```text
program preview=LinuxCNC interpreter canonical motion
tool execution trace=LinuxCNC TP samples or task/motion/HAL feedback
rapid/feed/arc visual layers=ready
current segment highlight=ready
path fit bounds=ready
desktop/mobile canvas nonblank=ready
threejs_generated_gcode_semantics=forbidden
```
Three.js 只按 runtime 输出的 motion/timing/feedback 绘制,不解析 G-code不生成 CNC 运动语义。
### Step 5profile 和 panel schema
目标:
@@ -493,6 +510,96 @@ hostRealtimeKernel=false
externalUserMProcessReady=false
```
### Step 10Native task/HAL readiness artifact
目标:
- 对齐 `docs/native-task-hal-sync-implementation-steps.md` 阶段 0-8 的 source/probe/runtime 证据;
- 生成机器可读 artifact明确 Web simulation promoted 与 host realtime/hardware/native process blocked 的区别;
- 把该 gate 接入常规 Node smoke避免文档和 runtime readiness 字段漂移。
当前实现:
```text
app/src/runtime/native-task-hal-audit.js
tests/node/verify_native_task_hal_audit.mjs
build/readiness/native-task-hal-readiness.json
```
artifact 必须包含:
```text
status=ok
taskHalWebSimulationBoundaryConsistent=true
webSimulation.promoted=true
webSimulation.nativeTaskReady=true
webSimulation.nativeHalSyncReady=true
nativeHostAndHardware.nativePromotionAllowed=false
nativeHostAndHardware.hardwareDrive=false
nativeHostAndHardware.hostRealtimeKernel=false
nativeHostAndHardware.externalUserMProcessReady=false
nativeHostAndHardware.toolDbProcessReady=false
gates.promotion_scope=web_simulation_only
```
验收:
```text
native_task_hal_source_artifact_audit=ok
task_hal_web_simulation_boundary_consistent=1
native_task_hal_host_probe_status=passed_or_ready_disabled_by_default_or_skipped_missing_host_runtime
hardware_drive=0
host_realtime_kernel=0
external_user_m_process_ready=0
tool_db_process_ready=0
promotion_scope=web_simulation_only
```
### Step 11LinuxCNC source program case coverage
目标:
- 以 vendored LinuxCNC TRT demo `.ngc` 为案例源,不新增 Web 侧 G-code 运动语义;
- 覆盖 `boat-xyzac.ngc``boat-xyzbc.ngc``impeller-7bl-xyzac.ngc`
`xyzac_switchkins*.ngc``xyzbc_switchkins.ngc`
- 对可直接解释的源程序,验证 interpreter canonical motion、TP queue timing samples、
当前 G-code 行、switchkins/RTCP 状态和 Three.js 数据源;
-`o<sub> call` 入口程序,验证 machine-file staging/remap run 与 source guard
不把 direct interpreter 无子程序上下文时的 0 motion 当成通过。
当前实现:
```text
tests/node/verify_real_linuxcnc_5axis_program_cases.mjs
tests/browser/gmoccapy_shell_smoke.html
app/src/runtime/linuxcnc-interpreter-runtime.js
wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_tp_wasm.c
```
关键约束:
```text
sourceProgramBoundary=linuxcnc_vendored_5axis_gcode_source_file
toolpathPreviewBoundary=linuxcnc_interpreter_canonical_motion
toolExecutionTraceBoundary=linuxcnc_tp_samples_or_task_motion_hal_feedback
threejsGeneratedToolpathSemantics=forbidden
fixtureToolpathFallbackPromoted=false
```
验收:
```text
linuxcnc_source_program_case_count=8
all_cases_program_preview_points=ok
all_cases_executed_path_points=ok_after_run_or_step
all_cases_toolpath_preview_source=linuxcnc_interpreter_canonical_motion
all_cases_tool_execution_trace_source=linuxcnc_tp_samples_or_task_motion_hal_feedback
all_switchkins_cases_rtcp_state_changes_verified=1
all_cases_source_guard=linuxcnc_vendored_5axis_gcode_source_file
fixture_toolpath_fallback_not_promoted=1
real_linuxcnc_5axis_program_cases_smoke=ok
```
不允许:
- 用 JS 重写 lookahead、blend、exact stop、S-curve 或 G-code modal 语义;
@@ -516,6 +623,10 @@ externalUserMProcessReady=false
当前已完成 Step 1 到 Step 9 的 Node/browser LinuxCNC kinematics proof、浏览器 Worker kinematics 隔离、浏览器 Worker interpreter canonical execution source、`xyzac-trt`/`xyzbc-trt` profile 切换、OPFS 五轴会话保存/恢复、OPFS machine-file staging、machine-file backed `fiveAxisRemap` C ABI run、程序级 `M428/M429` switchkins RTCP 自动切换、LinuxCNC TP queue timing runtime、full execution boundary audit以及真实 LinuxCNC TRT 5 轴 `.ngc` 源程序 staging/选择/运行路径。native task/HAL 执行文档的 Phase 0-8 已建立 Web simulation boundarysource manifest、默认禁用的 native TRT probe、HAL registry/thread scheduler、minimal motion/HAL servo-cycle C ABI、`lctask_*` task shim、SDK wrapper、machine-file session、store/UI diagnostics 和 full boundary gate。`M428/M429/M430` 当前既可作为 Web runtime switchkins 事件驱动 `lckins_switch()`,也可在 staged machine-file run 中交给 vendored LinuxCNC five-axis remap C ABI 验证,还可通过 task/HAL runtime 的 MDI path 写入 `motion.switchkins-type` HAL snapshot只有 LinuxCNC source manifest 中的 `configs/sim/axis/vismach/5axis/table-rotary-tilting/demos/*.ngc` 可作为 `linuxcnc-vendored-5axis-gcode` 进入 UI 和 machine-file run。`web-rtcp-5axis-full-linuxcnc-execution-boundary` 可以在 kinematics/interpreter/machine-file-remap/TP/task-HAL gates 同时通过时报告 `promotionAllowed=true`,但该提升仅限 Web simulation boundary仍必须显示 `hardwareDrive=false``hostRealtimeKernel=false``externalUserMProcessReady=false``toolDbProcessReady=false`
OPFS session 和 machine-file staging 当前具备 capability 检测。安全上下文且 `navigator.storage.getDirectory()` 可用时使用 OPFS公网 HTTP/IP 或浏览器禁用 OPFS 时切换到 memory fallback。memory fallback 只保证当前页面生命周期内的保存、恢复、staging 和 full boundary audit 可继续运行不声明跨刷新持久化。UI diagnostics 必须显示 storage mode、OPFS unavailable 状态和原因,公共 HTTP smoke 必须验证无 uncaught exception且不依赖 OPFS 的预览、DRO、G-code 加载、运行和 Three.js 显示继续通过。
gmoccapy info tabs 当前还必须显示 Host/native boundary`hardwareDrive=false``hostRealtimeKernel=false``externalUserMProcessReady=false``toolDbProcessReady=false`。browser smoke 需要同时检查 DOM 和 `fullExecutionBoundary` state避免把 Web simulation promoted 误读为 host-native 或硬件能力 ready。
注意:`wasm-port/tests/wasm/node/verify_hal_runtime.sh``wasm-port/tests/wasm/node/verify_motion_hal_sync.sh``wasm-port/tests/wasm/node/verify_task_hal_wasm.sh``wasm-port/tests/wasm/node/verify_task_hal_sdk.sh` 会写同一个 `build/wasm/task-hal/linuxcnc_task_hal.*` 输出,验证时应串行运行,避免并发构建竞争造成无效 WASM 产物。
后续如果要越过 Web simulation boundary必须另行实现 host realtime kernel / hardware IO / external user-M / tool DB process 证明;当前完成范围仍限定为浏览器仿真。