# 03-推进台账

## 本轮目标

完成 Web RTCP 五轴仿真页面中 Run、Stop、Pause、Resume、Step、Home 按钮的互相功能，使按钮真实反映 LinuxCNC task/HAL 状态。Run 不满足条件时必须给出明确提示。

## 推进记录

| 轮次 | 做了什么 | 改了哪些文件 | 验证了什么 | 下一步 |
|---|---|---|---|---|
| 1 | 阅读 workspace 和 LinuxCNC WASM port 规则，确认必须以 LinuxCNC 源码作为语义依据 | 无 | 确认 `AGENTS.md` 和 `wasm-port/SKILL.md` 规则 | 定位按钮和状态代码 |
| 2 | 查找按钮渲染、状态 store、task/HAL runtime、motion runtime | 无 | 定位 `gmoccapy-shell.js`、`store.js`、task/HAL WASM shim | 对照 LinuxCNC 源码 |
| 3 | 对照 LinuxCNC 源码确认命令语义 | 无 | 确认 `RUN/PAUSE/RESUME/STEP/ABORT/HOME` 对应 LinuxCNC command | 修改 UI gate |
| 4 | 调整按钮 blocked 行为，Run/Stop/Pause/Resume/Step/Home blocked 时仍可点击 | `web-rtcp-5axis-sim-plan/app/src/ui/gmoccapy-shell.js` | blocked Run 可以点击并产生 operatorMessage | 修改 store 命令 |
| 5 | 修改 store 中 Resume、Step、Home、session reset 和 status patch 行为 | `web-rtcp-5axis-sim-plan/app/src/state/store.js` | Step 发送 `EMC_TASK_PLAN_STEP`，Home 状态不丢失 | 修改 WASM runtime |
| 6 | task/HAL runtime 增加 paused/single-stepping 状态和 `EMC_TASK_PLAN_STEP` | `wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_task_hal_wasm.cpp` | task status 输出 `taskPaused`、`singleStepping` | 修改 motion runtime |
| 7 | motion runtime 增加 `EMC_TRAJ_STEP` / `EMCMOT_STEP` | `wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_motion_runtime.c` | paused 状态下 step 命令可以通过 | 重建 WASM |
| 8 | 重建 task/HAL WASM | 生成/更新 build artifact | `linuxcnc_task_hal_wasm_build=ok` | 跑 Node/WASM 测试 |
| 9 | 跑 WASM 和 Node 测试，发现 MDI `M428` 状态被旧时序影响 | `store.js` | 定位 Home 快速切模式导致 `allHomed` 丢失 | 修复 Home race |
| 10 | 修复 Home race：task/HAL HOME 先同步 Web homed 状态，再发 runtime command | `store.js` | `verify_linuxcnc_task_hal_runtime.mjs` 通过 | 增强测试 |
| 11 | 增加 STEP/STOP task/HAL 状态断言 | `web-rtcp-5axis-sim-plan/tests/node/verify_linuxcnc_task_hal_runtime.mjs` | Step/Stop 状态可验收 | 增加浏览器断言 |
| 12 | 增加浏览器 blocked Run button 可点击断言 | `web-rtcp-5axis-sim-plan/tests/browser/gmoccapy_shell_smoke.html` | blocked Run 不再 disabled，点击后提示原因 | 记录日志 |
| 13 | 追加 GPT/Codex 过程日志 | `web-rtcp-5axis-sim-plan/gptlog-process/gpdlog.md` | 满足 workspace logging rule | 生成交付文档 |
| 14 | 新增浏览器按钮流程取证脚本，采集 Home/Run/Pause/Resume/Step/Stop 点击前后截图和状态报告 | `qa/web-rtcp-5axis-site-test/capture-button-control-evidence.mjs` | `button_control_evidence_status=PASS`，生成 14 张截图和 JSON 报告 | 更新工作文档和日志 |
| 15 | 参数化按钮取证脚本，增加 `TARGET_URL`、云端独立输出、job_id、report_id、PDF 报告 | `qa/web-rtcp-5axis-site-test/capture-button-control-evidence.mjs` | 本地取证仍 PASS，并生成 PDF | 部署云端 |
| 16 | 重建并部署当前静态站点到 `https://82.156.24.101:8092/` | `web-rtcp-5axis-sim-plan/app/dist`；远端 `/var/www/web-rtcp-5axis-sim` | `nginx -t` 成功；远端 `curl -k -I https://127.0.0.1:8092/` 返回 `HTTP/2 200` | 跑云端按钮验收 |
| 17 | 对云端页面运行按钮流程取证 | `qa/web-rtcp-5axis-site-test/output/cloud-button-control-evidence-report.json`；`cloud-button-control-evidence-report.pdf`；`screenshots/cloud-button-control-evidence/*.png` | `button_control_evidence_status=PASS`，job_id/report_id 已生成 | 做 native 对照 |
| 18 | 生成 LinuxCNC native task/HAL 对照报告，记录 source/phase0 audit 和 host-native runtime blocker | `qa/web-rtcp-5axis-site-test/capture-native-task-hal-comparison.mjs`；`native-task-hal-comparison-report.json`；`native-task-hal-comparison-report.md` | `native_task_hal_comparison_status=PASS_WITH_HOST_NATIVE_RUNTIME_BLOCKER` | 更新文档和日志 |

## 最终改动文件

- `wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_motion_runtime.c`
- `wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_task_hal_wasm.cpp`
- `web-rtcp-5axis-sim-plan/app/src/state/store.js`
- `web-rtcp-5axis-sim-plan/app/src/ui/gmoccapy-shell.js`
- `web-rtcp-5axis-sim-plan/tests/browser/gmoccapy_shell_smoke.html`
- `web-rtcp-5axis-sim-plan/tests/node/verify_linuxcnc_task_hal_runtime.mjs`
- `qa/web-rtcp-5axis-site-test/capture-button-control-evidence.mjs`
- `qa/web-rtcp-5axis-site-test/output/button-control-evidence-report.json`
- `qa/web-rtcp-5axis-site-test/output/button-control-evidence-report.pdf`
- `qa/web-rtcp-5axis-site-test/screenshots/button-control-evidence/*.png`
- `qa/web-rtcp-5axis-site-test/output/cloud-button-control-evidence-report.json`
- `qa/web-rtcp-5axis-site-test/output/cloud-button-control-evidence-report.pdf`
- `qa/web-rtcp-5axis-site-test/screenshots/cloud-button-control-evidence/*.png`
- `qa/web-rtcp-5axis-site-test/capture-native-task-hal-comparison.mjs`
- `qa/web-rtcp-5axis-site-test/output/native-task-hal-comparison-report.json`
- `qa/web-rtcp-5axis-site-test/output/native-task-hal-comparison-report.md`
- `web-rtcp-5axis-sim-plan/gptlog-process/gpdlog.md`

## 最终验证

通过：

- `bash wasm-port/tools/build_task_hal_wasm.sh`
- `node wasm-port/tests/wasm/node/verify_task_hal_wasm.mjs`
- `node web-rtcp-5axis-sim-plan/tests/node/verify_linuxcnc_task_hal_runtime.mjs`
- `node web-rtcp-5axis-sim-plan/tests/node/verify_run_preconditions.mjs`
- `node web-rtcp-5axis-sim-plan/tests/node/verify_rtcp_store.mjs`
- `bash web-rtcp-5axis-sim-plan/tests/browser/verify_gmoccapy_shell_browser.sh`
- `node --check qa/web-rtcp-5axis-site-test/capture-button-control-evidence.mjs`
- `node qa/web-rtcp-5axis-site-test/capture-button-control-evidence.mjs`
- `TARGET_URL='https://82.156.24.101:8092/' EVIDENCE_SCOPE='cloud-button-control-evidence' node qa/web-rtcp-5axis-site-test/capture-button-control-evidence.mjs`
- `bash wasm-port/tests/native/verify_task_hal_phase0.sh`
- `node web-rtcp-5axis-sim-plan/tests/node/verify_native_task_hal_audit.mjs`
- `node --check qa/web-rtcp-5axis-site-test/capture-native-task-hal-comparison.mjs`
- `node qa/web-rtcp-5axis-site-test/capture-native-task-hal-comparison.mjs`

新增浏览器取证结果：

- `button_control_evidence_status=PASS`
- JSON：`/home/meswork/cnc_wams/qa/web-rtcp-5axis-site-test/output/button-control-evidence-report.json`
- 截图目录：`/home/meswork/cnc_wams/qa/web-rtcp-5axis-site-test/screenshots/button-control-evidence/`
- PDF：`/home/meswork/cnc_wams/qa/web-rtcp-5axis-site-test/output/button-control-evidence-report.pdf`
- 云端 JSON：`/home/meswork/cnc_wams/qa/web-rtcp-5axis-site-test/output/cloud-button-control-evidence-report.json`
- 云端 PDF：`/home/meswork/cnc_wams/qa/web-rtcp-5axis-site-test/output/cloud-button-control-evidence-report.pdf`
- 云端截图目录：`/home/meswork/cnc_wams/qa/web-rtcp-5axis-site-test/screenshots/cloud-button-control-evidence/`
- 云端 job_id：`btn-20260623091811-c291e49b`
- 云端 report_id：`report-btn-20260623091811-c291e49b`
- Native 对照 JSON：`/home/meswork/cnc_wams/qa/web-rtcp-5axis-site-test/output/native-task-hal-comparison-report.json`
- Native 对照 Markdown：`/home/meswork/cnc_wams/qa/web-rtcp-5axis-site-test/output/native-task-hal-comparison-report.md`

## 遗留事项

1. `work/working1` 中 BTN-001 到 BTN-013 已全部有验收或 blocker 证据。
2. 当前仍不声明真实硬件、host realtime kernel、外部 User-M process 或 tool DB native runtime 已具备；native host runtime 的阻塞原因已记录在 native 对照报告中。
