Skip empty messages when aggregating pending-pod event-check results#4896
Skip empty messages when aggregating pending-pod event-check results#4896dejanzele wants to merge 1 commit intoarmadaproject:masterfrom
Conversation
Greptile SummaryFixes spurious blank lines in pod failure messages by skipping empty strings before appending to the ` separators in the final user-facing error message.
` in the output. Confidence Score: 5/5Safe to merge — the change is a minimal, well-targeted guard on an append call with no effect on the action-selection logic. The fix touches a single append site, leaves maxAction accumulation and all return paths intact, and is accompanied by a new regression test that directly exercises the previously broken scenario. No existing tests are altered, and the new test covers both the action result and the absence of blank lines in the joined message. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[getAction called with podEvents] --> B[Iterate each event]
B --> C[getEventAction: check event against configured rules]
C --> D{Event matches a rule AND past grace period?}
D -- Yes --> E[return action, podEvent.Message]
D -- No --> F[return ActionWait, empty string]
E --> G[resultAction = maxAction]
F --> G
G --> H{message != empty?}
H -- Yes --> I[append message to resultMessages]
H -- No --> J[skip - previously caused blank lines]
I --> K[Next event]
J --> K
K --> B
B -- done --> L[strings.Join resultMessages with newline]
L --> M[Return resultAction, joined message]
Reviews (4): Last reviewed commit: "Skip empty messages when aggregating pen..." | Re-trigger Greptile |
5148e14 to
0019b9b
Compare
Signed-off-by: Dejan Zele Pejchev <pejcev.dejan@gmail.com>
0019b9b to
159c44d
Compare
Summary
pendingPodChecks.getActionininternal/executor/podchecks/event_checks.goiterates every event on a failing pod, callinggetEventActionfor each. Events that don't match any configured check return("", ActionWait). The function appended those empty strings to the result list anyway, thenstrings.Join(..., "\n")produced multiple consecutive newlines.End-user impact: when kubelet emits multiple events on a failing pod (Scheduled, Pulling, Failed, BackOff, etc.) and only one matches a check, the failure message that lands in
lookoutdb.job_run.errorends up with several blank lines between the preface and the actual error text.Fix
Skip empty messages before appending. One-line change.
Empty strings are dead weight in a
\n-joined list; nothing else relied on their presence.Validation
Live impact: removes 4-6 spurious blank lines from the user-facing failure message in Lookout when k8s emits more than one event on the failing pod.