refactor(streaming): noteUpdated payload を typed NoteUpdateBody に置き換える - #36
Merged
Conversation
notedeck#781 Phase 1。StreamNoteUpdatedEvent / StreamNoteCaptureEvent の
update_type: String + body: Value を、adjacent tagging (updateType/body) の
NoteUpdateBody enum に置き換える。serde(flatten) により歴史的ワイヤ形
{ noteId, updateType, body } は不変で、specta feature 有効時は TS の
discriminated union として bindings に載る。
- reacted / unreacted / pollVoted / deleted の 4 variant + 各 body struct
- emoji は { name, url } / bare string / null のフォーク揺れを
untagged ReactionEmoji で吸収
- 未知の updateType (フォーク拡張) は WS 境界で debug log とともに drop
(Inspector の raw tap には影響しない)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
body を省略するフォークで noteUpdated deleted が握り潰されると ゴーストノートが残るため、null は空 body として扱う。 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 1。ストリーミングイベント payload の
serde_json::Value素通しを specta 型付き契約に載せる移行の第一歩として、noteUpdated系イベントのupdate_type: String+body: Valueを typed enum に置き換える。フォーク差異による payload 揺れを Rust 側 normalize (WS 境界) に集約し、フロントの防御的コードを削減する土台。変更内容
NoteUpdateBodyenum (reacted / unreacted / pollVoted / deleted) + 各 body struct を models.rs に追加(specta cfg_attr は既存パターン踏襲)StreamNoteUpdatedEvent/StreamNoteCaptureEventのupdate_type+bodyを#[serde(flatten)] update: NoteUpdateBodyに置換 — ワイヤ形{ noteId, updateType, body }は不変(契約テストあり)emojiの揺れ({ name, url }/ bare string / null)は untaggedReactionEmojiで吸収テスト
note_update_body_*4 件(from_raw の parse / 揺れ吸収 / unknown drop / ワイヤ形)stream_note_updated_event_keeps_wire_shape(flatten 後のワイヤ形契約)🤖 Generated with Claude Code