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

Aperta
#4,084 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@Dhruvdesai793 ci sta già lavorando.

Dal 3/12/2026.

Valutazione

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

Direzione di ricerca

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.

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

Descrizione

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.
Lingua principale
TypeScript
Stelle
246
Fork
436
Merge medio
9h 33m
PR unite (30g)
213

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

Tutte le issue di Priyanshu-byte-coder/devtrack

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.