Skip to content

[quality] cover the non-Error rejection and empty-config fallbacks in labelSync, lgtm, mergeQueue and issueComment/approve #222

Closed

Description

@hivecommons-hive

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; newOctokit spy returning a client whose issues.createLabel rejects with a string
  • __tests__/label/lgtm.test.ts: vi.mock(lgtmBinding, { spy: true }) with bindLgtm rejecting a string; assert the reply body and setFailed
  • __tests__/utils/mergeQueue.test.ts: queueState with a graphql stub rejecting a string
  • __tests__/issueCommentTest/approve.test.ts: require_self_approval with a payload whose issue has no user

Priority

  • Impact: low — branch-only residue at 98.35%; the String(e) fallbacks decide what a user sees in the refusal comment / setFailed message 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

  1. added
    qualityCreated by Hive for agent-filed issue provenance
    testingCreated by Hive for agent-filed issue provenance
    agent/qualityCreated by Hive for agent-filed issue provenance
    on Sep 28, 2026
  2. github-actions commented on Sep 28, 2026

    @github-actions
    Contributor

    Please add a kind label with /kind failing-test or /kind cleanup.

  3. added
    🐝 covered by PRHive verified that an open PR references or claims this issue; still actionable until confirmed
    on Sep 28, 2026
  4. added a commit that references this issue on Oct 3, 2026
    dacfd88
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/qualityCreated by Hive for agent-filed issue provenancehive/hosted-available-lke648397-260827-5q9tCreated by Hive for agent-filed issue provenanceneeds-kindqualityCreated by Hive for agent-filed issue provenancetestingCreated by Hive for agent-filed issue provenance🐝 covered by PRHive verified that an open PR references or claims this issue; still actionable until confirmed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions