JS: the EventEmitter pass pairs emit/on by event name only and picks the handler by name project-wide
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 55/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- javascript, node.js, typescript
- 領域
- tooling
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- C
- スター
- 73.2k
- フォーク
- 4.7k
- 平均マージ
- 3時間 15分
- マージ済み PR(30日)
- 576
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
colbymchenry/codegraph のほかの issue
-
mcp: a projectPath naming a file inside a project returns isError ("Path is not a directory")対応中かも @maxmilian が 2 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
colbymchenry/codegraph#2982 ·
メンテナーはふだん 1 日以内に返信
-
mcp: a non-object tools/call arguments crashes the handler and is reported as an internal error to retry対応中かも @kjgggggg が 2 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
colbymchenry/codegraph#2981 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
colbymchenry/codegraph#2974 ·
メンテナーはふだん 1 日以内に返信
-
search: FTS special characters are deleted, not separated, so leaf(entry) matches nothing対応中かも @kjgggggg が 2 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
colbymchenry/codegraph#2971 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
colbymchenry/codegraph#2959 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
colbymchenry/codegraph の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
JustAResearcher/gpu-unlock-ada#124 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
inflate: total_in uses plain += on c_ulong (32-bit on Windows), panics in debug for streams > 4 GiBオープン
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
trifectatechfoundation/zlib-rs#570 · コメント 1 件 ·
-
ci: mingw64 cross-compile fails on ubuntu-26.04 because Wine 10 drops /usr/lib/wine/wine64対応中かも @hyoklee が今日担当しました。 オープンComponent - Testing
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信