Repository navigation
Follow #11635's Diffusers prefetch and #11660's responsive classes in the tests - #11680
Conversation
#11635's _prefetch_diffusers_main builds the pinned Diffusers into a scratch --target directory to warm uv's cache, so it installs nothing into the environment and cannot change which torch is there. The entry-point check counted any caller of _build_uv_cmd as an installer and failed main. A function whose every build command carries --target is now read as a scratch prefetch. Anything else that builds a command still has to drop the memoized torch classification.
#11660 gave the Images, Audio and image-train rails a 20px gutter on phones (max-sm:px-5, max-sm:pl-5) and moved the chat split from md to lg, so tablets stack. Four contracts still pinned the old class strings.
|
@codex review |
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: c240e27039
ℹ️ 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".
| return any( | ||
| (isinstance(item, ast.Constant) and item.value == "--target") or carries(item) | ||
| for item in node.elts |
There was a problem hiding this comment.
Require a scratch destination before exempting target installs
When a helper passes the active environment's site-packages directory to --target, this predicate returns true solely because the flag occurs in the tuple, so test_every_installer_entry_point_invalidates excludes a real environment-mutating installer and no longer detects a missing torch-probe invalidation. Both pip install --help ("Install packages into
uv pip install --help ("specified directory") confirm that the destination is arbitrary; verify that it is actually a disposable scratch path, or narrowly exempt _prefetch_diffusers_main, rather than treating every --target command as harmless.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in af280f2: --target only counts when the next argument is a directory the same function made with tempfile.mkdtemp, as s or str(s). Pointing _prefetch_diffusers_main at site.getsitepackages()[0] now fails the entry-point test, and the parametrised cases cover a caller-supplied directory and site-packages.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: af280f22f5
ℹ️ 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".
| if any( | ||
| isinstance(sub, ast.Call) | ||
| and isinstance(sub.func, ast.Attribute) | ||
| and sub.func.attr == "mkdtemp" | ||
| for sub in ast.walk(node.value) | ||
| ): | ||
| scratch.add(target.id) |
There was a problem hiding this comment.
Invalidate scratch names when they are rebound
The new mkdtemp check still produces a false exemption when a function later reassigns the same variable: for example, target = tempfile.mkdtemp(); target = site.getsitepackages()[0]; _build_uv_cmd(("--target", target)). Because scratch only accumulates names and never accounts for the later binding, this environment-mutating helper is classified as scratch-only and omitted from the invalidation check. Track the value reaching each command call, or at least remove a name from scratch when a subsequent assignment is not derived from mkdtemp.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 22eab66: a scratch directory or argument tuple now counts only when its name is bound exactly once in the function (any assignment, loop target or parameter counts as a binding). The parametrised cases add a rebind after mkdtemp, a rebound args tuple, and a loop that rebinds the name; all three read as installers. Dropping the single-binding rule fails the mkdtemp rebind and the loop cases (the rebound tuple was already caught, since the later tuple carries no --target).
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 22eab66568
ℹ️ 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".
| return carries(node.value) | ||
| if isinstance(node, ast.Tuple): | ||
| items = node.elts | ||
| return any( |
There was a problem hiding this comment.
Reject later non-scratch targets before exempting the command
When a helper builds ("--target", scratch, "--target", site.getsitepackages()[0], "torch"), this any(...) succeeds on the first pair and causes the invalidation test to omit the helper. This is environment-mutating under pip: pip install --help describes --target <dir> as “Install packages into
--target rather than accepting any matching pair.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 8c9e04a, by dropping the source classifier rather than growing it. _prefetch_diffusers_main is now exempted by name, and a new TestScratchPrefetch runs it through both the git and archive paths with the subprocess stubbed and checks the command it actually issues: exactly one --target (either spelling), naming a directory under the temp root with the prefetch prefix, removed afterwards. A second --target, a target under sys.prefix, and no target each fail both cases. Any other builder of a command still has to invalidate.
…ts source The AST classifier kept meeting spellings it could not see through: a rebound name, a second --target. Exempt _prefetch_diffusers_main by name instead, and prove the exemption by running it with the subprocess stubbed, through both the git and the archive source: exactly one --target, naming a directory it made under the temp root, gone afterwards.
|
@codex review |
|
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". |
…s prefetch The ARM64 wheelhouse test counted _effective_requirements(req) and expected four. #11635's Diffusers prefetch is a fifth, and it has to filter the same way, since it builds the cache entry the install then reads. Name each caller and the file it passes instead, so a new caller fails with its own name.
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! 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". |
…ponsive classes in the tests (unslothai#11680) * Let a scratch --target prefetch through the torch-probe installer check unslothai#11635's _prefetch_diffusers_main builds the pinned Diffusers into a scratch --target directory to warm uv's cache, so it installs nothing into the environment and cannot change which torch is there. The entry-point check counted any caller of _build_uv_cmd as an installer and failed main. A function whose every build command carries --target is now read as a scratch prefetch. Anything else that builds a command still has to drop the memoized torch classification. * Follow unslothai#11660's phone gutters and lg chat split in the desktop contract unslothai#11660 gave the Images, Audio and image-train rails a 20px gutter on phones (max-sm:px-5, max-sm:pl-5) and moved the chat split from md to lg, so tablets stack. Four contracts still pinned the old class strings. * Exempt only a --target into a directory the function just made with mkdtemp * Only a name bound once can prove its --target is the mkdtemp scratch * Hold the prefetch to a scratch target by running it, not by reading its source The AST classifier kept meeting spellings it could not see through: a rebound name, a second --target. Exempt _prefetch_diffusers_main by name instead, and prove the exemption by running it with the subprocess stubbed, through both the git and the archive source: exactly one --target, naming a directory it made under the temp root, gone afterwards. * Name the callers of the shared requirements filter, including unslothai#11635's prefetch The ARM64 wheelhouse test counted _effective_requirements(req) and expected four. unslothai#11635's Diffusers prefetch is a fifth, and it has to filter the same way, since it builds the cache entry the install then reads. Name each caller and the file it passes instead, so a new caller fails with its own name.
Repo tests (CPU, studio)is red on main with six failures from two PRs that merged today: five intests/studio(on318fcc97cthe suite gives 5 failed, 14,578 passed) and one intests/python.#11635:
test_every_installer_entry_point_invalidatesThe check treats any function that builds a pip or uv command as an installer, and requires every installer to drop the memoized torch classification.
_prefetch_diffusers_mainbuilds with("--no-deps", "--target", scratch). That writes the pinned Diffusers into a scratch directory only to warm uv's cache, and installs nothing into the environment. It cannot change which torch is installed.The product is right and the check was too broad.
_prefetch_diffusers_mainis exempted by name (SCRATCH_PREFETCHERS). Every other function that builds a command still has to invalidate, and the installer set is still read from the module rather than listed. Earlier revisions tried to prove the exemption from the source withast, and review kept finding spellings it could not see through (a rebound name, a second--target), so the proof now runs the function instead.TestScratchPrefetch: runs the prefetch through both its git and archive paths, with the subprocess stubbed, and reads the command it actually issues. It requires exactly one--target(either spelling), naming a directory under the temp root with the prefetch prefix, and requires that directory to be gone afterwards.#11635 again:
test_pip_install_and_the_audits_share_itThe ARM64 wheelhouse test counted
_effective_requirements(req)ininstall_python_stack.pyand expected four. The Diffusers prefetch is a fifth caller. It is the invariant holding, not loosening: the prefetch has to build from the same filtered file that_diffusers_main_stepthen installs from, or its cache entry misses.The test now names each caller (
pip_install,pip_install_try,_closure_record,_requirements_satisfied,_prefetch_diffusers_main) and the file it passes. A new caller fails with its own name, and a caller that stops filtering fails by going missing.#11660: four
test_desktop_reliability_frontend_contract.pytests#11660 made these changes on purpose:
max-sm:px-5,max-sm:pl-5).md:flex-rowtolg:flex-row, so tablets stack.The four contracts pinned the old class strings. They now pin the new ones, with a line saying which PR changed them.
Verification
tests/studio/install/test_torch_probe_memoization.py,tests/studio/test_desktop_reliability_frontend_contract.pyandtests/python/test_windows_arm64_wheelhouse_tags.pyall pass.--target, a target undersys.prefix, or no target at all: bothTestScratchPrefetchcases fail._effective_requirements(req), or another caller passing a different file:test_pip_install_and_the_audits_share_it.max-sm:px-5:test_image_page_structural_panes_share_the_container_breakpoint.max-sm:px-5:test_audio_page_matches_the_image_rail_header_and_action_footer.md:flex-row:test_mac_chat_header_controls_share_the_titlebar_row.