fix(frontseat-store): GH-266 bound the slice, not the subscribe cursor - #267
Open
joaodinissf wants to merge 1 commit into
Open
fix(frontseat-store): GH-266 bound the slice, not the subscribe cursor#267joaodinissf wants to merge 1 commit into
joaodinissf wants to merge 1 commit into
Conversation
Subscribe clamped its cursor down to len(events) as it stood when the delivery goroutine happened to start. The clamp was there to stop a cursor past the end panicking on the first wake, but bounding the cursor rather than the slice left a subscriber that over-asked tailing from wherever the journal was at that instant, delivering sequences below the one it asked for. Keep the cursor at fromSeq-1 as a permanent floor and bound the slice instead, so an over-asking subscriber yields nothing — matching the replay path. Carrying it as an int64 also removes the wrap-to-negative index a wire value near math.MaxInt64 could produce. TestJournalSubscribeBeyondEnd/finished caught this about once in 3000 runs; 4000 iterations and the race detector are clean now. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
joaodinissf
force-pushed
the
fix/266-journal-subscribe-beyond-end
branch
from
August 1, 2026 20:25
f06da03 to
77cec36
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Subscribeclamped its cursor down tolen(events)as it stood when thedelivery goroutine happened to start. The clamp was there to stop a cursor past
the end panicking on the first wake, but bounding the cursor rather than the
slice left a subscriber that over-asked tailing from wherever the journal was
at that instant — delivering sequences below the one it asked for.
The cursor now stays at
fromSeq-1as a permanent floor and the slice isbounded instead, so an over-asking subscriber yields nothing, matching the
replay path. Carrying it as an
int64also removes the wrap-to-negative indexa wire value near
math.MaxInt64could produce.TestJournalSubscribeBeyondEnd/finishedcaught this about once in 3000 runs,which was enough to redden unrelated PRs. 4000 iterations and the race detector
are clean now.
Fixes #266
This pull request was published with assistance from Claude.