List images with multiple since/before filters#44503
Merged
neersighted merged 1 commit intomoby:masterfrom Dec 13, 2022
Merged
Conversation
The List Images API endpoint has accepted multiple values for the `since` and `before` filter predicates, but thanks to Go's randomizing of map iteration order, it would pick an arbitrary image to compare created timestamps against. In other words, the behaviour was undefined. Change these filter predicates to have well-defined semantics: the logical AND of all values for each of the respective predicates. As timestamps are a totally-ordered relation, this is exactly equivalent to applying the newest and oldest creation timestamps for the `since` and `before` predicates, respectively. Signed-off-by: Cory Snider <csnider@mirantis.com>
ad2be86 to
0426c76
Compare
Member
|
@tianon ptal |
neersighted
approved these changes
Dec 13, 2022
Member
neersighted
left a comment
There was a problem hiding this comment.
LGTM/good to merge IMO given we discussed these semantics in detail last week.
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.
- What I did
The List Images API endpoint has accepted multiple values for the
sinceandbeforefilter predicates, but thanks to Go's randomizing of map iteration order, it would pick an arbitrary image to compare created timestamps against. In other words, the behaviour was undefined. Change these filter predicates to have well-defined semantics: the logical AND of all values for each of the respective predicates. As timestamps are a totally-ordered relation, this is exactly equivalent to applying the newest and oldest creation timestamps for thesinceandbeforepredicates, respectively.- How I did it
- How to verify it
A new integration test
- Description for the changelog
sinceorbeforefilter predicates by listing images which were created after the newest of thesinceimages and before the oldest of thebeforeimages. Previously the API would randomly pick one of each of thebeforeandsincefilter predicates to apply, and ignore the rest.- A picture of a cute animal (not mandatory but encouraged)