Files
mnote/bugs/03-rust-web/process/3-18-ws-sse-delta-contract-split-v1.md
T
lix-2026 3311bd0366 chore: document architecture gaps and add dev hot reload
- add npm dev:hot wrapper using cargo-watch and page reload polling

- add mnote-web dev hot reload endpoint and coverage

- record current architecture review and tracked bug findings across realtime, tree, editor, and AI runtimes

Verification:

- node scripts/task-dev-hot-plan-test.js

- node --check scripts/dev-hot.js

- cargo test -p mnote-web dev_hot -- --nocapture
2026-05-17 23:09:56 +08:00

34 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 3-18 [process][bug] WS 与 SSE delta 载荷合同分裂 v1
> 发现时间:2026-05-17
>
> 状态:`[process]`
>
> 关联主线:`03-rust-web`
## 1. 问题定义
SSE polling 可以从 bridgeLogs / domainEvents 解析 `streamDelta` 并附带 snapshot / resync 信息;WS 当前广播的是 `command_committed` 外壳,两者不是同一套 delta 合同。
## 2. 证据
- [stream_support.rs](/mnt/Data1T/mnote/rust/crates/mnote-web/src/routes/stream_support.rs:577) 附近解析 `streamDelta`
- [command_support.rs](/mnt/Data1T/mnote/rust/crates/mnote-web/src/routes/command_support.rs:102) 附近广播 command committed 事件。
- [ws.rs](/mnt/Data1T/mnote/rust/crates/mnote-web/src/routes/ws.rs:40) 处理 WS socket。
## 3. 影响
- 同一 tree command 在 WS 与 SSE 下可能给客户端不同结构。
- 前端 live cache 需要维护两套 reducer,增加状态分裂风险。
- WS 切主时,SSE 已覆盖的 snapshot/resync 语义可能丢失。
## 4. 建议修复
- 抽出统一的 tree realtime envelopeWS 与 SSE 只作为 transport。
- 对同一命令分别跑 WS / SSE 合同测试,断言事件 kind、cursor、snapshot、resync 语义一致。
- 前端 reducer 只消费统一 envelope,不感知 transport 差异。
## 5. 状态
已确认 WS / SSE 事件结构不统一,尚未修复。