docs(03): capture phase context

This commit is contained in:
2026-03-28 11:16:02 +08:00
parent 4ff5dcf55e
commit ce6aa62fd6
2 changed files with 202 additions and 0 deletions

View File

@@ -0,0 +1,70 @@
# Phase 3: 设备体系完善 - Discussion Log
> **Audit trail only.** Do not use as input to planning, research, or execution agents.
> Decisions are captured in CONTEXT.md — this log preserves the alternatives considered.
**Date:** 2026-03-28
**Phase:** 03-device-system
**Areas discussed:** Plan 分组策略, 实时字段暴露范围, is_current DTO 同步范围, Gateway 类型定义位置
---
## Plan 分组策略
| Option | Description | Selected |
|--------|-------------|----------|
| 2 个 Plan推荐 | Plan 1: D-0+D-1+D-2基础层Plan 2: D-3功能层—— 与 Phase 2 分法类似 | ✓ |
| 1 个 Plan | D-0~D-3 全在一个 Plan 里,顶序执行,简单直接但回滚粒度较粗 | |
| 3 个 Plan | Plan 1: D-0Plan 2: D-1+D-2并行Plan 3: D-3 —— 粒度最细 | |
**User's choice:** 2 个 Plan推荐
**Notes:** 与 Phase 2 的"小修合并 + REALNAME 独立"分法保持风格一致
---
## 实时字段暴露范围
| Option | Description | Selected |
|--------|-------------|----------|
| 不暴露(推荐) | 实时字段仅写入 DB响应只返回存储字段满足所有成功标准 | ✓ |
| 暴露实时字段 | 在 AssetRealtimeStatusResponse 新增嵌套 DeviceRealtimeInfo 结构rssi / battery / ssid 等),需较大 DTO 改动 | |
**User's choice:** 不暴露(推荐)
**Notes:** 成功标准 2/4 只要求 online_status / software_version 等存储字段同步,不特别要求实时字段。实时字段暴露推迟到后续阶段按需决策。
---
## is_current DTO 同步范围
| Option | Description | Selected |
|--------|-------------|----------|
| 两处都加(推荐) | BoundCardInfoasset_dto.go+ DeviceCardBindingResponsedevice_dto.go同时新增 is_current | ✓ |
| 仅 BoundCardInfo | 只改 BoundCardInfo设备管理页绑定列表看不到当前卡标识 | |
**User's choice:** 两处都加(推荐)
**Notes:** 保持前端两个场景下的数据一致性
---
## Gateway 类型定义位置
| Option | Description | Selected |
|--------|-------------|----------|
| 放 models.go推荐 | 与现有 DeviceInfoReq / SlotInfoResp 等结构保持一致Gateway 类型集中在一个文件 | ✓ |
| 放 device.go | 跟修正文档建议,类型和方法在同一文件,但与其他 Gateway 结构不一致 | |
**User's choice:** 放 models.go推荐
**Notes:** 修正文档将类型嵌入 device.go 代码片段属于示意用法,不代表最终放置位置,遵循现有项目分离风格
---
## Agent's Discretion
- `updateDeviceFromSyncInfo` 内 is_current 更新的事务策略(先全 false 再设 true
- `last_online_time` 字符串 → time.Time 的 Parse 格式
- GORM Updates 而非 Save 的具体写法
## Deferred Ideas
- 设备实时字段rssi / battery / ssid 等)暴露到 Refresh 响应 —— 超出当前成功标准
- DeviceRealtimeInfo 独立 DTO 结构 —— 等实时字段暴露需求时再建