Repository navigation
[quality] labelIssue's refused POST /issues/{n}/labels write (src/utils/labeling.ts L88) has no end-to-end coverage #336
Description
Finding
labelIssue (src/utils/labeling.ts L80–89) is the single write path every label command and plugin uses (/kind, /area, /hold, /lgtm, ok-to-test, approve, owners-label, require-matching-label). Its catch at L88 rewraps a refused POST /repos/{o}/{r}/issues/{n}/labels as could not add labels: <cause>, which is what reaches the run's ::error:: annotation.
- Unit evidence:
npx vitest run --coverageonmain@ 3fc21f2 —labeling.ts100 % lines; the L88 arm is asserted in__tests__/label/area.test.ts,__tests__/plugins/ownersLabel.test.ts,__tests__/plugins/requireMatchingLabel.test.tsand__tests__/cronJobTest/sweep.test.ts. - End-to-end evidence:
npm run test:coverage:e2eonmain@ 3fc21f2 (Node v26.10.0, vitest 5.0.3, 6 files / 142 tests) —labeling.ts73.07 % lines, uncovered29–32, 52–59, 88, 114, 135, 170, 174, 203. L88 is never executed: every__tests__/bundlecase that reaches a label write routesPOST …/issues/1/labelsto200.
Of the other uncovered labeling.ts lines, L29–32 (#246), L135 (#298), L174 (#300/#310/#326) and L202–203 (#326) are claimed by open hold-gated PRs; L52–59 (getArgumentLabels) and L114 (resetLabelCache) have no caller under src/, and L170 is the legacy string-label shape GitHub no longer returns — none of those is reachable through the bundle. L88 is the one remaining reachable arm.
Recommendation
-
__tests__/bundle/labelWriteRefused.test.ts(new):/kind cleanupwith.prowlabels.yamlserved,GET /labelslistingkind/cleanup, andPOST /issues/1/labelsanswered500→ exit 1, the single errorerror handling issue comment: Error: could not add labels: HttpError: boom, exactly onePOSTwith{ labels: ['kind/cleanup'] }after the configuration reads and the labels read.
Measured: with that file, labeling.ts e2e lines 73.07 → 75 % and L88 leaves the uncovered set; bundle suite 142 → 143 tests.
Priority
- Impact: medium — unit-covered, e2e-uncovered (priority 2 under the coverage evidence rules)
- Effort: low
Filed by quality agent (hold-gated mode)
Activity
github-actions commentedon Oct 6, 2026
Please add a kind label with
/kind failing-testor/kind cleanup.test(bundle): drive labelIssue's refused label write through dist/ind…