fix(github): avoid false outage attribution

This commit is contained in:
Brennan Benson
2026-07-16 19:44:45 -07:00
parent a7f7682693
commit bb3642ae31
2 changed files with 7 additions and 1 deletions
@@ -20,6 +20,7 @@ describe('classifyGitHubUnavailable', () => {
'connect ETIMEDOUT 140.82.112.5:443',
'TimeoutError: request aborted',
'NetworkError when attempting to fetch resource',
'network unavailable',
'fetch failed',
'socket hang up',
'could not resolve host: api.github.com',
@@ -41,6 +42,11 @@ describe('classifyGitHubUnavailable', () => {
expect(classifyGitHubUnavailable('HTTP 403: Resource not accessible by integration')).toBeNull()
expect(classifyGitHubUnavailable('HTTP 404: Not Found')).toBeNull()
expect(classifyGitHubUnavailable('could not resolve to a Repository with the name')).toBeNull()
expect(
classifyGitHubUnavailable(
"GraphQL: Could not resolve to a Repository with the name 'network'."
)
).toBeNull()
expect(classifyGitHubUnavailable('gh auth login required')).toBeNull()
expect(classifyGitHubUnavailable('')).toBeNull()
})
+1 -1
View File
@@ -23,7 +23,7 @@ const SERVER_ERROR_PATTERN =
// both Node (ENOTFOUND/ECONNRESET) and the gh Go client ("dial tcp", "i/o
// timeout", "no such host") shapes.
const NETWORK_PATTERN =
/timeout|\btimed out\b|\bno such host\b|could not resolve host|could not resolve to a host|network|\bconnection (?:refused|reset)\b|\bdial tcp\b|\bi\/o timeout\b|\bfetch failed\b|\bsocket hang up\b|ENOTFOUND|ECONNRESET|ECONNREFUSED|ETIMEDOUT|EAI_AGAIN|ENETUNREACH/i
/timeout|\btimed out\b|\bno such host\b|could not resolve host|could not resolve to a host|\bnetwork(?:error| (?:error|unavailable|unreachable|request failed))\b|\bconnection (?:refused|reset)\b|\bdial tcp\b|\bi\/o timeout\b|\bfetch failed\b|\bsocket hang up\b|ENOTFOUND|ECONNRESET|ECONNREFUSED|ETIMEDOUT|EAI_AGAIN|ENETUNREACH/i
/**
* Classify a gh/Octokit error message as a GitHub-reachability problem, or