[BUG] Compare metrics reports zeroes when GitHub searches fail

Aperta
#4,072 3 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@Dhruvdesai793 ci sta già lavorando.

Dal 3/12/2026.

  • #4078 di @Dhruvdesai793 — aperta

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

bug needs-triage status:assigned
What happened?

The compare endpoint returns HTTP 200 with default zero counts when secondary GitHub requests fail. The initial user lookup handles errors, but failed commit, repository, or PR searches leave streak, commits30d, or prs at zero (and repositories as Unknown). A GitHub 403, rate limit, or 5xx is therefore presented as valid user data. See the response handlers for commitsRes, reposRes, and prsRes in src/app/api/metrics/compare/route.ts.

Proposed solution: Check every upstream response and return a consistent error or explicit partial-result indicator; do not silently serialize default values as successful metrics. Add mocked tests for each failed subrequest and assert that the response cannot be mistaken for real zero values.

Steps to reproduce
  1. Request compare metrics for a valid GitHub username while the initial user lookup succeeds.
  2. Make a subsequent commit, repository, or PR search return 403 or 5xx.
  3. Observe that the route still returns HTTP 200 with zero/default values for the failed metric.
Where is it?

API

Where did you see it?

Local development

Browser and device

Not browser-specific: server-side API route. Local environment: Linux x86_64, Node v26.13.1, Vitest 4.1.12.

Screenshots, console errors or logs

No screenshot applies to this API behavior. Validation: ./node_modules/.bin/tsc --noEmit completed successfully. Focused existing tests ./node_modules/.bin/vitest run test/goals-sync-lib.test.ts test/weekly-summary-combined.test.ts --reporter=dot passed (2 files, 28 tests); they do not cover failed GitHub subrequests in this endpoint. Full ./node_modules/.bin/vitest run: 3,405 passed, 54 failed. All 54 failures were in six component suites because localStorage was undefined in JSDOM; they are unrelated to this API path. The current tests do not verify failed responses for these three requests, so the mocked regression cases above should be added.

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.