[BUG] Repo analytics reports one pull request when a repo has none

Abierto
#4,084 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@Dhruvdesai793 ya está trabajando en esto.

Desde el 3/12/2026.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
48/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
github, nextjs, typescript

Línea de trabajo

Read src/app/api/metrics/repo-analytics/route.ts around lines 190–206, then inspect test/repo-analytics-validation.test.ts for route test patterns. Mock a successful empty pulls response without a Link header and check the returned total. Done means prActivity.total is 0 for an empty result while existing analytics behavior remains covered.

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

Descripción

bug needs-triage
What happened?

Repo analytics reports one pull request for a repository with no pull requests. The route requests one page item, checks the pagination Link header, and falls back to 1 whenever the response is successful but has no rel=last link. GitHub's empty result has no Link header, so the empty case is reported as one.

Expected: return 0 when the successful response contains no pull requests.

Source: the request and fallback set totalPrs to 1 in this case; the Repo Analytics sheet displays that value.

Steps to reproduce
  1. Sign in and open Repo Analytics for a repository with no pull requests.
  2. Inspect GET /api/metrics/repo-analytics?repo=owner/repo.
  3. GitHub returns an empty pull-request list with no Link header.
  4. The route returns prActivity.total: 1, and the sheet displays one PR instead of zero.
Where is it?

Dashboard overview

Where did you see it?

Local development

Browser and device

Not browser-specific; server-side API data.

Screenshots, console errors or logs

No screenshot or runtime log applies. This is a source-level reproduction from the successful empty-response branch; I did not make a live request to GitHub for a specific repository. I did not run tests for this report to avoid using the shared checkout while another contributor is working. Existing test/repo-analytics-validation.test.ts checks parameter validation and cache behavior, but does not assert the pull-request total for an empty result. A route regression test should mock an empty successful pulls response without a Link header and expect prActivity.total to be 0.

Want to fix it?
  • I'd like to work on this. A maintainer will assign you; please don't start before that.
Lenguaje dominante
TypeScript
Estrellas
246
Forks
436
Merge medio
9 h 33 min
PR fusionados (30 d)
213

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 Priyanshu-byte-coder/devtrack

Todos los issues de Priyanshu-byte-coder/devtrack

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.