Skip to content

test(bundle): drive tide's verdict arms (unknown-retry exhaustion, moved head, 405/409 refusals, merged/closed/locked, check_suite guards, once-per-run) through dist/index.js - #347

Merged
mrbobbytables merged 5 commits into
mainfrom
quality/test-tide-verdict-arms
Oct 9, 2026
Merged

mrbobbytables merged 5 commits into
mainfrom
quality/test-tide-verdict-arms

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds __tests__/bundle/tideVerdictArms.test.ts (13 tests, new file only — no production, harness or config change), driving src/plugins/tide.ts's verdict arms through dist/index.js against the fake GitHub:

  • fetchMergeability: mergeability still unknown after the 1 s / 2 s / 4 s retries → skipping pr #1: not mergeable (unknown) (lines 99, 108–111)
  • a head that moves while mergeability is computed → head moved during evaluation (208)
  • a merge refused with 405 once a concurrent event merged it → pr #1 was merged concurrently, exit 0 (219)
  • a merge refused with 409 → base branch moved / head moved (223, both regex arms)
  • a refused merge whose re-read fails too → could not merge pr #1: …, run fails (439)
  • blockedReason: a pull request GitHub reports as already merged, closed, locked, skipped before its binding or mergeability is read (399, 402, 405)
  • tideOnComment on a closed pull request after /hold (496–497)
  • tideOnCheckSuite without a head sha (520) and naming no pull request with the listing finding none (564–565)
  • evaluateMerge once: schedule with jobs: 'sweep lgtm' merges the shared pull request once and the other job skips it as already evaluated in this run (175)

check_suite with pull_requests: [{ number: 1 }] is the vehicle for the merge-path arms: tide is its only handler, so every recorded request is tide's and the sequences are asserted exactly (including the one POST /graphql dequeue check a gate skip makes on an event, since tide.merge_queue defaults to auto).

Measured with npm run test:coverage:e2e on main @ 3fc21f2: src/plugins/tide.ts 158/195 → 173/195 lines from __tests__/bundle alone. npx vitest run __tests__/bundle/tideVerdictArms.test.ts passes (13/13); npx eslint clean; npm run test:coverage passes all 1652 tests (the only red is the pre-existing unhandled ERR_TLS_CERT_ALTNAME_INVALID from __tests__/issueCommentTest/meow.test.ts, tracked in #294 and fixed by #287).

Disjoint from every open __tests__/bundle PR: these lines stay uncovered with all 33 held bundle PRs (#242–#345) applied together, and the file name is new. It does not use #246's repoLabels helper so it does not depend on that PR landing.

Related Issue

Closes #346


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

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

Adds __tests__/bundle/tideVerdictArms.test.ts: a mergeability still
unknown after every retry, a head that moves while it is computed, a
merge refused with 405 (merged concurrently) or 409 (base/head moved), a
refused merge whose re-read fails too, pull requests GitHub reports as
merged, closed or locked, tideOnComment on a closed pull request,
tideOnCheckSuite without a head sha and with nothing to evaluate, and
the once-per-run skip when the sweep and lgtm jobs share a pull request.

src/plugins/tide.ts e2e lines: 158/195 -> 173/195 under
npm run test:coverage:e2e.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: quality <quality@hive.kubestellar.io>
@hivecommons-hive
hivecommons-hive Bot requested a review from jpmcb as a code owner October 6, 2026 10:47
@hivecommons-hive hivecommons-hive Bot added the hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 6, 2026
@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.

@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.

All 13 cases add coverage.

  • tideVerdictArms.test.ts:159–162: use toHaveLength(2) plus fragments (merge exploded, could not merge pull request(s) #1) instead of comparing both ::error:: lines with toEqual.
  • Not blocking: the L77 case spends about 7.3s waiting through real 1s+2s+4s retries, which makes this the slowest bundle file. If there's a way to shorten the backoff for tests, use it.

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Addressed: the two ::error:: lines are now toHaveLength(2) plus the merge exploded / could not merge pull request(s) #1 fragments. On the backoff: the delays are hard-coded in tide.ts with no test hook, and this PR only touches the test file, so I've left the ~7s case as is rather than reach into src/. 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 3acb2a0: toHaveLength(2) plus merge exploded / could not merge pull request(s) #1 fragments. On the 7.3s backoff: unknownRetryDelaysMs is a const in src/plugins/tide.ts with no test-side override, so shortening it needs a production change (e.g. an env or input knob) that this PR deliberately doesn't make; happy to follow up if you want one.

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.

The error lines are now fragments. On current main one row adds nothing:

  • tideVerdictArms.test.ts:61: drop the ['closed', …] row, and remove "closed" from the header comment at :14. #363 merged after the first review, and approveReviewShortCircuits.test.ts:72 now reaches tide.ts:401–402.
  • Optional: the 7s backoff can be shortened without touching src. meow.test.ts:78 already loads a test-only script into the child process with NODE_OPTIONS=--require, and a similar script could shorten the 1000/2000/4000ms setTimeout waits.

…ackoff with a preload

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

Copy link
Copy Markdown
Contributor Author

Addressed in 5235110:


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

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

@mrbobbytables

Copy link
Copy Markdown
Member

/kind cleanup

@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 9, 2026
@mrbobbytables
mrbobbytables merged commit cba983c into main Oct 9, 2026
5 checks passed
@mrbobbytables
mrbobbytables deleted the quality/test-tide-verdict-arms branch October 9, 2026 17:59
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. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt.

Projects

None yet

2 participants