Skip to content

Stabilize core architecture with injectable session layers - #6

Merged
Andyccr merged 1 commit into
mainfrom
cursor/arch-stabilize-7527
Sep 3, 2026
Merged

Andyccr merged 1 commit into
mainfrom
cursor/arch-stabilize-7527

Conversation

@Andyccr

@Andyccr Andyccr commented Sep 3, 2026

Copy link
Copy Markdown
Owner

主题和紧凑壳已经稳住。这次不动视觉,把核心层收成可测、可替换的结构,避免再在 ChatSession 里堆传输、成员、日志和定时器。

架构

  • Transport factory:默认 Trystero;测试注入 FakeTransport。以后接 libp2p 只换工厂。
  • Runtime:浏览器定时器 / 可见性可替换成内存时钟,会话不必挂 jsdom。
  • Presence / Transcript:成员与输入中 TTL、消息去重和条数上限从会话里拆出。
  • RoomManager:同一房间且已加入才跳过重连;握手失败不再卡死,可以重试;切房仍会丢掉过期的 join。
  • UIChatPane 独立模块,壳只负责路由和大厅。

测试

Vitest 29 项:会话加入/去重/输入中/失败相位、房间管理器重试与中途切换、近期房间、节流。

协议和 UI 行为不变。

Open in Web Open in Cursor 

Split ChatSession into Presence, Transcript, and an injected transport/runtime so join, switch, and protocol behavior can run under fakes. Failed joins no longer pin a dead room, and the chat pane is a separate UI module.

Co-authored-by: Andy <mail@andychen.net>
@Andyccr
Andyccr marked this pull request as ready for review September 3, 2026 18:57
@Andyccr
Andyccr merged commit 4887454 into main Sep 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants