M8-T05: bind electricity costs to source bindings
This commit is contained in:
@@ -451,7 +451,7 @@ T01~T06 先把现有 DSMR 安全迁到统一 source/binding;T07~T11 再接
|
||||
|
||||
### M8-T05 — 电费计算绑定 Source Binding [structural]
|
||||
|
||||
- **Status**: `todo`
|
||||
- **Status**: `done`
|
||||
- **Depends**: M8-T04
|
||||
- **Context**: DSMR 已多 source 后,电力 period 必须只在同一 Meter/binding 累计域内计算。
|
||||
|
||||
@@ -461,6 +461,10 @@ T01~T06 先把现有 DSMR 安全迁到统一 source/binding;T07~T11 再接
|
||||
- `modify app/schemas/energy.py`
|
||||
- `modify tests/test_energy_cost.py`
|
||||
- `modify tests/test_api_energy.py`
|
||||
- `modify tests/test_energy_expose.py`
|
||||
- `modify openapi/openapi.json`
|
||||
- `modify openapi/openapi.yaml`
|
||||
- `modify frontend/src/api/schema.d.ts`
|
||||
|
||||
**Steps**
|
||||
1. 为 period 两个边界按时间解析唯一 electricity Meter、binding 和 DSMR source;查询 reading 时加入
|
||||
@@ -471,6 +475,10 @@ T01~T06 先把现有 DSMR 安全迁到统一 source/binding;T07~T11 再接
|
||||
不删除旧字段。
|
||||
4. 用现有 golden tests 锁住单 source 正常 period 的 quantity、cost、rounding、fixed fee 与 summary;
|
||||
增加 source switch、binding boundary、missing/ambiguous binding 测试。
|
||||
5. 因响应 schema 增加 nullable binding identity,重导 OpenAPI,并在 `frontend/` 运行
|
||||
`npm run codegen`;两个生成物必须随本卡提交,禁止手改 `schema.d.ts`。
|
||||
6. 固定现有 expose fixed-fee/credit 回归中的 `local_now()` 到明确已越过 01:05 结算点的时刻;测试
|
||||
不得依赖执行当天恰好处于 UTC 00:00~01:05 之外,也不得为消除红灯改变生产结算语义。
|
||||
|
||||
**Out of scope / 不要碰**
|
||||
- 不实现 thermal cost,不修改合同 scope,不改变正常电价公式。
|
||||
@@ -480,11 +488,14 @@ T01~T06 先把现有 DSMR 安全迁到统一 source/binding;T07~T11 再接
|
||||
- [ ] 正常新周期总能审计到唯一 binding,跨域周期明确 degraded。
|
||||
- [ ] 既有单 DSMR source 的所有非降级数字逐项不变。
|
||||
- [ ] recompute 幂等,不能把 source A 起点和 source B 终点相减。
|
||||
- [ ] `pytest`、`ruff check .` 全绿。
|
||||
- [ ] fixed-fee/credit golden tests 在 01:05 前后任意实际运行时刻均确定性通过,生产结算点不变。
|
||||
- [ ] `pytest`、`ruff check .`、OpenAPI/codegen 同步闸门全绿且生成物已提交。
|
||||
|
||||
**Reviewer checklist**
|
||||
- 重点构造 Meter 相同但 source 切换、source 相同但 Meter 换表两种边界。
|
||||
- 检查 Decimal/rounding 和本地日 fixed-fee 逻辑是否被无意改变。
|
||||
- 检查 expose golden tests 是否显式固定业务时钟,而不是等待 wall clock 或放宽 01:05 断言。
|
||||
- 独立重导 OpenAPI 与 codegen,确认 schema 生成物同步且不是手改。
|
||||
|
||||
### M8-T06 — Source / Channel / Binding HTTP 契约 [structural]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user