Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

[quality] mutation survivors in src/plugins/requireMatchingLabel.ts: the withGracePeriod default, the graceMs > 0 guard, isBot's || and the no-rule debug text are not pinned by any test

Abierto Apto para principiantes
#519 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

@hivecommons-hive ya está trabajando en esto.

Desde el 19/10/2026.

  • #520 de @hivecommons-hive — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
78/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
github-actions, typescript
Área
ci-cd, testing

Línea de trabajo

Lee __tests__/plugins/requireMatchingLabel.test.ts junto con src/plugins/requireMatchingLabel.ts para ver los fixtures existentes y los casos de enforceRequiredLabels. Añade las cuatro aserciones descritas para las opciones omitidas, un evento opened sin período de gracia, un comentario de un bot de GitHub App y el mensaje de depuración de una etiqueta no relacionada. Ejecuta npx vitest related src/plugins/requireMatchingLabel.ts --run; el trabajo estará terminado cuando cada una de las cuatro mutaciones descritas haga fallar su prueba correspondiente.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Finding

Line coverage on main @ 88241f4 is 100 % for src/plugins/requireMatchingLabel.ts in both npm run test:coverage (unit) and npm run test:coverage:e2e (bundle), so the question is whether the tests pin the behaviour they execute. A single-operator mutation probe over the module (57 mutants: ||/&&, ===/!==, </<=, >/>=, true/false, ??/||, ! removal) — same method as #513, disjoint modules — leaves four survivors that pass the full transitive set, npx vitest related src/plugins/requireMatchingLabel.ts --run (40 files / 752 tests):

  • :139 withGracePeriod = false → true as the EnforceOptions default. The only caller that omits the option is sweep.ts:113; under the mutant every swept pull request with a grace_period_duration rule would park the runner for the grace period. No test calls enforceRequiredLabels without options and asserts sleep is not called.
  • :154 graceMs > 0 → >= 0. A rule without grace_period_duration on opened/reopened would call sleep(0) before reading labels. No opened case under a grace-less rule asserts sleep was not called ("touches nothing" at test line 207 asserts the writes only).
  • :252 isBot: type === 'Bot' || login === 'github-actions[bot]' → &&. The only bot fixture carries both attributes, so a marker comment from another GitHub App (type: 'Bot', a different [bot] login) is never exercised; under the mutant it would stop being deleted when the rule is satisfied.
  • :149 the "no rule applies … for label X" debug suffix inverted (changedLabel === undefined → !==). Cosmetic, but one toHaveBeenCalledWith on the existing unrelated-label case pins it for free.

Survivors that are equivalent and need no test: :123 required: true→false on getInput (the token is always set in tests; same class as #513's type-only literals), :248 ?? ''→|| '' on a string body.

Recommendation

Add four cases to __tests__/plugins/requireMatchingLabel.test.ts; no src/ change:

  • a new describe('enforceRequiredLabels') calling it with { issueNumber: 1, isPullRequest: false } and no options under a 5s rule: sleep not called, needs-kind added (the sweep's call shape)
  • opened with kindRule (no grace) and no kind label: sleep not called at all, needs-kind added
  • labeled kind/bug with needs-kind present and comments [human-with-marker, other-app[bot] with marker]: exactly the app bot's comment id is deleted
  • expect(debug).toHaveBeenCalledWith('require-matching-label: no rule applies to issue #1 for label priority/high') on the existing unrelated-label case

Verified locally: with these cases each of the four mutants fails exactly one test (53 tests in the file).

Priority

  • Impact: medium (grace-period sleeps bill Actions minutes on every swept PR; bot-comment cleanup)
  • Effort: low

Decision taken by hive: one issue, since one PR to one test file closes all four and no src/ change is involved.


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

Lenguaje dominante
TypeScript
Estrellas
132
Forks
24
Merge medio
1 d 18 h
PR fusionados (30 d)
191

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de cncf/prow-github-actions

Todos los issues de cncf/prow-github-actions

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.