JS: the EventEmitter pass pairs emit/on by event name only and picks the handler by name project-wide
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 55/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- javascript, node.js, typescript
- Área
- tooling
Línea de trabajo
Start in src/resolution/callback-synthesizer.ts around lines 385-386, where ctx.getNodesByName(handlerName) takes the first match project-wide, and in the handler map that is keyed only by the event string. Reproduce with the two-module example (src/a_cart.js, src/b_profile.js) using CODEGRAPH_KERNEL=0, then check how the pass knows the registering file and receiver binding. Done means saveProfile links to b_profile's handleSave, no cross links appear, and synthesized edges carry a line.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
The EventEmitter synthesis pass pairs emitters and handlers by event name alone, and looks up a registered handler by name anywhere in the project. Two modules that each use their own emitter with the same event name and a same-named handler cross-link.
// src/a_cart.js
const EventEmitter = require('events')
const cart = new EventEmitter()
function handleSave () { return 'cart' }
cart.on('save', handleSave)
function saveCart () { cart.emit('save') }
// src/b_profile.js
const EventEmitter = require('events')
const profile = new EventEmitter()
function handleSave () { return 'profile' }
profile.on('save', handleSave)
function saveProfile () { profile.emit('save') }
edge on main (synthesized) |
expected |
|---|---|
saveCart → handleSave (a_cart.js:3) ✓ |
same |
saveProfile → handleSave (a_cart.js:3) ✗ |
handleSave in b_profile.js |
b_profile.js's own handleSave gets no synthesized caller. With distinct handler names (onCartSaved / onProfileSaved), each emitter links to both handlers, so all four cross pairs appear (from an audit run; not re-run here). The synthesized edges also carry no line (line: null).
Cause. callback-synthesizer.ts#L385-L386: ctx.getNodesByName(handlerName).find(...) takes the first function of that name anywhere, not the one in the registering file. The handler map is keyed only by event string, so the receiver (cart vs profile) is never compared.
Reproduced on main at 77ee3484 with CODEGRAPH_KERNEL=0. Linux/WSL2, Node 22.23.2.
Expected. Resolve the handler name in the registering file's scope first (as a bare call there would), and pair emit with on only when the receivers can be the same object (same binding or import), not on the event string alone. Generic names (save, change, error, data) are exactly the ones that collide.
- Lenguaje dominante
- C
- Estrellas
- 73.2k
- Forks
- 4.7k
- Merge medio
- 3 h 15 min
- PR fusionados (30 d)
- 576
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
-
mcp: a projectPath naming a file inside a project returns isError ("Path is not a directory")Posiblemente ocupada @maxmilian la tomó hace 1 día. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
colbymchenry/codegraph#2982 ·
Los mantenedores suelen responder en 1 día
-
mcp: a non-object tools/call arguments crashes the handler and is reported as an internal error to retryPosiblemente ocupada @kjgggggg la tomó hace 2 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
colbymchenry/codegraph#2981 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
colbymchenry/codegraph#2974 ·
Los mantenedores suelen responder en 1 día
-
search: FTS special characters are deleted, not separated, so leaf(entry) matches nothingPosiblemente ocupada @kjgggggg la tomó hace 2 días. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
colbymchenry/codegraph#2971 ·
Los mantenedores suelen responder en 1 día
-
[Security Vulnerabiliy] Vulnerable bundled `node.exe` detected (Node2Shell - CVE-2026-111497)Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
colbymchenry/codegraph#2959 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de colbymchenry/codegraph
Issues similares
-
vim.filetype.match() prefixes a URL buffer name with the cwd before passing it to filetype functionsAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
Los mantenedores suelen responder en 1 día
-
stream_curl: retry_count never resets after a successful reconnect, so long sequential streams die after 5 dropsPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
mpv-player/mpv#18728 ·
Los mantenedores suelen responder en 1 día
-
followup Prio 📌
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
cyrusimap/cyrus-imapd#6640 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 60/100
Los mantenedores suelen responder en 1 día