fix: prevent missed messages in stream after valid error#3427
Conversation
|
Claude finished @cameronvoell's task —— View job Code Review CompleteReview Date: 2026-04-13 23:52 UTC Todo List:
SummaryThe implementation is solid and well-tested. The fallback logic correctly prevents missed messages by scanning alternate successful cursors when the primary cursor errors. Code quality is high with good documentation and thorough test coverage. Detailed FeedbackCode Quality & Best Practices ✅
Potential Issues 🔍Minor: Short-circuit opportunity in fallback loop factory.rs:202-206 - The fallback loop could theoretically scan many candidates if multiple cursors succeed for the same group. Consider adding an early break or limiting to the first successful candidate, since we're already sorting ascending: for id in candidates {
if let Some(stored) = self.group_db.msg(Some(id), msg)? {
return Ok(Some((stored, id.cursor)));
// This already returns, but if the query is expensive,
// consider whether we want the *first* ascending or truly
// iterate all candidates
}
}Current behavior looks correct (returns on first hit), but worth confirming this is intentional vs. wanting to scan all. Observation: Mock expectation range in regression test process_message.rs:241 - Performance Considerations ✅
Security Concerns ✅
Test Coverage ✅
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3427 +/- ##
=======================================
Coverage 83.24% 83.25%
=======================================
Files 378 378
Lines 51943 52035 +92
=======================================
+ Hits 43240 43321 +81
- Misses 8703 8714 +11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
dd4e974 to
a0e57b5
Compare
a0e57b5 to
20d41cf
Compare
ApprovabilityVerdict: Approved A straightforward bug fix adding fallback logic to prevent stream from missing valid messages when adjacent cursors error. The author owns all modified files, the change is well-scoped with clear intent, and includes a regression test. The runtime behavior change is defensive and targeted. No code changes detected at You can customize Macroscope's approvability policy. Learn more. |
Prevent missed messages in stream after a valid error by falling back to alternate cursors
MessageProcessornow checks other successful cursors from the same sync batch for the same group before giving up.lookup_stored_from_syncin factory.rs to first look up the streamed cursor, then scan alternate successfulMessageIdentifiers ordered by ascending cursor.next_messageis set to that cursor rather than the errored one, so the stream does not stall or skip the delivered message.Macroscope summarized 4986ee0.