Repository navigation
[quality] src/utils/mergeQueue.ts failure arms are unit-covered but never exercised end-to-end through dist/index.js #269
Description
Finding
src/utils/mergeQueue.ts is 100 % line / branch covered by unit tests (__tests__/utils/mergeQueue.test.ts, __tests__/plugins/tideMergeQueue.test.ts), but the bundle e2e suite only drives its happy paths. Measured with the recipe from #235 (npx ncc build src/main.ts -o dist --source-map --no-source-map-register, then npx vitest run __tests__/bundle --coverage --coverage.autoAttachSubprocess --coverage.excludeAfterRemap --coverage.include='src/**/*.ts' --coverage.include='dist/**/*.js') on main @ 61577d5, Node v26.10.0, vitest 5.0.1:
| file | e2e lines | e2e branches | uncovered |
|---|---|---|---|
src/utils/mergeQueue.ts |
30.37 % | 10.34 % | 80-91, 115-147, 161-188 |
Never reached through dist/index.js:
queueStatecatch: an HTTP or GraphQL failure on the state query (a GHES without the queue fields, a token that may not read it) → once-per-runcore.warningand fallback to the REST merge.warnedUnavailableis never exercised across two pull requests in one run.queueState→repository.pullRequest === null→undefined(no warning).enqueuecatch and everyclassify()kind:head_moved,already_queued,not_ready,forbidden,other; and the position-less{ ok: true }arm whenmergeQueueEntryis null.dequeuecatch →could not dequeue pr #Nwarning, and tide'sdequeueIfOursreturning false on it (skip reason without(dequeued)).errorMessagereading a GraphQLerrors[]array (joined with;), versus a plainError.enqueuedByBoton an entry whoseenqueueris null.
__tests__/bundle/fakeGithub.ts already has MergeQueueFixture.enqueueError for exactly this; nothing uses it.
Unit evidence: npx vitest run --coverage on main @ 61577d5 → mergeQueue.ts 100 / 100 / 100 / 100. E2E evidence: the recipe above (local run; the repository publishes no e2e coverage, see #235).
Recommendation
- Add
__tests__/bundle/mergeQueueFailures.test.tsdriving each arm above throughdist/index.jsagainst the fake GitHub API: state-query HTTP 500 and GraphQLerrors[]→ warning + REST merge; null pull request → REST merge, no warning; scheduledlgtmjob over two pull requests → one warning;enqueueErrorfor eachclassify()kind asserting tide's skip reason or::error::; enqueue with nullmergeQueueEntry→enqueued pr #1without position; dequeue refusal → warning, skip reason without(dequeued); entry with null enqueuer → left in the queue.
Priority
- Impact: medium — unit-covered, not end-to-end; the merge queue fallbacks are what keep existing users merging when GraphQL misbehaves
- Effort: low
Filed by quality agent (hold-gated mode)
🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5q9t | SHA: 61577d5
— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88
Activity
github-actions commentedon Oct 3, 2026
Please add a kind label with
/kind failing-testor/kind cleanup.hivecommons-hive commentedon Oct 3, 2026
task-list sweep: 0 of 1 items ticked. Not closing yet — outstanding boxes remain.
Outstanding items:
__tests__/bundle/mergeQueueFailures.test.tsdriving each arm above throughdist/index.jsagainst the fake GitHub API: state-query HTTP 500 and GraphQLerrors[]→ warning + REST merge; null pull request → REST merge, no warning; scheduledlgtmjob over two pull requests → one warning;enqueueErrorfor eachclassify()kind asserting tide's skip reason or::error::; enqueue with nullmergeQueueEntry→enqueued pr #1without position; dequeue refusal → warning, skip reason without(dequeued); entry with null enqueuer → left in the queue.Merged PRs referencing this issue so far:
This comment is edited in place by the task-list sweep on every cycle; it is not duplicated.
hivecommons-hive commentedon Oct 3, 2026
Verified on main@ec76a3b: #270 landed the three outcomes
dist/did not reach — GraphQLerrors[]state read warning + REST fallback (bundle.test.ts L1459), forbidden enqueue failing with the permissions hint (L1475), refused dequeue warning (L1489) — withqueryError/dequeueErrorinfakeGithub.ts. The other classify() kinds were cut on review as duplicates oftideMergeQueue.test.ts/mergeQueue.test.ts; closing as resolved at the scope the maintainer accepted.— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88