Files
cnc_wams/完善wasm/working/41-User-M-Python-Remap-WASM-Web完整移植实施记录.md
2026-07-10 21:26:42 -04:00

52 lines
3.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# User-M 与 Python Remap WASM/Web 完整移植实施记录
## 任务
本文件落实 `ACC-053/INT-040`,解除 `L4-USER-M-PROCESS``L4-PYTHON-REMAP` 在 Web 软件发布范围内的阻塞。宿主外部进程、GTK/Python UI、实时内核和真实硬件不属于本次 Web/WASM promotion。
## User-M
1. 将上游 millturn `mcodes/M128``mcodes/M129` 加入 source manifest/vendor
2. `linuxcnc_machine_config.cpp` 在注册 `USER_M_PATH` 时识别这两个允许项,从同一 INI 读取 X/Y/Z 的 mill/turn 限位、速度和加速度;
3. LinuxCNC interpreter WASM 执行 M128/M129 时更新 `ini.[xyz].min_limit/max_limit/min_velocity/max_acceleration` HAL pins并输出 `USER_M_RESULT ... execution=wasm-precompiled`
4. Web store 同步相同 `userMAxisLimits` 和 HAL patch任意其他宿主 M100-M199 程序仍不执行,只保留受控 canonical event/allowlist 边界。
## Python Remap
1. 固定安装官方 `pyodide@314.0.2`,将 CPython WASM、标准库和 lock file 本地打包到 static dist不依赖 CDN
2. 新增 Pyodide provider在 Worker 中初始化 CPython、写入 LinuxCNC Python 源、应用 `PYTHONPATH`、执行 TOPLEVEL、导入模块、查找并调用 callable/generator
3. provider 注入 `interpreter``emccanon``hal``pyhal` 桥接模块canonical 调用和 HAL 状态保留结构化输出;
4. 目标 Web `main.js` 启动本地 Worker执行 stop-lookahead `queuebuster`,把 runtime/lifecycle/execution/promotion 状态写入 store并纳入 full-execution boundary
5. 53 个 inventory rows 对应的 27 个唯一 Python 源全部进入 source/vendor/static 发布包,并由真实 CPython/WASM `compile()` 全量验证;代表性 generator 实际首次 yield 为 LinuxCNC `INTERP_EXECUTE_FINISH=2`
## Gate
```text
user_m_m128_m129_wasm_execution=ok
user_m_host_process_execution=0
python_remap_pyodide_node_runtime=ok
python_remap_queuebuster_generator=ok
python_remap_inventory_rows=53
python_remap_unique_python_sources=27
python_remap_pyodide_bulk_source_validation=ok
python_remap_pyodide_browser_runtime=ok
python_remap_target_web_integration=ok
sim_configs_wasm_node_smoke=ok
project_release_gate=ok
```
以上专项 gate 已接入 `verify_web_software_parity_gate.sh`。项目 readiness artifact 中 `blockedRuntimeFamilies=[]``pythonRemapRuntimeProofReady=true``promotionAllowed=true``executionEnabled=true``bulkPromotionAllowed=true`
完整 release 回归首次发现旧 `verify_sim_configs_wasm.mjs` 仍把 millturn 强制断言为外部 User-M process blocked。该合同已更新为M128/M129 两个 handler 均已 vendored/staged、`unstagedExecutionCodes=[]`、不再声明 `external_user_m_process` dependency任意未 allowlist 宿主程序继续由专项 `user_m_host_process_execution=0` 保护。修复后完整 14 项 release gate 通过。
## 边界
- M128/M129 是上游源码派生的预编译 Web/WASM handler不启动浏览器宿主 Tcl 进程;
- 任意未列入 manifest/allowlist 的 User-M 外部程序仍禁止;
- Python remap 使用真实 CPython/WASMGTK、GI、桌面窗口和宿主 Python 进程不属于浏览器数控语义;
- realtime kernel、硬件驱动和完整 native process topology 不因本任务晋级。
## 结论
`ACC-053/INT-040` 完成。两个 L4 family 已从 Web 软件 blocked runtime family 清单移除,并由 required parity/release gate 保护;宿主与硬件边界继续独立锁定。