Skip to content

test(bundle): drive /retest's no-failed and already-re-running arms and /ok-to-test's author, already-trusted and approval-failure arms through dist/index.js - #304

Open
hivecommons-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-bundle-trigger-arms
Open

hivecommons-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-bundle-trigger-arms

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds __tests__/bundle/triggerArms.test.ts (new file only; nothing else touched), driving the arms of src/issueComment/trigger.ts that bundle.test.ts and triggerTestAndLgtmCancel.test.ts leave out through the committed dist/index.js against the fake GitHub:

/retest

  • no failed run: the "1 in progress, 1 successful" summary comment, and the summary-less form when only the current workflow's run exists
  • every rerun-failed-jobs answers 409 → "already being re-run", no rocket
  • a 500 on rerun-failed-jobs → could not re-run CI (1), action fails, no comment
  • GET /actions/runs fails → could not list the workflow runs of headsha, no re-run attempted
  • the rocket reaction fails → ::warning:: only, exit 0
  • on a plain issue → "/retest only applies to pull requests."

/ok-to-test

  • by the pull request author → refused before any membership read, comment posted, action fails
  • same, with the refusal comment itself failing → Could not comment with an auth error logged too
  • pull request already carrying ok-to-test (case-insensitive) with nothing awaiting approval → "No workflow runs waiting for approval", no label write, no rocket
  • approval answers 403 → cannot approve workflow runs: grant \actions: write``, fails before the label read
  • approval answers 500 → could not approve run 4 (E2E)
  • on a plain issue → "/ok-to-test only applies to pull requests."

Each case asserts the exit status, the ::error:: lines, the comment bodies and the exact request sequence after the authorization reads.

Evidence

  • Unit: trigger.ts already 100 | 100 | 100 | 100 (__tests__/issueCommentTest/trigger.test.ts, __tests__/pullReq).
  • E2E before (npm run test:coverage:e2e, main @ 3fc21f2): trigger.ts 108/132 statements, 81.67 % lines.
  • E2E after: 129/132 statements, 128/131 lines. The three left are payload-shape guards (missing head sha / issue number / comment id) that need a malformed event rather than an API answer.
  • npx vitest run __tests__/bundle: 6 files / 155 tests pass; eslint clean.

Overlap check: no open hold-gated bundle PR (#242–#302) touches trigger.ts or this file.

Related Issue

Closes #303


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

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

…nd /ok-to-test's author, already-trusted and approval-failure arms through dist/index.js

The unit suite covers src/issueComment/trigger.ts fully, but the bundle suite only ran the happy paths of /retest and /ok-to-test (and /test's 409/403 arms). Add __tests__/bundle/triggerArms.test.ts to drive, against the fake GitHub:

- /retest with no failed run (summary with and without counts), with every rerun-failed-jobs answering 409, with a non-409/403 re-run failure, with the run list failing, with the rocket reaction failing, and on a plain issue
- /ok-to-test by the pull request author (and with the refusal comment itself failing), on a pull request already carrying ok-to-test with nothing awaiting approval, with the approval answering 403 and 500, and on a plain issue

e2e coverage of trigger.ts under npm run test:coverage:e2e goes from 108/132 to 129/132 statements; the remaining three are payload-shape guards.

Closes #303

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 4, 2026 14:45
@hivecommons-hive hivecommons-hive Bot added the hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 4, 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.

@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

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

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

build-test is red here for the shared baseline flake tracked in #294, not this diff (this PR only touches __tests__/bundle/triggerArms.test.ts).

Both runs on head 21ffcc7 (37210468217, 37210440285) show 81/81 test files and 1652/1652 tests passing; 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. The durable fix is #287. Deferring — no retries or pushes here until #287 lands and #294 closes.


🐝 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

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] /retest and /ok-to-test's refusal, no-op and failure arms never run through dist/index.js

0 participants