Repository navigation
[BUG]: Top-repository scoring double-counts stars via watchers_count #399
Description
Bug Description
getTopRepositories() scores repos with:
score = stargazers_count + forks_count*2 + watchers_count*1.5 + activityBonus
(src/services/analytics.js, ~lines 194-198)
On the GitHub REST API, watchers_count is a duplicate of stargazers_count (both are the
star count); the real watcher/subscriber count is subscribers_count, which the repos list
endpoint doesn't even return. So the formula is effectively stars2.5 + forks2 + ... —
stars are silently weighted 2.5x, and the intended "watchers" signal contributes nothing.
This matters because getTopRepositories(..., 10) selects the top 10 repos per org in standard
(no-PAT) mode, and that selection feeds Repositories, Contributors, Network, Governance and
Analytics (AppContext.jsx lines 227, 282).
Live proof (2026-10-22):
- GET api.github.com/repos/facebook/react -> stargazers_count 251692, watchers_count 251692
(identical), subscribers_count 6610. - Running the real getTopRepositories on AOSSIE-Org's 87 repos, the buggy top-10 includes
"Devr.AI" where a stars-only (corrected) top-10 picks "BabyNest" — the duplicate-stars term
actually changes which repos are selected.
Steps to Reproduce
-
Open api.github.com/repos/facebook/react and note watchers_count == stargazers_count,
while subscribers_count is much smaller. -
Run the repro (imports the project's real getTopRepositories):
node f2_watchers.mjs
watchers_count === stargazers_count : true
current top-10: [...,"OrgExplorer","Devr.AI"]
corrected top-10: [...,"OrgExplorer","BabyNest"] <- ranking changes
Logs and Screenshots
=== F2.1 GitHub API fact (facebook/react) ===
stargazers_count : 251692
watchers_count : 251692 <-- identical to stars
subscribers_count: 6610 <-- the REAL watcher count
watchers_count === stargazers_count : true
=== F2.2 Top-10 selection for AOSSIE-Org (87 repos) ===
current (with watchers_count*1.5): [...,"OrgExplorer","Devr.AI"]
corrected(watchers term removed) : [...,"OrgExplorer","BabyNest"]
positions that differ: ["Devr.AI"]
📎 Image file:
Environment Details
- OS: macOS (API behaviour is platform-independent)
- Browser: Chrome
- Repo: main @ d91d2b8, src/services/analytics.js getTopRepositories()
- Node.js: v20 (for the repro script)
- Suggested fix: drop the watchers_count term (it duplicates stars). subscribers_count would
be the real signal but isn't on the list endpoint, so removing the term is the simplest fix.
Impact
Medium - Feature works but has issues
Code of Conduct
- I have joined the Discord server and will post updates there
- I have searched existing issues to avoid duplicates
Activity
rishi919-rgb commentedon Oct 24, 2026
Hi @Saurabhyadav0,
I have investigated this issue and verified the root cause where
watchers_countduplicatesstargazers_counton the GitHub REST API, effectively weighting stars at 2.5x ingetTopRepositories().I have implemented the fix and added full Vitest unit test coverage (
src/services/analytics.getTopRepositories.test.js) on a dedicated branch (fix/399-top-repo-scoring-watchers). All 86 tests and production builds are passing cleanly.Due to the repository's 1-open-PR limit, I am ready to submit the pull request immediately once my current approved PR (#254) is merged.