refactor(streaming)!: FrontendEmitter を typed StreamEvent に置き換える - #38
Merged
Conversation
notedeck#781 Phase 3。emit(&str, Value) を emit(StreamEvent) に変更し、
生 JSON の寿命を WS 受信境界で終わらせる。
- StreamEvent: 全 11 イベントの typed union。adjacent tagging (kind/payload)
で Tauri 統合チャネルの歴史的ワイヤ形 { kind, payload } と一致
- kind() / sse_event_type() / payload_value() で命名の正本を enum に集約
(SSE の歴史的命名 note / chat-deleted / main-{eventType} 等を維持)
- emit_or_log! / emit_event! マクロを廃止し、emit_both() fn + 直接 emit に置換
- variant は Box 化 (serde/specta 透過、clippy::large_enum_variant)
BREAKING CHANGE: FrontendEmitter trait のシグネチャ変更。実装側 (notedeck
TauriEmitter) は同時更新が必要。
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
なぜ
notedeck-dev/notedeck#781 Phase 3(本丸)。イベント境界の
&str + serde_json::Valueを廃止し、「生 JSON は WS 受信境界で死ぬ」という設計確定(issue #781 の設計コメント参照)を実現する。変更内容
StreamEventenum: 全 11 イベントの typed union。#[serde(tag = "kind", content = "payload")]で Tauri 統合チャネルの歴史的ワイヤ形{ kind, payload }と一致(フロントの raw tap は無修正で互換)FrontendEmitter::emit(StreamEvent)— trait 変更(BREAKING、notedeck 側は rev bump と同時に更新)NoopEmitter/EventBusEmitter/ テスト用 emitter を typed 化。SSE の event type 命名(note/chat-deleted/main-{eventType}等)はsse_event_type()に集約し歴史的命名を維持emit_or_log!/emit_event!マクロ廃止 →emit_both()fn + 直接 emitテスト
既存 187 件全通過(再接続ループの契約テストは typed match に書き換え)、clippy (--features specta --all-targets) クリーン。
🤖 Generated with Claude Code