Skip to content

test(bundle): drive tide's merge-queue skip and enqueue-refusal arms through dist/index.js - #322

Merged
github-actions[bot] merged 3 commits into
mainfrom
quality/test-bundle-merge-queue-arms
Oct 9, 2026
Merged

github-actions[bot] merged 3 commits into
mainfrom
quality/test-bundle-merge-queue-arms

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Files: __tests__/bundle/mergeQueueArms.test.ts (new, bundle e2e; imports configReads, helpersFor, ownersProbe, queueRead, repo, token from ./helpers). Cluster: tide's merge-queue path — src/plugins/tide.ts evaluateInQueue skip and enqueue-refusal arms, src/utils/mergeQueue.ts classify/errorMessage and the pullRequest: null state-query arm — driven through dist/index.js.

Ten pull_request labeled lgtm runs on a queue-enabled base branch against fakeGithub:

  1. pr already in the queue with an entry → skipping pr #1: in the merge queue (position 2, AWAITING_CHECKS), no enqueue mutation, no PUT
  2. pr in the queue without an entry → skipping pr #1: in the merge queue
  3. mergeable_state: dirty → skipping pr #1: not mergeable (dirty), no enqueue
  4. first read unknown, re-read after the 1 s backoff at a different head → skipping pr #1: head moved during evaluation, no enqueue
    5–7. enqueueError messages classified head_moved / already_queued / not_ready → each skipped, exit 0
  5. an unclassified GraphQL refusal → ::error::could not enqueue pr #1: …, exit 1, no PUT
  6. HTTP 500 on the mutation (no GraphQL errors array) → the transport's Server Error is reported, exit 1
  7. state query answering repository.pullRequest: null → falls back to the direct PUT …/merge without the "falling back" warning

Each case asserts the exact request sequence (bind, pullRead, ownersProbe, bindingRead, graphql[, graphql | pullRead | merge]).

Evidence (main @ 3fc21f2, Node v26.10.0, vitest 5.0.3, npm run test:coverage:e2e): src/plugins/tide.ts e2e lines 81.02 → 86.15 % (303–304, 308, 313, 316, 335, 337, 339, 346–347 now hit); src/utils/mergeQueue.ts 84.09 → 97.72 % (only line 67, the test-only resetMergeQueueWarnings, remains). Bundle suite 6 files / 152 tests green; eslint and tsc --noEmit clean. Unit coverage unchanged (no src/ change).

Disjoint from the open hold-gated PRs: #289 (mergeGateLabels.test.ts, the missing_labels gate and labelMatch.ts), #293 (holdSweepSettings.test.ts), #310 (pullReqJobsArms.test.ts), #318 (lgtmBindingArms.test.ts) and the rest — none drives evaluateInQueue's skip arms or an enqueue refusal other than forbidden, which bundle.test.ts already covers.

Related Issue

Closes #321


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

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

…through dist/index.js

Adds __tests__/bundle/mergeQueueArms.test.ts: on a queue-enabled base branch, a
pull_request labeled lgtm run is driven through the committed bundle against
fakeGithub for the arms bundle.test.ts does not reach — a pr already in the
queue (with and without an entry), a dirty pr the queue would refuse, a head
that moves while mergeability is computed, each classified enqueue refusal
(head_moved, already_queued, not_ready, other, and a transport 500), and a
state query that answers without a pull request.

Measured with npm run test:coverage:e2e on main @ 3fc21f2: src/plugins/tide.ts
e2e lines 81.02 % -> 86.15 %, src/utils/mergeQueue.ts 84.09 % -> 97.72 %.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: quality <quality@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 Oct 5, 2026
@hivecommons-hive
hivecommons-hive Bot requested a review from jpmcb as a code owner October 5, 2026 07:33
@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 keep the hold label until a human removes it. Operators can make a deliberate one-off release during an ACMM level change with release_level_holds=true, but level changes never release this hold automatically.

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

/kind cleanup


🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5q9t | SHA: 443e72f

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

@github-actions github-actions Bot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. and removed needs-kind labels Oct 5, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

build-test is red here for a cause this PR's diff (__tests__/bundle/mergeQueueArms.test.ts only) does not touch: all 81 test files pass, and the job exits 1 on the single vitest Unhandled Error assert(err.code !== "ERR_TLS_CERT_ALTNAME_INVALID") originating in __tests__/issueCommentTest/meow.test.ts (runs 37278444109, 37278399048). This is the shared incident tracked in #294; the fix is #287 (held, awaiting human review). Deferring this PR until that lands — no retries or pushes here for this failure.


🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5q9t | SHA: unknown

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

@jeefy jeefy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nine of the ten cases add coverage.

  • mergeQueueArms.test.ts:136–139 and :158–161: check fragments, e.g. some(e => e.includes('could not enqueue pr #1: Server Error')), instead of comparing whole ::error:: lines with toEqual.
  • Drop :129. L144 already reaches tide.ts:345–347 and mergeQueue.ts:178.

quality added 2 commits October 7, 2026 21:50
…ueue errors by fragment

Signed-off-by: quality <quality@hive.kubestellar.io>
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Addressed: the unclassified enqueue-failure case is dropped, and the remaining ::error:: assertions check the could not enqueue pr #1: Server Error / could not merge pull request(s) #1 fragments. Merged main too (it brings #287's meow network fix, which is what build-test was failing on).


🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5q9t | SHA: unknown

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

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Addressed in 7393294: dropped the unclassified enqueue-failure case; the two enqueue-refusal checks use some(e => e.includes(...)) fragments.

CI is green on the new head.


🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5q9t | SHA: 1f7d33c

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

@jeefy jeefy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Asks addressed; verified on current main (aa6a0f8) together with the other approved PRs.

@jeefy

jeefy commented Oct 9, 2026

Copy link
Copy Markdown
Member

/kind cleanup
/lgtm
/approve
/hold cancel

@github-actions github-actions Bot removed the hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 9, 2026
@github-actions github-actions Bot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 9, 2026
@github-actions
github-actions Bot merged commit 1269349 into main Oct 9, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] tide's merge-queue skip and enqueue-refusal arms are unit-covered but never driven through dist/index.js

1 participant