Fix directory module IDs for collision-prone paths#25
Merged
tob-scott-a merged 1 commit intotrailofbits:mainfrom Apr 24, 2026
Merged
Fix directory module IDs for collision-prone paths#25tob-scott-a merged 1 commit intotrailofbits:mainfrom
tob-scott-a merged 1 commit intotrailofbits:mainfrom
Conversation
Directory parsing previously derived module IDs from filename stems, causing same-named files in different directories to collide during graph merge. Use root-relative module IDs during directory parsing while preserving existing single-file stem behavior. Escape dotted path components so the encoding remains unambiguous, and derive relative paths lexically so symlinked files are keyed by their scanned location rather than their resolved target. Resolve pyproject and override entrypoint targets by exact node ID first, and only fall back to suffix matching when the suffix is unambiguous. Add shared parser regression tests for duplicate stems, dotted path components, package __init__.py files, and symlinked files, plus entrypoint ambiguity tests.
Collaborator
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix directory parsing so same-named files in different directories do not collide during graph merge.
Directory parsing now uses root-relative module IDs while preserving existing stem-based IDs for single-file parsing. Path components are escaped before joining so dotted filenames remain unambiguous, and symlinked files are keyed by their scanned lexical path.
This also tightens pyproject and override entrypoint resolution so ambiguous suffix matches are skipped instead of selecting an order-dependent node.
Testing
ruff format src/ tests/ruff check src/ tests/pytest -qty checkcross_file_contains 0