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

@@ -29,10 +29,12 @@ CNC 语义必须来自 LinuxCNC source/WASM/source-derived boundary
| 程序运行/暂停/继续/停止 | `app/src/state/store.js`, `app/src/state/linuxcnc-task-policy.js`, `app/src/ui/gmoccapy-shell.js` | `src/emc/task/emctaskmain.cc` `EMC_TASK_PLAN_RUN`, `EMC_TASK_PLAN_PAUSE`, `EMC_TASK_PLAN_RESUME`, `EMC_TASK_ABORT` | LinuxCNC task source-referenced Web policy | node smoke + browser operator smoke |
| G-code 文件加载 | `app/src/ui/gmoccapy-shell.js`, `app/src/state/store.js` | AXIS/gmoccapy open program workflow | browser file staging + LinuxCNC interpreter execution | node smoke + browser operator smoke |
| LinuxCNC 5 轴源程序选择 | `app/src/runtime/linuxcnc-machine-file-staging.js`, `app/src/state/store.js`, `app/src/ui/gmoccapy-shell.js` | `configs/sim/axis/vismach/5axis/table-rotary-tilting/demos/*.ngc` | guarded vendored LinuxCNC source-directory G-code staging + selected machine-file run | machine-file staging node smoke + browser source selector smoke |
| LinuxCNC 5 轴源程序案例覆盖 | `tests/node/verify_real_linuxcnc_5axis_program_cases.mjs`, `tests/browser/gmoccapy_shell_smoke.html`, `app/src/runtime/linuxcnc-interpreter-runtime.js` | `boat-xyzac.ngc`, `boat-xyzbc.ngc`, `impeller-7bl-xyzac.ngc`, `xyzac_switchkins*.ngc`, `xyzbc_switchkins.ngc` | source-guarded LinuxCNC demo canonical/TP/toolpath coverage; `o<sub> call` entries verified through machine-file staging/remap boundary | real LinuxCNC 5-axis program cases node smoke + browser source program smoke |
| 程序执行当前行显示 | `app/src/state/store.js`, `app/src/ui/gmoccapy-shell.js` | AXIS/gmoccapy current line display | LinuxCNC interpreter canonical motion events with fixture fallback | node smoke + browser operator smoke |
| 程序执行速度/时间 | `wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_tp_wasm.c`, `wasm-port/runtime/sdk/src/linuxcnc-tp.js`, `app/src/runtime/linuxcnc-interpreter-runtime.js`, `app/src/state/store.js`, `app/src/ui/gmoccapy-shell.js` | LinuxCNC interpreter canonical motion events queued through `src/emc/tp/tp.c`, `tc.c`, `tcq.c`, S-curve/Ruckig support sources | LinuxCNC TP queue runtime timing from canonical motion; JS estimate kept only as fallback/MDI lightweight path | TP WASM smoke + interpreter/store node smoke + browser source/dist TP timing smoke |
| 刀具预览 | `app/src/ui/gmoccapy-shell.js`, `app/src/visualization/five-axis-scene.js` | gmoccapy/vismach tool display | visualization/runtime state display | browser operator smoke |
| 3D 五轴预览 | `app/src/visualization/five-axis-scene.js` | `qtvismach_5axis_gantry.png`, `lib/python/vismach.py` | visualization | canvas nonblank smoke |
| 3D 五轴预览 | `app/src/visualization/five-axis-scene.js` | `qtvismach_5axis_gantry.png`, `lib/python/vismach.py` | visualization consuming runtime state | canvas nonblank smoke |
| Three.js 程序预览和执行轨迹 | `app/src/visualization/five-axis-scene.js`, `tests/browser/gmoccapy_shell_smoke.html` | LinuxCNC interpreter canonical motion, LinuxCNC TP timing samples, task/motion/HAL feedback | display only; no G-code semantics generated in Three.js | source-program browser smoke + desktop/mobile canvas nonblank |
| Vismach transform tree | `app/src/visualization/machine-model.ts` | `lib/python/vismach.py`, `src/hal/user_comps/vismach/*.py` | visualization from GUI reference | scene graph smoke |
| `xyzac-trt` profile | `app/src/profiles/xyzac-trt.js` | `configs/sim/axis/vismach/5axis/table-rotary-tilting/xyzac-trt.ini` | source/config reference | profile boundary node smoke |
| `xyzac-trt` source reference map | `app/src/profiles/source-reference-map.js` | `xyzac-trt.ini`, `xyzac-trt.xml`, `switchkins_postgui.hal`, `xyzac-trt_cmds.hal`, `xyzac-trt-kins.c`, `trtfuncs.c`, `switchkins.c` | profile/source map only, not runtime proof | profile boundary node smoke |
@@ -41,10 +43,11 @@ CNC 语义必须来自 LinuxCNC source/WASM/source-derived boundary
| M428/M429/M430 state | `app/src/profiles/xyzac-trt.js`, `app/src/panel-schema/xyzac-trt-pyvcp.js` | `remap_subs/428remap.ngc`, `429remap.ngc`, `430remap.ngc` | LinuxCNC remap/source reference only until runtime adapter is connected | profile boundary node smoke |
| LinuxCNC boundary adapter | `app/src/runtime/linuxcnc-boundary-adapter.js` | LinuxCNC interpreter/kinematics/TP WASM adapter point | kinematics + interpreter + TP timing runtime connected; task/motion/HAL simulation runtime connected separately | profile boundary node smoke + browser DOM smoke |
| Full execution boundary audit | `app/src/runtime/full-execution-boundary.js`, `app/src/state/store.js`, `app/src/ui/gmoccapy-shell.js` | LinuxCNC kinematics WASM, interpreter WASM, TP WASM, task/motion/HAL WASM, `runSimConfigProgram({ executionMode: "fiveAxisRemap" })`, TRT remap files | machine-file remap, TP timing, and task/motion/HAL ready for Web simulation boundary; hardware/realtime kernel/external processes still false | full execution boundary node smoke + browser DOM smoke |
| Native task/HAL readiness artifact | `app/src/runtime/native-task-hal-audit.js`, `tests/node/verify_native_task_hal_audit.mjs`, `build/readiness/native-task-hal-readiness.json` | `wasm-port/tools/task-hal-source-manifest.txt`, `wasm-port/tests/native/probe_trt_task_hal_runtime.sh`, task/motion/HAL WASM gates | machine-readable audit that separates Web simulation promotion from host realtime/hardware/native process blockers | native task/HAL audit node smoke |
| Native task / realtime HAL sync runtime | `docs/native-task-hal-sync-implementation-steps.md`, `wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_task_hal_wasm.cpp`, `app/src/runtime/linuxcnc-task-hal-runtime.js` | `src/emc/task/emctaskmain.cc`, `src/emc/task/emctask.cc`, `src/emc/task/taskintf.cc`, `src/emc/task/emccanon.cc`, `src/emc/motion/control.c`, `src/emc/motion/command.c`, `src/emc/motion/motion.c`, `src/hal/hal_lib.c`, `src/hal/hal_priv.h` | task/motion/HAL deterministic WASM simulation runtime; host realtime/hardware out of scope | source manifest, native opt-in probe, HAL runtime smoke, motion/HAL sync smoke, task/HAL WASM SDK smoke, Web store/browser smoke |
| Five-axis kinematics | `core/linuxcnc_kinematics_wasm` | `trtfuncs.c`, `xyzac-trt-kins.c`, `xyzbc-trt-kins.c`, `5axiskins.c` | LinuxCNC source-derived WASM | Node roundtrip smoke |
| RTCP/TCP frame | `app/src/runtime/rtcp-frame.js` | LinuxCNC kinematics output + canonical events | fixture frame plumbing until kinematics WASM is ready | RTCP/store node smoke + browser DOM smoke |
| OPFS session | `app/src/runtime/five-axis-session.js` | current `wasm-port/runtime/opfs` | browser OPFS 5-axis session persistence | five_axis_session_smoke + browser save/restore smoke |
| OPFS/session storage capability | `app/src/runtime/five-axis-session.js`, `app/src/runtime/linuxcnc-machine-file-staging.js`, `app/src/ui/gmoccapy-shell.js` | browser OPFS contract and current page memory fallback | OPFS persistence when available; memory fallback is current page lifecycle only | five_axis_session_smoke + machine_file_staging_smoke + public HTTP fallback browser smoke |
## 3. 源文件追溯清单
@@ -1192,3 +1195,257 @@ Remaining risk:
Next:
interpreter_worker_or_opfs_machine_file_staging_or_remap_planner_boundary
```
## 21. M18 追溯记录
```text
Batch: M18-native-task-hal-source-and-artifact-audit
Date: 2026-06-22 CST
Files changed:
.gitignore
app/package.json
app/src/runtime/native-task-hal-audit.js
tests/node/verify_native_task_hal_audit.mjs
docs/development-continuation.md
docs/program-implementation-guide.md
docs/traceability-matrix.md
Feature:
Adds a machine-readable readiness audit for the native task/HAL source and
artifact boundary. The audit consumes task/HAL source manifest evidence,
default non-exclusive TRT native probe evidence, full execution boundary
readiness, and task/HAL runtime status, then writes
build/readiness/native-task-hal-readiness.json.
LinuxCNC references:
wasm-port/tools/task-hal-source-manifest.txt
wasm-port/tests/native/probe_trt_task_hal_runtime.sh
src/emc/task/emctaskmain.cc
src/emc/motion/control.c
src/hal/hal_lib.c
Boundary:
webSimulation.promotionScope=web_simulation_only
nativeTaskReady=true for Web simulation boundary only
nativeHalSyncReady=true for Web simulation boundary only
hardwareDrive=false
hostRealtimeKernel=false
externalUserMProcessReady=false
toolDbProcessReady=false
Tests:
node web-rtcp-5axis-sim-plan/tests/node/verify_native_task_hal_audit.mjs
npm --prefix web-rtcp-5axis-sim-plan/app run smoke:node
bash web-rtcp-5axis-sim-plan/tests/browser/verify_gmoccapy_shell_browser.sh
bash web-rtcp-5axis-sim-plan/tests/browser/verify_gmoccapy_dist_browser.sh
Result:
native_task_hal_source_artifact_audit=ok
task_hal_web_simulation_boundary_consistent=1
native_task_hal_host_probe_status=ready_disabled_by_default
hardware_drive=0
host_realtime_kernel=0
external_user_m_process_ready=0
tool_db_process_ready=0
promotion_scope=web_simulation_only
Remaining risk:
The readiness artifact does not execute host realtime LinuxCNC or hardware IO.
It intentionally keeps external user-M process and tool DB process readiness
false.
Next:
M19-linuxcnc-source-program-case-coverage
```
## 22. M19 追溯记录
```text
Batch: M19-linuxcnc-source-program-case-coverage
Date: 2026-06-22 CST
Files changed:
app/package.json
app/src/runtime/linuxcnc-interpreter-runtime.js
tests/node/verify_real_linuxcnc_5axis_program_cases.mjs
tests/browser/gmoccapy_shell_smoke.html
wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_tp_wasm.c
docs/development-continuation.md
docs/program-implementation-guide.md
docs/traceability-matrix.md
Feature:
Adds a real LinuxCNC TRT source-program case gate. The gate covers staged
source guards for boat, impeller, xyzac switchkins, and xyzbc switchkins demo
programs; validates direct interpreter canonical motion and LinuxCNC TP
samples where the source file is directly executable; and validates
machine-file staging/remap readiness for subroutine-entry demo files.
LinuxCNC references:
configs/sim/axis/vismach/5axis/table-rotary-tilting/demos/boat-xyzac.ngc
configs/sim/axis/vismach/5axis/table-rotary-tilting/demos/boat-xyzbc.ngc
configs/sim/axis/vismach/5axis/table-rotary-tilting/demos/impeller-7bl-xyzac.ngc
configs/sim/axis/vismach/5axis/table-rotary-tilting/demos/xyzac_switchkins.ngc
configs/sim/axis/vismach/5axis/table-rotary-tilting/demos/xyzac_switchkins_test_1.ngc
configs/sim/axis/vismach/5axis/table-rotary-tilting/demos/xyzac_switchkins_test_2.ngc
configs/sim/axis/vismach/5axis/table-rotary-tilting/demos/xyzac_switchkins_test_3.ngc
configs/sim/axis/vismach/5axis/table-rotary-tilting/demos/xyzbc_switchkins.ngc
src/emc/tp/tp.c
Boundary:
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
Tests:
source /home/cnc/emsdk/emsdk_env.sh >/dev/null && bash wasm-port/tools/build_tp_wasm.sh
bash wasm-port/tests/wasm/node/verify_tp_wasm.sh
node web-rtcp-5axis-sim-plan/tests/node/verify_real_linuxcnc_5axis_program_cases.mjs
npm --prefix web-rtcp-5axis-sim-plan/app run smoke:node
bash web-rtcp-5axis-sim-plan/tests/browser/verify_gmoccapy_shell_browser.sh
bash web-rtcp-5axis-sim-plan/tests/browser/verify_gmoccapy_dist_browser.sh
Result:
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
Remaining risk:
`xyzac_switchkins.ngc` and `xyzbc_switchkins.ngc` are subroutine-entry demo
files; direct interpreter execution without staged subroutine context still
has zero canonical motion, so they remain verified through source guard and
machine-file remap staging rather than direct single-file preview.
Next:
M20-threejs-tool-execution-quality
```
## 23. M20 Three.js 显示质量追溯记录
```text
Batch: M20-threejs-tool-execution-quality
Date: 2026-06-22 CST
Files changed:
app/src/visualization/five-axis-scene.js
tests/browser/gmoccapy_shell_smoke.html
docs/development-continuation.md
docs/program-implementation-guide.md
docs/traceability-matrix.md
Feature:
Adds program-preview and tool-execution display quality gates to Three.js.
The scene now draws rapid/feed/arc layers, the executed TP/task trace, and
the current segment highlight while fitting the camera to real LinuxCNC
source-program bounds.
LinuxCNC references:
LinuxCNC interpreter canonical motion events
LinuxCNC TP queue timing samples
task/motion/HAL runtime feedback snapshots
Boundary:
threejsProgramPreviewMode=program-preview-and-tool-execution
toolpathPreviewBoundary=linuxcnc_interpreter_canonical_motion
toolExecutionTraceBoundary=linuxcnc_tp_samples_or_task_motion_hal_feedback
threejsGeneratedToolpathSemantics=forbidden
Tests:
bash web-rtcp-5axis-sim-plan/tests/browser/verify_gmoccapy_shell_browser.sh
bash web-rtcp-5axis-sim-plan/tests/browser/verify_gmoccapy_dist_browser.sh
Result:
threejs_program_preview_mode=program-preview-and-tool-execution
threejs_toolpath_preview_source=linuxcnc_interpreter_canonical_motion
threejs_tool_execution_trace_source=linuxcnc_tp_samples_or_task_motion_hal_feedback
threejs_path_fit_bounds=ok
threejs_current_segment_highlight=ok
threejs_rapid_feed_visual_distinction=ok
threejs_no_gcode_semantics_generation=ok
threejs_canvas_nonblank_desktop=ok
threejs_canvas_nonblank_mobile=ok
Remaining risk:
The visual distinction is display-only and remains limited to canonical/TP
segment data already emitted by LinuxCNC runtimes. It does not add lookahead,
blending, planner semantics, or hardware execution semantics in Three.js.
Next:
M21-public-http-opfs-degradation
```
## 24. M21 公网 OPFS 降级追溯记录
```text
Batch: M21-public-http-opfs-degradation
Date: 2026-06-22 CST
Files changed:
app/src/runtime/five-axis-session.js
app/src/runtime/linuxcnc-machine-file-staging.js
app/src/state/store.js
app/src/ui/gmoccapy-shell.js
tests/node/verify_machine_file_staging.mjs
tests/browser/gmoccapy_shell_smoke.html
docs/development-continuation.md
docs/program-implementation-guide.md
docs/traceability-matrix.md
Feature:
Adds explicit storage capability detection and current-page memory fallback
for public HTTP/IP deployments where OPFS is unavailable. Session save/restore
and machine-file staging continue inside the current page lifecycle, while UI
diagnostics report OPFS unavailable and the fallback reason.
LinuxCNC references:
LinuxCNC machine-file staging remains based on vendored TRT source/config
files; storage fallback does not alter interpreter, TP, task/HAL, or
kinematics semantics.
Boundary:
opfsAvailable=false when browser capability is missing or forced unavailable
fallbackMode=memory-fallback
memoryFallbackPersistence=current_page_lifecycle_only
nonOpfsWorkflowsStillPass=true
Tests:
node web-rtcp-5axis-sim-plan/tests/node/verify_machine_file_staging.mjs
node web-rtcp-5axis-sim-plan/tests/node/verify_five_axis_session.mjs
npm --prefix web-rtcp-5axis-sim-plan/app run smoke:node
bash web-rtcp-5axis-sim-plan/tests/browser/verify_gmoccapy_shell_browser.sh
bash web-rtcp-5axis-sim-plan/tests/browser/verify_gmoccapy_dist_browser.sh
Result:
opfs_unavailable_detected=1
opfs_fallback_current_page_lifecycle_only=1
opfs_dependent_actions_report_clear_fallback_message=1
non_opfs_workflows_still_pass=1
public_http_smoke_no_uncaught_exception=1
Remaining risk:
Memory fallback is not persistent across reloads. True OPFS persistence still
requires a secure context and browser OPFS support.
Next:
none_from_development_continuation
```
## 25. M22 Host/native 边界可见性追溯记录
```text
Batch: M22-host-native-boundary-visibility
Date: 2026-06-22 CST
Files changed:
app/src/ui/gmoccapy-shell.js
tests/browser/gmoccapy_shell_smoke.html
docs/development-continuation.md
docs/traceability-matrix.md
Feature:
Adds an explicit Host/native diagnostics row in gmoccapy info tabs so the
promoted Web simulation task/motion/HAL boundary remains visibly separated
from hardware drive, host realtime kernel, external user-M process, and tool
DB process readiness.
LinuxCNC references:
No new LinuxCNC source semantics are introduced. The change displays existing
full execution boundary fields emitted by the LinuxCNC task/motion/HAL Web
simulation runtime audit.
Boundary:
hardwareDrive=false
hostRealtimeKernel=false
externalUserMProcessReady=false
toolDbProcessReady=false
promotionScope=web_simulation_only
Tests:
bash web-rtcp-5axis-sim-plan/tests/browser/verify_gmoccapy_shell_browser.sh
bash web-rtcp-5axis-sim-plan/tests/browser/verify_gmoccapy_dist_browser.sh
npm --prefix web-rtcp-5axis-sim-plan/app run smoke:node
Result:
host_native_boundary_ui=ok
hardware_drive_false_visible=1
host_realtime_false_visible=1
external_user_m_false_visible=1
tool_db_false_visible=1
Remaining risk:
This is a visibility and regression guard only. It does not implement host
realtime kernel, hardware IO, external user-M process, or native tool DB
process support.
Next:
none_from_development_continuation
```