TEL-730: Add validation method variants that include soft errors.#1667
Merged
Conversation
🦋 Changeset detectedLatest commit: 5c42903 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
0d0eecd to
abdbad6
Compare
abdbad6 to
177344e
Compare
177344e to
5453c4d
Compare
alexlivekit
approved these changes
Jul 15, 2026
alexlivekit
left a comment
Contributor
There was a problem hiding this comment.
a few nits, but overall lgtm
…e Combine implementation.
Contributor
Author
Thanks for the review! |
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.
This PR adds
ValidateResultvariants of some of the existing SIPValidatemethods. Logically, these are the same as the current ones, except they return aValidationResultinstead of anerror, where saidValidationResultis composed of an error and zero or more "soft validation errors".Context: for certain kinds of validation failures, we'd like to log something, but swallow the error, so that the surrounding processing might still continue (we call these "soft errors"). There already exists a mechanism for logging these "soft" errors (SoftFailureReporter), but the SoftFailure reporter is global, and so it is cumbersome to pass the SoftFailure reporter request-scoped logging context (note: I had originally experimented with extending the SoftFailureReporter function signature to include a
Contextand adding flavors of theValidatemethods that had aContextparameter, but this felt a bit error-prone).Now, if callers want to log soft validation errors, they may do so by invoking the
ValidateResultvariant of theValidatemethod and logging the soft errors of the returned value.General notes:
Validatethat returned an[]errorrather than aValidationResult(where the error slice contained both hard and soft errors). This was simpler in some ways (avoided introducing a new type), but it became a bit annoying to continually re-check for hard errors in various contexts. This motivated me to add a new type with a simpleOK()method that could allow callers to conveniently check whether or not they should continue processing or not.ValidationResultto contain a slice of hard errors. For now, I've opted to keep behavioral changes to a minimum, so that the validation logic will continue to eagerly return if a hard error is encountered.LogSoftErrorssuggestion!).Example of how these methods will be used