Skip to content

test(mergeQueue): cover queueState, enqueue, dequeue and enqueuedByBot directly - #190

Merged
mrbobbytables merged 1 commit into
mainfrom
quality/test-merge-queue-unit
Sep 28, 2026
Merged

mrbobbytables merged 1 commit into
mainfrom
quality/test-merge-queue-unit

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Description

Adds __tests__/utils/mergeQueue.test.ts, a direct unit test for src/utils/mergeQueue.ts (queueState, enqueue, dequeue, enqueuedByBot, and the private classify/errorMessage helpers). Until now this module was exercised only indirectly through the tide handler tests and the bundle e2e suite, both of which drive it through fixtures that always return a populated repository.pullRequest and an enqueue entry with a position.

New assertions, none of which existed in either suite:

  • queueState returns undefined — without a warning — when GitHub answers repository.pullRequest: null or repository: null (src/utils/mergeQueue.ts:96, the file's only uncovered line on main)
  • queueState warns once per run on a GraphQL failure, stays quiet on the next call, and warns again after resetMergeQueueWarnings(); a transport (non-GraphQL) failure is reported by its message
  • entry mapping with and without an enqueuer, and no entry key when the PR is not queued
  • enqueue returns { ok: true } with no position when the mutation returns a null entry or a null payload
  • every classify kind (head_moved, already_queued, not_ready, forbidden, other) pinned to representative GitHub messages
  • errorMessage joins several GraphQL errors[].message, and falls back to the thrown error's message when none carries one
  • dequeue success and a refused dequeue (warns, returns false)
  • enqueuedByBot: github-actions case-insensitively, any [bot] suffix, humans, look-alikes, undefined

Test-only change; no src/ or dist/ changes, so no repack is needed.

Closes #189

Testing

  • npx vitest run __tests__/utils/mergeQueue.test.ts --coverage --coverage.include=src/utils/mergeQueue.ts → 33 passed; mergeQueue.ts | 100 | 96.66 | 100 | 100 (remaining branch is the String(e) fallback for a non-Error throw, which octokit never produces)
  • npx eslint __tests__/utils/mergeQueue.test.ts → clean

Checklist

  • I ran npm run all to lint and build my code (lint + tests; no build/pack output changes since only __tests__/ is touched)
  • I ran npm run pack and committed dist/ — n/a, no source change
  • Commits are signed off (DCO)
  • Note any new dependencies these changes bring in — none
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation — n/a
  • My changes generates no new warnings

Disjoint from the open test PRs #173/#175/#177/#179/#181/#183/#185/#187: this PR adds one new file, __tests__/utils/mergeQueue.test.ts, and touches no existing test.

Filed by quality agent (hold-gated mode). Human review required.

— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88

…t directly

Add __tests__/utils/mergeQueue.test.ts driving src/utils/mergeQueue.ts over
MSW rather than through the tide handler: the missing-pull-request and
missing-repository answers to queueState, the warn-once/reset semantics,
an enqueue that returns no entry or a null payload, every classify kind,
multi-error and no-message GraphQL error messages, a refused dequeue, and
the enqueuedByBot login pattern.

Signed-off-by: hivecommons-hive[bot] <hivecommons-hive@hive.kubestellar.io>
@hivecommons-hive hivecommons-hive Bot added the hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 26, 2026
@hivecommons-hive
hivecommons-hive Bot requested a review from jpmcb as a code owner September 26, 2026 17:44
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Important

Held for human review by the hive's ACMM level gate.

This PR was opened by the "quality" agent while Hive policy required a human checkpoint for that agent. Non-outreach agents are held at ACMM L3–L5; the outreach agent is always held because it publishes project-facing communication.

Hive will automatically remove the hold label once current policy no longer requires a level hold for "quality". If this is an outreach PR, a human must review it and remove the label.

@hivecommons-hive hivecommons-hive Bot added the hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hold Indicates that a PR should not merge because someone has issued a /hold command. needs-kind

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] src/utils/mergeQueue.ts has no direct unit test; the pullRequest:null, null-entry enqueue and classify kinds are untested

1 participant