Context
src/github/labels.ts:72-87's doc comment says removing a label is "Best-effort — a 404 (label not on the PR) is ignored." But the implementation is a bare .catch(() => undefined) with no status check at all — a 500, 403, or rate-limit failure is discarded identically to a 404, silently and unlogged. The same file's ensurePullRequestLabel (label-creation) catch a few lines above explicitly narrows what it swallows (e.status !== 422 || !e.message?.includes("already_exists") then re-throw), making removePullRequestLabel the inconsistent outlier within its own file.
Requirements
- Change
removePullRequestLabel's catch to check the error status, following ensurePullRequestLabel's exact narrowing pattern in the same file: only swallow a 404 (label not present, the documented best-effort case); re-throw (or at minimum log via this codebase's existing error-capture convention) anything else.
- Do not change
ensurePullRequestLabel — it's already correct and is the reference pattern.
Test Coverage Requirements
99%+ Codecov patch coverage on both the swallowed-404 branch and the re-thrown/logged non-404 branch; add regression tests for both cases.
Deliverables
Expected Outcome
A genuine GitHub API failure (rate-limit, permission error, 500) while removing a label is no longer silently discarded and unlogged.
Links & Resources
src/github/labels.ts:72-87 (the bug), same file's ensurePullRequestLabel (the correct reference pattern a few lines above)
Context
src/github/labels.ts:72-87's doc comment says removing a label is "Best-effort — a 404 (label not on the PR) is ignored." But the implementation is a bare.catch(() => undefined)with no status check at all — a 500, 403, or rate-limit failure is discarded identically to a 404, silently and unlogged. The same file'sensurePullRequestLabel(label-creation) catch a few lines above explicitly narrows what it swallows (e.status !== 422 || !e.message?.includes("already_exists")then re-throw), makingremovePullRequestLabelthe inconsistent outlier within its own file.Requirements
removePullRequestLabel's catch to check the error status, followingensurePullRequestLabel's exact narrowing pattern in the same file: only swallow a 404 (label not present, the documented best-effort case); re-throw (or at minimum log via this codebase's existing error-capture convention) anything else.ensurePullRequestLabel— it's already correct and is the reference pattern.Test Coverage Requirements
99%+ Codecov patch coverage on both the swallowed-404 branch and the re-thrown/logged non-404 branch; add regression tests for both cases.
Deliverables
removePullRequestLabelonly silently swallows a real 404; any other failure is surfaced (thrown or logged), matchingensurePullRequestLabel's convention.Expected Outcome
A genuine GitHub API failure (rate-limit, permission error, 500) while removing a label is no longer silently discarded and unlogged.
Links & Resources
src/github/labels.ts:72-87(the bug), same file'sensurePullRequestLabel(the correct reference pattern a few lines above)