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

Đang mở
#4,084 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@Dhruvdesai793 đang làm issue này rồi.

Từ ngày 3/12/2026.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
github, nextjs, typescript

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.
Ngôn ngữ chính
TypeScript
Star
246
Fork
436
Merge trung bình
9 giờ 33 phút
Pull request đã merge (30 ngày)
213

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Priyanshu-byte-coder/devtrack

Tất cả issue của Priyanshu-byte-coder/devtrack

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.