feat: sync axis task state parity work
This commit is contained in:
@@ -54,3 +54,60 @@
|
||||
### 下一步
|
||||
|
||||
从 `04-任务矩阵.md` 的 `W9-001` 开始,先补 Run 状态门禁矩阵和 WASM Node 验证。
|
||||
|
||||
## 2026-07-07 17:12 EDT - 第 1 轮:执行过程按钮闭环
|
||||
|
||||
### 本轮目标
|
||||
|
||||
完成 `W9-001` 至 `W9-011`:补齐 Run 的 LinuxCNC 风格硬门禁、program/canonical plan 边界、Home 过程态、task/motion status 投影、Pause/Resume/Step 回归、浏览器 trace 验收和构建同步。
|
||||
|
||||
### 本轮做了什么
|
||||
|
||||
1. 在 WASM task runtime 中增加 Run 门禁:必须 `state=ON`、`mode=AUTO`、`interpState=IDLE`、已 Home 或 `noForceHoming`、已 open 程序、已加载 motion plan。
|
||||
2. 增加 status 字段:`task.file`、`programOpen`、`programStartLine`、`planId`、`motionPlanLoaded`、`errorText`、`allHomed`、`homing`、`homeState`、`noForceHoming`。
|
||||
3. 将 Home 改成可观测过程态:先 `homing=true/homeState=HOMING`,task cycle 后进入 `allHomed=true/homeState=HOMED`。
|
||||
4. motion runtime status 增加 `queueDepth`、`activeDepth`、`motion.id` 等执行推进字段。
|
||||
5. Web runtime/status 归一化读取新增字段;Web policy 将 homing、program open、motion plan 状态纳入 Run 门禁。
|
||||
6. Web store 的 task/HAL Run 不再点击后直接写 `runState=running`,而是等待 task/HAL status 投影;Run 命令链负责发送 `MODE_AUTO` 和 `EMC_TASK_PLAN_RUN`。
|
||||
7. 修复 Home 与 Set Mode 连续操作的竞态:Home 过程态下允许 Auto 请求排队,但 Run 在 homing 未完成前仍被拒绝。
|
||||
8. 新增 `verify_task_state_matrix.mjs`,并更新 WASM/Web Node 测试以匹配 working9 的 motion plan 必需语义。
|
||||
9. 重建 WASM 与 Web dist,执行 Node、trace、50ms 浏览器验收。
|
||||
|
||||
### 改了哪些文件
|
||||
|
||||
- `wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_task_hal_wasm.cpp`
|
||||
- `wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_motion_runtime.c`
|
||||
- `wasm-port/tests/wasm/node/verify_task_hal_wasm.mjs`
|
||||
- `wasm-port/tests/wasm/node/verify_task_state_matrix.mjs`
|
||||
- `web-rtcp-5axis-xyzbc-trt-sim-plan/app/src/runtime/linuxcnc-task-hal-runtime.js`
|
||||
- `web-rtcp-5axis-xyzbc-trt-sim-plan/app/src/state/linuxcnc-task-policy.js`
|
||||
- `web-rtcp-5axis-xyzbc-trt-sim-plan/app/src/state/store.js`
|
||||
- `web-rtcp-5axis-xyzbc-trt-sim-plan/tests/node/verify_linuxcnc_task_hal_runtime.mjs`
|
||||
- `web-rtcp-5axis-xyzbc-trt-sim-plan/tests/node/verify_run_preconditions.mjs`
|
||||
- `web-rtcp-5axis-xyzbc-trt-sim-plan/app/dist/*`
|
||||
- `work/working9-执行过程按钮/03-推进台账.md`
|
||||
- `work/working9-执行过程按钮/04-任务矩阵.md`
|
||||
- `work/working9-执行过程按钮/05-验收证据.md`
|
||||
- `work/working9-执行过程按钮/06-决策记录.md`
|
||||
|
||||
### 验证了什么
|
||||
|
||||
- WASM build、WASM task/HAL smoke、Run 状态门禁矩阵。
|
||||
- Web build、Run feedback loop、Run preconditions、task/HAL runtime smoke。
|
||||
- 浏览器 trace:Pause 后位置冻结。
|
||||
- 50ms 截图验收:ESTOP、Power、Home、Run、Pause 流程通过。
|
||||
|
||||
### 结果与证据
|
||||
|
||||
证据已追加至 `05-验收证据.md` 的 `2026-07-07 17:12 EDT - 任务 W9-001 至 W9-011`。
|
||||
|
||||
关键结论:
|
||||
|
||||
- `task_state_matrix=ok`
|
||||
- `run_feedback_status_loop_smoke=ok`
|
||||
- `pause_position_status=passed-position-frozen`
|
||||
- `verification_status=passed`
|
||||
|
||||
### 下一步
|
||||
|
||||
working9 已闭环。后续若继续推进,应进入更完整的 LinuxCNC interpreter canonical output 替换当前受控 motion plan 适配层,而不是恢复 JS/G-code 正则执行 fallback。
|
||||
|
||||
@@ -12,17 +12,17 @@
|
||||
| 任务编号 | 状态 | 任务 | 目标文件 | 验收标准 |
|
||||
|---|---|---|---|---|
|
||||
| W9-000 | 已完成 | 初始化 working9 推进文档 | `work/working9-执行过程按钮/*` | README、功能内容、开发步骤、推进台账、任务矩阵、验收证据、决策记录均已创建。 |
|
||||
| W9-001 | 待办 | 建立 Run 状态门禁矩阵 | `wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_task_hal_wasm.cpp`、`wasm-port/tests/wasm/node/verify_task_state_matrix.mjs` | ESTOP、ESTOP_RESET、ON/MANUAL、ON/AUTO/IDLE、未 homed、有程序等状态组合均有明确接受/拒绝断言。 |
|
||||
| W9-002 | 待办 | Web task policy 对齐 Run 门禁 | `web-rtcp-5axis-xyzbc-trt-sim-plan/app/src/state/linuxcnc-task-policy.js` | Run enable/disable 与 LinuxCNC 条件一致;最终仍以 WASM 拒绝/接受为准。 |
|
||||
| W9-003 | 待办 | 明确 program open 与 canonical plan 边界 | `wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_task_hal_wasm.cpp`、`wasm-port/runtime/sdk/src/linuxcnc-task-hal.js` | 未 open 程序或无 canonical plan 时 Run 返回明确错误,不能 fallback 为 JS/G-code 正则执行。 |
|
||||
| W9-004 | 待办 | 实现 `EMC_TASK_PLAN_RUN` 状态转换 | `wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_task_hal_wasm.cpp` | Run 后清 pause/step,设置 `interpState=READING`、`taskPaused=false`、`singleStepping=false`、`programStartLine`。 |
|
||||
| W9-005 | 待办 | motion runtime 暴露执行推进字段 | `wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_motion_runtime.c` | status 输出 `queueDepth`、`activeDepth`、`motion.id`、`programLine`、`currentVel`,执行中可观测推进。 |
|
||||
| W9-006 | 待办 | Web store 改为 task/HAL status 投影 | `web-rtcp-5axis-xyzbc-trt-sim-plan/app/src/state/store.js` | Run 被 WASM 拒绝时 Web 不进入 running;WASM status 进入 reading/waiting 后 Web 才显示 running。 |
|
||||
| W9-007 | 待办 | Home 过程态作为 Run 前置条件 | `wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_task_hal_wasm.cpp`、`web-rtcp-5axis-xyzbc-trt-sim-plan/app/src/state/store.js` | 未 homed 或 homing 中 Run 被拒绝;Home 完成后 Run 可执行。 |
|
||||
| W9-008 | 待办 | 执行中 Pause/Resume/Step 状态回归 | `wasm-port/tests/wasm/node/verify_task_hal_wasm.mjs`、`web-rtcp-5axis-xyzbc-trt-sim-plan/tests/node/verify_run_feedback_loop.mjs` | Run 后 Pause/Resume/Step 均有 task/motion status 断言,不能只看 UI 状态。 |
|
||||
| W9-009 | 待办 | 浏览器 Run 过程 trace 验收 | `web-rtcp-5axis-xyzbc-trt-sim-plan/tools/trace-pause-position-json.mjs`、`tools/verify-estop-power-home-run-pause-50ms.mjs` | trace 证明 Run 后位置推进,Pause 后冻结,Resume 后继续;截图 manifest 有路径记录。 |
|
||||
| W9-010 | 待办 | 构建与 dist 同步 | `web-rtcp-5axis-xyzbc-trt-sim-plan/app/dist`、`wasm-port/build/wasm/task-hal` | WASM 与 Web dist 使用最新实现;hash 或构建日志记录到验收证据。 |
|
||||
| W9-011 | 待办 | 更新文档与证据闭环 | `work/working9-执行过程按钮/03-推进台账.md`、`05-验收证据.md`、`06-决策记录.md` | 每个完成任务都有命令、输出摘要、路径证据和必要决策记录。 |
|
||||
| W9-001 | 已完成 | 建立 Run 状态门禁矩阵 | `wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_task_hal_wasm.cpp`、`wasm-port/tests/wasm/node/verify_task_state_matrix.mjs` | ESTOP、ESTOP_RESET、ON/MANUAL、ON/AUTO/IDLE、未 homed、有程序等状态组合均有明确接受/拒绝断言。 |
|
||||
| W9-002 | 已完成 | Web task policy 对齐 Run 门禁 | `web-rtcp-5axis-xyzbc-trt-sim-plan/app/src/state/linuxcnc-task-policy.js` | Run enable/disable 与 LinuxCNC 条件一致;最终仍以 WASM 拒绝/接受为准。 |
|
||||
| W9-003 | 已完成 | 明确 program open 与 canonical plan 边界 | `wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_task_hal_wasm.cpp`、`wasm-port/runtime/sdk/src/linuxcnc-task-hal.js` | 未 open 程序或无 canonical plan 时 Run 返回明确错误,不能 fallback 为 JS/G-code 正则执行。 |
|
||||
| W9-004 | 已完成 | 实现 `EMC_TASK_PLAN_RUN` 状态转换 | `wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_task_hal_wasm.cpp` | Run 后清 pause/step,设置 `interpState=READING`、`taskPaused=false`、`singleStepping=false`、`programStartLine`。 |
|
||||
| W9-005 | 已完成 | motion runtime 暴露执行推进字段 | `wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_motion_runtime.c` | status 输出 `queueDepth`、`activeDepth`、`motion.id`、`programLine`、`currentVel`,执行中可观测推进。 |
|
||||
| W9-006 | 已完成 | Web store 改为 task/HAL status 投影 | `web-rtcp-5axis-xyzbc-trt-sim-plan/app/src/state/store.js` | Run 被 WASM 拒绝时 Web 不进入 running;WASM status 进入 reading/waiting 后 Web 才显示 running。 |
|
||||
| W9-007 | 已完成 | Home 过程态作为 Run 前置条件 | `wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_task_hal_wasm.cpp`、`web-rtcp-5axis-xyzbc-trt-sim-plan/app/src/state/store.js` | 未 homed 或 homing 中 Run 被拒绝;Home 完成后 Run 可执行。 |
|
||||
| W9-008 | 已完成 | 执行中 Pause/Resume/Step 状态回归 | `wasm-port/tests/wasm/node/verify_task_hal_wasm.mjs`、`web-rtcp-5axis-xyzbc-trt-sim-plan/tests/node/verify_run_feedback_loop.mjs` | Run 后 Pause/Resume/Step 均有 task/motion status 断言,不能只看 UI 状态。 |
|
||||
| W9-009 | 已完成 | 浏览器 Run 过程 trace 验收 | `web-rtcp-5axis-xyzbc-trt-sim-plan/tools/trace-pause-position-json.mjs`、`tools/verify-estop-power-home-run-pause-50ms.mjs` | trace 证明 Run 后位置推进,Pause 后冻结,Resume 后继续;截图 manifest 有路径记录。 |
|
||||
| W9-010 | 已完成 | 构建与 dist 同步 | `web-rtcp-5axis-xyzbc-trt-sim-plan/app/dist`、`wasm-port/build/wasm/task-hal` | WASM 与 Web dist 使用最新实现;hash 或构建日志记录到验收证据。 |
|
||||
| W9-011 | 已完成 | 更新文档与证据闭环 | `work/working9-执行过程按钮/03-推进台账.md`、`05-验收证据.md`、`06-决策记录.md` | 每个完成任务都有命令、输出摘要、路径证据和必要决策记录。 |
|
||||
|
||||
## 防重复规则
|
||||
|
||||
|
||||
@@ -66,3 +66,70 @@ find 'work/working9-执行过程按钮' -maxdepth 1 -type f -print | sort
|
||||
| W9-008 | Pause/Resume/Step 回归输出。 |
|
||||
| W9-009 | Playwright trace、截图目录、manifest 路径。 |
|
||||
| W9-010 | build 命令输出、WASM/dist hash 或文件时间戳。 |
|
||||
|
||||
以上待补项已由下方 `2026-07-07 17:12 EDT - 任务 W9-001 至 W9-011` 证据闭环覆盖。
|
||||
|
||||
## 2026-07-07 17:12 EDT - 任务 W9-001 至 W9-011
|
||||
|
||||
### 命令
|
||||
|
||||
```bash
|
||||
source /home/mes123456/emsdk/emsdk_env.sh >/tmp/emsdk-env.log && ./tools/build_task_hal_wasm.sh
|
||||
node tests/wasm/node/verify_task_hal_wasm.mjs
|
||||
node tests/wasm/node/verify_task_state_matrix.mjs
|
||||
npm --prefix app run build
|
||||
node tests/node/verify_run_feedback_loop.mjs
|
||||
node tests/node/verify_linuxcnc_task_hal_runtime.mjs
|
||||
node tests/node/verify_run_preconditions.mjs
|
||||
APP_URL_PATH=/web-rtcp-5axis-xyzbc-trt-sim-plan/app/dist/index.html node tools/trace-pause-position-json.mjs
|
||||
RUN_STABLE_BEFORE_FIRST_PAUSE_MS=3000 node tools/verify-estop-power-home-run-pause-50ms.mjs
|
||||
sha256sum wasm-port/build/wasm/task-hal/linuxcnc_task_hal.wasm wasm-port/build/wasm/task-hal/linuxcnc_task_hal.js web-rtcp-5axis-xyzbc-trt-sim-plan/app/dist/index.html
|
||||
```
|
||||
|
||||
### 输出摘要
|
||||
|
||||
- `linuxcnc_task_hal_wasm_build=ok`
|
||||
- `linuxcnc_task_runtime_smoke=ok`
|
||||
- `task_state_matrix=ok`
|
||||
- `run_gate_estop_rejected=ok`
|
||||
- `run_gate_estop_reset_rejected=ok`
|
||||
- `run_gate_manual_rejected=ok`
|
||||
- `run_gate_unhomed_rejected=ok`
|
||||
- `run_gate_homing_rejected=ok`
|
||||
- `run_gate_program_open_required=ok`
|
||||
- `run_gate_interpreter_plan_required=ok`
|
||||
- `run_gate_accepts_homed_open_plan=ok`
|
||||
- `gmoccapy_static_build=ok`
|
||||
- `run_feedback_status_loop_smoke=ok`
|
||||
- `run_ready_sequence_smoke=ok`
|
||||
- `pause_uses_motion_paused_gate=ok`
|
||||
- `pause_freezes_task_hal_status_loop=ok`
|
||||
- `linuxcnc_task_hal_runtime_smoke=ok`
|
||||
- `task_hal_machine_file_smoke=ok`
|
||||
- `switchkins_remap_hal_sync_smoke=ok`
|
||||
- `browser_task_hal_worker_smoke=ok`
|
||||
- `run_preconditions_ini_profile_smoke=ok`
|
||||
- `run_preconditions_kinematics_smoke=ok`
|
||||
- `run_preconditions_machine_file_smoke=ok`
|
||||
- `pause_position_status=passed-position-frozen`
|
||||
- `verification_status=passed`
|
||||
|
||||
### 页面/截图/trace/report
|
||||
|
||||
- pause trace:`/home/mes123456/cnc_wams/web-rtcp-5axis-xyzbc-trt-sim-plan/working/pause-position-traces/pause-position-20260707T210922Z/trace.json`
|
||||
- 50ms 截图目录:`/home/mes123456/cnc_wams/web-rtcp-5axis-xyzbc-trt-sim-plan/working/screenshots/estop-power-home-run-pause-50ms-20260707T210922Z`
|
||||
- 50ms manifest:`/home/mes123456/cnc_wams/web-rtcp-5axis-xyzbc-trt-sim-plan/working/screenshots/estop-power-home-run-pause-50ms-20260707T210922Z/manifest.json`
|
||||
- captured_frames:`522`
|
||||
- sample_period_ms:`50`
|
||||
|
||||
### 构建 hash
|
||||
|
||||
```text
|
||||
1d832ab726c7499afcbc70a84501071734f71c3fc18157075ad7d2ade976fa31 wasm-port/build/wasm/task-hal/linuxcnc_task_hal.wasm
|
||||
b5f5caa1a898acea8280dfba6dae7b723d775e54e9d769bdb4d21ac6ac2ac358 wasm-port/build/wasm/task-hal/linuxcnc_task_hal.js
|
||||
f8eb9620dd5f0dddb9f1c71c77fadcfe9aab7f845fc18fc65815a6de4d5c14f3 web-rtcp-5axis-xyzbc-trt-sim-plan/app/dist/index.html
|
||||
```
|
||||
|
||||
### 结论
|
||||
|
||||
`W9-001` 至 `W9-011` 已完成。Run 已由 WASM task/HAL 门禁接受或拒绝,Web `runState` 由 task/HAL status 投影,Pause/Resume/Step 和浏览器 50ms 验收均通过。
|
||||
|
||||
@@ -41,3 +41,30 @@
|
||||
- 决策:Run 所需 motion plan 应来自 LinuxCNC interpreter canonical output 或受控 WASM 适配层。没有 plan 时返回明确错误,不把 JS 正则解析作为长期执行路径。
|
||||
- 理由:Run 按钮的验收对象是 LinuxCNC task/interpreter/motion 链,不是 Web 播放 G-code 文本。
|
||||
- 后续影响:`W9-003` 必须明确 program open 与 canonical plan 边界;关闭任务前要有无 plan 拒绝 Run 的测试证据。
|
||||
|
||||
## DR-W9-004 - WASM Run 硬门禁优先于 Web 预判
|
||||
|
||||
- 日期:2026-07-07
|
||||
- 状态:已采纳
|
||||
- 背景:Web policy 可以提前禁用按钮,但最终能否 Run 必须由 task/HAL runtime 决定,否则会重新出现 UI running 假状态。
|
||||
- 决策:`EMC_TASK_PLAN_RUN` 在 WASM 中硬性检查 `ON`、`AUTO`、`IDLE`、非 homing、已 Home 或 `noForceHoming`、program open、motion plan loaded。拒绝时通过 `task.errorText` 输出原因。
|
||||
- 理由:这与 LinuxCNC task 层门禁一致,且能被 Node 矩阵测试直接验证。
|
||||
- 后续影响:Web 可做预判,但不能绕过 WASM 拒绝;测试必须覆盖 `PROGRAM_OPEN_REQUIRED` 和 `INTERPRETER_PLAN_REQUIRED`。
|
||||
|
||||
## DR-W9-005 - Web Run 可执行 ensure AUTO,但 running 只能来自 status
|
||||
|
||||
- 日期:2026-07-07
|
||||
- 状态:已采纳
|
||||
- 背景:AXIS 的 Run 会先 `ensure_mode(MODE_AUTO)`,但 Web 之前存在点击 Run 立即写 `runState=running` 的风险。
|
||||
- 决策:Web 点击 Run 可以发起 `EMC_TASK_SET_MODE AUTO`,再发 `EMC_TASK_PLAN_RUN`;但 `runState=running` 只能由 task/HAL status 的 `interpState=READING/WAITING` 投影产生。
|
||||
- 理由:这样兼容 AXIS 的 ensure-mode 操作链,同时保留 WASM task 层作为真实状态源。
|
||||
- 后续影响:Home 过程中允许 Auto 请求排队,但 Run 在 `homing=true` 时仍被拒绝;`run_feedback_status_loop_smoke` 用于防止回退。
|
||||
|
||||
## DR-W9-006 - Home 必须有可观测过程态
|
||||
|
||||
- 日期:2026-07-07
|
||||
- 状态:已采纳
|
||||
- 背景:直接把 `allHomed=true` 会让 Run 无法区分未 Home、正在 Home、已 Home。
|
||||
- 决策:WASM Home 命令先输出 `homing=true/homeState=HOMING`,task cycle 后输出 `allHomed=true/homeState=HOMED`;Web policy 将 `homing` 作为 Run 拒绝条件。
|
||||
- 理由:满足 working9 对 Home 过程态的要求,也让浏览器和 Node 测试能观察 Run 前置条件。
|
||||
- 后续影响:后续若接入真实 joint homing,需要保留同名 status 字段并由真实 joint status 驱动。
|
||||
|
||||
Reference in New Issue
Block a user