fix[tool]: keep import search paths request-local - #5262
DicksonWu654 wants to merge 1 commit into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: aa434d9906
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| with self.input_bundle.temporary_search_paths(search_paths): | ||
| return self.input_bundle.load_file(path) | ||
| return self.input_bundle.load_file(path, search_paths=search_paths) |
There was a problem hiding this comment.
Make the top-level search path request-local too
When two CompilerData instances sharing a bundle compile entrypoints from different directories concurrently, CompilerData._resolve_imports still appends each entrypoint directory to the shared input_bundle.search_paths at vyper/compiler/phases.py:167, and each ImportAnalyzer snapshots that contaminated list. Consequently, this call-local override can still resolve an absolute import from the other request's higher-precedence directory; the overlapping context managers can also pop one another's paths. Pass the entrypoint directory into the analyzer without mutating the bundle so the initial absolute-search-path snapshot is request-local as well.
Useful? React with 👍 / 👎.
What I did
Allow
InputBundle.load_file()to receive a call-local search-path sequence and use it without replacingInputBundle.search_paths.ImportAnalyzernow passes its absolute or relative resolution paths directly.This preserves existing behavior for ordinary callers while making resolution deterministic when an input bundle is reused by overlapping callers.
How I did it
search_pathsoverride toload_file()ImportAnalyzeruse oftemporary_search_pathsTests
125 passedacross the input-bundle tests and relevant interface/module import suites.