fix(sync): don't misclassify plain 403 auth errors as rate limited

This commit is contained in:
Gabriel Brown
2026-07-11 14:28:02 -04:00
parent 4769a76274
commit e4a7f96633
2 changed files with 30 additions and 2 deletions
@@ -22,6 +22,24 @@ describe('isRateLimitError', () => {
).toBe(true);
});
test('does not misclassify a plain 403 auth error as rate limited', () => {
// GitHub sends X-RateLimit-* headers on essentially every REST response,
// including a permission-denied 403 where remaining is still positive.
// A reset header being present must NOT count as a rate limit.
expect(
isRateLimitError({
status: 403,
message: 'Resource not accessible by integration',
response: {
headers: {
'x-ratelimit-remaining': '4998',
'x-ratelimit-reset': '1700000000',
},
},
}),
).toBe(false);
});
test('returns false for a 404', () => {
expect(isRateLimitError({ status: 404 })).toBe(false);
});