refactor: Stateful Sense (RFC #308) #312
Reference in New Issue
Block a user
Delete Branch "refactor/308-stateful-sense"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Stateful Sense refactor. Fixes #308
Review: Stateful Sense (RFC #308) ✅
净删 2900+ 行,架构大幅简化。整体执行质量很高。
👍 亮点
compute(state) => { state, workflow }签名设计干净,泛型S保证输入输出类型一致T | null规范完全遵守,无?:违规onSubscribersmap 比 bus 订阅更直接;stoppedguard 是好的防御⚠️ 建议(非阻塞,可后续跟进)
writeFileSync写到一半 crash 会导致 JSON 损坏。建议后续改为 write-to-temp + rename 模式readState静默吞错误 — 所有异常(包括权限错误、磁盘故障)都回退到initialState,可能掩盖数据丢失。建议至少 log warnruntime.state在writeState之前就已更新,写失败会导致内存和磁盘状态分叉SenseInfo.triggers应为ReadonlyArray<string>— 与其他配置数组(如KnowledgeConfig.exclude)保持一致data/senses/<name>.json在 layout 表中提及但无详细说明建议 1-3 开个 follow-up issue 追踪。