# 计划:策略数据 JSON data store schema 标准化(阶段航点) > 编号:PLAN-005 | 粒度:阶段航点(大粒度) | 创建:2026-08-31 | 状态:**已完成(2026-09-01 迭代 04 验收通过,R-006 已实现)** > 派生自终极目标:目标-001(DSH 插件形态) > 依据需求:**R-006(已定稿,2026-08-31)** —— 符合入范围门槛 > 设计约束:技术约束-011(测试数据隔离)、技术约束-012(新增:JSON data store schema) ## 目标 将策略份额分配数据(现 allocations.json,code 为中心)标准化为 **JSON data store schema**: - store.schema.json:描述数据集(dataset)的标准字段(类 JSON Schema); - store.json:实际数据文件,策略为中心(strategies[].dataset = [{code, shares}]); - 策略定义仍留 DSH settings(设置页交互不变); - 旧 allocations.json 启动时自动迁移(保留备份)。 ## 范围 **做**: 1. 新增 DataStore 模块(src/component/DataStore.js): - 定义 store.schema.json 与 store.json 结构; - 读写 store.json(schema 校验 + 原子写); - 迁移:启动时检测旧 allocations.json → 转换为 store.json(code 为中心 → 策略为中心),保留 allocations.json.bak; - 数据集 CRUD:getDataset(strategyId) / setDataset(strategyId, items) / removeDataset(strategyId)。 2. PositionManager / api 改造: - 份额读写改走 DataStore(替代 AllocationStorage); - strategies/remove 联动删 store dataset(同现状联清份额模式); - 现有端点(add-shares/remove-shares/strategy-positions/summary 等)行为不变。 3. 删除/归档 AllocationStorage(迁移完成后)。 **不做**: - 策略定义迁移(保留 settings); - 不引入数据库(数据量少,JSON 足够)。 ## 实现步骤 1. DataStore 模块(schema + 读写 + 迁移 + dataset CRUD); 2. PositionManager 改接 DataStore; 3. api 编排(strategies/remove 联动删 dataset); 4. 构建 + 测试隔离模式验证迁移; 5. 验收 + 记录迭代。