From 667601012c86d0a567344dc565d321074009bb39 Mon Sep 17 00:00:00 2001 From: Timmy Date: Thu, 14 May 2026 20:24:27 +0100 Subject: [PATCH] fix: populate story_name in event buffer via CRDT lookup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `subscribe_to_watcher` was pushing StoredEvents into the event buffer with story_name hardcoded to String::new(), so /api/events polled by the gateway always omitted the title. The 1035 fix patched the other path (gateway_relay status_to_stored) but left this one bleeding empty strings. Lookup happens once at the subscriber boundary rather than at all 44 watcher emit sites — the story_id is already in hand and crdt_state::read_item is the canonical name source. Co-Authored-By: Claude Opus 4.7 (1M context) --- server/src/service/events/io.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/server/src/service/events/io.rs b/server/src/service/events/io.rs index e3434c53..a4cf1dde 100644 --- a/server/src/service/events/io.rs +++ b/server/src/service/events/io.rs @@ -31,9 +31,10 @@ pub fn subscribe_to_watcher(buffer: EventBuffer, mut rx: broadcast::Receiver { if let Some(from) = from_stage { + let story_name = lookup_story_name(&item_id); buffer.push(StoredEvent::StageTransition { story_id: item_id, - story_name: String::new(), + story_name, from_stage: from, to_stage: stage, timestamp_ms: now_ms(), @@ -41,17 +42,19 @@ pub fn subscribe_to_watcher(buffer: EventBuffer, mut rx: broadcast::Receiver { + let story_name = lookup_story_name(&story_id); buffer.push(StoredEvent::MergeFailure { story_id, - story_name: String::new(), + story_name, reason, timestamp_ms: now_ms(), }); } Ok(WatcherEvent::StoryBlocked { story_id, reason }) => { + let story_name = lookup_story_name(&story_id); buffer.push(StoredEvent::StoryBlocked { story_id, - story_name: String::new(), + story_name, reason, timestamp_ms: now_ms(), }); @@ -68,3 +71,10 @@ pub fn subscribe_to_watcher(buffer: EventBuffer, mut rx: broadcast::Receiver String { + crate::crdt_state::read_item(story_id) + .map(|view| view.name().to_string()) + .unwrap_or_default() +}