Skip to content

test(labeling): pin removeLabels continuing past an already-gone label and stopping at a real failure - #543

Open
hivecommons-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-labeling-remove-continues
Open

hivecommons-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-labeling-remove-continues

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Pins the one non-equivalent survivor a single-operator mutation probe (16 mutants, npx vitest related src/utils/labeling.ts --run, 67 files / 1369 tests) left in src/utils/labeling.ts, which is 100 % line- and branch-covered by both npm run test:coverage and npm run test:coverage:e2e on main @ 88241f4. Tests only; no src/, dist/ or docs change.

Files / functions claimed: __tests__/utils/labeling.test.ts (new removeLabels describe). Disjoint from every open held PR: #512 owns __tests__/label/remove.test.ts, #514 command.test.ts/labelMatch.test.ts, #542 duration.test.ts/labelCatalog.test.ts; none touches labeling.test.ts or src/utils/labeling.ts.

mutant new test
labeling.ts:180-181 — removeLabels returns after the already absent debug instead of continuing the loop removeLabels › keeps removing the later labels after an earlier one is already gone: ['gone', 'kind/bug', 'still-there'] with gone → 404 resolves and all three DELETEs are issued in order
(complement, previously asserted only for single-label lists) removeLabels › stops at the first failure that is not a 404 and names the label: ['first', 'broken', 'never'] with broken → 500 rejects could not remove label broken and never is not requested

removeLabels is the shared removal path for /remove, /remove-<prefix>, /hold cancel, /lgtm cancel, exclusive-prefix replacement (prefixed.ts:107), approve's label sync and require-matching-label's cleanup; every existing 404 case removes a single label, so a loop that silently stopped at the first gone label passed the whole suite.

Equivalent survivors left alone: e.name || '' → ?? '' in getCurrentLabels, and dropping the 'status' in error TypeScript narrowing in isNotFound.

Verification (this branch, local)

  • npx vitest run __tests__/utils/labeling.test.ts: 17/17 pass on main; with the mutant applied the new test fails (expected ['gone'] to deeply equal ['gone', 'kind/bug', 'still-there'])
  • npx eslint __tests__/utils/labeling.test.ts: clean
  • npm run test:coverage on main @ 88241f4: 163 files / 2206 tests, 100 / 99.75 / 100 / 100 (the four branches reported are the negative-count v8 artifacts docs(contributing): record the four negative-count BRDA branches as a v8 await artifact, not a gap #511 documents)
  • npm run test:coverage:e2e on main @ 88241f4: 99.96 / 98.79 / 100 / 99.95; labeling.ts has no zero-hit branch (the two reports are produced by different transforms and are not merged, as vitest.e2e-coverage.config.mjs documents)

Related Issue

Refs #523 — the hive folded this finding (removeLabels continues past a 404) onto that tracker; this PR is the finding and its complete fix. The tracker stays open for its other folded findings (trigger.ts, approveReview.ts, the run.ts:40/config.ts:657 src/ annotation), which are other PRs' or a human's.


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

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

…l and stopping at a real failure

removeLabels is the shared removal path for /remove, /remove-<prefix>,
/hold cancel, /lgtm cancel, exclusive-prefix replacement, approve's label
sync and require-matching-label's cleanup. Every existing 404 case removes
a single label, so a loop that stopped at the first already-gone label
passed the whole suite. Call removeLabels directly with three labels,
answer one DELETE with 404, and assert all three are requested in order;
answer one with 500 and assert the loop stops there with the label named.

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

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