From 8229dbf4c28dbd502768fdb8947f71ec5b89f58f Mon Sep 17 00:00:00 2001 From: Bendik Aagaard Lynghaug Date: Sun, 30 Aug 2026 23:13:29 +0200 Subject: [PATCH] Announce sweeper: refresh open records from content A date or place corrected after first announce never reached the portal_events record, so the followup fired on the stale schedule. While a record is still in its initial state, content is the source of truth: differing responses are written back on each sweep. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01Y42TyF8Zu7NGRR2893vNcZ --- src/announce.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/announce.rs b/src/announce.rs index 15c7335..2a25ef1 100644 --- a/src/announce.rs +++ b/src/announce.rs @@ -92,6 +92,18 @@ pub async fn sweep(state: &AppState) -> anyhow::Result<()> { Some(a) => a, }; + // Content is the source of truth while the window is still + // open: a corrected date or place flows into the record, so the + // followup fires on the schedule the page actually announces. + if answer.state == schema.initial && answer.responses != responses { + let mut refreshed = answer.clone(); + refreshed.responses = responses.clone(); + if let Some(store) = &store { + store.put(&id, serde_json::to_vec(&refreshed)?.into()).await?; + tracing::info!(question = %q.id, "event record refreshed from content"); + } + } + if answer.state == schema.initial && now_ms >= ends { let target = "awaiting_summary"; let payload = serde_json::json!({ "to": target, "item": id, "by": "portal" });