From 7441326785ac60fa1ce9671b83bba32fed3f30b2 Mon Sep 17 00:00:00 2001 From: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Tue, 27 Oct 2026 05:27:04 -0400 Subject: [PATCH] test(prefixed,tide): pin a do-not-merge label section's own command past the /label protected guard, and the position-less enqueued verdict MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit requestedLabels' protected-label refusal is gated on cmd.prefix === '': only the bare /label and /remove-label commands refuse lgtm, hold, approved, the do-not-merge/ family and hold.label. A configured do-not-merge section — whose values become exactly the labels that guard refuses — labels through its own /do-not-merge command. No test drove such a section, so Stryker's `cmd.prefix === '' → true` mutant at src/labels/prefixed.ts:254 survived: under it every /do-not-merge value is refused as 'managed by its own command'. The new file drives the add, default-hold-label and remove forms, and keeps /label's refusal as the control. evaluateInQueue returns { result: 'enqueued' } without a position key when the queue reports no entry; the test asserted it with toEqual, which treats a missing key and an undefined one alike, so the `outcome.position === undefined → false` mutant at src/plugins/tide.ts:332 survived. toStrictEqual pins the key's absence. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com> --- .../label/dynamicProtectedPrefix.test.ts | 102 ++++++++++++++++++ __tests__/plugins/tideMergeQueue.test.ts | 2 +- 2 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 __tests__/label/dynamicProtectedPrefix.test.ts diff --git a/__tests__/label/dynamicProtectedPrefix.test.ts b/__tests__/label/dynamicProtectedPrefix.test.ts new file mode 100644 index 00000000..ae341926 --- /dev/null +++ b/__tests__/label/dynamicProtectedPrefix.test.ts @@ -0,0 +1,102 @@ +import { Buffer } from 'node:buffer' + +import * as core from '@actions/core' +import { http } from 'msw' +import { setupServer } from 'msw/node' +import { afterAll, afterEach, beforeAll, describe, expect, it, vi } from 'vitest' + +import { handleIssueComment } from '../../src/issueComment/handleIssueComment' +import issuePayload from '../fixtures/issues/issue.json' +import issueCommentEvent from '../fixtures/issues/issueCommentEvent.json' + +import labelFileContents from '../fixtures/labels/labelFileContentsResp.json' +import * as utils from '../testUtils' + +// The protected-label refusal ("