Repository navigation
Tests: let the ST cache_dir guard follow the cache_folder mapping - #19310
Merged
Merged
Conversation
Member
Author
|
@codex review |
Codex Review Summary: ✅ CompletedThis 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. |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
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.
Problem
tests/test_prefetch_snapshot_scope.py::test_st_cache_resolutions_honor_explicit_hf_cache_dirfails on main since #19170, and with it the Core legs of every PR based on main (seen first on the staging run for #19181):Cause
#19170 added
_refuse_network_share_raw_adapter_base(...)before bothSentenceTransformer(...)loads. On thefor_inference = Trueroute it passesThe code is right. A few lines earlier the same function maps an explicit HF
cache_dirontost_kwargs["cache_folder"]:so
st_kwargs.get("cache_folder")already readscache_dirfirst, and it is the same value the neighbouring_check_modules_json_types(..., cache_dir = st_kwargs.get("cache_folder"))call and theSentenceTransformer(**st_kwargs)load use. The guard only looked for the literal'cache_dir'inside the expression, so it could not see the mapping. #19170's own CI ran on an older base and the failure showed up only after it merged.Fix
Test only, no product code changes. The guard now accepts a resolution that either:
kwargs.get("cache_dir")as its first operand, or<dict>.get("cache_folder")first, where the same function, earlier, assigns<dict>["cache_folder"]only from expressions whose first operand readscache_dir(directly or through one local name).This is stricter than before in one way:
cache_dirhas to come first, not just appear somewhere in the expression.Verification
tests/test_prefetch_snapshot_scope.py: 43 passed (1 failed on main).sentence_transformer.py, each makes the guard fail:kwargs.get("cache_folder") or kwargs.get("cache_dir");st_kwargs["cache_folder"] = _st_cache;kwargs.get("cache_folder") or os.environ.get("SENTENCE_TRANSFORMERS_HOME").tests/test_adapter_unc_base_guard.py(the tests Refuse a network-share adapter base that transformers resolves by itself #19170 added): all pass.