Conversation
`JobListCursor.MarshalText` emits URL-safe base64, but the decoder uses the standard alphabet. A job kind that puts `-` or `_` in the encoded text makes a cursor produced by River fail to round-trip. Decode with the same URL-safe alphabet used for encoding. Cover a cursor whose ASCII job kind produces `-` in its text representation.
bgentry
force-pushed
the
bg/fix-job-list-cursor-base64
branch
from
September 25, 2026 15:26
2900a21 to
d642384
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.
Job list cursors from
JobListCursor.MarshalText(and so fromJobListResult.LastCursoronce it's serialized, for example as JSON in an API response) sometimes can't be read back.MarshalTextencodes the cursor with the URL-safe base64 alphabet, which uses-and_, butUnmarshalTextdecodes it with the standard alphabet, which expects+and/. Whenever the encoded cursor happens to contain-or_, decoding fails with anillegal base64 dataerror and the next page can't be fetched.Whether that happens depends on the bytes of the cursor's JSON, so it shows up only for some jobs. A cursor for a job whose kind is
a~, for example, encodes to text containing-, and passing that text straight back toUnmarshalTextfails.This change decodes with the same URL-safe alphabet used for encoding, so every cursor River produces round-trips. Cursors that decoded before are unaffected, since text without
-or_means the same thing in both alphabets. A new test covers a cursor whose encoded text contains-.