Repository navigation
Give start_vite's unit tests a toolchain, rather than weakening the refusal - #9656
Merged
Merged
Conversation
…efusal #9654 added an up-front toolchain refusal to start_vite so a job with no node_modules fails with the cause instead of 'vite exited with code 127'. That is right, and the two process-group tests were simply not updated for the new precondition: they exercise which process-group flag the platform gets, they already stub the sibling _port_is_taken precondition for the same reason, and this file's own docstring promises nothing here touches npm or a real install. So the tests get a synthetic frontend tree in tmp_path with a vite shim, not a stubbed-out check. A stub would keep them green if the refusal were deleted; a tree makes the check run and pass on its merits. Adds the tests the refusal never had: it must reject a tree with no toolchain BEFORE anything is spawned, accept the bun and Windows shims as well as the POSIX name, and report a missing checkout as its own failure.
rhsCZ
pushed a commit
to rhsCZ/unsloth
that referenced
this pull request
Aug 25, 2026
Picks up unslothai#9654 and unslothai#9656, which clear the overlay rail shard, and the Apertus mapping fix. No conflicts.
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.
Repo tests (CPU)is red on main atf2fa54f8c:Attribution is #9654,
f2fa54f8c, which is the commit that introduced_require_frontend_toolchainand the string in that message. Reproduced locally on a clean checkout off2fa54f8c: 2 failed, 17 passed.Which side is wrong
Both readings were live, so stating the one I took and why.
The refusal is right and stays exactly as it is.
start_vite's entire job is to start vite. There is no caller that reaches it without meaning to launch a dev server; the only thing in the repo that calls it withsubprocess.Popenstubbed is a unit test. Moving the check to the point of use means moving it after the spawn, and after the spawn is precisely the state #9654 removed:npm run devexits 127, the readiness poll reportsvite exited with code 127, and a missing setup step reads as a vite crash. That cost a day of it looking like flake. Weakening or relocating it would undo the PR.The two tests are stale. Three things say so:
_require_frontend_toolchainis not what they are about.monkeypatch.setattr(robust, "_port_is_taken", lambda port, host: False)is in both of them, because the occupied-port refusal is not what they are about either. The toolchain check is a precondition of exactly the same shape, added later, and the tests were not updated for it.studio/frontendis a real-world dependency this file never intended to have.So the change is entirely in the test file.
tests/studio/_playwright_robust.pyis untouched.A tree, not a stub
The obvious fix is
monkeypatch.setattr(robust, "_require_frontend_toolchain", lambda: None), and it is the wrong one: it would keep both tests green if the refusal were deleted fromstart_viteoutright, which is the vacuity shape we keep finding. They get a synthetic tree instead:The check runs and passes on its merits, and nothing depends on a real install. The demonstration that this is not a stub is case V6 below.
test_an_occupied_port_is_refused_rather_than_measuredgets the same fixture. It passes on main today only because the port check happens to be written above the toolchain check; with a satisfied toolchain it asserts the port refusal itself rather than the order the two preconditions are written in.The refusal had no test at all
That is the other half of this. #9654's up-front refusal is the thing the PR exists for, and nothing pinned it, so it could be deleted or narrowed silently. Three tests added:
assert spawned == [], because a refusal landing afterPopenhas already lost the cause.vite.cmd,vite.exeandvite.bunx, not only the POSIX name. bun writes.bunxshims and npm writes.cmdon Windows, and a POSIX-only check would reject a good tree.Anti-vacuity
25 passed on a clean tree, on a checkout with no
studio/frontend/node_modulesat all, which is the condition that made main red. Every case mutated the real file, was confirmed on disk by md5, and was restored from a byte snapshot._require_frontend_toolchain()call deleted fromstart_viteFAILED ...refuses_a_tree_with_no_frontend_toolchainPopenAssertionError: the refusal must land before npm is spawned, or the cause is lostvite.cmd/vite.exe/vite.bunxdropped from the accepted namesFAILED ...names_a_missing_frontend_separatelyFAILED ...picks_the_platform_process_group[posix]and[nt]V6 is the one that matters for the fixture. Both process-group tests go red when the check is broken, which is only possible because they run it. Had they stubbed it out they would have stayed green, and the fix would have been a way of not noticing.
Checked
tests/studio/test_playwright_server_lifecycle.py: 25 passed, was 17 passed / 2 failed on maintests/studio/test_playwright_suites_run_in_ci.pyandtest_indicator_browsers_run_in_parallel.py: 21 passedgit diff --checkcleantests/studio/_playwright_robust.pynot modified:git diff origin/maintouches one file