Repository navigation
fix: don't crash when posting the CI link comment fails - #707
Open
NopeCharon wants to merge 1 commit into
Open
NopeCharon wants to merge 1 commit into
NopeCharon wants to merge 1 commit into
Conversation
pushStarted() posts a "CI: <url>" (or "V8 CI:" / "Lite-CI:") comment on the pull request when Jenkins reports a pending build, but called createPrComment() without awaiting it or attaching a rejection handler. createPrComment() logs the error and rethrows it, so any GitHub API failure while commenting (5xx, rate limiting, locked PR, timeout) turned into an unhandled promise rejection. server.js treats those as fatal and exits the process, taking down the bot because of a best-effort comment. Route the three comment calls through a small postCiComment() helper that swallows the already-logged rejection, so the commit status update and the rest of the bot keep working. Add a unit test which makes the comment endpoint return 500 and asserts that the status is still created and no unhandled rejection is raised; it fails without this change. Fixes: nodejs#704 Signed-off-by: NopeCharon <115794254+NopeCharon@users.noreply.github.com>
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 #704
pushStarted()posted the "CI: " / "V8 CI:" / "Lite-CI:" comment without awaitingcreatePrComment()or handling its rejection.createPrComment()logs the error and then rethrows it, so a GitHub API failure while commenting became an unhandled rejection, andserver.jsexits the process on those.This sends the three comment calls through a small
postCiComment()helper. The helper discards the rejection, whichcreatePrComment()has already logged. The commit status update and the rest of the bot keep running.Testing
failureType: 'unhandledRejection'.npm test(node --test + standard) passes.