-
-
Notifications
You must be signed in to change notification settings - Fork 645
fix: correctly merge conflicting paths when files (instead of dirs) are being linked #3458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: correctly merge conflicting paths when files (instead of dirs) are being linked #3458
Conversation
Summary of ChangesHello @rickeylev, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical bug in the virtual environment (venv) merging logic where individual files were erroneously processed as directories when conflicts arose. The core change introduces a precise path equality check to ensure that when a file's path exactly matches a conflicting entry, it is correctly linked as a file, overriding any directory-based interpretations. This prevents unintended behavior, such as accidental implicit namespace package creation. Alongside this fix, the PR also includes a substantial update to the documentation's Python dependencies, incorporating Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
97b9278 to
8a752a0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request correctly fixes an issue with merging conflicting venv files, particularly when a file is duplicated instead of a directory. The core logic change in python/private/venv_runfiles.bzl is sound, using rf_root_path == entry.link_to_path to handle direct file links and partition for more robust prefix matching. The refactoring of the tests in tests/venv_site_packages_libs/app_files_building/app_files_building_tests.bzl improves clarity and the new test case for conflicting files is a great addition. I've found one minor typo in a test comment. Overall, this is a good fix.
When a file (instead of directory) was duplicated, it was incorrectly be treated as
a directory. The conflicting path was turned into a directory and all the files
were made child paths of it. In practice, this usually worked out OK still because
the conflicting file was an
__init__.pyfile for a pkgutil-style namespace package,which effectively converted it to an implicit namespace package.
I think this was introduced by #3448,
but am not 100% sure.
To fix, first check for exact path equality when merging conflicting paths. If the
candidate file has the same link_to_path as the grouping, then just link to that file
and skip any remaining files in the group. The rest of the group's files are skipped
because none of them can contribute links anymore:
in the group should be exact matches or sub-paths of a common prefix)
group and are skipped.