Repository navigation
fix: prevent machine-specific Dart absolute paths from leaking into child node IDs - #999
Conversation
safishamsi
left a comment
There was a problem hiding this comment.
Correct fix — Dart was the only remaining extractor embedding absolute paths in child node IDs, and switching to _file_stem matches every other extractor's convention. Two small cleanup items:
-
Test assertion:
assert 'tmp' not in nidis a fragile negative check that would pass trivially on most CIs and miss a regression that swaps in a different non-portable identifier. Better to assert the positive expected value:assert nid == _make_id('sample', 'MyClass')(or equivalent based on the fixture). -
Scope wording: the PR title says "all affected extractors" but Dart was the only one — every other extractor already uses
_file_stem. Worth correcting the description so reviewers don't think there are other files touched. -
Migration note: this is a format-breaking change for anyone with existing Dart entries in
graphify-out/— old absolute-path IDs become orphans on next run. A one-line note in the PR body ("existing Dart graphs should be rebuilt with--force") would help users hit by this.
Otherwise solid — ready to merge after those tweaks.
1b172bd to
7b42df3
Compare
… IDs to prevent machine-specific absolute paths in graph.json
7b42df3 to
7f11d2d
Compare
Hey Sami, thanks for the feedback! I've updated the PR and squashed everything into one clean commit:
Let me know if it looks good to merge now! |
|
@safishamsi all done, please recheck ) |
… IDs to prevent machine-specific absolute paths in graph.json (Graphify-Labs#999)
Problem
extract_dartwas building class and function node IDs fromstr(path)— the absolute local filesystem path — instead of_file_stem(path), which is the convention used by every other extractor.As a result, the same Dart symbol got a different node ID on every machine:
The
id_remappost-processor (introduced in #502) remaps file node IDs to project-root-relative paths, but does not touch compound child node IDs — so class and function nodes permanently retained the absolute path of whoever rangraphifylast.This broke three things for any team sharing
graphify-out/in version control:This is a breaking ID change for existing Dart graphs. Old absolute-path-derived node IDs will become orphans on the next incremental run. Rebuild from scratch after updating:
graphify . --force