Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 18 additions & 13 deletions crates/buzz-relay/src/handlers/ingest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2837,24 +2837,29 @@ async fn ingest_event_inner(
};

let pubkey_hex = auth.pubkey().to_hex();
// Spec WriteInsert (line 514) / WriteDuplicate (line 606): emit
// the abstract write action. The persist API returns
// `was_inserted` (true → Insert, false → Duplicate). This branch
// is the reaction path; channel_id is always Some here, so
// WriteInsertGlobal does not apply.
// Spec WriteInsert (line 514) / WriteDuplicate (line 606) /
// WriteInsertGlobal (line 559): emit the abstract write action. The
// persist API returns `was_inserted` (true → Insert/Global, false →
// Duplicate). Reactions on project events (issue/PR roots and their
// comments) carry no `h` tag, so `channel_id` can be `None` here —
// mirror the message write's three-way split instead of asserting a
// channel, which panicked the ingest worker on those events.
let claimed = claimed_community_from_event(&event);
let action = if was_inserted {
TraceAction::WriteInsert {
let action = match (channel_id, was_inserted) {
(Some(ch), true) => TraceAction::WriteInsert {
msg_id: msg_id_label(event.id.as_bytes()),
channel: channel_label(channel_id.expect("reaction path has channel")),
channel: channel_label(ch),
claimed_community: claimed,
}
} else {
TraceAction::WriteDuplicate {
},
(Some(ch), false) => TraceAction::WriteDuplicate {
msg_id: msg_id_label(event.id.as_bytes()),
channel: channel_label(channel_id.expect("reaction path has channel")),
channel: channel_label(ch),
claimed_community: claimed,
}
},
(None, _) => TraceAction::WriteInsertGlobal {
msg_id: msg_id_label(event.id.as_bytes()),
claimed_community: claimed,
},
};
emit(tracer, action, state_for_request(tenant, auth.pubkey()));
dispatch_persistent_event(
Expand Down