Skip to content
Open
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions go/internal/delivery/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -625,8 +625,9 @@ func (f *fakeReads) seedOwedMention(agent store.AccountID, channel store.Channel
}

// waitForOwed blocks until agent has exactly n owed-mention rows, or fails at the
// deadline — a polling barrier for the nil-waker case where no dispatch/wake
// signal is available to gate on (the owed row is the only observable effect).
// deadline — a polling barrier for cases where the owed-row count is the only
// observable effect to gate on, e.g. a nil-waker record (no dispatch/wake
// signal) or a start-edge sweep's ClearOwedMention (owed -> 0 after the sweep).
func (f *fakeReads) waitForOwed(t *testing.T, agent store.AccountID, n int) {
t.Helper()
deadline := time.After(testTimeout)
Expand Down
10 changes: 5 additions & 5 deletions go/internal/delivery/offline_mention_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,14 @@ func TestUnreadableOwedMentionClearedNotReswept(t *testing.T) {
startConsumer(t, c)

c.OnSessionStarted("sess-recip", recipient)
c.waitStartsDrained(t)

// The sweep's observable effect is the clear (owed -> 0); gate on it. A bare
// waitStartsDrained only proves the start edge was DEQUEUED, not that the
// sweep's ClearOwedMention ran (introspect_test.go), so asserting owedCount
// right after it races the async sweep and flakes red under CI load.
reads.waitForOwed(t, recipient, 0)
if got := disp.snapshot(); len(got) != 0 {
t.Fatalf("dispatches = %d, want 0 (an unreadable owed message is cleared, not dispatched)", len(got))
}
if n := reads.owedCount(recipient); n != 0 {
t.Fatalf("owed rows for recipient = %d, want 0 (the unreadable row must be cleared)", n)
}

// A second start edge finds nothing owed — the row was cleared, so no re-log loop.
c.OnSessionStarted("sess-recip", recipient)
Expand Down
Loading