fix ListObjectVersions pagination comparison #12270
Merged
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.
Motivation
Follow up from #12259, I've introduced flakiness in the tests and bad behavior (also reported). I saw the failed run here: https://github.com/localstack/localstack/actions/runs/13314341024/job/37184566141 and realized my mistake instantly 🤦♂️
I incorrectly assumed the b64 encoded data could be sorted lexicographically, but this was wrong. The increasing values are cycling from upper case, lower case, digits, back to upper case. However, there is one comparison that fails:
z
to0
.This is because if we look at the proper Unicode code point for the characters, we go from
y
,z
,0
,1
to ->49
,48
,122
,121
. So we break the order at this one character. (if they had started with digits, things would have been fine 😝)I've introduced a small utility function to properly compare version between each other, maybe using hexadecimal characters could have been fine, but who knows what people does with
VersionId
field 😅 keeping the format as close as possible to AWS might be preferable.Also introduced unit tests for it, and an integration test to validate the paginator behavior.
Changes
VersionId
comparison to properly look at the raw data instead of the encoded onefixes #12255