Repository navigation
[quality] cover the non-Error rejection and empty-config fallbacks in labelSync, lgtm, mergeQueue and issueComment/approve #222
Description
Finding
Unit coverage on main @ c48bd6d (npm ci && npx vitest run --coverage, vitest v8 provider, reproducible locally; CI run of the same command in build-test on run 35910387179 prints the same table but publishes nothing, see #209) reports 99.83% statements / 98.35% branches. The remaining uncovered branches in four files form one cluster — the non-Error fallback of e instanceof Error ? e.message : String(e) plus two nullish/empty fallbacks — none of which any test reaches:
| File | Line | Uncovered branch |
|---|---|---|
src/cronJobs/labelSync.ts |
48 | config.sources.length === 0 → "the built-in defaults only" debug line |
src/cronJobs/labelSync.ts |
107 | write() catch with a non-Error rejection |
src/labels/lgtm.ts |
68 | bindLgtm rejecting with a non-Error value → refuse(..., String(e), e) |
src/utils/mergeQueue.ts |
188 | errorMessage() for a non-Error, non-{errors: []} rejection |
src/issueComment/approve.ts |
94 | context.payload.issue?.user?.login ?? '' when the payload issue has no user |
End-to-end evidence: the prow / prow check dogfoods the built dist/ on PRs but emits no coverage data (see #209), so no end-to-end coverage source exists to combine with; this finding is unit-only and the limitation is stated here rather than inferred.
src/utils/config.ts:603 (e instanceof Error ? e.message : e around parseDuration) is excluded on purpose: parseDuration only ever throws Error, so that branch is unreachable and not a test gap.
Disjoint from the open hold-gated PRs: #217 (__tests__/utils/auth.test.ts), #219 (__tests__/plugins/tideMergeQueue.test.ts, testUtils.ts), #221 (__tests__/plugins/approveEvents.test.ts).
Recommendation
Add one test per row to the existing test file of each module, stubbing the rejection where the github client can only ever produce an Error over HTTP:
-
__tests__/cronJobTest/labelSync.test.ts: no-config debug line;newOctokitspy returning a client whoseissues.createLabelrejects with a string -
__tests__/label/lgtm.test.ts:vi.mock(lgtmBinding, { spy: true })withbindLgtmrejecting a string; assert the reply body andsetFailed -
__tests__/utils/mergeQueue.test.ts:queueStatewith agraphqlstub rejecting a string -
__tests__/issueCommentTest/approve.test.ts:require_self_approvalwith a payload whoseissuehas nouser
Priority
- Impact: low — branch-only residue at 98.35%; the
String(e)fallbacks decide what a user sees in the refusal comment /setFailedmessage when a plugin rejects with a bare value - Effort: low
Filed by quality agent (hold-gated mode)
🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5q9t | SHA: c48bd6d
— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88
Activity
github-actions commentedon Sep 28, 2026
Please add a kind label with
/kind failing-testor/kind cleanup.test: cover the non-Error rejection and empty-config fallbacks of lab…