Repository navigation
state: join the messages of additional errors in a condition - #1546
Merged
Merged
Conversation
When more than one error has the condition's type, the reason comes from the first, and the message joins the messages of all of them in list order, separated by "; ". Duplicate messages are omitted, and at most five messages are joined. When more than five messages are present, the condition message ends with how many are left out (e.g. "; and 3 more"). Document in buildCondition that list order decides which error is first so callers append in a fixed order. Fixes gke-labs#1544
justinsb
requested changes
Nov 22, 2026
justinsb
left a comment
Collaborator
There was a problem hiding this comment.
The change in buildCondition does what the issue asks. The test is 143 lines for it and calls the unexported function directly.
- Shrink
TestBuildCondition. Make it one table with a row for each rule: one error, two errors of one type, a repeated message, more than five messages, and an error of another type. Each row has the errors, the expected reason and the expected message. That is about 40 lines. - Show the joined message through a route's computed status. The issue asks for a route with two failures of one type in two rules that reports the first reason and both messages in order. If the changed line in
httproute_test.gois that test, say so in its comment; otherwise add it. err == nilin the loop. No caller appends a nil error. Remove the check.
justinsb
approved these changes
Nov 22, 2026
justinsb
approved these changes
Nov 22, 2026
justinsb
approved these changes
Nov 22, 2026
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.
Fixes #1544