You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
File node takes the label of a module-level variable when a same-stem sibling file exists (x.mjs + x.sql, const sql) #4449
When a JS file and a file with another extension share the same stem in one directory (x.mjs + x.sql), the .mjs file node gets the disambiguated id <dir>_<stem>_mjs_<dir>_<stem>. If the .mjs also declares a module-level variable whose name equals the sibling's extension (const sql = ...), that variable is minted with the same id. Dedup keeps the variable and drops the file node, so the file node ends up labelled sql and cannot be found by its filename.
Reproduction (graphify 0.9.33 and 0.9.90, --code-only, with [sql] extra)
So the trigger is: a same-stem sibling file (which turns on the extension-tagged id scheme) plus a module-level symbol named like the sibling's extension.
Expected
The file node keeps its own label (x.mjs) and the variable gets a distinct id.
Impact
This is common in database repos, where a migration runner foo.mjs sits next to foo.sql and uses the postgres client conventionally named sql. In our repo it hits 3 of 3 such pairs.
I reproduced this on v8 (0.9.90), using your steps and then by calling extract() directly.
What happens is not a clash between two ids inside the .mjs. The sql variable and the file node start out with different ids, esquema_x_sql and esquema_x_mjs. Later, extract() renames each file's old id, which has the extension in it, to its final id. The old id of x.sql is esquema_x_sql, the same string the variable has, so the rename meant for x.sql also hits the variable. Now the variable and the file node share an id, and dedup keeps one of them.
That also means the sibling doesn't have to produce nodes. An x.ts with const css next to an x.css gives the same label swap. Edges that end on the variable get renamed wrongly too.
I opened #4452 with a fix. A file's old id is now renamed only on items from the file that made it. The tests cover your four controls, plus the x.ts and x.css case.
This looks fixed on the v8 branch by c29950f8 (fix(extract): keep a symbol that spells a sibling's old file id on its own node (#4449)). Could a maintainer confirm and close?
Activity
github-actions commentedon Oct 14, 2026
Thanks for opening this issue, @brogollack. A maintainer will take a look soon.
If you would like to discuss it in real time, come say hi on our Discord server. For longer-form questions and ideas there is also GitHub Discussions.
To help us triage, please make sure the report includes what you expected, what actually happened, and the steps (and a small sample) to reproduce it.
Deepjyoti-Sarmah commentedon Oct 14, 2026
I reproduced this on v8 (0.9.90), using your steps and then by calling
extract()directly.What happens is not a clash between two ids inside the .mjs. The
sqlvariable and the file node start out with different ids,esquema_x_sqlandesquema_x_mjs. Later,extract()renames each file's old id, which has the extension in it, to its final id. The old id of x.sql isesquema_x_sql, the same string the variable has, so the rename meant for x.sql also hits the variable. Now the variable and the file node share an id, and dedup keeps one of them.That also means the sibling doesn't have to produce nodes. An x.ts with
const cssnext to an x.css gives the same label swap. Edges that end on the variable get renamed wrongly too.I opened #4452 with a fix. A file's old id is now renamed only on items from the file that made it. The tests cover your four controls, plus the x.ts and x.css case.
fix(extract): keep a symbol that spells a sibling's old file id on it…
omsenjalia commentedon Oct 18, 2026
This looks fixed on the
v8branch by c29950f8 (fix(extract): keep a symbol that spells a sibling's old file id on its own node (#4449)). Could a maintainer confirm and close?