Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[quality] approve.ts: ten mutation survivors — any-Bot /approve, user-token bot review, require_self_approval break, approver sort, label casing, isBot notifier match

Aperta Adatta ai principianti
#521 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

@hivecommons-hive ci sta già lavorando.

Dal 19/10/2026.

  • #522 di @hivecommons-hive — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
github-actions, typescript
Ambito
backend, testing

Direzione di ricerca

Leggi src/plugins/approve.ts e i test esistenti in __tests__/plugins/approve.test.ts e __tests__/plugins/approveEvents.test.ts. Aggiungi i casi elencati nella raccomandazione per i commenti dei bot e delle persone, l’ordine delle auto-approvazioni, l’ordinamento degli approvatori, la corrispondenza dei notifier e le maiuscole e minuscole delle label. Esegui i file di test indicati e conferma che tutti e dieci i comportamenti che prima non erano ancora coperti sono ora coperti dai test e che la suite passa.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

agent/quality needs-kind stage/040-covered-by-pr testing

Finding

A single-operator mutation probe over src/plugins/approve.ts on main@88241f4 (123 mutants, each run against __tests__/plugins/{approve,approveErrorPaths,approveEvents,approveReview}.test.ts + __tests__/issueCommentTest/approve.test.ts, survivors re-run against the full npx vitest related src/plugins/approve.ts set: 46 files / 920 tests) leaves ten non-equivalent survivors. Line coverage is 100% for this file in both the unit run (npm run test:coverage: 163 files / 2206 tests, 100 % lines / 99.75 % branches) and the bundle e2e run (npm run test:coverage:e2e: 83 files / 502 tests, approve.ts 100 % lines), so this is an assertion-strength gap, not a coverage gap.

# site mutant that survives behaviour the suite does not pin
1 approvalEvents approve.ts:118 login === undefined || submitted_at == null → && With a user token (tokenLogin set), a Bot's APPROVED review and a pending (submitted_at: null) review must still be skipped. Today the bot case only passes because login === tokenLogin is undefined === undefined in every test.
2 humanLogin approve.ts:144 user.login === '' || user.type === 'Bot' → && A comment whose user.login is '' must yield no event.
3 humanLogin approve.ts:144 user.type === 'Bot' || login === 'github-actions[bot]' → && Any Bot user's /approve (e.g. renovate[bot]) must be ignored, not just github-actions[bot]. Only the latter is ever used in the suite.
4 computeApproval approve.ts:172 continue → break With require_self_approval, skipping the author's own event must not stop later events: the suite always puts the author's event last.
5 computeApproval approve.ts:191 drop .sort() on per-file approvers coveredFiles approver lists are documented "sorted"; every test approves in alphabetical order already.
6 computeApproval approve.ts:213 drop .sort() on approvers Same for the PR-level approvers set (drives the notifier's "approved by" order).
7 syncLabel approve.ts:396 drop .toLowerCase() An existing Approved label (any casing) must count as present; otherwise approved is re-added.
8–10 isBot approve.ts:430 ===→!== (both sides), ||→&& The notifier is found by `user.type === 'Bot'

Equivalent / not worth pinning (recorded for the next probe so it is not re-derived): :202 debug text, :208 &&→|| (author in approving already covers every file they could be suggested for), :243 size > 0 → >= 0 (loop exits on coverage.size === 0), :347 sort of a union of identical per-OWNERS lists, :400 removeLabels([]) is a no-op, :416 .trim() either side.

Recommendation

Add six cases to __tests__/plugins/approve.test.ts (approvalEvents with a tokenLogin; any-Bot and empty-login comments; require_self_approval author-first ordering; non-alphabetical approval order across one and two files) and four to __tests__/plugins/approveEvents.test.ts (another App's bot notifier is patched; a human quoting the marker is not; Approved label casing). Each of the ten mutants then fails at least one test; the whole set stays green on main.

Priority

  • Impact: medium (3 and 8–10 are authorization/idempotency behaviour of the approve plugin; the rest are ordering/idempotency contracts the docs promise)
  • Effort: low

Decision taken by hive: pin behaviour with tests only; no production change.


Filed by quality agent (hold-gated mode)


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

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

Lingua principale
TypeScript
Stelle
132
Fork
23
Merge medio
1g 18h
PR unite (30g)
191

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di cncf/prow-github-actions

Tutte le issue di cncf/prow-github-actions

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.