Validate AXIS task state flow
This commit is contained in:
@@ -65,7 +65,7 @@
|
||||
|
||||
因此,新增状态应优先进入 C/C++ 结构体、枚举、队列和周期函数;status JSON 只能从最后一次 status write 或 `StandaloneEmcStatus` 导出。
|
||||
|
||||
`status JSON` 的具体 LinuxCNC 对标方案详见 `12-status-json-LinuxCNC对标方案.md`。该方案要求 `emcStatus` 成为新增 LinuxCNC 对标字段的主对象,`task`、`motionStatus` 等旧字段只作为兼容视图。
|
||||
`status JSON` 的具体 LinuxCNC 对标方案详见 `12-status-json-LinuxCNC对标方案.md`。该方案要求 `emcStatus` 成为 LinuxCNC 对标字段的唯一 task/motion/io 状态入口;`task`、`motionStatus`、`rcsStatus`、`taskTopLevelStatus` 等旧顶层字段不再输出。
|
||||
|
||||
## 功能范围
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ static void write_status_snapshot(TaskRuntime &state);
|
||||
- command JSON 只描述 host command envelope。
|
||||
- status JSON 只导出最后一次 status write。
|
||||
- 不允许新增依赖 JSON 文本推进 task cycle 的路径。
|
||||
- 新增 status 字段优先进入 `emcStatus` 对标对象,再按需提供旧字段兼容视图。
|
||||
- 新增 status 字段进入 `emcStatus` 对标对象,不再提供旧字段兼容视图。
|
||||
4. 每次迁移新语义时优先查找 vendored LinuxCNC source:
|
||||
- 能接入 source-anchored subset 时接入 subset。
|
||||
- 不能直接接入时建立窄 shim,并在 `06-决策记录.md` 写明原因。
|
||||
|
||||
@@ -1,5 +1,88 @@
|
||||
# 03-推进台账
|
||||
|
||||
## 2026-07-08 10:18 EDT
|
||||
|
||||
### 本轮目标
|
||||
|
||||
按用户要求从源头 `/home/mes123456/cnc_wams/wasm-port` 取消旧字段输入兼容,不再让 task status JSON 输出旧顶层字段。
|
||||
|
||||
### 本轮做了什么
|
||||
|
||||
1. 修改 `linuxcnc_task_hal_wasm.cpp` 的 `status_json()`,移除 `taskTopLevelStatus`、`rcsStatus`、顶层 `task`、`servoCycle` 和顶层 `motionStatus` 输出。
|
||||
2. 将旧 `task`、`motionStatus.motion` 中仍需要的字段收拢到 `emcStatus.task` 和 `emcStatus.motion`。
|
||||
3. 更新 WASM、SDK、status contract 和 state matrix 测试,所有 task status 读取路径均只消费 `emcStatus`,并对旧顶层字段做负向断言。
|
||||
4. 同步更新 `01`、`02`、`04`、`11`、`12` 文档口径,新增 T-056:源头取消旧 status 字段兼容输出。
|
||||
5. 重建 `task-hal` wasm,并运行四个直接相关 Node 验证。
|
||||
|
||||
### 影响文件
|
||||
|
||||
- `wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_task_hal_wasm.cpp`
|
||||
- `wasm-port/tests/wasm/node/verify_task_status_json_contract.mjs`
|
||||
- `wasm-port/tests/wasm/node/verify_task_hal_sdk.mjs`
|
||||
- `wasm-port/tests/wasm/node/verify_task_hal_wasm.mjs`
|
||||
- `wasm-port/tests/wasm/node/verify_task_state_matrix.mjs`
|
||||
- `wasm-port/working/01-项目功能内容.md`
|
||||
- `wasm-port/working/02-项目程序开发详细步骤.md`
|
||||
- `wasm-port/working/03-推进台账.md`
|
||||
- `wasm-port/working/04-任务矩阵.md`
|
||||
- `wasm-port/working/05-验收证据.md`
|
||||
- `wasm-port/working/11-WASM核心状态机边界与后续完善路线.md`
|
||||
- `wasm-port/working/12-status-json-LinuxCNC对标方案.md`
|
||||
|
||||
### 当前结论
|
||||
|
||||
T-056 已完成。`lctask_read_status_json()` 的 task/motion/io/top 状态入口收口为 `emcStatus`,旧顶层字段不再输出;直接相关 Node 验证均通过。
|
||||
|
||||
## 2026-07-08 09:30 EDT
|
||||
|
||||
### 本轮目标
|
||||
|
||||
按用户明确指定的两个文件完成并复核:
|
||||
|
||||
- `/home/mes123456/cnc_wams/wasm-port/working/11-WASM核心状态机边界与后续完善路线.md`
|
||||
- `/home/mes123456/cnc_wams/wasm-port/working/12-status-json-LinuxCNC对标方案.md`
|
||||
|
||||
### 本轮做了什么
|
||||
|
||||
1. 读取两个目标文档,确认 `12-status-json-LinuxCNC对标方案.md` 中 SJ-1 到 SJ-5 已进入 `04-任务矩阵.md` 的 T-051 到 T-055,且 `11-WASM核心状态机边界与后续完善路线.md` 已记录这些批次闭合。
|
||||
2. 复核 `04-任务矩阵.md`,确认 T-001 到 T-055 均为完成,当前推进指针为“下一条优先任务:无”。
|
||||
3. 检查 `tools/verify_task_status_json_contract.sh` 和 `tools/verify_task_full_closure.sh`,确认 status JSON contract gate 已纳入 full closure。
|
||||
4. 扫描 working、docs、tools、runtime、tests 中的 `StandaloneEmcStatus`、`emcStatus`、SJ/T 编号和 contract gate 锚点,确认 runtime、测试、文档均有对应覆盖。
|
||||
5. 执行 `./tools/verify_task_full_closure.sh`,验证 task-HAL WASM build、WASM smoke、SDK smoke、state matrix、motion sync、StandaloneEmcStatus、no-JSON 主路径、status JSON contract、working closure、source reuse/drift docs 和 readiness contract。
|
||||
6. 执行 `git diff --check`,确认当前差异无 whitespace error。
|
||||
|
||||
### 影响文件
|
||||
|
||||
- `wasm-port/working/03-推进台账.md`
|
||||
- `wasm-port/working/05-验收证据.md`
|
||||
|
||||
### 当前结论
|
||||
|
||||
目标文件 `11` 和 `12` 中定义的当前全部工作已完成并通过复核:SJ-1 到 SJ-5 对应 T-051 到 T-055,status JSON contract gate 已纳入 full closure,全量闭合脚本最终输出 `task_full_closure_status=ok`,`git diff --check` 无输出。
|
||||
|
||||
## 2026-07-08 09:26 EDT
|
||||
|
||||
### 本轮目标
|
||||
|
||||
按用户要求复核并完成 `/home/mes123456/cnc_wams/wasm-port/working` 全部工作,确认当前任务矩阵、闭合 gate 和执行证据均无未闭合项。
|
||||
|
||||
### 本轮做了什么
|
||||
|
||||
1. 读取 `wasm-port/working/README.md`、`04-任务矩阵.md`、`03-推进台账.md` 和 `05-验收证据.md`,确认当前文档声明 T-001 到 T-055 均为完成,下一条优先任务为“无”。
|
||||
2. 检查仓库根目录和 `wasm-port/AGENTS.md`,确认本轮同时受根目录中文日志规则和 `wasm-port` LinuxCNC source reuse / 额外日志规则约束。
|
||||
3. 扫描 `wasm-port/working`、`tools`、`docs`、`runtime`、`tests` 中的开放标记,确认出现的“后续”主要是已文档化的保守边界或新增任务入口,不是当前矩阵未完成任务;矩阵任务行均为“完成”。
|
||||
4. 执行 `./tools/verify_task_full_closure.sh`,完成 task-HAL WASM 构建、WASM smoke、SDK smoke、state matrix、motion sync、StandaloneEmcStatus、no-JSON 主路径、status JSON contract、working closure、source reuse/drift docs 和 readiness contract 验证。
|
||||
5. 全量闭合脚本通过,最终输出 `task_full_closure_status=ok`。
|
||||
|
||||
### 影响文件
|
||||
|
||||
- `wasm-port/working/03-推进台账.md`
|
||||
- `wasm-port/working/05-验收证据.md`
|
||||
|
||||
### 当前结论
|
||||
|
||||
`wasm-port/working` 当前全部工作已完成并复核通过。任务矩阵无待办、进行中或阻塞项;T-051 到 T-055 的 status JSON contract 已纳入 full closure;全量闭合 gate 输出 `task_full_closure_status=ok`。
|
||||
|
||||
## 2026-07-08 09:12 EDT
|
||||
|
||||
### 本轮目标
|
||||
|
||||
@@ -61,12 +61,13 @@
|
||||
| T-048 | 将 working closure gate 纳入全局文档一致性验证 | 完成 | `source-reuse-map.md`、`compatibility-validation.md` 和 `verify_task_source_reuse_drift_docs.sh` 均记录并检查 `verify_task_working_closure.sh`。 |
|
||||
| T-049 | 建立 task-HAL 全量闭合验证入口 | 完成 | `tools/verify_task_full_closure.sh` 一次性执行 build、WASM smoke、SDK、state matrix、motion sync、T-007/T-046/T-047/T-048/docs/readiness gates。 |
|
||||
| T-050 | 建立 status JSON LinuxCNC 对标方案 | 完成 | `12-status-json-LinuxCNC对标方案.md` 存在;README、功能内容、开发步骤、台账、证据和决策记录均记录 `StandaloneEmcStatus -> status JSON` 方案;working closure gate 不回退。 |
|
||||
| T-051 | SJ-1 规范 `emcStatus.motion.traj` | 完成 | `emcStatus.motion.traj` 导出 enabled/inpos/queue/activeQueue/queueFull/id/paused/singleStepping/position/actualPosition/currentVel;WASM/SDK/state matrix 和 status JSON contract gate 断言其与兼容 `motionStatus` 同源。 |
|
||||
| T-052 | SJ-2 规范 task line 和 interpreter 字段 | 完成 | `StandaloneEmcTaskStatus` 集中 currentLine/readLine/motionLine/callLevel;`task` 兼容视图和 `emcStatus.task` 同源;staged RUN 后 contract gate 验证 line 字段。 |
|
||||
| T-053 | SJ-3 规范 `emcStatus.motion.axis[]` 和 `joint[]` | 完成 | `StandaloneEmcMotionStatus` 保存 axis command/feedback 与 joint command/feedback 数组;`emcStatus.motion.axis[]`、`joint[]` 导出至少 6 轴/关节,旧 `motionStatus.axis`、`joint0` 与新数组一致。 |
|
||||
| T-051 | SJ-1 规范 `emcStatus.motion.traj` | 完成 | `emcStatus.motion.traj` 导出 enabled/inpos/queue/activeQueue/queueFull/id/paused/singleStepping/position/actualPosition/currentVel;WASM/SDK/state matrix 和 status JSON contract gate 断言其与 `emcStatus.motion` 同源。 |
|
||||
| T-052 | SJ-2 规范 task line 和 interpreter 字段 | 完成 | `StandaloneEmcTaskStatus` 集中 currentLine/readLine/motionLine/callLevel;staged RUN 后 contract gate 验证 `emcStatus.task` line 字段。 |
|
||||
| T-053 | SJ-3 规范 `emcStatus.motion.axis[]` 和 `joint[]` | 完成 | `StandaloneEmcMotionStatus` 保存 axis command/feedback 与 joint command/feedback 数组;`emcStatus.motion.axis[]`、`joint[]` 导出至少 6 轴/关节,`emcStatus.motion.axisByName` 和 `joint0` 与新数组一致。 |
|
||||
| T-054 | SJ-4 规范 IO/aux/tool/coolant 边界 | 完成 | `emcStatus.io` 导出 status/error/fault/reason/aux.estop;tool/coolant 以 `supported=false` 和 shim reason 显式标记未接 native IO;readiness 仍为 false。 |
|
||||
| T-055 | SJ-5 引入 status JSON contract gate | 完成 | 新增 `tools/verify_task_status_json_contract.sh` 和 Node contract 测试;检查 `statusSource=StandaloneEmcStatus`、`lctask_read_status_json()` 不调用 motion JSON、SDK 不实现 task/motion 语义;该 gate 纳入 full closure。 |
|
||||
| T-056 | 源头取消旧 status 字段输入兼容 | 完成 | `lctask_read_status_json()` 不再输出 `taskTopLevelStatus`、`rcsStatus`、顶层 `task`、`servoCycle`、顶层 `motionStatus`;WASM/SDK/state matrix/status contract 读取时均做负向断言。 |
|
||||
|
||||
## 当前推进指针
|
||||
|
||||
下一条优先任务:无。任务矩阵当前已闭合;`11-WASM核心状态机边界与后续完善路线.md` 和 `12-status-json-LinuxCNC对标方案.md` 中 SJ-1 到 SJ-5 已补入 T-051 到 T-055 并闭合。后续新增对标项需先补入本矩阵。
|
||||
下一条优先任务:无。任务矩阵当前已闭合;`11-WASM核心状态机边界与后续完善路线.md` 和 `12-status-json-LinuxCNC对标方案.md` 中 SJ-1 到 SJ-5 已补入 T-051 到 T-055 并闭合,旧 status 字段源头收口已作为 T-056 闭合。后续新增对标项需先补入本矩阵。
|
||||
|
||||
@@ -1,5 +1,121 @@
|
||||
# 05-验收证据
|
||||
|
||||
## 2026-07-08 10:18 EDT T-056 旧 status 字段源头收口
|
||||
|
||||
### 验收对象
|
||||
|
||||
`lctask_read_status_json()` 输出契约和直接消费 task status JSON 的 WASM/SDK/state matrix 测试。
|
||||
|
||||
### 证据命令
|
||||
|
||||
```bash
|
||||
source /home/mes123456/emsdk/emsdk_env.sh >/dev/null && bash wasm-port/tools/build_task_hal_wasm.sh
|
||||
node wasm-port/tests/wasm/node/verify_task_status_json_contract.mjs
|
||||
node wasm-port/tests/wasm/node/verify_task_hal_sdk.mjs
|
||||
node wasm-port/tests/wasm/node/verify_task_state_matrix.mjs
|
||||
node wasm-port/tests/wasm/node/verify_task_hal_wasm.mjs
|
||||
```
|
||||
|
||||
### 实际输出摘要
|
||||
|
||||
```text
|
||||
linuxcnc_task_hal_wasm_build=ok
|
||||
task_status_json_contract=ok
|
||||
linuxcnc_task_hal_sdk=ok
|
||||
task_hal_sdk_status_json_contract=ok
|
||||
task_state_matrix=ok
|
||||
task_status_json_contract_matrix=ok
|
||||
linuxcnc_task_runtime_smoke=ok
|
||||
task_status_json_contract=ok
|
||||
```
|
||||
|
||||
### 结论
|
||||
|
||||
T-056 验收通过。task status JSON 不再输出 `taskTopLevelStatus`、`rcsStatus`、顶层 `task`、`servoCycle`、顶层 `motionStatus`;测试读取路径均从 `emcStatus` 取值,并对旧字段做负向断言。
|
||||
|
||||
## 2026-07-08 09:30 EDT 目标文件 11/12 全部工作复核
|
||||
|
||||
### 验收对象
|
||||
|
||||
- `11-WASM核心状态机边界与后续完善路线.md`
|
||||
- `12-status-json-LinuxCNC对标方案.md`
|
||||
- T-051 到 T-055 / SJ-1 到 SJ-5 当前闭合状态。
|
||||
|
||||
### 证据命令
|
||||
|
||||
```bash
|
||||
cd /home/mes123456/cnc_wams/wasm-port
|
||||
./tools/verify_task_full_closure.sh
|
||||
cd /home/mes123456/cnc_wams
|
||||
git diff --check
|
||||
```
|
||||
|
||||
### 实际输出摘要
|
||||
|
||||
`./tools/verify_task_full_closure.sh`:
|
||||
|
||||
```text
|
||||
linuxcnc_task_hal_wasm_build=ok
|
||||
task_status_json_contract=ok
|
||||
linuxcnc_task_hal_sdk=ok
|
||||
task_state_matrix=ok
|
||||
motion_hal_sync_smoke=ok
|
||||
task_standalone_emc_status_status=ok
|
||||
task_no_json_motion_plan_main_path_status=ok
|
||||
task_status_json_contract_status=ok
|
||||
task_working_closure_status=ok
|
||||
task_source_reuse_drift_docs_status=ok
|
||||
task_hal_readiness_contract_status=ok
|
||||
task_full_closure_status=ok
|
||||
```
|
||||
|
||||
`git diff --check`:无输出,以 0 退出。
|
||||
|
||||
### 结论
|
||||
|
||||
目标文件 `11` 和 `12` 当前定义的全部可执行工作已闭合。后续新增状态或 LinuxCNC 对标字段仍需先补入任务矩阵、验收标准和 gate。
|
||||
|
||||
## 2026-07-08 09:26 EDT working 全部工作闭合复核
|
||||
|
||||
### 验收对象
|
||||
|
||||
`/home/mes123456/cnc_wams/wasm-port/working` 当前全部任务闭合状态。
|
||||
|
||||
### 验收目标
|
||||
|
||||
- `04-任务矩阵.md` 中 T-001 到 T-055 均为完成。
|
||||
- 当前推进指针为“下一条优先任务:无”。
|
||||
- T-051 到 T-055 的 status JSON contract gate 已纳入 full closure。
|
||||
- 全量闭合验证通过。
|
||||
|
||||
### 证据命令
|
||||
|
||||
```bash
|
||||
cd /home/mes123456/cnc_wams/wasm-port
|
||||
./tools/verify_task_full_closure.sh
|
||||
```
|
||||
|
||||
### 实际输出摘要
|
||||
|
||||
```text
|
||||
linuxcnc_task_hal_wasm_build=ok
|
||||
linuxcnc_task_runtime_smoke=ok
|
||||
linuxcnc_task_hal_sdk=ok
|
||||
task_state_matrix=ok
|
||||
motion_hal_sync_smoke=ok
|
||||
task_standalone_emc_status_status=ok
|
||||
task_no_json_motion_plan_main_path_status=ok
|
||||
task_status_json_contract_status=ok
|
||||
task_working_closure_status=ok
|
||||
task_source_reuse_drift_docs_status=ok
|
||||
task_hal_readiness_contract_status=ok
|
||||
task_full_closure_status=ok
|
||||
```
|
||||
|
||||
### 结论
|
||||
|
||||
`wasm-port/working` 全部工作闭合复核通过。后续新增对标项仍需先补入任务矩阵、验收标准和 gate,再实施代码或文档变更。
|
||||
|
||||
## 2026-07-08 09:12 EDT SJ-1 到 SJ-5 status JSON contract 验收
|
||||
|
||||
### 验收对象
|
||||
|
||||
@@ -1,5 +1,28 @@
|
||||
# 06-决策记录
|
||||
|
||||
## D-046:task status JSON 不再保留旧顶层字段兼容视图
|
||||
|
||||
日期:2026-07-08
|
||||
|
||||
状态:已采纳
|
||||
|
||||
### 决策
|
||||
|
||||
`lctask_read_status_json()` 只通过 `emcStatus` 导出 task/motion/io/top 状态,不再输出 `taskTopLevelStatus`、`rcsStatus`、顶层 `task`、`servoCycle`、顶层 `motionStatus`。
|
||||
|
||||
本决策取代 D-044 中“既有旧字段保留为兼容视图”的部分;D-044 中“status JSON 对标 LinuxCNC status buffer、JSON 不能成为事实源、read status 只读”的部分继续有效。
|
||||
|
||||
### 理由
|
||||
|
||||
上层项目已经迁移到 `emcStatus` 契约。继续在源头输出旧字段会扩大状态表面,导致 SDK/UI 继续依赖旧字段,并让后续 LinuxCNC `EMC_STAT` 对标和契约测试同时维护两套入口。
|
||||
|
||||
### 影响
|
||||
|
||||
- `status_json()` 移除旧顶层字段输出。
|
||||
- `emcStatus.task` 和 `emcStatus.motion` 补齐旧视图中仍需要的字段。
|
||||
- WASM、SDK、state matrix 和 status contract 测试均对旧顶层字段做负向断言。
|
||||
- 后续新增字段只能进入 `emcStatus` 或底层 C/C++ status buffer,不新增旧字段兼容视图。
|
||||
|
||||
## D-045:SJ-1 到 SJ-5 必须进入任务矩阵并由 contract gate 固定
|
||||
|
||||
日期:2026-07-08
|
||||
|
||||
@@ -198,7 +198,7 @@ WASM 需要引入 task status buffer 等价物:
|
||||
- status read 不直接调用 `lcmot_read_status_json()` 改变观察口径。
|
||||
- debug/event log 可以单独存在,但不能替代 status buffer。
|
||||
|
||||
status JSON 只是 status buffer 的 host/browser 序列化格式。后续新增 LinuxCNC 对标字段时,字段应先进入 `StandaloneEmcStatus` 或后续 `EMC_STAT` 等价容器,再导出到 `emcStatus` JSON 对象;旧 `task`、`motionStatus` 字段只作为兼容视图。具体字段映射和 SJ 批次见 `12-status-json-LinuxCNC对标方案.md`。
|
||||
status JSON 只是 status buffer 的 host/browser 序列化格式。后续新增 LinuxCNC 对标字段时,字段应先进入 `StandaloneEmcStatus` 或后续 `EMC_STAT` 等价容器,再导出到 `emcStatus` JSON 对象;旧 `task`、`motionStatus` 等顶层状态字段不再作为兼容视图输出。具体字段映射和 SJ 批次见 `12-status-json-LinuxCNC对标方案.md`。
|
||||
|
||||
## 替换上游源码路线
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
3. `lctask_read_status_json()` 只导出最后一次 status write,不推进 cycle、不重新读取 motion、不触发 command 执行。
|
||||
4. 核心状态保存在 C/C++ 结构体、枚举、队列和周期函数中;当前集中容器为 `StandaloneEmcStatus`。
|
||||
5. motion 状态通过 `LcmotStatusSnapshot` 在 task 周期内读入,再映射到 `StandaloneEmcStatus.motion`。
|
||||
6. JSON 字段可以兼容旧 SDK/UI,但必须从核心结构体导出,不能成为新的事实源。
|
||||
6. status JSON 只通过 `emcStatus` 暴露 task/motion/io/top 状态;旧顶层状态字段不再作为兼容视图输出。
|
||||
7. 若 LinuxCNC 上游源码已有对应语义,优先接入 vendored source 或窄 shim,不在 JS/JSON 中重写。
|
||||
|
||||
## 当前事实源
|
||||
@@ -34,7 +34,7 @@
|
||||
- RUN 主路径:staged program -> `emcTaskPlanRead()` -> `emcTaskPlanCommand()` -> `emcTaskPlanExecute()` -> `emccanon.cc` command envelope -> `taskintf.cc` motion issue。
|
||||
- JSON status:`statusSource=StandaloneEmcStatus` 的外部导出视图。
|
||||
|
||||
status JSON 的 LinuxCNC `EMC_STAT` 字段映射、兼容策略和后续 SJ 批次见 `12-status-json-LinuxCNC对标方案.md`。
|
||||
status JSON 的 LinuxCNC `EMC_STAT` 字段映射、旧字段收口策略和后续 SJ 批次见 `12-status-json-LinuxCNC对标方案.md`。
|
||||
|
||||
当前 `12-status-json-LinuxCNC对标方案.md` 中 SJ-1 到 SJ-5 已补入 `04-任务矩阵.md` 的 T-051 到 T-055,并已闭合。后续不得再只用“后续路线”描述实际任务;凡是出现可执行实现项,必须同步进入任务矩阵。
|
||||
|
||||
@@ -57,6 +57,7 @@ status JSON 的 LinuxCNC `EMC_STAT` 字段映射、兼容策略和后续 SJ 批
|
||||
- T-053 / SJ-3:`emcStatus.motion.axis[]` 与 `joint[]`。
|
||||
- T-054 / SJ-4:`emcStatus.io.aux/tool/coolant` 窄边界。
|
||||
- T-055 / SJ-5:`tools/verify_task_status_json_contract.sh`。
|
||||
- T-056:源头取消旧 status 字段兼容输出。
|
||||
|
||||
## 代码修改检查清单
|
||||
|
||||
@@ -65,7 +66,7 @@ status JSON 的 LinuxCNC `EMC_STAT` 字段映射、兼容策略和后续 SJ 批
|
||||
- 新状态是否有 C/C++ 结构体字段,而不是只新增 JSON 字段。
|
||||
- 新 command 是否先入队,再由 `lctask_run_cycles()` 消费。
|
||||
- 新 status JSON 字段是否从 `StandaloneEmcStatus` 或明确的 C/C++ status buffer 导出。
|
||||
- JS/SDK 是否只做边界包装和兼容 API。
|
||||
- JS/SDK 是否只做边界包装,不重新引入旧 status 字段兼容读取。
|
||||
- 是否新增或更新 `tools/verify_task_*` gate。
|
||||
- 是否同步更新 `03-推进台账.md`、`05-验收证据.md`、`06-决策记录.md`。
|
||||
|
||||
|
||||
@@ -59,9 +59,9 @@ lctask_read_status_json() -> step servo / read fresh motion / consume command
|
||||
`status JSON` 只承担四类职责:
|
||||
|
||||
1. 把最后一次 `write_status_snapshot()` 中的状态导出给 JS/SDK/UI。
|
||||
2. 给浏览器 UI 提供稳定、可版本化、可兼容的字段名。
|
||||
2. 给浏览器 UI 提供稳定、可版本化的字段名。
|
||||
3. 给 Node/WASM/browser 测试提供可断言的观察面。
|
||||
4. 保留旧 SDK/UI 兼容字段,同时新增更接近 `EMC_STAT` 的 `emcStatus` 对象。
|
||||
4. 以更接近 `EMC_STAT` 的 `emcStatus` 对象作为唯一 task/motion/io 状态入口。
|
||||
|
||||
`status JSON` 不承担:
|
||||
|
||||
@@ -72,21 +72,12 @@ lctask_read_status_json() -> step servo / read fresh motion / consume command
|
||||
|
||||
## 推荐JSON结构
|
||||
|
||||
顶层保留 runtime/readiness 和兼容字段,同时以 `emcStatus` 作为 LinuxCNC 对标主对象:
|
||||
顶层只保留 runtime/readiness/source/schema 等边界字段;task/motion/io/top 状态只进入 `emcStatus`:
|
||||
|
||||
```json
|
||||
{
|
||||
"statusSource": "StandaloneEmcStatus",
|
||||
"schemaVersion": 1,
|
||||
"taskTopLevelStatus": "DONE",
|
||||
"rcsStatus": {
|
||||
"top": "DONE",
|
||||
"task": "DONE",
|
||||
"motion": "DONE",
|
||||
"io": "DONE"
|
||||
},
|
||||
"task": {},
|
||||
"motionStatus": {},
|
||||
"emcStatus": {
|
||||
"source": "StandaloneEmcStatus",
|
||||
"top": { "status": "DONE" },
|
||||
@@ -99,27 +90,26 @@ lctask_read_status_json() -> step servo / read fresh motion / consume command
|
||||
|
||||
要求:
|
||||
|
||||
- `task` 和 `motionStatus` 是兼容视图,字段必须来自 `emcStatus` 或同一份 C/C++ status buffer。
|
||||
- `emcStatus` 是后续新增 LinuxCNC 对标字段的默认入口。
|
||||
- 新字段优先落在 `emcStatus.task`、`emcStatus.motion.traj`、`emcStatus.motion.joint[]`、`emcStatus.motion.axis[]`、`emcStatus.io` 中。
|
||||
- 若必须保留旧字段名,应在测试中断言旧字段与 `emcStatus` 同源一致。
|
||||
- `taskTopLevelStatus`、`rcsStatus`、顶层 `task`、`servoCycle`、顶层 `motionStatus` 禁止再从 `lctask_read_status_json()` 输出。
|
||||
|
||||
## 字段映射方案
|
||||
|
||||
| LinuxCNC字段 | WASM事实源 | JSON位置 | 状态 |
|
||||
| --- | --- | --- | --- |
|
||||
| `EMC_STAT.status` / top RCS status | `StandaloneEmcStatus.top_rcs_status` | `emcStatus.top.status`、`taskTopLevelStatus`、`rcsStatus.top` | 已有 |
|
||||
| `EMC_STAT.task.status` | `StandaloneEmcTaskStatus.rcs_status` | `emcStatus.task.status`、`task.status`、`rcsStatus.task` | 已有 |
|
||||
| `EMC_STAT.task.state` | `StandaloneEmcTaskStatus.state` | `emcStatus.task.state`、`task.state` | 已有 |
|
||||
| `EMC_STAT.task.mode` | `StandaloneEmcTaskStatus.mode` | `emcStatus.task.mode`、`task.mode` | 已有 |
|
||||
| `EMC_STAT.task.execState` | `StandaloneEmcTaskStatus.exec_state` | `emcStatus.task.execState`、`task.execState` | 已有 |
|
||||
| `EMC_STAT.task.interpState` | `StandaloneEmcTaskStatus.interp_state` | `emcStatus.task.interpState`、`task.interpState` | 已有 |
|
||||
| `EMC_STAT.task.task_paused` | `StandaloneEmcTaskStatus.task_paused` | `emcStatus.task.taskPaused`、`task.taskPaused` | 已有 |
|
||||
| `EMC_STAT.task.file` | `StandaloneEmcTaskStatus.open_program` | `emcStatus.task.file`、`task.file` | 已有 |
|
||||
| `EMC_STAT.status` / top RCS status | `StandaloneEmcStatus.top_rcs_status` | `emcStatus.top.status` | 已有 |
|
||||
| `EMC_STAT.task.status` | `StandaloneEmcTaskStatus.rcs_status` | `emcStatus.task.status` | 已有 |
|
||||
| `EMC_STAT.task.state` | `StandaloneEmcTaskStatus.state` | `emcStatus.task.state` | 已有 |
|
||||
| `EMC_STAT.task.mode` | `StandaloneEmcTaskStatus.mode` | `emcStatus.task.mode` | 已有 |
|
||||
| `EMC_STAT.task.execState` | `StandaloneEmcTaskStatus.exec_state` | `emcStatus.task.execState` | 已有 |
|
||||
| `EMC_STAT.task.interpState` | `StandaloneEmcTaskStatus.interp_state` | `emcStatus.task.interpState` | 已有 |
|
||||
| `EMC_STAT.task.task_paused` | `StandaloneEmcTaskStatus.task_paused` | `emcStatus.task.taskPaused` | 已有 |
|
||||
| `EMC_STAT.task.file` | `StandaloneEmcTaskStatus.open_program` | `emcStatus.task.file` | 已有 |
|
||||
| `EMC_STAT.task.currentLine/readLine/motionLine` | staged interpreter + motion snapshot | `emcStatus.task.currentLine/readLine/motionLine` | 已有 |
|
||||
| `EMC_STAT.task.activeGCodes/activeMCodes/activeSettings` | vendored interpreter/canon state | `emcStatus.task.activeGCodes/activeMCodes/activeSettings` | 后续 |
|
||||
| `EMC_STAT.task.g5x_offset/g92_offset/toolOffset` | vendored interpreter/canon state | `emcStatus.task.offsets` | 后续 |
|
||||
| `EMC_STAT.motion.status` | `StandaloneEmcMotionStatus.rcs_status` | `emcStatus.motion.status`、`rcsStatus.motion` | 已有 |
|
||||
| `EMC_STAT.motion.status` | `StandaloneEmcMotionStatus.rcs_status` | `emcStatus.motion.status` | 已有 |
|
||||
| `EMC_STAT.motion.traj.enabled` | `LcmotStatusSnapshot.motion_enabled` | `emcStatus.motion.traj.enabled` | 已有 |
|
||||
| `EMC_STAT.motion.traj.inpos` | `LcmotStatusSnapshot.in_position` | `emcStatus.motion.traj.inpos` | 已有 |
|
||||
| `EMC_STAT.motion.traj.queue` | `LcmotStatusSnapshot.queue_count` | `emcStatus.motion.traj.queue` | 已有 |
|
||||
@@ -133,7 +123,7 @@ lctask_read_status_json() -> step servo / read fresh motion / consume command
|
||||
| `EMC_STAT.motion.on_soft_limit` | `LcmotStatusSnapshot.on_soft_limit` | `emcStatus.motion.onSoftLimit` | 已有 |
|
||||
| `EMC_STAT.motion.joint[]` | `LcmotStatusSnapshot.joint_cmd/joint_fb` | `emcStatus.motion.joint[]` | 已有 |
|
||||
| `EMC_STAT.motion.axis[]` | `LcmotStatusSnapshot.axis_cmd/axis_fb` | `emcStatus.motion.axis[]` | 已有 |
|
||||
| `EMC_STAT.io.status` | `StandaloneEmcIoStatus.rcs_status` | `emcStatus.io.status`、`rcsStatus.io` | 已有 |
|
||||
| `EMC_STAT.io.status` | `StandaloneEmcIoStatus.rcs_status` | `emcStatus.io.status` | 已有 |
|
||||
| `EMC_STAT.io.aux.estop` | task/io shim | `emcStatus.io.aux.estop` | 已有 |
|
||||
| `EMC_STAT.io.fault/reason` | `StandaloneEmcIoStatus.error/reason` | `emcStatus.io.fault/reason` | 已有 |
|
||||
|
||||
@@ -143,13 +133,13 @@ lctask_read_status_json() -> step servo / read fresh motion / consume command
|
||||
|
||||
状态:已完成,对应 T-051。
|
||||
|
||||
目标:把当前 `motionStatus.motion.*` 中已有的 queue、inpos、id、paused、stepping、currentVel 等字段,以 LinuxCNC `EMC_TRAJ_STAT` 名称归入 `emcStatus.motion.traj`。
|
||||
目标:把 motion snapshot 中已有的 queue、inpos、id、paused、stepping、currentVel 等字段,以 LinuxCNC `EMC_TRAJ_STAT` 名称归入 `emcStatus.motion.traj`。
|
||||
|
||||
验收:
|
||||
|
||||
- `emcStatus.motion.traj.queue` 等于兼容字段 `motionStatus.motion.queueDepth`。
|
||||
- `emcStatus.motion.traj.inpos` 等于兼容字段 `motionStatus.motion.inPosition`。
|
||||
- `emcStatus.motion.traj.id` 等于兼容字段 `motionStatus.motion.id`。
|
||||
- `emcStatus.motion.traj.queue` 等于 `emcStatus.motion.queueDepth`。
|
||||
- `emcStatus.motion.traj.inpos` 等于 `emcStatus.motion.inPosition`。
|
||||
- `emcStatus.motion.traj.id` 等于 `emcStatus.motion.motionId`。
|
||||
- `lctask_read_status_json()` 不新增 motion read 或 servo step。
|
||||
|
||||
### SJ-2:规范 task line 和 interpreter字段
|
||||
@@ -161,18 +151,18 @@ lctask_read_status_json() -> step servo / read fresh motion / consume command
|
||||
验收:
|
||||
|
||||
- staged program RUN 后,`emcStatus.task.readLine/currentLine/motionLine` 与现有 plan read/execute/motion id evidence 一致。
|
||||
- 兼容字段若存在,必须与 `emcStatus.task.*Line` 同源。
|
||||
- 顶层 `task` 兼容视图不得再存在。
|
||||
|
||||
### SJ-3:规范 `motion.axis[]` 和 `motion.joint[]`
|
||||
|
||||
状态:已完成,对应 T-053。`emcStatus.motion.axis` 和 `emcStatus.motion.joint` 为数组;按名字访问的兼容视图保留在 `motionStatus.axis`,`emcStatus.motion.axisByName` 仅辅助迁移。
|
||||
状态:已完成,对应 T-053。`emcStatus.motion.axis` 和 `emcStatus.motion.joint` 为数组;`emcStatus.motion.axisByName` 仅提供按名字读取的同对象辅助视图。
|
||||
|
||||
目标:把当前 axis x/y/z/a/b/c 和 joint0 字段扩展成数组结构,对标 `EMC_MOTION_STAT.axis[]` 和 `joint[]`。
|
||||
|
||||
验收:
|
||||
|
||||
- 至少导出存在的 5/6 轴位置和 joint0 command/feedback。
|
||||
- 旧 `motionStatus.axis`、`motionStatus.joint0` 与新数组值一致。
|
||||
- 顶层 `motionStatus` 兼容视图不得再存在。
|
||||
|
||||
### SJ-4:规范 IO/aux/tool/coolant边界
|
||||
|
||||
@@ -189,22 +179,24 @@ lctask_read_status_json() -> step servo / read fresh motion / consume command
|
||||
|
||||
状态:已完成,对应 T-055。
|
||||
|
||||
目标:新增专用 gate,例如 `tools/verify_task_status_json_contract.sh`,固定 status JSON 字段来自 `StandaloneEmcStatus`,并检查 `emcStatus` 与兼容字段的一致性。
|
||||
目标:新增专用 gate,例如 `tools/verify_task_status_json_contract.sh`,固定 status JSON 字段来自 `StandaloneEmcStatus`,并检查旧顶层状态字段不存在。
|
||||
|
||||
验收:
|
||||
|
||||
- gate 检查 `statusSource=StandaloneEmcStatus`。
|
||||
- gate 检查 `taskTopLevelStatus`、`rcsStatus`、顶层 `task`、`servoCycle`、顶层 `motionStatus` 不存在。
|
||||
- gate 检查 `lctask_read_status_json()` 不调用 `lcmot_read_status_json()`。
|
||||
- gate 检查 JS/SDK 没有实现 task/motion 语义。
|
||||
- gate 纳入 `tools/verify_task_full_closure.sh`。
|
||||
|
||||
## 兼容策略
|
||||
## 旧字段收口策略
|
||||
|
||||
短期保留:
|
||||
禁止 `lctask_read_status_json()` 输出:
|
||||
|
||||
- `taskTopLevelStatus`
|
||||
- `rcsStatus`
|
||||
- `task`
|
||||
- `servoCycle`
|
||||
- `motionStatus`
|
||||
|
||||
新增字段默认进入:
|
||||
@@ -217,7 +209,7 @@ lctask_read_status_json() -> step servo / read fresh motion / consume command
|
||||
- `emcStatus.motion.joint`
|
||||
- `emcStatus.io`
|
||||
|
||||
旧字段只能作为兼容视图,不能作为后续实现的主字段。新增测试应优先断言 `emcStatus`,再断言兼容字段与其一致。
|
||||
旧字段不再作为兼容视图保留。新增测试必须优先断言 `emcStatus`,并在契约测试中继续对旧字段做负向断言。
|
||||
|
||||
## 文档和测试要求
|
||||
|
||||
|
||||
Reference in New Issue
Block a user