feat: 添加对 Kafka CurrentStatus 的 restart 值支持,更新 G5 入库逻辑及相关测试
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
# Change: add restart current_status mapping
|
||||
|
||||
## Why
|
||||
上游 Kafka 的 `CurrentStatus` 新增了 `restart` 值。现有处理逻辑仍按 `on/off` 处理,导致 `restart` 在入库时无法被正确标记为 3。
|
||||
|
||||
## What Changes
|
||||
- 让 Kafka 解析链路接受 `CurrentStatus=restart`。
|
||||
- 将 G5 入库链路中的 `current_status=restart` 映射为 `3`。
|
||||
- 更新相关测试与 OpenSpec 说明,确保 `restart` 是受支持状态。
|
||||
|
||||
## Impact
|
||||
- Affected specs: `openspec/specs/onoffline/spec.md`
|
||||
- Affected code: `src/processor/index.js`, `src/db/g5DatabaseManager.js`, `tests/processor.test.js`
|
||||
@@ -0,0 +1,14 @@
|
||||
## MODIFIED Requirements
|
||||
|
||||
### Requirement: 重启数据处理
|
||||
系统 SHALL 在 `CurrentStatus` 为 `restart` 时将 `current_status` 保留为 `restart`,并在 G5 入库链路中映射为 `3`。
|
||||
|
||||
#### Scenario: restart 状态写入
|
||||
- **GIVEN** Kafka 消息中的 `CurrentStatus` 为 `restart`
|
||||
- **WHEN** 消息被处理并写入数据库
|
||||
- **THEN** 普通入库链路保留 `restart`,G5 入库链路将其写入为 `3`
|
||||
|
||||
#### Scenario: 其他状态保持原样
|
||||
- **GIVEN** Kafka 消息中的 `CurrentStatus` 为 `on` 或 `off`
|
||||
- **WHEN** 消息被处理并写入数据库
|
||||
- **THEN** 系统按既有规则处理该状态值
|
||||
@@ -0,0 +1,10 @@
|
||||
## 1. Implementation
|
||||
- [x] 1.1 Update Kafka row building logic to preserve `restart` as a valid `current_status` value.
|
||||
- [x] 1.2 Update G5 database mapping so `restart` maps to `3`.
|
||||
- [x] 1.3 Update processor tests for the `restart` case.
|
||||
- [x] 1.4 Update OpenSpec requirements for supported current status values.
|
||||
|
||||
## 2. Validation
|
||||
- [x] 2.1 Run `npm run test`.
|
||||
- [x] 2.2 Run `npm run build`.
|
||||
- [x] 2.3 Run `openspec validate add-restart-current-status-mapping --strict`.
|
||||
Reference in New Issue
Block a user