Files
cnc_wams/wasm-port/docs/drift-report.md
wangdequan 335ab61a61 按建议,继续完成后续工作
结论:将解释器外部长度单位读取接入共享 emcStatus 状态边界,并补充 inch/mm 初始化验证。
2026-06-07 23:51:13 +08:00

95 lines
5.9 KiB
Markdown

# Drift Report
## Current Status
As of the current upstream baseline, no byte-level drift is allowed between
files listed in `tools/source-manifest.txt` and the matching files under
`../linuxcnc/`.
The enforced upstream baseline is:
```text
60597ee0718873d2449058c824262a275e5e4bad
```
`tools/verify_vendor_sync.sh` enforces this by comparing every manifest file
against upstream during native validation.
## Allowed Standalone Boundaries
The following differences are intentional runtime boundaries, not LinuxCNC
semantic rewrites:
| Boundary | Standalone treatment |
| --- | --- |
| RTAPI | Minimal compatibility shim in `runtime/core/shims/rtapi.h`. |
| HAL lookup | Standalone HAL adapter for `_hal[...]` named parameter reads. |
| INI lookup | Standalone INI adapter around vendored LinuxCNC INI parser behavior. |
| Canonical output | Canonical calls are captured as test events instead of driving hardware. |
| Tool-data reload | LinuxCNC `RELOAD_TOOLDATA` is captured as a canonical test event; browser/native tool-table reload plumbing remains a future host/runtime adapter. |
| Interpreter state tags | LinuxCNC `UPDATE_TAG` callbacks are captured from the state tags packed by vendored interpreter code; standalone code does not derive modal state. |
| Rotary indexer lock state | LinuxCNC `UNLOCK_ROTARY` and `LOCK_ROTARY` callbacks are captured from the vendored single-axis indexer path; standalone code does not implement rotary-indexing semantics. |
| File flush | LinuxCNC `FINISH` is captured as a canonical test event on the vendored `%`-delimited file-reading path. |
| Interpreter reset | LinuxCNC `ON_RESET` is captured as a canonical test event on the vendored interpreter reset/file-open path. |
| Interpreter init | LinuxCNC `INIT_CANON` and the canonical initialization sequence from vendored `Interp::init()` are captured as test events. |
| Comment logging | LinuxCNC `LOGOPEN`, `LOG`, `LOGAPPEND`, and `LOGCLOSE` callbacks are captured as canonical test events instead of writing host log files. |
| EMC status machine units | A narrow standalone `emcStatus` shim exposes the machine-units field used by vendored interpreter conversion and initialization code; `linuxcnc_emc_status_probe` and `linuxcnc_interp_init_harness` guard the inch/mm boundary. |
| Python/remap | Python/remap hooks are stubbed at the runtime edge. |
| Dynamic interpreter path | `interp_base.cc` probe uses standalone `EMC2_HOME` compile-time path boundary. |
| Realtime scheduler | TP probes seed deterministic status/config data instead of running LinuxCNC realtime process topology. |
| 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. |
## Enforced Non-Drift Rules
- Do not edit `../linuxcnc/`.
- Do not patch vendored files without adding a patch under `patches/` and
documenting the reason.
- Do not add standalone `Interp::convert_g()`.
- Do not add `.c` or `.cc` manifest files without a source compile probe.
- Do not sync from a different upstream commit without updating
`tools/upstream-baseline.txt` and `docs/scope-and-baseline.md`.
## Known Gaps
- No browser/WASM parity tests yet.
- No JS SDK validation yet.
- No OPFS persistence validation yet.
- Identity/trivial, `5axiskins`, TRT `xyzac`/`xyzbc`, delta, SCARA, PUMA,
serial, hexapod, pentapod, and related kinematics sources now have native
source-probe coverage.
- Full machine baselines beyond the current identity/trivial, `5axiskins`,
TRT, delta, SCARA, PUMA, serial `genserkins`, hexapod `genhexkins`,
pentapod `pentakins`, and other existing runtime probes are not established.
- Positive cutter-compensated motion and cutter compensation rejection paths
now have standalone interpreter fixture coverage through vendored LinuxCNC
source.
- Fixture expectations are checked against the standalone vendored source
path. The upstream `rs274` side-by-side baseline now covers simple motion,
arc geometry, offsets, feed-control, comment/logging, numbered-parameter,
probing, spindle-orient, file-open reset, file-finish, tool-reload, and
tool select/change/length-offset, canned-cycle, state-tag motion, tool-table
setup, and O-word subroutine fixtures; it also covers threading/rigid tap,
NURBS dispatch boundaries, and comparable canonical runtime edge and
program-end cleanup calls.
Adapter-heavy fixtures, standalone modal-state assertions, and upstream
`rs274` output gaps such as `WAIT` or hidden NURBS control-point detail still
need dedicated native LinuxCNC baselines.
- `canned_cycles` is now in the upstream `rs274` side-by-side baseline after
the minimal interpreter harness was aligned with LinuxCNC `Interp::init()`
default `G73/G83` peck-clearance values for millimeter units.
- `tool_table_setup` is now in the upstream `rs274` side-by-side baseline using
a dedicated `rs274 -t` tool table and `-i` millimeter-unit INI boundary.
- `tool_semantics` now compares its T/M6/G43/G49 canonical subset with
upstream `rs274 -t -i`; M61 current-pocket host-state behavior remains a
standalone fixture expectation.
## Current Drift Conclusion
Within the native extracted-core scope, the port currently has no permitted
byte-level drift from vendored LinuxCNC source files. All current behavior
coverage is guarded by upstream baseline validation, vendor sync validation,
source compile probes, native harnesses, and fixture checks.