chore: close wasm status contract work

This commit is contained in:
wangdequan
2026-07-08 09:20:47 -04:00
parent 97732ceb0b
commit e69333972c
69 changed files with 20435 additions and 495 deletions

View File

@@ -1064,6 +1064,29 @@ The validation fails if:
| `tests/wasm/node/verify_sim_configs_inventory_wasm.sh` | Validates the first machine-readable Node inventory layer for `configs/sim`. It ensures native `build/native/sim-configs/summary.tsv`, generated `class-summary.tsv`, and generated `path-matrix.tsv` exist; verifies that generated `path-matrix.tsv` and tracked `docs/sim-configs-coverage-matrix.md` contain the same 159 paths as native `summary.tsv`; checks tracked matrix fields for class, native status, expected-failure reason, and blocked kind drift against generated `path-matrix.tsv`; and checks that generated `class-summary.tsv` matches class/status/expected-failure counts derived from `summary.tsv`. It then executes only entries that are currently vendored and have a defined standalone/WASM runtime path, and writes the sim-config inventory TSV artifacts. The boundary summary records one row per native inventory path with the matrix block, SDK classifier recommendation, declared HAL/UI/HALUI/Python process dependencies, `[EMCIO]DB_PROGRAM`, and execution-chain user-M codes; vendored INI rows must have an available classifier report, vendored hard blocks fail on classifier/matrix drift, safe process-declaring representatives must remain Node/browser `REP` rows with the expected process flag combinations rather than full-process promotions, and the designed full-process blocked rows must remain non-`REP` until their proof criteria are met. The generated inventory summary also requires all hard-blocked rows to remain `SKIP` with matching reasons, and `skip-summary.tsv` must match the matrix-derived skip counts. The blocked-dependency and boundary summaries record hard blocked Python-remap, tool-database, and external user-M rows from source `linuxcnc/configs/sim` INI files for dependency accounting only, including LinuxCNC source/config ownership fields, user-M script side effects, tool DB protocol evidence, Python runtime owner evidence, and completion criteria that all remain non-executing. Current gate: `executed=82`, `passed=82`, `skipped=77`, `unexpected_fail=0`; current skip/block counts are `ASSET_ONLY=65`, `L4_USER_M_PROCESS=1`, `NON_MAIN_CLASS=10`, and `UPSTREAM_DEMO=1`. The executed set now includes the deterministic `woodpecker` plus `qtdragon` / `qtdragon_hd` / `qtvcp_screens` `on_abort.ngc` family, `axis/gladevcp/probe.ngc`, `axis/rose_engine/rcone_demo.ngc`, `axis/vismach/melfa-sim/example.ngc`, and the `axis/vismach/puma` sample programs after vendoring the required machine INI, tool-table, and remap-subroutine inputs. When an upstream INI declares a missing local tool table but the native harness resolved a valid fallback table, the Node inventory stages that native-selected table at the INI-declared path so WASM execution uses the same machine context. The skip reasons are explicit: `NON_MAIN_CLASS`, `L4-TOOL-DB`, `L4-USER-M-PROCESS`, `L4-PYTHON-REMAP`, and `UPSTREAM-DEMO`; an eligible row that lacks vendored machine context is reported as an inventory failure. This runner is an inventory source-of-truth for Node WASM and is intentionally narrower than a browser full inventory. |
| `tests/wasm/node/verify_nc_files_wasm.sh` | Validates representative vendored LinuxCNC `nc_files` examples in Node WASM by copying `3D_Chips.ngc`, `arcspiral.ngc`, `hole-circle.ngc`, `factorial.ngc`, and `m6demo.ngc` into the Emscripten filesystem and forwarding to the LinuxCNC-backed `Interp::open()`/`read()`/`execute()` path. `3D_Chips.ngc` is staged with a minimal INI-declared `tool.tbl` because the upstream program contains `T1 M6`; JavaScript only stages files and checks LinuxCNC output, including `run_step` status records, and does not implement G-code, O-word, tool-change, or M-code behavior. |
| `tests/wasm/node/verify_tp_wasm.sh` | Validates a standalone trajectory-planner WASM module can be built from vendored LinuxCNC TP/TC/Ruckig support source, loaded in Node, and run the same linear, arc, and queued-line planner probe paths covered by the native TP harness. |
| `tests/wasm/node/verify_task_hal_wasm.sh` | Validates the task/motion/HAL WASM runtime-edge adapter. It builds the task-HAL module, checks task-cycle motion snapshots, command buffering, plan/execute motion issue, pause/resume/step, wait-for-motion queue behavior, motion abort/error/soft-limit subordinate sync, top/task/motion/io RCS DONE/EXEC/ERROR aggregation through `rcsStatus`, T-007 `StandaloneEmcStatus` status container export through `statusSource`, `emcStatus`, `task`, and `motionStatus`, source reuse evidence for the narrow `emctask.cc`, `taskintf.cc`, and `emccanon.cc` subsets, T-033 `taskintfMotionBridge` evidence for `emcMotionInit()`/`emcMotionUpdate()`/`emcMotionAbort()` over `lcmot_*`, T-034 `taskintf` traj control evidence for enable/disable/abort/pause/step/resume/set-motion-id, T-035 structured linear move issue evidence for `emcTrajLinearMove()` through `lcmot_write_linear_move()`, T-036 structured jog/home/switchkins issue evidence for `emcJogIncr()``emcJointHome/Unhome()` and `emcMotionSetAout()`, T-037 structured `emctask.cc` abort/state/mode command-result evidence for `emcTaskAbort()``emcTaskSetMode()` and `emcTaskSetState()`, T-038 snapshot-fed `determineMode()``determineState()` and `emcTaskUpdate()` evidence through `updateInputSource`, T-039 plan wait/open/synch/reset evidence through `planAnchors` and `taskPlanOpen`, T-040/T-046 plan read/execute evidence through `planReadExecuteAnchors` plus a staged-program main RUN path that does not call `lctask_load_program_motion_plan_json()`, T-041 canon init/finish/unit/endpoint evidence through `initFinishUnitAnchors`, T-042 canon straight motion evidence through `straightMotionAnchors` and `lastInterpListCommand=EMC_TRAJ_LINEAR_MOVE`, T-043 canon dwell/path-control evidence through `dwellPathControlAnchors`, `delayAppendCount`, and `termCondAppendCount`, T-044 canon spindle/tool command evidence through `spindleToolAnchors`, `spindleAppendCount`, and `toolAppendCount`, and T-045 canon motion output/switchkins evidence through `motionOutputAnchors`, `motionOutputAppendCount`, `motionOutputTaskintfAoutCount`, and `waitInputCount`. It also asserts `nativeTaskReady=false`, `nativeHalSyncReady=false`, and `fullLinuxCncProgramExecutionReady=false`. |
| `tests/wasm/node/verify_task_hal_sdk.sh` | Validates the JavaScript task-HAL SDK wrapper around the same C ABI without promoting native task/HAL readiness. |
| `tools/verify_task_hal_readiness_contract.sh` | Validates that the task-HAL manifest, runtime status, WASM smoke, and `docs/source-reuse-map.md` all agree that task/HAL readiness is not promoted. |
| `tools/verify_task_emc_nml_reuse_plan.sh` | Validates the T-029 decision that full upstream `emc_nml.hh` is evaluated but not directly included or vendored yet, and that the phased `StandaloneEmcStatus` / typedef route remains documented. |
| `tools/verify_task_source_reuse_drift_docs.sh` | Validates that `docs/source-reuse-map.md`, `docs/drift-report.md`, and this compatibility document all describe the current task main-loop migration phase, readiness contract, RCS aggregation surface, `StandaloneEmcStatus`, status JSON contract gate, working closure gate, and `emc_nml.hh` reuse decision consistently. |
| `tools/verify_task_taskintf_motion_bridge.sh` | Validates T-033 implementation anchors: upstream `taskintf.cc` motion init/update/abort functions, usrmot status/config/error reads, the narrow `taskintf_wasm_subset` bridge, `lcmot_read_config_snapshot()`, `lcmot_read_error_message()`, WASM exports, task status JSON `taskintfMotionBridge`, and the T-033/T-034 matrix transition. |
| `tools/verify_task_taskintf_traj_control.sh` | Validates T-034 implementation anchors: upstream `taskintf.cc` traj control functions, `EMCMOT_*` control commands, `taskintf_wasm_subset` enable/disable/set-motion-id command envelopes, `lcmot` enabled/next-motion-id state, task status JSON `trajControlIssueCount`, smoke output `taskintf_traj_control_status=ok`, and the T-034/T-035 matrix transition. |
| `tools/verify_task_taskintf_linear_move.sh` | Validates T-035 implementation anchors: upstream `emcTrajLinearMove()` and `EMCMOT_SET_LINE`, the `taskintf_wasm_subset` linear move envelope, structured `lcmot_write_linear_move()`, task status JSON `linearMoveStructuredIssueCount`, smoke output `taskintf_linear_move_status=ok`, and the T-035/T-036 matrix transition. |
| `tools/verify_task_taskintf_jog_home_switchkins.sh` | Validates T-036 implementation anchors: upstream `emcJogIncr()``emcJointHome()``emcJointUnhome()``emcMotionSetAout()` and matching `EMCMOT_*` commands, structured `lcmot_write_jog_incr()``lcmot_write_joint_home()``lcmot_write_joint_unhome()``lcmot_write_aout()`, task status JSON `jogHomeSwitchkinsStructuredIssueCount`, smoke output `taskintf_jog_home_switchkins_status=ok`, and the T-036/T-037 matrix transition. |
| `tools/verify_task_emctask_state_mode.sh` | Validates T-037 implementation anchors: upstream `emcTaskAbort()``emcTaskSetMode()``emcTaskSetState()`, the `emctask_wasm_subset` command-result boundary, task wrapper use of `apply_emctask_command_result()`, task status JSON `stateModeIssueCount`, the state matrix smoke, and the T-037/T-038 matrix transition. |
| `tools/verify_task_emctask_update_snapshot.sh` | Validates T-038 implementation anchors: upstream `determineMode()``determineState()``emcTaskUpdate()`, wrapper construction of update inputs from `LcmotStatusSnapshot` and the IO estop/error latch, task status JSON `snapshotUpdateCount`/`updateInputSource`, and the T-038/T-039 matrix transition. |
| `tools/verify_task_emctask_plan_open_wait.sh` | Validates T-039 implementation anchors: upstream `emcTaskPlanSetWait()``emcTaskPlanIsWait()``emcTaskPlanClearWait()``emcTaskPlanSynch()``emcTaskPlanOpen()``emcTaskPlanClose()``emcTaskPlanReset()`, the `emctask_wasm_subset` plan state/result boundary, task wrapper use of staged FS and plan result helpers, task status JSON `planIssueCount`/`planAnchors`, and the T-039/T-040 matrix transition. |
| `tools/verify_task_emctask_plan_read_execute.sh` | Validates T-040 implementation anchors: upstream `emcTaskPlanRead()``emcTaskPlanExecute()``emcTaskPlanLine()``emcTaskPlanLevel()``emcTaskPlanCommand()` and `interp_list`, the `emctask_wasm_subset` plan IO result boundary, wrapper use of staged program lines without host JSON motion plans, task status JSON `planReadCount`/`planExecuteCount`/`interpListAppendCount`, and the T-040/T-041 matrix transition. |
| `tools/verify_task_emccanon_init_finish_unit.sh` | Validates T-041 implementation anchors: upstream `INIT_CANON()``ON_RESET()``FINISH()``USE_LENGTH_UNITS()``GET_EXTERNAL_LENGTH_UNITS()``GET_EXTERNAL_ANGLE_UNITS()` and `GET_EXTERNAL_POSITION*()`, the `emccanon_wasm_subset` state/getter boundary, wrapper status JSON `emccanonSourceReuse.initFinishUnitAnchors` and endpoint/unit evidence, `emccanon_init_finish_unit_status=ok`, and the T-041/T-042 matrix transition. |
| `tools/verify_task_emccanon_straight_motion.sh` | Validates T-042 implementation anchors: upstream `generate_fast_move()``generate_move()``STRAIGHT_TRAVERSE()``STRAIGHT_FEED()``EMC_TRAJ_LINEAR_MOVE` and `interp_list`, the `emccanon_wasm_subset` straight linear move boundary, wrapper status JSON `straightTraverseCount`/`straightFeedCount`/`linearMoveAppendCount`/`lastInterpListCommand`, `emccanon_straight_motion_status=ok`, and the T-042/T-043 matrix transition. |
| `tools/verify_task_emccanon_dwell_path_control.sh` | Validates T-043 implementation anchors: upstream `DWELL()``SET_MOTION_CONTROL_MODE()``EMC_TRAJ_DELAY``EMC_TRAJ_SET_TERM_COND` and `interp_list`, the `emccanon_wasm_subset` dwell/path-control boundary, wrapper status JSON `dwellCount`/`delayAppendCount`/`pathControlCount`/`termCondAppendCount`, `emccanon_dwell_path_control_status=ok`, and the T-043/T-044 matrix transition. |
| `tools/verify_task_emccanon_spindle_tool.sh` | Validates T-044 implementation anchors: upstream spindle/tool command functions, `EMC_SPINDLE_*``EMC_TOOL_*` and `interp_list`, the `emccanon_wasm_subset` spindle/tool command boundary, wrapper status JSON `spindleCommandCount`/`spindleAppendCount`/`toolCommandCount`/`toolAppendCount`, `emccanon_spindle_tool_status=ok`, and the T-044/T-045 matrix transition. |
| `tools/verify_task_emccanon_motion_output.sh` | Validates T-045 implementation anchors: upstream motion output and wait command functions, `EMC_MOTION_SET_DOUT``EMC_MOTION_SET_AOUT``EMC_AUX_INPUT_WAIT` and `interp_list`, the `emccanon_wasm_subset` motion-output boundary, wrapper status JSON `motionOutputCount`/`motionOutputAppendCount`/`motionOutputTaskintfAoutCount`/`waitInputCount`, `emccanon_motion_output_status=ok`, removal of the old `M428` string special-case, and the T-045/T-046 matrix transition. |
| `tools/verify_task_no_json_motion_plan_main_path.sh` | Validates T-046 implementation anchors: primary `verify_task_hal_wasm.mjs` does not call `lctask_load_program_motion_plan_json()`, staged RUN status keeps `motionPlanLoaded=false` and `planId=0`, SDK/state-matrix tests keep `loadProgramMotionPlan()` only as a compatibility/debug entry, smoke output `task_hal_no_json_main_path_status=ok`, and the T-046/T-007 matrix transition. |
| `tools/verify_task_standalone_emc_status.sh` | Validates T-007 implementation anchors: `StandaloneEmcStatus``StandaloneEmcTaskStatus``StandaloneEmcMotionStatus` and `StandaloneEmcIoStatus` exist in the task wrapper, `write_status_snapshot()` synchronizes the container before JSON export, `statusSource=StandaloneEmcStatus` and `emcStatus` are emitted, WASM/SDK/state-matrix tests assert container compatibility with `task``motionStatus` and `rcsStatus`, smoke output `standalone_emc_status_container=ok`, and the T-007 matrix completion. |
| `tools/verify_task_status_json_contract.sh` | Validates T-051 through T-055 status JSON contract anchors: `schemaVersion=1`, `statusSource=StandaloneEmcStatus`, `emcStatus.motion.traj`, task current/read/motion line fields, `emcStatus.motion.axis[]` and `joint[]`, IO aux/tool/coolant shim objects, no `lctask_read_status_json()` call to motion JSON, SDK boundary-only behavior, smoke output `task_status_json_contract=ok`, and full-closure inclusion. |
| `tools/verify_task_working_closure.sh` | Validates T-047/T-048 working closure anchors: task matrix has no `待办``进行中` or `阻塞` rows, next priority is `无`, README/function/NML evaluation documents reflect the T-007/T-046 closed state, and ledger/evidence/decision records include the closure decision. |
| `tools/verify_task_full_closure.sh` | Runs the final task-HAL closure bundle: build task-HAL WASM once, run task runtime smoke, SDK smoke, state matrix, motion/HAL sync, T-007 `StandaloneEmcStatus`, T-046 no-JSON main RUN path, T-051-T-055 status JSON contract, T-047/T-048 working closure, source reuse/drift docs, and readiness contract gates; emits `task_full_closure_status=ok`. |
| `tests/opfs/node/verify_file_service.sh` | Validates the host-owned OPFS text-file adapter, path model, session snapshot store including custom filenames and envelope/path rejection paths, machine file store, G-code text store including filename rejection paths, OPFS-to-WASM parameter/tool-table bridges, and grouped machine-session loading without moving file persistence, parameter semantics, or tool-table semantics into the WASM core. |
| `tests/browser/verify_ini_panel_browser.sh` | Validates the INI SDK, INI/interpreter WASM module loading, LinuxCNC-backed INI machine-session file-name string lookup, OPFS text-file round trip, generic session snapshot round trip plus custom filename and envelope/path rejection paths, machine file text round trip, G-code text round trip plus filename rejection paths, and the INI panel UI's machine-session load with default OPFS parameter/tool-table file mapping, G-code run, `run_step`-backed progress/line/statement/axis display, canonical-event display paths, and 5-axis remap demo action in a real browser runtime. |
| `tests/browser/verify_interp_browser.sh` | Validates the interpreter-core WASM module loads through the interpreter JS SDK in a real browser runtime and runs selected positive and negative canonical fixtures plus vendored upstream `tests/interp` regression files through vendored LinuxCNC `Interp::execute()` and `Interp::open()`/`read()`/`execute()` via the exported C ABI, including direct browser SDK and OPFS-backed parameter-file restore/save, non-random/random tool-table load/save through vendored LinuxCNC source, vendored `xyzac-trt`/`xyzbc-trt` table-rotary-tilting and `xyzab-tdr` table-dual-rotary switchkins remap demo execution, representative vendored `configs/sim` `foam`, `geometry`, `external_offsets`, `axis/gladevcp/probe.ngc`, deterministic `woodpecker/on_abort.ngc`, bridge-mill, `melfa-sim`, and `puma_cube.ngc` programs through `runSimConfigProgram()`, representative vendored `nc_files` examples through `runFile()` or `runFileWithIni()` when the upstream file requires INI/tool-table context, and a synthetic browser assertion that `planIniFileContextStaging()` can collect INI, program, tool-table, parameter, multi-directory subroutine, executable user-M, and remap-NGC files using only manifest text. |

View File

@@ -50,6 +50,16 @@ semantic rewrites:
| 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; `runtime/opfs/file-service.js` owns browser text-file persistence, `runtime/opfs/path-model.js` owns host-side storage paths for INI, tool table, parameter, G-code, preview-cache, and session-snapshot content, `runtime/opfs/snapshot-store.js` owns generic JSON session snapshot persistence, `runtime/opfs/machine-file-store.js` owns pure-text machine-file and G-code persistence, `runtime/opfs/linuxcnc-parameter-bridge.js` only copies parameter files between OPFS text storage and the LinuxCNC-backed WASM parameter-file ABI, `runtime/opfs/linuxcnc-tool-table-bridge.js` only copies tool tables between OPFS text storage and the LinuxCNC-backed WASM tool-table ABI, and `runtime/opfs/linuxcnc-machine-session-bridge.js` groups INI, parameter, and tool-table loading while using the LinuxCNC-backed INI SDK for `[EMCIO]RANDOM_TOOLCHANGER`, `[RS274NGC]PARAMETER_FILE`, and `[EMCIO]TOOL_TABLE` when available; explicit host session file-name options take precedence over INI-derived file names, missing INI file-name values fall back to host default parameter/tool-table paths, and path validation remains owned by the OPFS path model, including rejection of traversal or nested path segments from INI-derived file names. |
| INI-context SDK staging | `runtime/sdk/src/sim-config-staging.js` exposes `planIniFileContextStaging()` as a generic host-boundary file planner and `planSimConfigStaging()` as the representative vendored `configs/sim` wrapper. The planner reads INI text plus `tools/source-manifest.txt` to collect `[DISPLAY]OPEN_FILE`, `[EMCIO]TOOL_TABLE`, `[RS274NGC]PARAMETER_FILE`, one or more `[RS274NGC]SUBROUTINE_PATH` entries, one or more `[RS274NGC]USER_M_PATH` entries, and remap-NGC files for staging without relying on browser directory enumeration. `runtime/sdk/src/linuxcnc-interp.js` exposes `runSimConfigProgram()` as the execution convenience only: it writes planned text files into the Emscripten filesystem, applies executable bits for user M-code files, and forwards to existing LinuxCNC-backed C ABI entry points such as `runFileWithIni()` or `runFiveAxisRemapFile()`; neither helper implements interpreter, axis, remap, tool, parameter, or user M-code semantics. |
| Task/motion/HAL WASM runtime | `runtime/core/linuxcnc_wrap/linuxcnc_task_hal_wasm.cpp`, `linuxcnc_motion_runtime.c`, and the phase 2 HAL runtime form a deterministic Web simulation adapter. The current boundary has task-cycle motion snapshots, command buffering, plan/execute/motion-update/subordinate-sync/status-write stages, source-anchored `emctask.cc`/`taskintf.cc`/`emccanon.cc` subsets, a T-033 `taskintf.cc` motion bridge for `emcMotionInit()`/`emcMotionUpdate()`/`emcMotionAbort()` over `lcmot_*`, T-034 traj control mapping for enable/disable/abort/pause/step/resume/set-motion-id, T-035 linear move mapping from `emcTrajLinearMove()` to structured `lcmot_write_linear_move()`, T-036 jog/home/switchkins mapping from `emcJogIncr()``emcJointHome/Unhome()` and `emcMotionSetAout()` to structured `lcmot_write_*` calls, T-037 abort/state/mode mapping from `emcTaskAbort()``emcTaskSetMode()` and `emcTaskSetState()` to a structured `emctask.cc` command result, T-038 determine/update snapshot mapping from `LcmotStatusSnapshot` and the IO estop/error latch into `determineMode()``determineState()` and `emcTaskUpdate()`, T-039 plan wait/open/synch/reset mapping from `emcTaskPlanSetWait/IsWait/ClearWait/Synch/Open/Close/Reset()` into source-anchored plan results over staged FS, T-040 plan read/execute/line/level/command mapping from `emcTaskPlanRead/Execute/Line/Level/Command()` into source-anchored plan IO results that can append staged program work to the interp_list path without host JSON motion plans, config/error read snapshots, motion ERROR and soft-limit injection coverage, and top/task/motion/io DONE/EXEC/ERROR aggregation aligned with `emctaskmain.cc`. It is still not a full native task/HAL promotion: `nativeTaskReady=false`, `nativeHalSyncReady=false`, `fullLinuxCncProgramExecutionReady=false`, and `task_hal_runtime_promoted=0` remain required. |
| Task/motion/HAL WASM runtime T-007 StandaloneEmcStatus | T-007 centralizes the required top/task/motion/io status fields into `StandaloneEmcStatus`, a phased `EMC_STAT` equivalent. `write_status_snapshot()` synchronizes task state/mode/interp/exec, motion snapshot fields, IO error/estop state, and RCS aggregation before status JSON is written; compatibility JSON fields `task`, `motionStatus`, `rcsStatus`, and `taskTopLevelStatus` are exported from the same container through `statusSource=StandaloneEmcStatus` and `emcStatus`. Full upstream `emc_nml.hh` and NML transport remain intentionally unpromoted. |
| Task/motion/HAL WASM runtime T-051-T-055 status JSON contract | T-051 through T-055 extend the same `StandaloneEmcStatus` boundary rather than adding a JSON-owned state machine. `emcStatus.motion.traj` maps `LcmotStatusSnapshot` queue/inpos/id/pause/velocity/pose fields to LinuxCNC `EMC_TRAJ_STAT` names; `emcStatus.task.currentLine/readLine/motionLine/callLevel` come from staged plan and motion snapshot evidence; `emcStatus.motion.axis[]` and `joint[]` expose structured axis/joint arrays while legacy `motionStatus.axis` and `joint0` remain compatibility views; `emcStatus.io.aux/tool/coolant` exposes only shim/unsupported IO boundaries. `tools/verify_task_status_json_contract.sh` fixes this schema and confirms `lctask_read_status_json()` does not call motion JSON or advance motion state. |
| Task/motion/HAL WASM runtime T-041 canon state | T-041 canon init/finish/unit/endpoint mapping brings `INIT_CANON()``ON_RESET()``FINISH()``USE_LENGTH_UNITS()` and external unit/position getters into the source-anchored `emccanon.cc` subset. Drift remains bounded to deterministic status evidence: counters, length/angle units, and endpoint snapshots are surfaced through task status JSON, while full interpreter/canon process ownership is still unpromoted. |
| Task/motion/HAL WASM runtime T-042 canon straight motion | T-042 straight traverse/feed mapping brings `generate_fast_move()``generate_move()``STRAIGHT_TRAVERSE()` and `STRAIGHT_FEED()` into the source-anchored `emccanon.cc` subset. Drift remains bounded to `EMC_TRAJ_LINEAR_MOVE` / `interp_list` evidence and the existing structured `taskintf.cc` motion command boundary; full native canon offsets, tags, feed modes, and NML queue ownership remain unpromoted. |
| Task/motion/HAL WASM runtime T-043 canon dwell/path-control | T-043 dwell/path-control mapping brings `DWELL()` and `SET_MOTION_CONTROL_MODE()` into the source-anchored `emccanon.cc` subset. Drift remains bounded to `EMC_TRAJ_DELAY` / `EMC_TRAJ_SET_TERM_COND` / `interp_list` evidence and task status counters; full native blend planning, queue ownership, and NML transport remain unpromoted. |
| Task/motion/HAL WASM runtime T-044 canon spindle/tool | T-044 spindle/tool command mapping brings `SET_SPINDLE_SPEED()``START_SPINDLE_CLOCKWISE()``START_SPINDLE_COUNTERCLOCKWISE()``STOP_SPINDLE_TURNING()``SELECT_TOOL()``CHANGE_TOOL()``CHANGE_TOOL_NUMBER()` and `RELOAD_TOOLDATA()` into the source-anchored `emccanon.cc` subset. Drift remains bounded to `EMC_SPINDLE_*` / `EMC_TOOL_*` / `interp_list` evidence and task status counters; full native spindle control, IO, tool DB ownership, and NML transport remain unpromoted. |
| Task/motion/HAL WASM runtime T-045 canon motion output/switchkins | T-045 motion output/switchkins mapping brings `SET_MOTION_OUTPUT_BIT()``CLEAR_MOTION_OUTPUT_BIT()``SET_AUX_OUTPUT_BIT()``CLEAR_AUX_OUTPUT_BIT()``SET_MOTION_OUTPUT_VALUE()``SET_AUX_OUTPUT_VALUE()` and `WAIT()` into the source-anchored `emccanon.cc` subset. Drift remains bounded to `EMC_MOTION_SET_DOUT` / `EMC_MOTION_SET_AOUT` / `EMC_AUX_INPUT_WAIT` / `interp_list` evidence, with M428-M430 routed through canon `SET_AUX_OUTPUT_VALUE()` before the existing `taskintf.cc` AOUT boundary; full native IO wait, queue ownership, and NML transport remain unpromoted. |
| Task/motion/HAL WASM runtime T-046 no-JSON main RUN path | T-046 makes staged program RUN the default validation path through `emctask.cc` plan read/command/execute, `emccanon.cc` command envelopes, and `taskintf.cc` motion issue. Drift remains bounded by keeping `loadProgramMotionPlan()` as an explicit timed-plan compatibility/debug entry only; the primary WASM smoke no longer calls `lctask_load_program_motion_plan_json()` before RUN. |
| `emc_nml.hh` status container | Full upstream `src/emc/nml_intf/emc_nml.hh` is evaluated but not vendored or directly included. T-029 records that direct include would pull NML/CMS, RS274, canon/tool-table, and message serialization dependencies before the broader NML transport boundary exists. Current status aggregation therefore remains a phased `StandaloneEmcStatus`/typedef boundary with LinuxCNC field names and validation gates, not byte-level drift from a vendored `emc_nml.hh`. |
## Enforced Non-Drift Rules
@@ -125,6 +135,12 @@ semantic rewrites:
`_ini[...]` lookup with upstream `rs274 -i`; the broader
`namedparam_semantics` fixture still keeps `_hal[...]` lookup on the
documented standalone HAL adapter boundary.
- Task/motion/HAL runtime validation now covers task-cycle motion snapshots,
wait-for-motion queue behavior, motion abort/error/soft-limit subordinate
sync, top/task/motion/io RCS DONE/EXEC/ERROR aggregation, source-anchored
`emctask.cc`/`taskintf.cc`/`emccanon.cc` subsets, and the T-029
`emc_nml.hh` reuse decision. These are runtime-edge validations only and do
not promote native task/HAL readiness.
## Current Drift Conclusion

View File

@@ -42,10 +42,16 @@ families, and drift report.
| RTAPI compatibility headers | `src/rtapi/rtapi_*.h` in the manifest | Copy unchanged plus standalone shim include path | `runtime/core/shims/rtapi.h` supplies the minimal standalone RTAPI surface needed by vendored code | Vendor byte sync, compile coverage through dependent source probes |
| Canon/NML-facing interpreter types | `src/emc/nml_intf/canon*.hh`, `emctool.h`, `interp_return.hh`, `motion_types.h`, `emcpose.*`, `emcpos.h`, `debugflags.h`, `src/emc/linuxcnc.h` | Copy unchanged plus narrow standalone status shim | NML transport is not ported; `runtime/core/shims/nml_intf/emc.hh` exposes only the `emcStatus` machine-units status edge currently needed by vendored interpreter conversion and initialization code | Vendor byte sync, dependent source probes, `linuxcnc_emc_status_probe`, `linuxcnc_tp_api_probe`, interpreter harnesses, `tests/wasm/node/verify_interp_wasm.sh` and `tests/browser/verify_interp_browser.sh` `Interp::init()` machine-unit assertions |
| Motion state headers | `src/emc/motion/state_tag.h`, `emcmotcfg.h`, `simple_tp.h`, `motion.h`, `mot_priv.h`, `axis.h` | Copy unchanged | Realtime motion process is not ported; standalone probes seed the small motion status/config state required by TP calls | Vendor byte sync, `linuxcnc_tp_api_probe`, `tests/wasm/node/verify_tp_wasm.sh` |
| Native task / motion / HAL sync phase 0 references | `tools/task-hal-source-manifest.txt` lists `src/emc/task/*`, selected `src/emc/motion/*`, `src/hal/*`, `src/emc/nml_intf/emc.hh`, and `src/libnml/posemath/*` | Reference proof for task/motion/HAL Web simulation runtime | `tools/verify_task_hal_source_manifest.sh` compares the local LinuxCNC reference tree and vendored tree where present, emits task/HAL/motion/NML/libnml counts. `tests/native/probe_trt_task_hal_runtime.sh` is opt-in for exclusive host LinuxCNC runtime probing and does not promote by default; Web simulation promotion is handled by task/HAL WASM and browser gates. | `tests/native/verify_task_hal_phase0.sh` |
| Native task / motion / HAL sync phase 0 references | `tools/task-hal-source-manifest.txt` lists `src/emc/task/*`, selected `src/emc/motion/*`, `src/hal/*`, `src/emc/nml_intf/emc.hh`, and `src/libnml/posemath/*` | Reference proof for task/motion/HAL Web simulation runtime | `tools/verify_task_hal_source_manifest.sh` compares the local LinuxCNC reference tree and vendored tree where present, emits task/HAL/motion/NML/libnml counts. `tests/native/probe_trt_task_hal_runtime.sh` is opt-in for exclusive host LinuxCNC runtime probing and does not promote by default; Web simulation validation is handled by task/HAL WASM and browser gates while readiness remains false. | `tests/native/verify_task_hal_phase0.sh` |
| HAL runtime phase 2 minimal boundary | `src/hal/hal_lib.c`, `src/hal/hal_priv.h`, `src/hal/components/threads.c`, `src/hal/utils/halcmd_commands.cc` as source references; `runtime/core/shims/hal.h` type boundary | Runtime-edge adapter, not full native HAL promotion | `runtime/core/linuxcnc_wrap/linuxcnc_hal_runtime.cpp` owns C/C++ HAL pin, signal, param, net, and thread scheduler state behind LinuxCNC-style `hal_*` APIs and `lchal_*` C ABI; `loadusr` is blocked evidence; task runtime and native HAL comparison remain future work | `tests/wasm/node/verify_hal_runtime.sh` WASM Node smoke; native fallback only when `emcc` is unavailable |
| Motion/HAL sync phase 3 minimal boundary | `src/emc/motion/motion.h`, `src/emc/motion/command.c`, `src/emc/motion/control.c`, `src/emc/motion/mot_priv.h`, `src/emc/task/taskintf.cc` as source references | Runtime-edge adapter, not full native motion promotion | `runtime/core/linuxcnc_wrap/linuxcnc_motion_runtime.c` exposes the planned `lcmot_*` C ABI, accepts LinuxCNC-style motion command JSON, advances deterministic servo cycles, and synchronizes `motion.*`, `axis.*`, and `joint.*` HAL pins through the phase 2 HAL runtime; full LinuxCNC `emcmotController()` and task/NML queue integration remain future work | `tests/wasm/node/verify_motion_hal_sync.sh` WASM Node smoke |
| Task/motion/HAL simulation runtime | `src/emc/task/task.hh`, `src/emc/task/emctask.cc`, `src/emc/task/emctaskmain.cc`, `src/emc/task/taskintf.cc`, `src/emc/task/emccanon.cc`, and `src/emc/nml_intf/emc.hh` as source references | Runtime-edge adapter promoted for Web simulation boundary only | `runtime/core/linuxcnc_wrap/linuxcnc_task_hal_wasm.cpp` exposes the planned `lctask_*` C ABI, stages files, opens a program, tracks task state/mode/interp/exec status, and forwards RUN/PAUSE/RESUME/ABORT/MDI/JOG into the phase 3 motion command queue. `runtime/sdk/src/linuxcnc-task-hal.js`, `app/src/runtime/linuxcnc-task-hal-runtime.js`, Worker/client files, store action mapping, gmoccapy diagnostics, and full boundary gates now validate `nativeTaskReady=true` plus `nativeHalSyncReady=true` for deterministic Web simulation. Hardware drive, host realtime kernel, external user-M process, and tool DB process remain false. | `tests/wasm/node/verify_task_hal_wasm.sh`; `tests/wasm/node/verify_task_hal_sdk.sh`; `web-rtcp-5axis-sim-plan/tests/node/verify_linuxcnc_task_hal_runtime.mjs`; browser smoke |
| Task/motion/HAL simulation runtime | `src/emc/task/task.hh`, `src/emc/task/emctask.cc`, `src/emc/task/emctaskmain.cc`, `src/emc/task/taskintf.cc`, `src/emc/task/emccanon.cc`, `src/emc/nml_intf/emc.hh`, and upstream `src/emc/nml_intf/emc_nml.hh` as an evaluated but not vendored status-container reference | Runtime-edge adapter, not full native task/HAL promotion | `runtime/core/linuxcnc_wrap/linuxcnc_task_hal_wasm.cpp` exposes the planned `lctask_*` C ABI, stages files, opens a program, tracks task state/mode/interp/exec status, and routes RUN/PAUSE/RESUME/ABORT/MDI/JOG/HOME through the phase 3 motion command queue. The current WASM simulation path uses narrow `emctask.cc`, `taskintf.cc`, and `emccanon.cc` source-anchored subsets for status update, task-to-motion command envelopes, and canonical straight motion envelopes. T-007 adds `StandaloneEmcStatus` as the current `EMC_STAT`-equivalent container for top/task/motion/io required fields; `statusSource=StandaloneEmcStatus`, `emcStatus`, `task`, `motionStatus`, and `rcsStatus` are written from that centralized status snapshot. T-051 through T-055 close the status JSON contract batches: `emcStatus.motion.traj`, task current/read/motion line fields, `emcStatus.motion.axis[]`/`joint[]`, IO aux/tool/coolant shim boundaries, and the dedicated schema gate. T-033 adds a narrow `taskintf.cc` motion bridge for `emcMotionInit()`/`emcMotionUpdate()`/`emcMotionAbort()` over `lcmot_*`, including `lcmot_read_config_snapshot()` and `lcmot_read_error_message()` for config/error reads. T-034 extends the `taskintf.cc` traj control subset so `emcTrajEnable()`/`emcTrajDisable()`/`emcTrajAbort()`/`emcTrajPause()`/`emcTrajStep()`/`emcTrajResume()`/`emcTrajSetMotionId()` map to `lcmot` command/state. T-035 maps `emcTrajLinearMove()` to structured `lcmot_write_linear_move()` instead of task-owned linear move JSON on the taskintf path. T-036 maps `emcJogIncr()``emcJointHome()``emcJointUnhome()` and `emcMotionSetAout()` to structured `lcmot_write_jog_incr()``lcmot_write_joint_home()``lcmot_write_joint_unhome()` and `lcmot_write_aout()`. T-037 maps `emcTaskAbort()``emcTaskSetMode()` and `emcTaskSetState()` into the `emctask.cc` subset so abort/state/mode decisions come from a source-anchored command result while task-cycle command buffering remains intact. T-038 feeds `determineMode()``determineState()` and `emcTaskUpdate()` from `LcmotStatusSnapshot` plus the IO estop/error latch instead of deriving update inputs from task-owned state strings. T-039 maps `emcTaskPlanSetWait()``emcTaskPlanIsWait()``emcTaskPlanClearWait()``emcTaskPlanSynch()``emcTaskPlanOpen()``emcTaskPlanClose()` and `emcTaskPlanReset()` into the `emctask.cc` subset so plan wait/open/synch/reset state is driven by source-anchored plan results over the staged FS boundary. T-040 maps `emcTaskPlanRead()``emcTaskPlanExecute()``emcTaskPlanLine()``emcTaskPlanLevel()` and `emcTaskPlanCommand()` into the `emctask.cc` subset so staged program lines can drive the interp_list/taskintf path without requiring host-provided JSON motion plans. It now has task-cycle motion snapshots, WAITING_FOR_MOTION/queue semantics, motion ERROR and soft-limit injection coverage, and top/task/motion/io DONE/EXEC/ERROR aggregation matching the `emctaskmain.cc` top-level status order. T-029 deliberately keeps full `emc_nml.hh` out of the vendor tree and records a phased `StandaloneEmcStatus`/typedef path while NML transport remains unpromoted. Full `emctaskmain.cc`/NML/native HAL/native motion process topology is not promoted. `task_hal_runtime_promoted=0`, `nativeTaskReady=false`, `nativeHalSyncReady=false`, and `fullLinuxCncProgramExecutionReady=false` are the current readiness contract. Hardware drive, host realtime kernel, external user-M process, full tool DB process, and full LinuxCNC program execution remain future work. | `tools/verify_task_full_closure.sh`; `tools/verify_task_status_json_contract.sh`; `tools/verify_task_standalone_emc_status.sh`; `tools/verify_task_working_closure.sh`; `tools/verify_task_hal_readiness_contract.sh`; `tools/verify_task_emc_nml_reuse_plan.sh`; `tools/verify_task_source_reuse_drift_docs.sh`; `tools/verify_task_emctask_state_mode.sh`; `tools/verify_task_emctask_update_snapshot.sh`; `tools/verify_task_emctask_plan_open_wait.sh`; `tools/verify_task_emctask_plan_read_execute.sh`; `tools/verify_task_taskintf_motion_bridge.sh`; `tools/verify_task_taskintf_traj_control.sh`; `tools/verify_task_taskintf_linear_move.sh`; `tools/verify_task_taskintf_jog_home_switchkins.sh`; `tests/wasm/node/verify_task_status_json_contract.mjs`; `tests/wasm/node/verify_task_hal_wasm.sh`; `tests/wasm/node/verify_task_hal_sdk.sh`; `web-rtcp-5axis-sim-plan/tests/node/verify_linuxcnc_task_hal_runtime.mjs`; browser smoke |
| Task/motion/HAL simulation runtime T-041 canon state | `src/emc/task/emccanon.cc` init/finish/unit/getter references | Runtime-edge adapter, not full native canon promotion | T-041 maps `INIT_CANON()``ON_RESET()``FINISH()``USE_LENGTH_UNITS()``GET_EXTERNAL_LENGTH_UNITS()``GET_EXTERNAL_ANGLE_UNITS()` and `GET_EXTERNAL_POSITION*()` into the `emccanon.cc` subset so canonical units, reset/finish counters, and external endpoint state are tracked from motion/config snapshots and surfaced through task status JSON without promoting full interpreter/canon ownership. | `tools/verify_task_emccanon_init_finish_unit.sh`; `tests/wasm/node/verify_task_hal_wasm.sh` |
| Task/motion/HAL simulation runtime T-042 canon straight motion | `src/emc/task/emccanon.cc` straight traverse/feed references | Runtime-edge adapter, not full native canon promotion | T-042 maps `generate_fast_move()``generate_move()``STRAIGHT_TRAVERSE()` and `STRAIGHT_FEED()` into the `emccanon.cc` subset so canonical straight traverse/feed calls produce `EMC_TRAJ_LINEAR_MOVE` evidence on the task `interp_list` path before crossing into the structured `taskintf.cc` / `lcmot_write_linear_move()` motion boundary. | `tools/verify_task_emccanon_straight_motion.sh`; `tests/wasm/node/verify_task_hal_wasm.sh` |
| Task/motion/HAL simulation runtime T-043 canon dwell/path-control | `src/emc/task/emccanon.cc` dwell and term-condition references | Runtime-edge adapter, not full native canon promotion | T-043 maps `DWELL()` and `SET_MOTION_CONTROL_MODE()` into the `emccanon.cc` subset so canonical dwell emits `EMC_TRAJ_DELAY` evidence and path-control emits `EMC_TRAJ_SET_TERM_COND` evidence on the task `interp_list` path without promoting full native canon blending, queue, or NML ownership. | `tools/verify_task_emccanon_dwell_path_control.sh`; `tests/wasm/node/verify_task_hal_wasm.sh` |
| Task/motion/HAL simulation runtime T-044 canon spindle/tool | `src/emc/task/emccanon.cc` spindle and tool command references | Runtime-edge adapter, not full native canon promotion | T-044 maps `SET_SPINDLE_SPEED()``START_SPINDLE_CLOCKWISE()``START_SPINDLE_COUNTERCLOCKWISE()``STOP_SPINDLE_TURNING()``SELECT_TOOL()``CHANGE_TOOL()``CHANGE_TOOL_NUMBER()` and `RELOAD_TOOLDATA()` into the `emccanon.cc` subset so spindle/tool command envelopes emit `EMC_SPINDLE_*` and `EMC_TOOL_*` / `interp_list` evidence without promoting full native spindle control, tool DB ownership, IO, or NML transport. | `tools/verify_task_emccanon_spindle_tool.sh`; `tests/wasm/node/verify_task_hal_wasm.sh` |
| Task/motion/HAL simulation runtime T-045 canon motion output/switchkins | `src/emc/task/emccanon.cc` motion output and wait references | Runtime-edge adapter, not full native canon promotion | T-045 maps `SET_MOTION_OUTPUT_BIT()``CLEAR_MOTION_OUTPUT_BIT()``SET_AUX_OUTPUT_BIT()``CLEAR_AUX_OUTPUT_BIT()``SET_MOTION_OUTPUT_VALUE()``SET_AUX_OUTPUT_VALUE()` and `WAIT()` into the `emccanon.cc` subset so M62-M68/M66 command envelopes emit `EMC_MOTION_SET_DOUT``EMC_MOTION_SET_AOUT` and `EMC_AUX_INPUT_WAIT` / `interp_list` evidence. M428-M430 now enter through canon `SET_AUX_OUTPUT_VALUE()` before crossing the existing `taskintf.cc` `emcMotionSetAout()` / `lcmot_write_aout()` boundary for switchkins; full native digital IO, analog IO wait semantics, queue ownership, and NML transport remain unpromoted. | `tools/verify_task_emccanon_motion_output.sh`; `tests/wasm/node/verify_task_hal_wasm.sh` |
| Task/motion/HAL simulation runtime T-046 no-JSON main RUN path | `src/emc/task/emctask.cc`, `src/emc/task/emccanon.cc`, and `src/emc/task/taskintf.cc` plan/canon/issue references | Runtime-edge adapter, not full native task promotion | T-046 removes host-provided JSON motion plans from the primary RUN validation path. The default staged-program path now proves `emcTaskPlanRead()` / `emcTaskPlanCommand()` / `emcTaskPlanExecute()` through `emccanon.cc` command envelopes and `taskintf.cc` motion issue without calling `lctask_load_program_motion_plan_json()`. `loadProgramMotionPlan()` remains exposed only as a timed-plan compatibility/debug SDK entry with separate tests, not as the main program execution path. | `tools/verify_task_no_json_motion_plan_main_path.sh`; `tests/wasm/node/verify_task_hal_wasm.sh`; `tests/wasm/node/verify_task_hal_sdk.sh`; `tests/wasm/node/verify_task_state_matrix.mjs` |
| Identity/trivial kinematics | `src/emc/kinematics/kinematics.h`, `cubic.h`, `kins_util.c`, `trivkins.c` | Copy unchanged | HAL component lifecycle and RTAPI module metadata are replaced by standalone shims; forward/inverse mapping behavior remains LinuxCNC source | Vendor byte sync, per-file source probes, `linuxcnc_kinematics_probe` |
| Switchable 5-axis bridge kinematics | `src/emc/kinematics/5axiskins.c`, `switchkins.c`, `switchkins.h`, `userkfuncs.c`, plus `src/rtapi/rtapi_ctype.h` | Copy unchanged | HAL pin allocation, HAL component lifecycle, and RTAPI module metadata are standalone runtime edges; switchable 5-axis forward/inverse behavior remains LinuxCNC source | Vendor byte sync, per-file source probes, `linuxcnc_5axis_kinematics_probe` |
| TRT table-rotary kinematics | `src/emc/kinematics/trtfuncs.c`, `xyzac-trt-kins.c`, `xyzbc-trt-kins.c` | Copy unchanged | HAL pin allocation and switchkins lifecycle stay runtime boundaries; XYZAC/XYZBC TRT forward/inverse behavior remains LinuxCNC source | Vendor byte sync, per-file source probes, `linuxcnc_xyzac_trt_kinematics_probe`, `linuxcnc_xyzbc_trt_kinematics_probe` |
@@ -132,9 +138,16 @@ families, and drift report.
`runtime/opfs/path-model.js`. Full machine-state restoration remains future
work.
- Native LinuxCNC GUI code remains out of scope for implementation.
- Native task/motion/HAL sync is complete for deterministic Web simulation:
phase 0 source/probe gates, phase 2 HAL registry, phase 3 motion/HAL
servo-cycle C ABI, phase 4 task shim plus SDK wrapper, machine-file session
handoff, Worker/client files, store action mapping, diagnostics, and full
boundary promotion gates are present. This does not imply host realtime
kernel, hardware IO, external user-M process, or full tool DB process support.
- Native task/motion/HAL sync remains a partial Web simulation adapter, not a
full LinuxCNC task/HAL promotion. Phase 0 source/probe gates, phase 2 HAL
registry, phase 3 motion/HAL servo-cycle C ABI, phase 4 task shim, SDK
wrapper, machine-file session handoff, Worker/client files, store action
mapping, diagnostics, and narrow `emctask.cc`/`taskintf.cc`/`emccanon.cc`
source-anchored subsets are present. Motion ERROR/soft-limit injection,
task/top-level RCS DONE/EXEC/ERROR aggregation, and the `emc_nml.hh` reuse
decision are documented and gated, but the status container is still a
phased standalone boundary rather than a direct `EMC_STAT` include. The
readiness fields intentionally stay `nativeTaskReady=false`,
`nativeHalSyncReady=false`, and `fullLinuxCncProgramExecutionReady=false`
until full native task cycle, native HAL sync, and full LinuxCNC program
execution are implemented and independently verified.