fix: guard against IndexOutOfRangeException when Branches list is empty in GithubStatusNotificationHandler#390
Conversation
Code Review: fix: guard against IndexOutOfRangeException when Branches list is empty in GithubStatusNotificationHandlerSummaryTargeted bug fix in Suggestions (nice to have)
Architecture CompliancePASS — all changes are internal to Test CoverageNew test What's Good
|
|
Code review round: fixed 1 finding — used consistent '(unknown)' fallback in status message title (c280a9f) |
Code Review: fix: guard against IndexOutOfRangeException when Branches list is empty in GithubStatusNotificationHandlerSummaryClean, focused bug fix with full test coverage. Low blast radius — changes confined to Critical (must fix before merge)None. Warnings (should fix, creates tech debt)None. Suggestions (nice to have)None — the previous round's finding (inconsistent fallback text) was already fixed in c280a9f. Architecture CompliancePASS — all changes internal to Test CoveragePASS — What's Good
|
|
Code review clean — advancing to security review |
Code Review: fix: guard against IndexOutOfRangeException when Branches list is empty in GithubStatusNotificationHandlerSummaryClean, minimal bug fix with correct test coverage. Low blast radius — changes confined to Critical (must fix before merge)None. Warnings (should fix, creates tech debt)None. Suggestions (nice to have)None. Architecture CompliancePASS — all changes internal to Test CoveragePASS — What's Good
|
|
Code review clean — advancing to security review |
|
Security review clean — advancing to human review |
|
PR marked ready for review and auto-merge enabled — will merge once all required checks pass and review is approved. |
Super-linter summary
All files and directories linted successfully For more information, see the GitHub Actions workflow run Powered by Super-linter |
fc51f14 to
a7e21c6
Compare
…ty in GithubStatusNotificationHandler Guard BuildStatusMessage and AddBranchEmbed in GithubStatusNotificationHandler against an empty Branches list. Previously, message.Branches[^1] threw IndexOutOfRangeException when no branches were present in the payload. Now uses a null-conditional accessor with string.Empty fallback for the embed title and "(unknown)" for the branch field value (Discord rejects empty field values). Adds parameterised test cases covering the empty-branches path for success, failure, and error states. Prompt: Fix the IndexOutOfRangeException in GithubStatusNotificationHandler when Branches is empty (issue #365)
…is empty in GithubStatusNotificationHandler
…ssage title Replaces string.Empty with "(unknown)" in the title embed to match the fallback text already used in the Branch embed field, avoiding a confusing empty-parentheses display when Branches list is empty.
a7e21c6 to
0725ace
Compare
Summary
message.Branches[^1]access inBuildStatusMessagewith a null-guarded form (message.Branches.Count > 0 ? message.Branches[^1] : null), preventingIndexOutOfRangeExceptionwhen the GitHub status payload arrives with an emptyBrancheslist.lastBranch?.Name ?? string.Emptyso an empty branches list produces a valid (if branch-less) title.AddBranchEmbedto use?? "(unknown)"on theFirstOrDefault()result soWithValuenever receives null or empty (Discord rejects both).NonPendingStateWithNoBranchesShouldPublishAsync) coveringsuccess,failure, anderrorstates with an empty branches list.Test plan
NonPendingStateWithNoBranchesShouldPublishAsynctests pass forsuccess,failure, anderrorstates.Closes #365