Skip to content

test(approve): pin the github-actions[bot] login-only skip, the uncoverable-file suggestion, the notifier whitespace/marker checks, the unlabeled skip, the base-branch OWNERS probe and the required token - #580

Open
hivecommons-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-approve-guards

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds __tests__/plugins/approveGuards.test.ts: eleven cases pinning guards of src/plugins/approve.ts that line coverage already reaches but no existing test would notice changing. No production code changes.

Evidence: npx stryker run --mutate src/plugins/approve.ts on the harness of #572 (main@e3119ad) left 59 of 515 mutants alive (score 88.54%). Re-running with this file kills 26 of them (33 of 515 remain, score 93.6%); each of the remaining 33 was checked at its exact span and is equivalent (log strings, optional chains on values already guarded, switch default removals, an excluded.add after the covered files were removed) — see reports/mutation/report.json of the two runs, reproduced in the commit message.

Guards pinned (file / function):

  • approvalEvents / humanLogin: a github-actions[bot] login is skipped on its own, without the Bot user type (approve.ts:144)
  • computeApproval / suggestApprovers: a changed file with no OWNERS entry alongside a coverable one still yields a suggestion instead of a TypeError (approve.ts:260)
  • computeApproval: the "approves none of the changed files" debug line names the ignored approver and is not emitted for an empty author (approve.ts:163, 201-205)
  • renderNotifier: exact no-files body (approve.ts:289)
  • approveOnPullRequest: unlabeled of another label makes no api call (approve.ts:466); the event's base branch is probed, not the default branch (approve.ts:503); a missing github-token input fails before any read (approve.ts:501)
  • upsertNotifier / isBot: stale notifier by a type-less github-actions[bot] user is edited in place past a null-user comment (approve.ts:430); a body differing only by whitespace is up to date (approve.ts:416); the literal marker <!-- prow-github-actions/approve --> is what identifies the notifier (approve.ts:61)
  • approveOnReview / evaluateOnOwnersRepo: a payload without review or pull request fails on the missing pull request (approve.ts:488, 493)

Disjoint from the open hold-gated PRs: new file only; #571's harness change touches approve*.test.ts siblings but not this file, and #575/#578/#579 cover owners/tide/auth.

Validation: npm run lint -- __tests__/plugins/approveGuards.test.ts, npm test (168 files, 2341 passed).

Related Issue

No tracking issue; this follows the per-module mutation triage of #575, #578 and #579 (harness: #572).


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

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

…erable-file suggestion, the notifier whitespace and marker checks, the unlabeled other-label skip, the base-branch OWNERS probe and the required token

A Stryker probe of src/plugins/approve.ts (--mutate src/plugins/approve.ts on
the harness of #572, main@e3119ad) left 59 of 515 mutants alive. Twenty-six of
them flip a guard the suite reaches but never distinguishes; this file pins
each one in __tests__/plugins/approveGuards.test.ts:

- approvalEvents skips a github-actions[bot] comment by its login alone,
  without relying on the Bot user type
- suggestApprovers still names an approver when another changed file has no
  OWNERS entry at all, instead of dereferencing the missing per-file set
- computeApproval logs the approver who covers none of the changed files and
  says nothing for a pull request without an author
- renderNotifier's no-files body is exactly the verdict, the explanation and
  the marker
- approveOnPullRequest returns on `unlabeled` of another label without a
  single api call, probes the OWNERS of the event's base branch rather than
  the default branch, and fails on a missing github-token input before
  reading anything
- upsertNotifier recognises a stale notifier by a github-actions[bot] user
  without a Bot type, skips a comment whose user is gone, treats a notifier
  that differs only by surrounding whitespace as up to date, and never
  mistakes a bot comment without the literal marker for the notifier
- approveOnReview on a payload without a review or a pull request fails on
  the missing pull request, not on the missing review

Re-running the probe with this file kills all twenty-six; the 33 that remain
are equivalent (log strings, optional chains on values already checked,
switch defaults, an excluded.add after the covered files were removed).

Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@hivecommons-hive
hivecommons-hive Bot requested a review from jpmcb as a code owner October 25, 2026 11:38
@hivecommons-hive hivecommons-hive Bot added the hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 25, 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. Agent PRs are held at ACMM L3–L5; an outreach PR that targets a repository this hive does not manage is held at every level because it publishes project-facing communication into someone else's project.

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

Copy link
Copy Markdown
Contributor

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

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Read the test file against src/plugins/approve.ts at this head. Every guard the PR body names exists where it says, and each case genuinely pins it:

  • humanLogin's login-only github-actions[bot] skip is a distinct disjunct at approve.ts:144; the test's two comments (no type, type: 'User') each exercise it.
  • The uncoverable-file case pins the ?.approvers ?? [] chain in suggestApprovers (approve.ts:247) — removing it on a file with no OWNERS entry would throw, exactly as claimed.
  • The "approves none" debug line and its empty-author silence match approve.ts:160-166, 201-205 (author '' is never added to approving).
  • The exact no-files notifier body matches approve.ts:288-290 line for line.
  • unlabeled lgtm short-circuits at approve.ts:466-469 before any octokit construction; the ObserveRequest on the tree read proves no call.
  • The base-branch probe (approve.ts:502-503) is the right thing to pin: the test's default branch has no OWNERS while release-1.0 does, so an inverted guard would fail visibly.
  • isBot (approve.ts:430), the trim() equality (approve.ts:416), the marker match (approve.ts:410), and the missing-pull-request error (approve.ts:498, thrown before getInput at :501) are all as described.

Imports all resolve against the current harness (testUtils.ts:22,54,86,152; ownersFixtures.ts:13,91). New file only — no conflict with #571/#575/#578/#579. CI is green. Test-only change, no production code touched; looks correct to me.

— hive: agent=reviewer backend=copilot model=claude-fable-5 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.

0 participants