getDominantFile returns null when test or generated files fill its 20-row window
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- Medio día
- Aptitud para principiantes
- 65/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- sql, typescript
- Área
- databases
Línea de trabajo
Start in src/db/queries.ts at computeDominantFile and its LIMIT 20 query, then getTopRouteFile, which has the same truncate-then-filter shape. The consumer is the edgeCount >= 3 * nextEdgeCount check in src/context/index.ts. Reproduce with the 60-function src/core.ts chain and 20 tests/tN.test.ts files; done when getDominantFile() returns src/core.ts with edgeCount 60 and nextEdgeCount 50 instead of null.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
computeDominantFile takes the top 20 files by in-file edge count in SQL (LIMIT 20), and only then drops test and generated files in code. When 20 or more low-value files outrank the real code, nothing is left and it returns null, even though a clear dominant file exists. With fewer than 20 such files, nextEdgeCount can be understated, because the runner-up was cut off by the limit. That affects the edgeCount >= 3 * nextEdgeCount check that decides the directory boost.
Reproduction (verified)
On main at c71a3d03, built from source, Linux (WSL2), Node 22.22.2.
src/core.tshas a chain of 60 functions, each calling the next (60 in-file edges), andsrc/second.tshas a chain of 50.- 20 files
tests/tN.test.tseach have a chain of 70.
const cg = await CodeGraph.init(dir, { index: true });
(cg as any).queries.getDominantFile(); // → null
Expected: { filePath: 'src/core.ts', edgeCount: 60, nextEdgeCount: 50 }.
Generated code makes this plausible in real repos. Android R.java per module, protobuf *OuterClass.java / *Grpc.java, and test-heavy monorepos could fill the window.
Same pattern (inferred, not reproduced)
getTopRouteFile takes the 20 files with the most routes, then filters. Both totalRoutes and the 30% share check are computed on the truncated, filtered set.
Possible fix
Push the test-path exclusion into SQL, or keep fetching past 20 rows until 20 rows survive the filter (or the rows run out). The generated-file check needs the files table, so the second option may be simpler.
Related
#2575 (the plan fix for the same query, #2571), and #2349 / #2115, which cache the result. None of them changes the window.
- Lenguaje dominante
- C
- Estrellas
- 73.2k
- Forks
- 4.7k
- Merge medio
- 2 h 16 min
- PR fusionados (30 d)
- 423
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de colbymchenry/codegraph
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 90/100
colbymchenry/codegraph#2634 ·
Los mantenedores suelen responder en 1 día
-
Windows: bundled Node v24.16.0 can abort at exit (nodejs/node#56645); please bundle Node >= 24.20.0Posiblemente ocupada @Ancienttwo la tomó hace 3 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
colbymchenry/codegraph#2617 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Invalid regular expression: /\boperator++\s*(?:<[^<>()]*>)?\s*\(/: Nothing to repeat (v1.6.2)Abierto
Dificultad 2/5 Menos de una hora Aptitud para principiantes 72/100
colbymchenry/codegraph#2482 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
codegraph ui - does not workAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
colbymchenry/codegraph#1900 · 2 comentarios · 5 reacciones ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
colbymchenry/codegraph#1700 ·
Los mantenedores suelen responder en 1 día
Todos los issues de colbymchenry/codegraph
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
FujiNetWIFI/fujinet-lib#204 ·
Los mantenedores suelen responder en 1 día
-
os:linux
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
mpv-player/mpv#18649 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
facebookincubator/muse-gadget-sdk#249 ·
Los mantenedores suelen responder en 1 día
-
docs: nng_dial / nng_dialer_start can return NNG_ECONNSHUT and NNG_ECRYPTO, which are not documentedAbierto
Dificultad 1/5 1-3 horas Aptitud para principiantes 89/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
micropython/micropython#19786 ·
Los mantenedores suelen responder en 1 día