Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

[BUG]: Complete Analysis can silently skip repositories when the PAT has access to private repos

Abierto Apto para principiantes
#394 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 4 días

@g-k-s-03 ya está trabajando en esto.

Desde el 22/10/2026.

  • #397 de @g-k-s-03 — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
75/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
github, javascript
Área
api, backend

Línea de trabajo

Empieza con fetchRepos en src/services/github.js y la llamada en src/context/AppContext.jsx; el issue incluye una reproducción con un fetch simulado que devuelve 100 repositorios y luego 50. Primero lee las pruebas de obtención de repositorios y comprueba cómo define el proyecto el alcance de Complete Analysis. El trabajo estará terminado cuando la prueba confirme que se obtienen todos los repositorios previstos y pasen las pruebas existentes.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug
Bug Description
Summary

With a Personal Access Token configured, fetchRepos decides how many pages to request based on the organization's public repository count. If the token can also see private repositories, GitHub returns more repositories than that count, and the remaining pages are never requested. Those repositories are silently missing from the analysis.

Root cause

In src/services/github.js:

export async function fetchRepos(org, repoCount, pat) {
  const all = []
  const maxPages = pat ? Math.ceil(repoCount / 100) : 5
  for (let page = 1; page <= maxPages; page++) {
    const url = `https://api.github.com/orgs/${org}/repos?per_page=100&page=${page}&sort=updated`
    const data = await fetchWithCache(url, pat)
    all.push(...data)
    if (data.length < 100) break
  }
  return all
}

src/context/AppContext.jsx calls it as:

fetchRepos(org.login, org.public_repos, pat)

The request URL does not set a type parameter, so for an authenticated token the /orgs/{org}/repos endpoint returns every repository the token can access, including private ones. The page limit, however, is calculated from org.public_repos only. When the token can see more repositories than public_repos, the loop reaches maxPages and stops, even though GitHub still has more full pages to return.

For example, with public_repos = 50 and 150 repositories visible to the token, maxPages is 1, so only the first 100 repositories are fetched and the remaining 50 are dropped.

Impact
  • Total Repos, the Repositories page, and the analytics built on them can be based on an incomplete list, with no indication that data is missing.
  • Private repositories can also be included in the results, while the "Learn More" panel describes Complete Analysis as covering all public repositories.

This only affects users whose token has access to private repositories in the analyzed organization.

Possible fixes

Either of these would resolve it, depending on the intended scope of Complete Analysis:

  1. Fetch public repositories only, by adding type=public to the request. This matches the "Learn More" description, and public_repos then becomes an accurate page count.
  2. Keep paginating until GitHub returns a page with fewer than 100 items, instead of deriving the limit from public_repos (with a reasonable safety cap).

I'd be happy to work on this once the preferred approach is confirmed.

Steps to Reproduce

The issue can be reproduced with a unit test against the current main branch, by stubbing fetch to serve 150 repositories across two pages while public_repos is 50:

// fetch is stubbed to return 100 repos for page 1 and 50 repos for page 2
const result = await fetchRepos('some-org', 50, 'pat-token')
expect(result).toHaveLength(150)

Result:
AssertionError: expected 100 to be 150

Only the first page is requested, because maxPages = Math.ceil(50 / 100) = 1.

Real-world reproduction:

  1. Add a PAT in Settings that has access to private repositories of an organization.
  2. Explore that organization.
  3. Compare the number of repositories shown with the number visible to the token on GitHub. If the token can see more repositories than the organization's public count, some are missing.

Expected: all repositories in scope are fetched.

Actual: fetching stops after ceil(public_repos / 100) pages, and the remaining repositories are skipped.

Logs and Screenshots

Test output from npx vitest run:

AssertionError: expected 100 to be 150 // Object.is equality

- Expected
+ Received

- 150
+ 100
Environment Details
  • Branch: upstream main (as of 21 October 2026)
  • Reproduced with: npx vitest run
  • Files: src/services/github.js (fetchRepos), src/context/AppContext.jsx
Impact

Critical - Application is unusable

Code of Conduct
  • I have joined the Discord server and will post updates there
  • I have searched existing issues to avoid duplicates
Lenguaje dominante
JavaScript
Estrellas
45
Forks
148
Merge medio
5 d 14 h
PR fusionados (30 d)
30

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de AOSSIE-Org/OrgExplorer

Todos los issues de AOSSIE-Org/OrgExplorer

Issues similares

Más issues de JavaScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.