This repository has been archived by the owner on Jun 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 499
Fix certificate highest priority fallback behavior (DEV) #3845
Merged
mtwalli
merged 5 commits into
release/2.7.x
from
fix/DEV-certificate-highest-priority-fallback-behavior
Jul 30, 2021
Merged
Fix certificate highest priority fallback behavior (DEV) #3845
mtwalli
merged 5 commits into
release/2.7.x
from
fix/DEV-certificate-highest-priority-fallback-behavior
Jul 30, 2021
Conversation
This file contains 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
Prevent fallback behavior from triggering early if there are no certificate with `Valid` state.
d4rken
added
bug
Something isn't working
maintainers
Tag pull requests created by maintainers
labels
Jul 30, 2021
…y-fallback-behavior
d4rken
commented
Jul 30, 2021
Comment on lines
+178
to
+197
|
||
/** | ||
* Bad: listOf(null,null,cert).map {...}.firstOrNull() ?: fallback | ||
* | ||
* findHighestPriorityCertificate(nowUtc=2021-06-24T14:00:00.000Z): [VaccinationCertificate(#1), VaccinationCertificate(#7)] | ||
* No certs with state Valid/ExpiringSoon | ||
* Checking 2 certs with for Expired | ||
* Rule 3 match (Series-completing Vaccination Certificate > 14 days): VaccinationCertificate(#7) | ||
* No certs with state Invalid | ||
* No priority match, this should not happen: [VaccinationCertificate(#1), VaccinationCertificate(#7)] | ||
* | ||
* | ||
* Good: listOf(null,null,cert).mapNotNull {...}.firstOrNull() ?: fallback | ||
* | ||
* findHighestPriorityCertificate(nowUtc=2021-06-24T14:00:00.000Z): [VaccinationCertificate(#1), VaccinationCertificate(#7)] | ||
* No certs with state Valid/ExpiringSoon | ||
* Checking 2 certs with for Expired | ||
* Rule 3 match (Series-completing Vaccination Certificate > 14 days): VaccinationCertificate(#7) | ||
* No certs with state Invalid | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Example
BMItr
approved these changes
Jul 30, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
mtwalli
approved these changes
Jul 30, 2021
…y-fallback-behavior
…y-fallback-behavior
Kudos, SonarCloud Quality Gate passed! |
mtwalli
deleted the
fix/DEV-certificate-highest-priority-fallback-behavior
branch
July 30, 2021 14:31
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
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.
Fixes return the wrong certificate if we have no only expired/invalid ones.
If no certificates matches a rule, we return null.
Since the introduction of the states, we process them in the order Valid/Expiring>Expired>Invalid.
When we have
listOf(emptyList(), emptyList(), list(cert))
we would getlistOf(null,null,cert)
.As our fallback behavior is
list.firstOrNull() ?: fallback
it would always trigger the fallback if the first list (valid/expiring) is empty.