Skip to content

fix: Fix landing GitHub stats showing zeros - #3505

Open
VedantMadane wants to merge 1 commit into
Priyanshu-byte-coder:mainfrom
VedantMadane:fix/issue-3493
Open

VedantMadane wants to merge 1 commit into
Priyanshu-byte-coder:mainfrom
VedantMadane:fix/issue-3493

Conversation

@VedantMadane

@VedantMadane VedantMadane commented Aug 25, 2026

Copy link
Copy Markdown

Summary

Count open good-first-issues using GitHub Search API with is:issue to exclude pull requests and read total_count, and include a standard User-Agent header on GitHub API requests.

Changes

  • Count good-first-issues via search query (repo:Priyanshu-byte-coder/devtrack label:"good first issue" is:issue is:open) reading total_count rather than listing up to 100 issues where pull requests are mixed in
  • Send explicit User-Agent header (devtrack-landing-stats) on GitHub API calls as standard client hygiene

Fixes #3493

@github-actions

Copy link
Copy Markdown

Thanks for your first PR on DevTrack! 🎉

A maintainer will review it within 48 hours. While you wait:

  • Make sure CI is passing (type-check + lint)
  • Double-check the PR description is filled out and the issue is linked
  • Feel free to ask questions in Discussions if you need help

If you find DevTrack useful, a ⭐ star on the repo is always appreciated — it helps the project grow and attract more contributors!

@github-actions github-actions Bot added gssoc26 GSSoC 2026 contribution type:bug GSSoC type bonus: bug fix labels Aug 25, 2026
@github-actions

Copy link
Copy Markdown

GSSoC Label Checklist 🏷️

@Priyanshu-byte-coder — please apply the appropriate labels before merging:

Difficulty (pick one):

  • level:beginner — 20 pts
  • level:intermediate — 35 pts
  • level:advanced — 55 pts
  • level:critical — 80 pts

Quality (optional):

  • quality:clean — ×1.2 multiplier
  • quality:exceptional — ×1.5 multiplier

Validation (required to score):

  • gssoc:approved — counts for points
  • gssoc:invalid / gssoc:spam / gssoc:ai-slop — does not score

Type labels (type:*) are auto-detected from files and title. Review and adjust if needed.
Points formula: (difficulty × quality_multiplier) + type_bonus

@github-actions github-actions Bot added type:feature GSSoC type bonus: new feature type:performance GSSoC type bonus: performance (+15 pts) labels Aug 25, 2026
@deepsource-io

deepsource-io Bot commented Aug 25, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in a20e51d...8107f42 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
Secrets Sep 15, 2026 9:42a.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

@Priyanshu-byte-coder

Copy link
Copy Markdown
Owner

I dug into this one properly because the diagnosis is testable, and it splits into one change I want and one built on a premise that doesn't hold.

The User-Agent part doesn't fix anything. The claim is that unauthenticated fetches 403 without a User-Agent. GitHub does require one — but Node's fetch (undici, which is what Next uses server-side) already sends a default, so the header is never actually absent:

$ node -e "fetch('https://api.github.com/repos/Priyanshu-byte-coder/devtrack', {headers:{Accept:'application/vnd.github.v3+json'}}).then(r=>console.log(r.status))"
200

I can reproduce a 403 only by explicitly blanking the header (curl -H "User-Agent:"), which isn't what the app does. Setting it is harmless and arguably good hygiene, but it isn't the cause of the zeros.

The good-first-issue change is a real improvement — keep it. /issues?labels=... returns pull requests alongside issues (GitHub treats PRs as issues on that endpoint), and per_page=100 silently caps the count. Moving to search/issues with is:issue and reading total_count fixes both. No PRs currently carry the label so the number is the same today (19 either way, I checked), but it's correct rather than accidentally correct.

What I think is actually happening. Running the page's exact four-call sequence unauthenticated:

repo         200  x-ratelimit-remaining=47
contributors 200  x-ratelimit-remaining=48
gfi search   200  x-ratelimit-remaining=8
prs search   200  x-ratelimit-remaining=9

Core API is 60/hr; Search is 10/min unauthenticated, and this page makes two search calls per render. That's the quota that runs out first, and when either search 403s the values fall back to zero. Note this PR adds a second search call where there was one, so it makes that pressure slightly worse, not better.

The fix for #3493 is almost certainly setting GITHUB_TOKEN in the deployment environment — it's already read at the top of fetchRepoStats and lifts search to 30/min and core to 5,000/hr. Worth confirming whether it's set in production before changing more code.

What I'd like: keep the good-first-issue counting change, keep the User-Agent if you want it, but please update the PR description so it doesn't claim the UA fixes the zeros — the next person debugging this will follow that trail. And if you can check whether GITHUB_TOKEN is configured on the deployment, that's the thing most likely to actually close #3493.

Verified against current main: merges clean, type-check clean, 163 files / 2387 tests passing, build green.

- Count good-first-issues via search API with is:issue to exclude PRs and use total_count
- Send User-Agent header on GitHub API calls as recommended hygiene

Fixes Priyanshu-byte-coder#3493

Signed-off-by: Vedant Madane <6527493+VedantMadane@users.noreply.github.com>
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc26 GSSoC 2026 contribution type:bug GSSoC type bonus: bug fix type:feature GSSoC type bonus: new feature type:performance GSSoC type bonus: performance (+15 pts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Live GitHub stats show 0 instead of real values

2 participants