Files
junhong_cmp_fiber/openspec/changes/remove-device-protect-period/tasks.md
邹进 79b7580554
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 9m30s
feat: 下线设备保护期
- 后台设备停复机不再设置 1 小时保护期,也不再因保护期拒绝相反操作;单卡手动停复机去掉保护期检查
- 删除保护期一致性轮询(polling:protect)及其强制停复机方法;调度、初始化、监控、匹配预览不再包含保护期;已入队的旧任务由空处理函数直接确认,下一次发布移除
- 轮询配置接口不再接受与返回 protect_check_interval;并发配置不再返回 protect,查询、更新、重置该类型时拒绝
- 资产详情 device_protect_status 固定返回 none 并标记废弃,兼容老版本客户端
- 删除保护期 Redis key 与时长常量;停机原因 protect_period 保留供历史数据与开放接口映射
- 迁移 000249 只把 protect_check_interval、last_protect_check_at 列注释标记为已废弃,不删列不改数据
2026-10-25 17:19:10 +09:00

33 lines
2.6 KiB
Markdown
Raw 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.
## 1. 迁移
- [x] 1.1 新增成对迁移:更新 `tb_polling_config.protect_check_interval`、`tb_iot_card.last_protect_check_at` 列注释为"已废弃";down 恢复原注释。(`000249_deprecate_device_protect_columns`)
## 2. 设备与单卡停复机
- [x] 2.1 `internal/service/device/service.go`:设备停机、复机不再设置保护期,不再因保护期拒绝相反操作。
- [x] 2.2 `internal/service/iot_card/stop_resume_service.go`:手动停复机单卡(第 969、1036 行附近)去掉保护期检查。(同时删除只服务于保护期轮询的 `ForceStopCard`、`ForceStartCard`)
- [x] 2.3 删除 `RedisDeviceProtectKey`、`DeviceProtectPeriodDuration`;保留 `StopReasonProtectPeriod` 并在注释说明不再产生新值。
## 3. 下线保护期轮询
- [x] 3.1 删除 `internal/task/polling_protect_handler.go`;`pkg/queue/handler.go` 对 `polling:protect` 改为空处理函数直接成功(下一次发布再移除)。(`TaskTypePollingProtect` 常量与队列权重暂留,用于消化存量任务)
- [x] 3.2 调度器、初始化器、生命周期、监控与统计去掉 `protect` 类型;删除 `ProtectCheckSkipsForRealname`。
- [x] 3.3 轮询并发配置与任务类型名称去掉 `protect`,提交 `protect` 时拒绝。(数据库 `protect` 行保留,服务层过滤:列表不返回,查询、更新、重置返回参数错误)
- [x] 3.4 `PollingConfig` 模型与 DTO 去掉 `ProtectCheckInterval`;`config_manager.go` 匹配去掉保护期;`IotCard` 模型去掉 `LastProtectCheckAt` 的读写。
## 4. 资产接口兼容
- [x] 4.1 后台与 C 端资产详情的 `device_protect_status` 固定返回 `none`,DTO 说明标记已废弃;`internal/service/asset/service.go` 不再读取保护期 key。(三个字段加 `deprecated:"true"`,接口文档显示已废弃)
- [x] 4.2 重新生成接口文档。
## 5. 编译与规范校验
- [x] 5.1 `gofmt -w`;`go build ./cmd/api ./cmd/worker` 通过;全仓检索无残留的保护期 key 读写。
- [x] 5.2 `openspec validate remove-device-protect-period` 与 `openspec doctor --json` 通过。(validate 通过;当前 openspec 无 doctor 命令)
## 6. 测试环境验证(自动化测试为 N/A,按 ENG-TEST-001)
- [ ] 6.1 设备停机后立即复机成功,不被保护期拒绝;单卡手动停复机同样。
- [ ] 6.2 不再产生 `polling:protect` 任务与 `protect_period` 停机原因;历史 `protect_period` 记录正常展示。
- [ ] 6.3 资产详情 `device_protect_status` 恒为 `none`;轮询配置接口不含保护期间隔;并发配置不含 `protect`。